Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_border.c e_utils.c e_utils.h Log Message: accpet an icon class as a comma-delimited list, so you can do multiple classes to match more than one eg: firefox,mozilla,web_browser,browser,application ie the app (lets say it was firefox) is a member of multiple classes - the first matched will be used, if none match, the .eap provided internal icon will be used. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v retrieving revision 1.347 retrieving revision 1.348 diff -u -3 -r1.347 -r1.348 --- e_border.c 30 Jul 2005 07:46:04 -0000 1.347 +++ e_border.c 30 Jul 2005 08:12:05 -0000 1.348 @@ -1748,7 +1748,7 @@ if (a) { o = edje_object_add(evas); - if (!e_util_edje_icon_set(o, a->icon_class)) + if (!e_util_edje_icon_list_set(o, a->icon_class)) edje_object_file_set(o, a->path, "icon"); } } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_utils.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- e_utils.c 30 Jul 2005 07:46:05 -0000 1.19 +++ e_utils.c 30 Jul 2005 08:12:05 -0000 1.20 @@ -257,28 +257,117 @@ } int +e_util_ejde_icon_list_set(Evas_Object *obj, char *list) +{ + char *buf; + char *p, *c; + + buf = malloc(strlen(list) + 1); + p = list; + while (p) + { + c = strchr(p, ','); + if (c) + { + strncpy(buf, p, c - p); + buf[c - p] = 0; + if (e_util_edje_icon_set(obj, buf)) + { + free(buf); + return 1; + } + p = c + 1; + if (!*p) + { + free(buf); + return 0; + } + } + else + { + strcpy(buf, p); + if (e_util_edje_icon_set(obj, buf)) + { + free(buf); + return 1; + } + } + } + free(buf); + return 0; +} + +int +e_util_menu_item_ejde_icon_list_set(E_Menu_Item *mi, char *list) +{ + char *buf; + char *p, *c; + + buf = malloc(strlen(list) + 1); + p = list; + while (p) + { + c = strchr(p, ','); + if (c) + { + strncpy(buf, p, c - p); + buf[c - p] = 0; + if (e_util_menu_item_edje_icon_set(mi, buf)) + { + free(buf); + return 1; + } + p = c + 1; + if (!*p) + { + free(buf); + return 0; + } + } + else + { + strcpy(buf, p); + if (e_util_menu_item_edje_icon_set(mi, buf)) + { + free(buf); + return 1; + } + } + } + free(buf); + return 0; +} + +int e_util_edje_icon_set(Evas_Object *obj, char *name) { char *file; char buf[4096]; - if (!name) return 0; + if ((!name) || (!name[0])) return 0; snprintf(buf, sizeof(buf), "icons/%s", name); file = (char *)e_theme_edje_file_get("base/theme/icons", buf); - if (!file[0]) return; - edje_object_file_set(obj, file, buf); - return 1; + if (file[0]) + { + edje_object_file_set(obj, file, buf); + return 1; + } + return 0; } -void +int e_util_menu_item_edje_icon_set(E_Menu_Item *mi, char *name) { char *file; char buf[4096]; - if (!name) return; + if ((!name) || (!name[0])) return 0; snprintf(buf, sizeof(buf), "icons/%s", name); file = (char *)e_theme_edje_file_get("base/theme/icons", buf); - if (!file[0]) return; - e_menu_item_icon_edje_set(mi, file, buf); + if (file[0]) + { + e_menu_item_icon_edje_set(mi, file, buf); + return 1; + } + return 0; } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_utils.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- e_utils.h 30 Jul 2005 07:46:05 -0000 1.13 +++ e_utils.h 30 Jul 2005 08:12:05 -0000 1.14 @@ -20,8 +20,10 @@ EAPI int e_util_strcmp(char *s1, char *s2); EAPI int e_util_both_str_empty(char *s1, char *s2); EAPI int e_util_immortal_check(void); +EAPI int e_util_ejde_icon_list_set(Evas_Object *obj, char *list); +EAPI int e_util_menu_item_ejde_icon_list_set(E_Menu_Item *mi, char *list); EAPI int e_util_edje_icon_set(Evas_Object *obj, char *name); -EAPI void e_util_menu_item_edje_icon_set(E_Menu_Item *mi, char *name); +EAPI int e_util_menu_item_edje_icon_set(E_Menu_Item *mi, char *name); #endif #endif ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs