forked from enlightenment/efl
Icon theme: added standard freedesktop names.
OK, this commit try to fix the mess we have done with icon names in elm. I just added standard names to icons yet existing in the elm theme, the old name are, of course, preserved. But I marked them as -deprecated-. Also added a new test: Icon Standard. It show all the icon that have standard fdo names. This can be really usefull for user that need to choose icons to use. I put some guidelines comment in the icons.edc files, I hope people will follow the rules from now on... or will recive my personal spanking :D I will work on those icons more in the next days: will add the new names to elm docs, will try to match better fdo icon names, and maybe also add some new icons... Suggestions are always welcome. @feature (maybe)
This commit is contained in:
parent
8db407f89c
commit
19d6ed361c
|
@ -1,3 +1,71 @@
|
|||
|
||||
|
||||
/*
|
||||
* Standard FreeDesktop icons:
|
||||
*
|
||||
* WARNING: When you add new icons you MUST ensure to use standard names as per:
|
||||
* http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
|
||||
* If you can't find the name in the spec then you MUST search in the Tango
|
||||
* and/or the Oxigen theme to find a suitable name. IF you really cannot find
|
||||
* anything try at least to be consistent with other existing names.
|
||||
* NOTE: icons marked with an empty comment are names that I cannot
|
||||
* find anywhere else, so they are not really standard.
|
||||
*/
|
||||
#define IC(Name, File, Min, Max) \
|
||||
group { name: "elm/icon/"##Name##"/default"; min: Min Min; max: Max Max; \
|
||||
images.image: File COMP; parts { part { name: "base"; \
|
||||
description { aspect: 1.0 1.0; aspect_preference: BOTH; \
|
||||
image.normal: File; } } } }
|
||||
IC("folder", "icon_folder.png", 16, 0);
|
||||
IC("user-home", "icon_home.png", 16, 0);
|
||||
IC("user-trash", "icon_delete.png", 16, 0);
|
||||
|
||||
IC("view-close", "icon_close.png", 16, 0);
|
||||
IC("view-refresh", "icon_refresh.png", 16, 0);
|
||||
|
||||
IC("window-close", "icon_close.png", 16, 0);
|
||||
|
||||
IC("document-close", "icon_close.png", 16, 0);
|
||||
IC("document-edit", "icon_edit.png", 16, 0);
|
||||
|
||||
IC("dialog-info", "icon_info.png", 16, 0);
|
||||
IC("dialog-close", "icon_close.png", 16, 0);
|
||||
|
||||
IC("arrow-up", "icon_arrow_up.png", 16, 0);
|
||||
IC("arrow-down", "icon_arrow_down.png", 16, 0);
|
||||
IC("arrow-left", "icon_arrow_left.png", 16, 0);
|
||||
IC("arrow-right", "icon_arrow_right.png", 16, 0);
|
||||
IC("arrow-up-left", "icon_arrow_up_left.png", 16, 0); /* */
|
||||
IC("arrow-up-right", "icon_arrow_up_right.png", 16, 0); /* */
|
||||
IC("arrow-down-left", "icon_arrow_down_left.png", 16, 0); /* */
|
||||
IC("arrow-down-right", "icon_arrow_down_right.png", 16, 0); /* */
|
||||
|
||||
IC("edit-delete", "icon_delete.png", 16, 0);
|
||||
|
||||
IC("application-chat", "icon_chat.png", 16, 0); /* */
|
||||
IC("application-clock", "icon_clock.png", 16, 0); /* */
|
||||
|
||||
IC("media-seek-forward", "icon_forward.png", 16, 0);
|
||||
IC("media-seek-backward", "icon_rewind.png", 16, 0);
|
||||
IC("media-skip-forward", "icon_next.png", 16, 0);
|
||||
IC("media-skip-backward", "icon_prev.png", 16, 0);
|
||||
IC("media-playback-pause", "icon_pause.png", 16, 0);
|
||||
IC("media-playback-start", "icon_play.png", 16, 0);
|
||||
IC("media-playback-stop", "icon_stop.png", 16, 0);
|
||||
IC("media-eject", "icon_eject.png", 16, 0);
|
||||
|
||||
IC("audio-volume", "icon_volume.png", 16, 0); /* */
|
||||
IC("audio-volume-muted", "icon_mute.png", 16, 0);
|
||||
|
||||
/// TODO emoticons, file, no_photo
|
||||
#undef IC
|
||||
|
||||
|
||||
/*
|
||||
* All the icons below this point are not standard and are to be considered
|
||||
* deprecated or at least just for internal usage only.
|
||||
*/
|
||||
|
||||
#define IC(Name, Alias, File, Min, Max) \
|
||||
group { name: "elm/icon/"##Name##"/default"; min: Min Min; max: Max Max; \
|
||||
alias: "elm/icon/"##Alias##"/default"; \
|
||||
|
@ -16,7 +84,6 @@ IC("clock", "toolbar/clock", "icon_clock.png", 16, 0);
|
|||
IC("delete", "toolbar/delete", "icon_delete.png", 16, 0);
|
||||
IC("edit", "toolbar/edit", "icon_edit.png", 16, 0);
|
||||
IC("refresh", "toolbar/refresh", "icon_refresh.png", 16, 0);
|
||||
IC("folder", "toolbar/folder", "icon_folder.png", 16, 0);
|
||||
IC("file", "toolbar/file", "icon_file.png", 16, 0);
|
||||
IC("no_photo", "photo/no_photo", "icon_head.png", 16, 0);
|
||||
#undef IC
|
||||
|
@ -28,6 +95,7 @@ IC("no_photo", "photo/no_photo", "icon_head.png", 16, 0);
|
|||
image.normal: File; } } } }
|
||||
|
||||
IC("toolbar/more_menu", "icon_arrow_down.png", 16, 0);
|
||||
IC("toolbar/folder", "icon_folder.png", 16, 0);
|
||||
|
||||
IC("arrow_up_left", "icon_arrow_up_left.png", 16, 0);
|
||||
IC("arrow_up_right", "icon_arrow_up_right.png", 16, 0);
|
||||
|
|
|
@ -17,6 +17,7 @@ void test_bg_image(void *data, Evas_Object *obj, void *event_info);
|
|||
void test_bg_options(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_icon(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_icon_transparent(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_icon_standard(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_box_vert(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_box_vert2(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_box_pack(void *data, Evas_Object *obj, void *event_info);
|
||||
|
@ -535,6 +536,7 @@ add_tests:
|
|||
ADD_TEST(NULL, "Images", "Icon", test_icon);
|
||||
ADD_TEST(NULL, "Images", "Icon Transparent", test_icon_transparent);
|
||||
ADD_TEST(NULL, "Images", "Icon Animation", test_icon_animated);
|
||||
ADD_TEST(NULL, "Images", "Icon Standard", test_icon_standard);
|
||||
ADD_TEST(NULL, "Images", "Photocam", test_photocam);
|
||||
ADD_TEST(NULL, "Images", "Photocam Remote", test_photocam_remote);
|
||||
ADD_TEST(NULL, "Images", "Photo", test_photo);
|
||||
|
|
|
@ -111,6 +111,7 @@ test_icon(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info
|
|||
evas_object_show(win);
|
||||
}
|
||||
|
||||
/* Test: Icon Transparent */
|
||||
static void
|
||||
icon_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -142,3 +143,114 @@ test_icon_transparent(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
||||
/* Test: Icon Standard */
|
||||
static void
|
||||
_standard_list_populate(Evas_Object *list, Elm_Icon_Lookup_Order order)
|
||||
{
|
||||
Evas_Object *ic;
|
||||
Eina_List* l;
|
||||
const char *group;
|
||||
char name[128], *p;
|
||||
|
||||
elm_list_clear(list);
|
||||
l = elm_theme_group_base_list(NULL, "elm/icon/");
|
||||
EINA_LIST_FREE(l, group)
|
||||
{
|
||||
// group = "/elm/icon/standard-name/style/maybe_another_style??"
|
||||
snprintf(name, sizeof(name), "%s", group + 9);
|
||||
p = strrchr(name, '/');
|
||||
*p = '\0';
|
||||
printf("Found group:%s Name:%s\n", group, name);
|
||||
|
||||
// quick hack to show only standard-compliant icons
|
||||
// apart from the "folder" one, all the others have "-" in the name
|
||||
if ((strrchr(name, '-') != NULL) || !strcmp(name, "folder"))
|
||||
{
|
||||
ic = elm_icon_add(list);
|
||||
elm_icon_order_lookup_set(ic, order);
|
||||
elm_icon_standard_set(ic, name);
|
||||
evas_object_size_hint_min_set(ic, 32, 32);
|
||||
elm_list_item_append(list, name, ic, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
eina_stringshare_del(group);
|
||||
}
|
||||
eina_list_free(l);
|
||||
elm_list_go(list);
|
||||
}
|
||||
|
||||
static void
|
||||
_rdg_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
_standard_list_populate(data, elm_radio_value_get(obj));
|
||||
}
|
||||
|
||||
void
|
||||
test_icon_standard(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *win, *li, *box, *hbox, *fr, *rd, *rdg;
|
||||
|
||||
|
||||
win = elm_win_util_standard_add("icon-test-std", "Icon Standard");
|
||||
elm_win_autodel_set(win, EINA_TRUE);
|
||||
|
||||
box = elm_box_add(win);
|
||||
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_win_resize_object_add(win, box);
|
||||
evas_object_show(box);
|
||||
|
||||
fr = elm_frame_add(box);
|
||||
elm_object_text_set(fr, "standard icon order lookup");
|
||||
evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0.0);
|
||||
elm_box_pack_end(box, fr);
|
||||
evas_object_show(fr);
|
||||
|
||||
li = elm_list_add(box);
|
||||
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(box, li);
|
||||
evas_object_show(li);
|
||||
_standard_list_populate(li, ELM_ICON_LOOKUP_FDO_THEME);
|
||||
|
||||
hbox = elm_box_add(fr);
|
||||
elm_box_horizontal_set(hbox, EINA_TRUE);
|
||||
elm_object_content_set(fr, hbox);
|
||||
evas_object_show(hbox);
|
||||
|
||||
rdg = elm_radio_add(hbox);
|
||||
elm_radio_state_value_set(rdg, ELM_ICON_LOOKUP_FDO_THEME);
|
||||
elm_object_text_set(rdg, "fdo, theme");
|
||||
elm_box_pack_end(hbox, rdg);
|
||||
evas_object_show(rdg);
|
||||
evas_object_smart_callback_add(rdg, "changed", _rdg_changed_cb, li);
|
||||
|
||||
rd = elm_radio_add(hbox);
|
||||
elm_radio_state_value_set(rd, ELM_ICON_LOOKUP_THEME_FDO);
|
||||
elm_radio_group_add(rd, rdg);
|
||||
elm_object_text_set(rd, "theme, fdo");
|
||||
elm_box_pack_end(hbox, rd);
|
||||
evas_object_show(rd);
|
||||
evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, li);
|
||||
|
||||
rd = elm_radio_add(hbox);
|
||||
elm_radio_state_value_set(rd, ELM_ICON_LOOKUP_FDO);
|
||||
elm_radio_group_add(rd, rdg);
|
||||
elm_object_text_set(rd, "fdo only");
|
||||
elm_box_pack_end(hbox, rd);
|
||||
evas_object_show(rd);
|
||||
evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, li);
|
||||
|
||||
rd = elm_radio_add(hbox);
|
||||
elm_radio_state_value_set(rd, ELM_ICON_LOOKUP_THEME);
|
||||
elm_radio_group_add(rd, rdg);
|
||||
elm_object_text_set(rd, "theme only");
|
||||
elm_box_pack_end(hbox, rd);
|
||||
evas_object_show(rd);
|
||||
evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, li);
|
||||
|
||||
evas_object_resize(win, 300, 400);
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue