Enlightenment CVS committal
Author : ravenlock
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_int_config_modules.c
Log Message:
Make sure the module description falls back to unavailable when there is no
selection. Plus a bunch of whitespace removal.
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_modules.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -3 -r1.75 -r1.76
--- e_int_config_modules.c 31 Oct 2007 12:21:01 -0000 1.75
+++ e_int_config_modules.c 31 Oct 2007 14:58:29 -0000 1.76
@@ -3,14 +3,14 @@
*/
#include "e.h"
-typedef struct _CFModule
+typedef struct _CFModule
{
const char *short_name, *name, *comment;
const char *icon, *orig_path;
int enabled, selected;
} CFModule;
-struct _E_Config_Dialog_Data
+struct _E_Config_Dialog_Data
{
Evas_Object *o_avail, *o_loaded;
Evas_Object *b_load, *b_unload;
@@ -19,9 +19,9 @@
static void *_create_data (E_Config_Dialog *cfd);
static void _fill_data (E_Config_Dialog_Data *cfdata);
-static void _free_data (E_Config_Dialog *cfd,
+static void _free_data (E_Config_Dialog *cfd,
E_Config_Dialog_Data *cfdata);
-static Evas_Object *_basic_create (E_Config_Dialog *cfd, Evas *evas,
+static Evas_Object *_basic_create (E_Config_Dialog *cfd, Evas *evas,
E_Config_Dialog_Data *cfdata);
/* Private Function Protos */
@@ -36,17 +36,17 @@
static int _upd_hdl_cb (void *data, int type, void *event);
/* Hash callback Protos */
-static Evas_Bool _modules_hash_cb_free (Evas_Hash *hash __UNUSED__,
- const char *key __UNUSED__,
+static Evas_Bool _modules_hash_cb_free (Evas_Hash *hash __UNUSED__,
+ const char *key __UNUSED__,
void *data, void *fdata __UNUSED__);
-static Evas_Bool _modules_hash_cb_unsel (Evas_Hash *hash __UNUSED__,
- const char *key __UNUSED__,
+static Evas_Bool _modules_hash_cb_unsel (Evas_Hash *hash __UNUSED__,
+ const char *key __UNUSED__,
void *data, void *fdata __UNUSED__);
-static Evas_Bool _modules_hash_cb_load (Evas_Hash *hash __UNUSED__,
- const char *key __UNUSED__,
+static Evas_Bool _modules_hash_cb_load (Evas_Hash *hash __UNUSED__,
+ const char *key __UNUSED__,
void *data, void *fdata __UNUSED__);
-static Evas_Bool _modules_hash_cb_unload (Evas_Hash *hash __UNUSED__,
- const char *key __UNUSED__,
+static Evas_Bool _modules_hash_cb_unload (Evas_Hash *hash __UNUSED__,
+ const char *key __UNUSED__,
void *data, void *fdata __UNUSED__);
static Evas_Hash *modules = NULL;
@@ -54,46 +54,46 @@
Ecore_Event_Handler *upd_hdl = NULL;
EAPI E_Config_Dialog *
-e_int_config_modules(E_Container *con, const char *params __UNUSED__)
+e_int_config_modules(E_Container *con, const char *params __UNUSED__)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
if (e_config_dialog_find("E", "_config_modules_dialog")) return NULL;
-
+
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.create_widgets = _basic_create;
-
- cfd = e_config_dialog_new(con, _("Module Settings"),
- "E", "_config_modules_dialog",
+
+ cfd = e_config_dialog_new(con, _("Module Settings"),
+ "E", "_config_modules_dialog",
"enlightenment/modules", 0, v, NULL);
e_dialog_resizable_set(cfd->dia, 1);
return cfd;
}
static void *
-_create_data(E_Config_Dialog *cfd)
+_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
-
+
cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cfdata);
return cfdata;
}
-static void
-_fill_data(E_Config_Dialog_Data *cfdata)
+static void
+_fill_data(E_Config_Dialog_Data *cfdata)
{
Evas_List *mdirs = NULL, *l = NULL;
if (!cfdata) return;
mdirs = e_path_dir_list_get(path_modules);
- for (l = mdirs; l; l = l->next)
+ for (l = mdirs; l; l = l->next)
{
E_Path_Dir *epd;
-
+
epd = l->data;
if (!epd) continue;
if (!ecore_file_is_dir(epd->dir)) continue;
@@ -103,37 +103,37 @@
if (mdirs) e_path_dir_list_free(mdirs);
}
-static void
-_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+static void
+_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
{
if (upd_hdl) ecore_event_handler_del(upd_hdl);
upd_hdl = NULL;
-
- if (modules)
+
+ if (modules)
{
evas_hash_foreach(modules, _modules_hash_cb_free, NULL);
evas_hash_free(modules);
modules = NULL;
}
- while (modules_list)
+ while (modules_list)
{
char *m;
-
+
m = modules_list->data;
modules_list = evas_list_remove_list(modules_list, modules_list);
free(m);
}
-
+
E_FREE(cfdata);
}
static Evas_Object *
-_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
+_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *ot, *of, *ow;
ot = e_widget_table_add(evas, 0);
-
+
of = e_widget_frametable_add(evas, _("Available Modules"), 0);
ow = e_widget_ilist_add(evas, 24, 24, NULL);
cfdata->o_avail = ow;
@@ -148,13 +148,13 @@
e_widget_textblock_markup_set(ow, "Description: Unavailable.");
e_widget_frametable_object_append(of, ow, 0, 1, 1, 1, 1, 1, 1, 0);
- ow = e_widget_button_add(evas, _("Load Module"), NULL, _btn_cb_load,
+ ow = e_widget_button_add(evas, _("Load Module"), NULL, _btn_cb_load,
cfdata, NULL);
cfdata->b_load = ow;
e_widget_disabled_set(ow, 1);
e_widget_frametable_object_append(of, ow, 0, 2, 1, 1, 1, 1, 1, 0);
e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 1);
-
+
of = e_widget_frametable_add(evas, _("Loaded Modules"), 0);
ow = e_widget_ilist_add(evas, 24, 24, NULL);
cfdata->o_loaded = ow;
@@ -163,25 +163,25 @@
_fill_loaded_list(cfdata);
e_widget_frametable_object_append(of, ow, 0, 0, 2, 1, 1, 1, 1, 1);
- ow = e_widget_button_add(evas, _("Unload Module"), NULL, _btn_cb_unload,
+ ow = e_widget_button_add(evas, _("Unload Module"), NULL, _btn_cb_unload,
cfdata, NULL);
cfdata->b_unload = ow;
e_widget_disabled_set(ow, 1);
e_widget_frametable_object_append(of, ow, 0, 2, 2, 1, 1, 1, 1, 0);
-
+
e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1);
-
+
/* Setup Module update Handler */
if (upd_hdl) ecore_event_handler_del(upd_hdl);
upd_hdl = NULL;
upd_hdl = ecore_event_handler_add(E_EVENT_MODULE_UPDATE, _upd_hdl_cb,
cfdata);
-
+
return ot;
}
/* Private Functions */
-static void
-_load_modules(const char *dir)
+static void
+_load_modules(const char *dir)
{
Ecore_List *files = NULL;
char *mod;
@@ -190,7 +190,7 @@
if (!files) return;
ecore_list_first_goto(files);
- while ((mod = ecore_list_next(files)))
+ while ((mod = ecore_list_next(files)))
{
char buf[4096];
Efreet_Desktop *desktop;
@@ -200,70 +200,70 @@
if (!ecore_file_exists(buf)) continue;
desktop = efreet_desktop_get(buf);
if (!desktop) continue;
- if (evas_hash_find(modules, desktop->name))
+ if (evas_hash_find(modules, desktop->name))
{
efreet_desktop_free(desktop);
continue;
}
-
+
module = E_NEW(CFModule, 1);
module->short_name = evas_stringshare_add(mod);
if (desktop->name) module->name = evas_stringshare_add(desktop->name);
if (desktop->icon) module->icon = evas_stringshare_add(desktop->icon);
if (desktop->comment) module->comment =
evas_stringshare_add(desktop->comment);
- if (desktop->orig_path)
+ if (desktop->orig_path)
module->orig_path = evas_stringshare_add(desktop->orig_path);
if (e_module_find(mod)) module->enabled = 1;
-
- modules = evas_hash_direct_add(modules,
- evas_stringshare_add(desktop->name),
+
+ modules = evas_hash_direct_add(modules,
+ evas_stringshare_add(desktop->name),
module);
modules_list = evas_list_append(modules_list, strdup(desktop->name));
efreet_desktop_free(desktop);
}
free(mod);
if (files) ecore_list_destroy(files);
-
- if (modules_list)
+
+ if (modules_list)
modules_list = evas_list_sort(modules_list, -1, _modules_list_cb_sort);
}
-static int
-_modules_list_cb_sort(void *data1, void *data2)
+static int
+_modules_list_cb_sort(void *data1, void *data2)
{
if (!data1) return 1;
if (!data2) return -1;
return (strcmp((char *)data1, (char *)data2));
}
-static void
-_fill_avail_list(E_Config_Dialog_Data *cfdata)
+static void
+_fill_avail_list(E_Config_Dialog_Data *cfdata)
{
Evas *evas;
Evas_List *l = NULL;
Evas_Coord w;
if (!cfdata) return;
-
+
evas = evas_object_evas_get(cfdata->o_avail);
evas_event_freeze(evas);
edje_freeze();
e_widget_ilist_freeze(cfdata->o_avail);
e_widget_ilist_clear(cfdata->o_avail);
-
- for (l = modules_list; l; l = l->next)
+
+ for (l = modules_list; l; l = l->next)
{
CFModule *module = NULL;
Evas_Object *ic = NULL;
char *name, *icon, *path;
char buf[4096];
-
+
name = l->data;
if (!name) continue;
module = evas_hash_find(modules, name);
if ((!module) || (module->enabled) || (!module->icon)) continue;
/*
- icon = efreet_icon_path_find(e_config->icon_theme,
+ icon = efreet_icon_path_find(e_config->icon_theme,
module->icon, "24x24");
if ((!icon) && (module->orig_path))
{
@@ -272,15 +272,15 @@
icon = strdup(buf);
free(path);
}
- */
- if (module->orig_path)
+ */
+ if (module->orig_path)
{
path = ecore_file_dir_get(module->orig_path);
snprintf(buf, sizeof(buf), "%s/%s.edj", path, module->icon);
icon = strdup(buf);
free(path);
}
- if (icon)
+ if (icon)
{
ic = e_util_icon_add(icon, evas);
free(icon);
@@ -290,7 +290,7 @@
else if (module->short_name)
e_widget_ilist_append(cfdata->o_avail, ic, module->short_name, NULL,
NULL, NULL);
}
-
+
e_widget_ilist_go(cfdata->o_avail);
e_widget_min_size_get(cfdata->o_avail, &w, NULL);
e_widget_min_size_set(cfdata->o_avail, w, 200);
@@ -300,34 +300,34 @@
if (l) evas_list_free(l);
}
-static void
-_fill_loaded_list(E_Config_Dialog_Data *cfdata)
+static void
+_fill_loaded_list(E_Config_Dialog_Data *cfdata)
{
Evas *evas;
Evas_List *l = NULL;
Evas_Coord w;
if (!cfdata) return;
-
+
evas = evas_object_evas_get(cfdata->o_loaded);
evas_event_freeze(evas);
edje_freeze();
e_widget_ilist_freeze(cfdata->o_loaded);
e_widget_ilist_clear(cfdata->o_loaded);
-
- for (l = modules_list; l; l = l->next)
+
+ for (l = modules_list; l; l = l->next)
{
CFModule *module = NULL;
Evas_Object *ic = NULL;
char *name, *icon, *path;
char buf[4096];
-
+
name = l->data;
if (!name) continue;
module = evas_hash_find(modules, name);
if ((!module) || (!module->enabled) || (!module->icon)) continue;
/*
- icon = efreet_icon_path_find(e_config->icon_theme,
+ icon = efreet_icon_path_find(e_config->icon_theme,
module->icon, "24x24");
if ((!icon) && (module->orig_path))
{
@@ -337,14 +337,14 @@
free(path);
}
*/
- if (module->orig_path)
+ if (module->orig_path)
{
path = ecore_file_dir_get(module->orig_path);
snprintf(buf, sizeof(buf), "%s/%s.edj", path, module->icon);
icon = strdup(buf);
free(path);
}
- if (icon)
+ if (icon)
{
ic = e_util_icon_add(icon, evas);
free(icon);
@@ -354,7 +354,7 @@
else if (module->short_name)
e_widget_ilist_append(cfdata->o_loaded, ic, module->short_name, NULL,
NULL, NULL);
}
-
+
e_widget_ilist_go(cfdata->o_loaded);
e_widget_min_size_get(cfdata->o_loaded, &w, NULL);
e_widget_min_size_set(cfdata->o_loaded, w, 200);
@@ -364,36 +364,36 @@
if (l) evas_list_free(l);
}
-static void
-_avail_list_cb_change(void *data, Evas_Object *obj)
+static void
+_avail_list_cb_change(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
Evas_List *l = NULL;
int i;
-
+
cfdata = data;
if (!cfdata) return;
/* Loop the hash & unselect all */
evas_hash_foreach(modules, _modules_hash_cb_unsel, NULL);
-
+
/* Unselect all in loaded list & disable buttons */
e_widget_ilist_unselect(cfdata->o_loaded);
e_widget_disabled_set(cfdata->b_unload, 1);
/* Make sure something is selected, else disable the load button */
- if (e_widget_ilist_selected_count_get(cfdata->o_avail) <= 0)
+ if (e_widget_ilist_selected_count_get(cfdata->o_avail) <= 0)
{
e_widget_disabled_set(cfdata->b_load, 1);
return;
}
- for (i = 0, l = e_widget_ilist_items_get(cfdata->o_avail); l; l = l->next,
i++)
+ for (i = 0, l = e_widget_ilist_items_get(cfdata->o_avail); l; l = l->next,
i++)
{
E_Ilist_Item *item = NULL;
CFModule *module = NULL;
const char *lbl;
-
+
item = l->data;
if ((!item) || (!item->selected)) continue;
lbl = e_widget_ilist_nth_label_get(cfdata->o_avail, i);
@@ -409,13 +409,13 @@
e_widget_disabled_set(cfdata->b_load, 0);
}
-static void
-_loaded_list_cb_change(void *data, Evas_Object *obj)
+static void
+_loaded_list_cb_change(void *data, Evas_Object *obj)
{
E_Config_Dialog_Data *cfdata;
Evas_List *l = NULL;
int i, c;
-
+
cfdata = data;
if (!cfdata) return;
@@ -425,22 +425,22 @@
/* Unselect all in avail list & disable buttons */
e_widget_ilist_unselect(cfdata->o_avail);
e_widget_disabled_set(cfdata->b_load, 1);
-
+
/* Make sure something is selected, else disable the buttons */
c = e_widget_ilist_selected_count_get(cfdata->o_loaded);
- if (c <= 0)
+ if (c <= 0)
{
e_widget_disabled_set(cfdata->b_unload, 1);
return;
}
- for (i = 0, l = e_widget_ilist_items_get(cfdata->o_loaded); l; l = l->next,
i++)
+ for (i = 0, l = e_widget_ilist_items_get(cfdata->o_loaded); l; l = l->next,
i++)
{
E_Ilist_Item *item = NULL;
E_Module *mod = NULL;
CFModule *module = NULL;
const char *lbl;
-
+
item = l->data;
if ((!item) || (!item->selected)) continue;
lbl = e_widget_ilist_nth_label_get(cfdata->o_loaded, i);
@@ -456,14 +456,14 @@
e_widget_disabled_set(cfdata->b_unload, 0);
}
-static void
-_btn_cb_unload(void *data, void *data2)
+static void
+_btn_cb_unload(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
-
+
cfdata = data;
if (!cfdata) return;
-
+
evas_hash_foreach(modules, _modules_hash_cb_unload, NULL);
/* Loop the hash & unselect all */
@@ -471,15 +471,16 @@
e_widget_ilist_unselect(cfdata->o_loaded);
e_widget_disabled_set(cfdata->b_unload, 1);
+ e_widget_textblock_markup_set(cfdata->o_desc, "Description: Unavailable.");
_fill_avail_list(cfdata);
_fill_loaded_list(cfdata);
}
-static void
-_btn_cb_load(void *data, void *data2)
+static void
+_btn_cb_load(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
-
+
cfdata = data;
if (!cfdata) return;
@@ -489,13 +490,14 @@
evas_hash_foreach(modules, _modules_hash_cb_unsel, NULL);
e_widget_ilist_unselect(cfdata->o_avail);
e_widget_disabled_set(cfdata->b_load, 1);
-
+
+ e_widget_textblock_markup_set(cfdata->o_desc, "Description: Unavailable.");
_fill_avail_list(cfdata);
_fill_loaded_list(cfdata);
}
-static int
-_upd_hdl_cb(void *data, int type, void *event)
+static int
+_upd_hdl_cb(void *data, int type, void *event)
{
E_Event_Module_Update *ev;
E_Config_Dialog_Data *cfdata;
@@ -510,9 +512,9 @@
}
/* Hash callback Functions */
-static Evas_Bool
-_modules_hash_cb_free(Evas_Hash *hash __UNUSED__, const char *key __UNUSED__,
- void *data, void *fdata __UNUSED__)
+static Evas_Bool
+_modules_hash_cb_free(Evas_Hash *hash __UNUSED__, const char *key __UNUSED__,
+ void *data, void *fdata __UNUSED__)
{
CFModule *module = NULL;
@@ -527,9 +529,9 @@
return 1;
}
-static Evas_Bool
-_modules_hash_cb_unsel(Evas_Hash *hash __UNUSED__, const char *key __UNUSED__,
- void *data, void *fdata __UNUSED__)
+static Evas_Bool
+_modules_hash_cb_unsel(Evas_Hash *hash __UNUSED__, const char *key __UNUSED__,
+ void *data, void *fdata __UNUSED__)
{
CFModule *module = NULL;
@@ -539,9 +541,9 @@
return 1;
}
-static Evas_Bool
-_modules_hash_cb_load(Evas_Hash *hash __UNUSED__, const char *key __UNUSED__,
- void *data, void *fdata __UNUSED__)
+static Evas_Bool
+_modules_hash_cb_load(Evas_Hash *hash __UNUSED__, const char *key __UNUSED__,
+ void *data, void *fdata __UNUSED__)
{
CFModule *module = NULL;
E_Module *mod = NULL;
@@ -555,9 +557,9 @@
return 1;
}
-static Evas_Bool
-_modules_hash_cb_unload(Evas_Hash *hash __UNUSED__, const char *key
__UNUSED__,
- void *data, void *fdata __UNUSED__)
+static Evas_Bool
+_modules_hash_cb_unload(Evas_Hash *hash __UNUSED__, const char *key __UNUSED__,
+ void *data, void *fdata __UNUSED__)
{
CFModule *module = NULL;
E_Module *mod = NULL;
@@ -565,7 +567,7 @@
module = data;
if ((!module) || (!module->selected)) return 1;
mod = e_module_find(module->short_name);
- if (mod)
+ if (mod)
{
e_module_disable(mod);
e_object_del(E_OBJECT(mod));
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs