Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_apps.c e_apps.h e_border.c e_dnd.c e_eapp_main.c e_hints.c e_int_menus.c e_theme.c e_utils.c e_utils.h Log Message: icons are now part of the theme and themable from the theme (always falls back to default of course if theme doesnt provide them) and this works for EAP icons too - if you give your EAP icons an icon class like "web_browser" and if the theme provides a theme override for icons of class "web_browser" then the theme icon is used instead of the .eap internal image. not surethis is perfect as u want more "specific" and "more general" levels - maybe i should make the eapp icon class a list of classes the icon is part of... =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.c,v retrieving revision 1.56 retrieving revision 1.57 diff -u -3 -r1.56 -r1.57 --- e_apps.c 12 Jul 2005 03:53:44 -0000 1.56 +++ e_apps.c 30 Jul 2005 07:46:04 -0000 1.57 @@ -720,8 +720,7 @@ _e_apps = evas_hash_del(_e_apps, a->path, a); _e_apps_list = evas_list_remove(_e_apps_list, a); _e_app_fields_empty(a); - if (a->path) - free(a->path); + IF_FREE(a->path); free(a); } } @@ -806,6 +805,15 @@ a->exe = str; free(v); } + v = eet_read(ef, "app/icon/class", &size); + if (v) + { + str = malloc(size + 1); + memcpy(str, v, size); + str[size] = 0; + a->icon_class = str; + free(v); + } v = eet_read(ef, "app/window/name", &size); if (v) { @@ -860,36 +868,15 @@ static void _e_app_fields_empty(E_App *a) { - if (a->name) - { - free(a->name); - a->name = NULL; - } - if (a->generic) - { - free(a->generic); - a->generic = NULL; - } - if (a->comment) - { - free(a->comment); - a->comment = NULL; - } - if (a->exe) - { - free(a->exe); - a->exe = NULL; - } - if (a->win_name) - { - free(a->win_name); - a->win_name = NULL; - } - if (a->win_class) - { - free(a->win_class); - a->win_class = NULL; - } + IF_FREE(a->name); + IF_FREE(a->generic); + IF_FREE(a->comment); + IF_FREE(a->exe); + IF_FREE(a->icon_class); + IF_FREE(a->win_name); + IF_FREE(a->win_class); + IF_FREE(a->win_title); + IF_FREE(a->win_role); } static Ecore_List * =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- e_apps.h 1 Jul 2005 04:41:34 -0000 1.16 +++ e_apps.h 30 Jul 2005 07:46:04 -0000 1.17 @@ -33,12 +33,15 @@ char *generic; /* generic app name */ char *comment; /* a longer description */ char *exe; /* command to execute, NULL if directory */ + char *path; /* path to .eet containing icons etc. etc. */ char *win_name; /* window name */ char *win_class; /* window class */ char *win_title; /* window title */ char *win_role; /* window role */ + + char *icon_class; /* icon_class */ Evas_List *subapps; /* if this a directory, a list of more E_App's */ =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v retrieving revision 1.346 retrieving revision 1.347 diff -u -3 -r1.346 -r1.347 --- e_border.c 29 Jul 2005 02:41:02 -0000 1.346 +++ e_border.c 30 Jul 2005 07:46:04 -0000 1.347 @@ -1748,7 +1748,8 @@ if (a) { o = edje_object_add(evas); - edje_object_file_set(o, a->path, "icon"); + if (!e_util_edje_icon_set(o, a->icon_class)) + edje_object_file_set(o, a->path, "icon"); } } else if (bd->client.netwm.icon.data) =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- e_dnd.c 27 Jun 2005 10:08:53 -0000 1.28 +++ e_dnd.c 30 Jul 2005 07:46:04 -0000 1.29 @@ -811,7 +811,7 @@ int i, size; data = ev->data; - text = data->data; + text = (char *)data->data; size = MIN(data->length, PATH_MAX - 1); /* A moz url _shall_ contain a space */ /* FIXME: The data is two-byte unicode. Somewhere it =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_eapp_main.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- e_eapp_main.c 9 Jul 2005 01:07:30 -0000 1.10 +++ e_eapp_main.c 30 Jul 2005 07:46:04 -0000 1.11 @@ -26,6 +26,7 @@ int del_win_class = 0; int del_win_title = 0; int del_win_role = 0; + int del_icon_class = 0; int del_startup_notify = 0; int del_wait_exit = 0; char *file = NULL; @@ -37,6 +38,7 @@ char *set_win_class = NULL; char *set_win_title = NULL; char *set_win_role = NULL; + char *set_icon_class = NULL; int set_startup_notify = -1; int set_wait_exit = -1; int get_name = 0; @@ -47,6 +49,7 @@ int get_win_class = 0; int get_win_title = 0; int get_win_role = 0; + int get_icon_class = 0; int get_startup_notify = 0; int get_wait_exit = 0; @@ -116,6 +119,13 @@ valid_args++; write_ops++; } + else if ((!strcmp(argv[i], "-set-icon-class")) && (i < (argc - 1))) + { + i++; + set_icon_class = argv[i]; + valid_args++; + write_ops++; + } else if ((!strcmp(argv[i], "-set-startup-notify")) && (i < (argc - 1))) { i++; @@ -140,6 +150,7 @@ del_win_class = 1; del_win_title = 1; del_win_role = 1; + del_icon_class = 1; del_startup_notify = 1; del_wait_exit = 1; valid_args++; @@ -193,6 +204,12 @@ valid_args++; write_ops++; } + else if ((!strcmp(argv[i], "-del-icon-class"))) + { + del_icon_class = 1; + valid_args++; + write_ops++; + } else if ((!strcmp(argv[i], "-del-startup-notify"))) { del_startup_notify = 1; @@ -216,52 +233,57 @@ else if ((!strcmp(argv[i], "-get-name"))) { get_name = 1; - valid_args++; + valid_args++; } else if ((!strcmp(argv[i], "-get-generic"))) { get_generic = 1; - valid_args++; + valid_args++; } else if ((!strcmp(argv[i], "-get-comment"))) { get_comment = 1; - valid_args++; + valid_args++; } else if ((!strcmp(argv[i], "-get-exe"))) { get_exe = 1; - valid_args++; + valid_args++; } else if ((!strcmp(argv[i], "-get-win-name"))) { get_win_name = 1; - valid_args++; + valid_args++; } else if ((!strcmp(argv[i], "-get-win-class"))) { get_win_class = 1; - valid_args++; + valid_args++; } else if ((!strcmp(argv[i], "-get-win-title"))) { get_win_title = 1; - valid_args++; + valid_args++; } else if ((!strcmp(argv[i], "-get-win-role"))) { get_win_role = 1; - valid_args++; + valid_args++; + } + else if ((!strcmp(argv[i], "-get-icon-class"))) + { + get_icon_class = 1; + valid_args++; } else if ((!strcmp(argv[i], "-get-startup-notify"))) { get_startup_notify = 1; - valid_args++; + valid_args++; } else if ((!strcmp(argv[i], "-get-wait-exit"))) { get_wait_exit = 1; - valid_args++; + valid_args++; } else file = argv[i]; @@ -321,6 +343,8 @@ eet_write(ef, "app/window/title", set_win_title, strlen(set_win_title), 0); if (set_win_role) eet_write(ef, "app/window/role", set_win_role, strlen(set_win_role), 0); + if (set_icon_class) + eet_write(ef, "app/icon/class", set_icon_class, strlen(set_icon_class), 0); if (set_startup_notify >= 0) { unsigned char tmp[1]; @@ -387,6 +411,8 @@ eet_delete(ef, "app/window/title"); if (del_win_role) eet_delete(ef, "app/window/role"); + if (del_icon_class) + eet_delete(ef, "app/icon/class"); if (del_startup_notify) eet_delete(ef, "app/info/startup_notify"); if (del_wait_exit) @@ -511,6 +537,18 @@ printf("%s\n", str); } } + if (get_icon_class) + { + v = eet_read(ef, "app/icon/class", &size); + if (v) + { + str = malloc(size + 1); + memcpy(str, v, size); + str[size] = 0; + free(v); + printf("%s\n", str); + } + } if (get_startup_notify) { v = eet_read(ef, "app/info/startup_notify", &size); @@ -571,6 +609,7 @@ " -set-win-class WIN_CLASS Set the application window class glob\n" " -set-win-title WIN_TITLE Set the application window title glob\n" " -set-win-role WIN_ROLE Set the application window role glob\n" + " -set-icon-class CLASS_NAME Set the application icon class for themes\n" " -set-startup-notify [1/0] Set the application startup notify flag\n" " -set-wait-exit [1/0] Set the application wait exit flag\n" " -get-name Get the application name\n" @@ -581,6 +620,7 @@ " -get-win-class Get the application window class glob\n" " -get-win-title Get the application window title glob\n" " -get-win-role Get the application window role glob\n" + " -get-icon-class Get the application icon class for themes\n" " -get-startup-notify Get the application startup notify flag\n" " -get-wait-exit Get the application wait exit flag\n" " -del-name Delete the application name\n" @@ -591,6 +631,7 @@ " -del-win-class Delete the application window class\n" " -del-win-title Delete the application window title glob\n" " -del-win-role Delete the application window role glob\n" + " -del-icon-class Delete the application icon class for themes\n" " -del-startup-notify Delete the application startup notify flag\n" " -del-wait-exit Delete the application wait exit flag\n" ); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_hints.c,v retrieving revision 1.61 retrieving revision 1.62 diff -u -3 -r1.61 -r1.62 --- e_hints.c 22 Jul 2005 10:28:09 -0000 1.61 +++ e_hints.c 30 Jul 2005 07:46:04 -0000 1.62 @@ -921,7 +921,7 @@ e_hints_window_saved_size_get(E_Border *bd) { int ret; - int sizes[4]; + unsigned int sizes[4]; memset(sizes, 0, sizeof(sizes)); ret = ecore_x_window_prop_card32_get(bd->client.win, E_ATOM_SAVED_SIZE, =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_menus.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -3 -r1.81 -r1.82 --- e_int_menus.c 28 Jul 2005 07:43:57 -0000 1.81 +++ e_int_menus.c 30 Jul 2005 07:46:04 -0000 1.82 @@ -54,7 +54,6 @@ E_Menu *m, *subm; E_Menu_Item *mi; Main_Data *dat; - char *s; dat = calloc(1, sizeof(Main_Data)); m = e_menu_new(); @@ -66,9 +65,7 @@ dat->apps = subm; mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Favorite Applications")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "favorites"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/favorites"); e_menu_item_submenu_set(mi, subm); mi = e_menu_item_new(m); @@ -78,54 +75,42 @@ dat->modules = subm; mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Modules")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "module"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/modules"); e_menu_item_submenu_set(mi, subm); subm = e_int_menus_desktops_new(); dat->desktops = subm; mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Desktops")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "desktops"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/desktops"); e_menu_item_submenu_set(mi, subm); subm = e_int_menus_clients_new(); dat->clients = subm; mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Windows")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "windows"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/windows"); e_menu_item_submenu_set(mi, subm); subm = e_int_menus_lost_clients_new(); dat->lost_clients = subm; mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Lost Windows")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "lost_windows"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/lost_windows"); e_menu_item_submenu_set(mi, subm); subm = e_int_menus_gadgets_new(); dat->gadgets = subm; mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Gadgets")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "gadgets"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/gadgets"); e_menu_item_submenu_set(mi, subm); subm = e_int_menus_themes_new(); dat->themes = subm; mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Themes")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "theme"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/themes"); e_menu_item_submenu_set(mi, subm); mi = e_menu_item_new(m); @@ -133,18 +118,14 @@ mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("About Enlightenment")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "e"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/e"); e_menu_item_callback_set(mi, _e_int_menus_main_about, NULL); if (ecore_file_app_installed("exige")) { mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Run Command")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "run"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/run"); e_menu_item_callback_set(mi, _e_int_menus_main_run, NULL); } @@ -152,9 +133,7 @@ dat->config = subm; mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Configuration")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "configuration"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); e_menu_item_submenu_set(mi, subm); mi = e_menu_item_new(m); @@ -162,16 +141,12 @@ mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Restart Enlightenment")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "reset"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/reset"); e_menu_item_callback_set(mi, _e_int_menus_main_restart, NULL); mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Exit Enlightenment")); - s = e_path_find(path_icons, "default.edj"); - e_menu_item_icon_edje_set(mi, s, "power"); - IF_FREE(s); + e_util_menu_item_edje_icon_set(mi, "enlightenment/exit"); e_menu_item_callback_set(mi, _e_int_menus_main_exit, NULL); return m; } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_theme.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- e_theme.c 11 Jul 2005 12:43:27 -0000 1.11 +++ e_theme.c 30 Jul 2005 07:46:04 -0000 1.12 @@ -54,6 +54,7 @@ * e_theme_file_set("base/theme/error", "default.edj"); * e_theme_file_set("base/theme/gadman", "default.edj"); * e_theme_file_set("base/theme/dnd", "default.edj"); + * e_theme_file_set("base/theme/icons", "default.edj"); * e_theme_file_set("base/theme/modules", "default.edj"); * e_theme_file_set("base/theme/modules/pager", "default.edj"); * e_theme_file_set("base/theme/modules/ibar", "default.edj"); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_utils.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- e_utils.c 25 Jul 2005 09:55:45 -0000 1.18 +++ e_utils.c 30 Jul 2005 07:46:05 -0000 1.19 @@ -255,3 +255,30 @@ } return 0; } + +int +e_util_edje_icon_set(Evas_Object *obj, char *name) +{ + char *file; + char buf[4096]; + + if (!name) 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; +} + +void +e_util_menu_item_edje_icon_set(E_Menu_Item *mi, char *name) +{ + char *file; + char buf[4096]; + + if (!name) return; + 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); +} =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_utils.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- e_utils.h 8 Jul 2005 08:43:27 -0000 1.12 +++ e_utils.h 30 Jul 2005 07:46:05 -0000 1.13 @@ -20,6 +20,8 @@ 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_edje_icon_set(Evas_Object *obj, char *name); +EAPI void 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