From fbd37bb027d2988ba0a247bed6df6cdcbc42b352 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 2 Sep 2006 04:20:10 +0000 Subject: [PATCH] More icon tweaking. I have started to simplify and rationalise this as it was starting to get silly. Searching the icon class in the wm theme first, then searching fdo icon themes sometimes ends up with a less specific icon. Menus make life tricky, as things are deferred there, but not enough to avoid delays. Lots more tweaking to come, but this commit should result in more icons on menus. SVN revision: 25324 --- src/bin/e_apps.c | 49 +++++++++++++++++++++++++++--------------------- src/bin/e_main.c | 6 ++++++ src/bin/e_menu.c | 2 +- 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/bin/e_apps.c b/src/bin/e_apps.c index ea89aefdb..2886bb76f 100644 --- a/src/bin/e_apps.c +++ b/src/bin/e_apps.c @@ -1170,15 +1170,6 @@ e_app_fields_fill(E_App *a, const char *path) if (desktop->startup) a->startup_notify = *(desktop->startup); - if ((desktop->icon) && (!desktop->icon_path)) - { - /* FIXME: Should do this only when needed, is it can be expensive. */ - /* FIXME: Use a real icon size. */ - v = (char *) ecore_desktop_icon_find(desktop->icon, NULL, e_config->icon_theme); - if (v) - a->icon_path = evas_stringshare_add(v); - } - // if (desktop->type) a->type = evas_stringshare_add(desktop->type); // if (desktop->categories) a->categories = evas_stringshare_add(desktop->categories); } @@ -1557,7 +1548,17 @@ e_app_icon_add(Evas *evas, E_App *a) { ; /* It's a bit more obvious this way. */ } - else if (a->icon_path) /* If that fails, then this might be an FDO icon. */ + else if (a->icon_class) /* If that fails, then this might be an FDO icon. */ + { + char *v; + + /* FIXME: Use a real icon size. */ + v = (char *) ecore_desktop_icon_find(a->icon_class, NULL, e_config->icon_theme); + if (v) + a->icon_path = evas_stringshare_add(v); + } + + if (a->icon_path) { /* Free the aborted object first. */ if (o) evas_object_del(o); @@ -1565,33 +1566,39 @@ e_app_icon_add(Evas *evas, E_App *a) e_icon_file_set(o, a->icon_path); e_icon_fill_inside_set(o, 1); } - /* FIXME: if we still haven't found an icon, feed icon_class into the FDO lookup process. */ } + return o; } /* Search order? - - * + * * fixed path to icon - * an .edje icon in ~/.e/e/icons + * an .edj icon in ~/.e/e/icons * icon_class in theme * icon from a->path in theme - * FDO search * FDO search for icon_class */ EAPI void e_app_icon_add_to_menu_item(E_Menu_Item *mi, E_App *a) { - if (!e_util_menu_item_edje_icon_list_set(mi, a->icon_class)) + if ((!a->icon_path) && (a->icon_class)) { - /* e_menu_item_icon_edje_set() just tucks away the params, the actual call to edje_object_file_set() happens later. */ - /* e_menu_item_icon_file_set() just tucks away the params, the actual call to e_icon_add() happens later. */ - e_menu_item_icon_edje_set(mi, a->path, "icon"); - if (a->icon_path) /* If that fails, then this might be an FDO icon. */ - e_menu_item_icon_file_set(mi, a->icon_path); - /* FIXME: if we still haven't found an icon, feed icon_class into the FDO lookup process. */ + char *v; + + /* FIXME: Use a real icon size. */ + v = (char *) ecore_desktop_icon_find(a->icon_class, NULL, e_config->icon_theme); + if (v) + a->icon_path = evas_stringshare_add(v); } + + e_util_menu_item_edje_icon_list_set(mi, a->icon_class); + /* e_menu_item_icon_edje_set() just tucks away the params, the actual call to edje_object_file_set() happens later. */ + /* e_menu_item_icon_file_set() just tucks away the params, the actual call to e_icon_add() happens later. */ + e_menu_item_icon_edje_set(mi, a->path, "icon"); + if (a->icon_path) + e_menu_item_icon_file_set(mi, a->icon_path); return; } diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 375a1fbc0..c27cc2fd5 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -887,6 +887,12 @@ _e_main_dirs_init(void) { e_fdo_menu_to_order(); } + /* FIXME: Add another temporary hack to keep the users happy. + * Move ~/.e/e/applications/all/*.eap to ~/.e/e/icons/*.edje + * Read the non .edje info from them and construct a matching ~/.e/e/applications/all/*.desktop + * Add an icon path to these .desktop files that points to the ~/.e/e/icons/*.edje files. + * Add ~/.e/e/icons/ to the top of the icon search path. + */ /* FIXME: THIS is to get people started - shoudl be in a wizard */ snprintf(buf, sizeof(buf), "%s/.e/e/fileman/favorites", homedir); if (!ecore_file_exists(buf)) diff --git a/src/bin/e_menu.c b/src/bin/e_menu.c index 8558efa1c..a464304cc 100644 --- a/src/bin/e_menu.c +++ b/src/bin/e_menu.c @@ -1208,7 +1208,7 @@ _e_menu_item_realize(E_Menu_Item *mi) if (mi->icon) { /* This is done this way to match up with how e_app_icon_add does it. */ - mi->icon_object = NULL; /* Just coz I'm paranoid, may not be needed. */ +// mi->icon_object = NULL; /* Just coz I'm paranoid, may not be needed. */ if (mi->icon_key) { Evas_Coord iww, ihh;