From 9b37ece08c9b585bef971bb8cec65b30c5aefa96 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 2 Sep 2006 11:58:53 +0000 Subject: [PATCH] module.desktop almost working, but e_module_dialog_show has issues with it. Probably something silly. SVN revision: 25346 --- src/bin/e_apps.c | 67 +++++++++++++++++++++++----------- src/bin/e_int_config_modules.c | 9 +++-- src/bin/e_module.c | 8 +++- 3 files changed, 58 insertions(+), 26 deletions(-) diff --git a/src/bin/e_apps.c b/src/bin/e_apps.c index 2886bb76f..8f723a1a7 100644 --- a/src/bin/e_apps.c +++ b/src/bin/e_apps.c @@ -1536,35 +1536,60 @@ e_app_valid_exe_get(E_App *a) return ok; } +static Evas_Object * +_e_app_icon_path_add(Evas *evas, E_App *a) +{ + Evas_Object *o; + char *ext; + + o = e_icon_add(evas); + ext = strrchr(a->icon_path, '.'); + if (ext) + { + if (strcmp(ext, ".edj") == 0) + e_icon_file_edje_set(o, a->icon_path, "icon"); + else + e_icon_file_set(o, a->icon_path); + } + else + e_icon_file_set(o, a->icon_path); + e_icon_fill_inside_set(o, 1); + return o; +} + + EAPI Evas_Object * e_app_icon_add(Evas *evas, E_App *a) { Evas_Object *o; - o = edje_object_add(evas); - if (!e_util_edje_icon_list_set(o, a->icon_class)) + if (a->icon_path) + o = _e_app_icon_path_add(evas, a); + else { - if (edje_object_file_set(o, a->path, "icon")) - { - ; /* It's a bit more obvious this way. */ - } - else if (a->icon_class) /* If that fails, then this might be an FDO icon. */ - { - char *v; + o = edje_object_add(evas); + if (!e_util_edje_icon_list_set(o, a->icon_class)) + { + if (edje_object_file_set(o, a->path, "icon")) + { + ; /* It's a bit more obvious this way. */ + } + 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); - } + /* 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); - o = e_icon_add(evas); - e_icon_file_set(o, a->icon_path); - e_icon_fill_inside_set(o, 1); + if (a->icon_path) + { + /* Free the aborted object first. */ + if (o) evas_object_del(o); + o = _e_app_icon_path_add(evas, a); + } } } diff --git a/src/bin/e_int_config_modules.c b/src/bin/e_int_config_modules.c index 3c3aeab7f..12c8f5bc7 100644 --- a/src/bin/e_int_config_modules.c +++ b/src/bin/e_int_config_modules.c @@ -264,13 +264,14 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf { if (m->enabled) cm->state = MOD_ENABLED; } - snprintf(buf, sizeof(buf), "%s/module.eap", cm->path); - + snprintf(buf, sizeof(buf), "%s/module.desktop", cm->path); + if (!ecore_file_exists(buf)) + snprintf(buf, sizeof(buf), "%s/module.eap", cm->path); + a = e_app_new(buf, 0); if (a) { - oc = edje_object_add(evas); - edje_object_file_set(oc, buf, "icon"); + oc = e_app_icon_add(evas, a); e_widget_ilist_append(ilist, oc, a->name, NULL, NULL, cm->name); e_object_unref(E_OBJECT(a)); } diff --git a/src/bin/e_module.c b/src/bin/e_module.c index 88efaac6c..40ca5979e 100644 --- a/src/bin/e_module.c +++ b/src/bin/e_module.c @@ -379,9 +379,11 @@ e_module_dialog_show(E_Module *m, const char *title, const char *body) { E_App *app; +printf("e_module_dialog_show() - Trying %s\n", eap); app = e_app_new(eap, 0); if (app) { +printf("e_module_dialog_show() - Trying %s, and it exists.\n", eap); dia->icon_object = e_app_icon_add(e_win_evas_get(dia->win), app); edje_extern_object_min_size_set(dia->icon_object, 64, 64); edje_object_part_swallow(dia->bg_object, "icon_swallow", dia->icon_object); @@ -393,10 +395,14 @@ e_module_dialog_show(E_Module *m, const char *title, const char *body) { snprintf(eap, sizeof(eap), "%s/module.edj", e_module_dir_get(m)); if (ecore_file_exists(eap)) - _e_module_dialog_icon_set(dia, eap); + { +printf("e_module_dialog_show() - Trying %s\n", eap); + _e_module_dialog_icon_set(dia, eap); + } else { snprintf(eap, sizeof(eap), "%s/module.eap", e_module_dir_get(m)); +printf("e_module_dialog_show() - Trying %s\n", eap); _e_module_dialog_icon_set(dia, eap); } }