Enlightenment CVS committal
Author : onefang
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_apps.c e_apps.h e_apps_cache.c e_apps_cache.h e_int_menus.c
e_menu.c e_menu.h
Log Message:
Actually display the FDO icons referenced from the FDO .desktop files.
Theme icons and .eaps are searched first.
Still needs some work and a lot of testing. Also needs optimising,
which will come when I go over the caching code later.
Ibar and ibox modules read the .eap directly, so I need to convert them
seperately.
Next I'll spend some time with valgrind, things are leaking.
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -3 -r1.148 -r1.149
--- e_apps.c 14 Aug 2006 21:56:13 -0000 1.148
+++ e_apps.c 16 Aug 2006 09:37:14 -0000 1.149
@@ -1176,7 +1176,15 @@
if (desktop->startup)
a->startup_notify = *(desktop->startup);
-// if (desktop->icon_path) a->icon_path =
evas_stringshare_add(desktop->icon_path);
+ if (desktop->icon)
+ {
+ /* FIXME: Should do this only when needed, is it can be
expensive. */
+ /* FIXME: Use a real icon size and theme. */
+ v = ecore_desktop_icon_find(desktop->icon, NULL, NULL);
+ 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);
}
@@ -1400,6 +1408,7 @@
if (a->comment) evas_stringshare_del(a->comment);
if (a->exe) evas_stringshare_del(a->exe);
if (a->icon_class) evas_stringshare_del(a->icon_class);
+ if (a->icon_path) evas_stringshare_del(a->icon_path);
if (a->win_name) evas_stringshare_del(a->win_name);
if (a->win_class) evas_stringshare_del(a->win_class);
if (a->win_title) evas_stringshare_del(a->win_title);
@@ -1409,6 +1418,7 @@
a->comment = NULL;
a->exe = NULL;
a->icon_class = NULL;
+ a->icon_path = NULL;
a->win_name = NULL;
a->win_class = NULL;
a->win_title = NULL;
@@ -1506,7 +1516,20 @@
o = edje_object_add(evas);
if (!e_util_edje_icon_list_set(o, a->icon_class))
- edje_object_file_set(o, a->path, "icon");
+ {
+ if (edje_object_file_set(o, a->path, "icon"))
+ {
+ ; /* It's a bit more obvious this way. */
+ }
+ else if (a->icon_path) /* If that fails, then this might be an FDO
icon. */
+ {
+ /* Free the aborted object first. */
+ if (o) evas_object_del(o);
+ o = e_icon_add(evas);
+ e_icon_file_set(o, a->icon_path);
+ e_icon_fill_inside_set(o, 1);
+ }
+ }
return o;
}
@@ -2085,6 +2108,7 @@
dst->win_title = src->win_title;
dst->win_role = src->win_role;
dst->icon_class = src->icon_class;
+ dst->icon_path = src->icon_path;
dst->startup_notify = src->startup_notify;
dst->wait_exit = src->wait_exit;
dst->starting = src->starting;
@@ -2276,6 +2300,7 @@
IF_DUP(win_title);
IF_DUP(win_role);
IF_DUP(icon_class);
+ IF_DUP(icon_path);
a->startup_notify = ac->startup_notify;
a->wait_exit = ac->wait_exit;
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- e_apps.h 14 Aug 2006 21:56:13 -0000 1.34
+++ e_apps.h 16 Aug 2006 09:37:14 -0000 1.35
@@ -46,6 +46,7 @@
const char *win_role; /* window role */
const char *icon_class; /* icon_class */
+ const char *icon_path; /* FDO icon path */
Evas_List *subapps; /* if this a directory, a list of more E_App's
*/
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps_cache.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_apps_cache.c 20 May 2006 03:26:21 -0000 1.8
+++ e_apps_cache.c 16 Aug 2006 09:37:14 -0000 1.9
@@ -55,6 +55,7 @@
NEWI("wt", win_title, EET_T_STRING);
NEWI("wr", win_role, EET_T_STRING);
NEWI("ic", icon_class, EET_T_STRING);
+ NEWI("ip", icon_path, EET_T_STRING);
NEWL("ap", subapps, _e_app_cache_edd);
NEWI("sn", startup_notify, EET_T_UCHAR);
NEWI("wx", wait_exit, EET_T_UCHAR);
@@ -145,6 +146,7 @@
if (ac->win_title) evas_stringshare_del(ac->win_title);
if (ac->win_role) evas_stringshare_del(ac->win_role);
if (ac->icon_class) evas_stringshare_del(ac->icon_class);
+ if (ac->icon_path) evas_stringshare_del(ac->icon_path);
while (ac->subapps)
{
E_App_Cache *ac2;
@@ -190,6 +192,7 @@
IF_DUP(win_title);
IF_DUP(win_role);
IF_DUP(icon_class);
+ IF_DUP(icon_path);
ac->startup_notify = a->startup_notify;
ac->wait_exit = a->wait_exit;
}
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps_cache.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_apps_cache.h 2 Mar 2006 12:03:48 -0000 1.4
+++ e_apps_cache.h 16 Aug 2006 09:37:14 -0000 1.5
@@ -25,6 +25,7 @@
const char *win_role; /* window role */
const char *icon_class; /* icon_class */
+ const char *icon_path; /* FDO icon path */
Evas_List *subapps; /* if this a directory, a list of more E_App's
*/
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_menus.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -3 -r1.147 -r1.148
--- e_int_menus.c 13 Aug 2006 02:40:11 -0000 1.147
+++ e_int_menus.c 16 Aug 2006 09:37:14 -0000 1.148
@@ -439,7 +439,10 @@
{
if (!((a->icon_class) &&
(e_util_menu_item_edje_icon_list_set(mi,
a->icon_class))))
- e_menu_item_icon_edje_set(mi, a->path, "icon");
+ {
+ e_menu_item_icon_edje_set(mi, a->path, "icon");
+ if (a->icon_path) e_menu_item_icon_path_set(mi,
a->icon_path);
+ }
e_menu_item_callback_set(mi, _e_int_menus_apps_run, a);
app_count++;
}
@@ -450,7 +453,7 @@
snprintf(buf, sizeof(buf), "%s/.directory.eap", a->path);
if (!((a->icon_class) &&
(e_util_menu_item_edje_icon_list_set(mi,
a->icon_class))))
- e_menu_item_icon_edje_set(mi, buf, "icon");
+ e_menu_item_icon_edje_set(mi, buf, "icon");
e_menu_item_submenu_set(mi,
e_int_menus_apps_new(a->path));
app_count++;
}
@@ -705,7 +708,10 @@
{
if (!((a->icon_class) &&
(e_util_menu_item_edje_icon_list_set(mi, a->icon_class))))
- e_menu_item_icon_edje_set(mi, a->path, "icon");
+ {
+ e_menu_item_icon_edje_set(mi, a->path, "icon");
+ if (a->icon_path) e_menu_item_icon_path_set(mi,
a->icon_path);
+ }
}
}
mi = e_menu_item_new(m);
@@ -863,7 +869,10 @@
{
if (!((a->icon_class) &&
(e_util_menu_item_edje_icon_list_set(mi, a->icon_class))))
- e_menu_item_icon_edje_set(mi, a->path, "icon");
+ {
+ e_menu_item_icon_edje_set(mi, a->path, "icon");
+ if (a->icon_path) e_menu_item_icon_path_set(mi,
a->icon_path);
+ }
}
}
e_object_free_attach_func_set(E_OBJECT(m),
_e_int_menus_lost_clients_free_hook);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_menu.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- e_menu.c 9 Aug 2006 15:24:34 -0000 1.58
+++ e_menu.c 16 Aug 2006 09:37:14 -0000 1.59
@@ -549,6 +549,21 @@
}
EAPI void
+e_menu_item_icon_path_set(E_Menu_Item *mi, const char *icon)
+{
+ E_OBJECT_CHECK(mi);
+ E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
+ if (((mi->icon_path) && (icon) && (!strcmp(icon, mi->icon_path))) ||
+ ((!mi->icon_path) && (!icon)))
+ return;
+ if (mi->icon_path) evas_stringshare_del(mi->icon_path);
+ mi->icon_path = NULL;
+ if (icon) mi->icon_path = evas_stringshare_add(icon);
+ mi->changed = 1;
+ mi->menu->changed = 1;
+}
+
+EAPI void
e_menu_item_icon_file_set(E_Menu_Item *mi, const char *icon)
{
E_OBJECT_CHECK(mi);
@@ -1045,6 +1060,7 @@
mi->menu->items = evas_list_remove(mi->menu->items, mi);
if (mi->icon) evas_stringshare_del(mi->icon);
if (mi->icon_key) evas_stringshare_del(mi->icon_key);
+ if (mi->icon_path) evas_stringshare_del(mi->icon_path);
if (mi->label) evas_stringshare_del(mi->label);
free(mi);
}
@@ -1197,6 +1213,7 @@
else
evas_object_del(o);
+ /* FIXME: This should be cleaned up a bit. */
if (mi->icon_object)
{
o = e_icon_add(mi->menu->evas);
@@ -1208,6 +1225,7 @@
}
else if (mi->icon)
{
+ /* Try a the usual suspects first. */
if (!mi->icon_key)
{
o = e_icon_add(mi->menu->evas);
@@ -1221,13 +1239,27 @@
Evas_Coord iww, ihh;
o = edje_object_add(mi->menu->evas);
+ if (edje_object_file_set(o, mi->icon, mi->icon_key))
+ {
+ mi->icon_object = o;
+ edje_object_size_max_get(o, &iww, &ihh);
+ icon_w = iww;
+ icon_h = ihh;
+ }
+ }
+
+ if ((!mi->icon_object) && (mi->icon_path)) /* If that
fails, then this might be an FDO icon. */
+ {
+ /* Free the aborted object first. */
+ if (mi->icon_object) evas_object_del(mi->icon_object);
+ o = e_icon_add(mi->menu->evas);
mi->icon_object = o;
- edje_object_file_set(o, mi->icon, mi->icon_key);
- edje_object_size_max_get(o, &iww, &ihh);
- icon_w = iww;
- icon_h = ihh;
+ e_icon_file_set(o, mi->icon_path);
+ e_icon_fill_inside_set(o, 1);
+ e_icon_size_get(mi->icon_object, &icon_w, &icon_h);
}
}
+
evas_object_pass_events_set(o, 1);
evas_object_show(o);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_menu.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- e_menu.h 28 Jul 2006 23:22:57 -0000 1.19
+++ e_menu.h 16 Aug 2006 09:37:14 -0000 1.20
@@ -84,6 +84,7 @@
E_Menu *menu;
const char *icon;
const char *icon_key;
+ const char *icon_path;
const char *label;
E_Menu *submenu;
@@ -169,6 +170,7 @@
EAPI E_Menu_Item *e_menu_item_new(E_Menu *m);
EAPI E_Menu_Item *e_menu_item_nth(E_Menu *m, int n);
EAPI int e_menu_item_num_get(E_Menu_Item *mi);
+EAPI void e_menu_item_icon_path_set(E_Menu_Item *mi, const char *icon);
EAPI void e_menu_item_icon_file_set(E_Menu_Item *mi, const char *icon);
EAPI void e_menu_item_icon_edje_set(E_Menu_Item *mi, const char *icon,
const char *key);
EAPI void e_menu_item_icon_object_set(E_Menu_Item *mi, Evas_Object
*obj);
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs