forked from enlightenment/enlightenment
Subscribe to module update event. This will allow Config Panel to have
dynamic adds/dels when a module gets loaded/unloaded; ie: If you load module that makes entries to Config Panel, then the Panel lists will dynamically be updated with those entries. SVN revision: 32853
This commit is contained in:
parent
95baed480c
commit
5528215b82
|
@ -22,6 +22,7 @@ struct _E_Configure
|
|||
Evas_Object *close;
|
||||
|
||||
Evas_List *cats;
|
||||
Ecore_Event_Handler *mod_hdl;
|
||||
};
|
||||
|
||||
struct _E_Configure_CB
|
||||
|
@ -57,6 +58,7 @@ static void _e_configure_item_cb(void *data);
|
|||
static void _e_configure_focus_cb(void *data, Evas_Object *obj);
|
||||
static void _e_configure_keydown_cb(void *data, Evas *e, Evas_Object *obj, void *event);
|
||||
static void _e_configure_fill_cat_list(void *data);
|
||||
static int _e_configure_module_update_cb(void *data, int type, void *event);
|
||||
|
||||
static E_Configure *_e_configure = NULL;
|
||||
|
||||
|
@ -112,7 +114,11 @@ e_configure_show(E_Container *con)
|
|||
eco->win->data = eco;
|
||||
eco->con = con;
|
||||
eco->evas = e_win_evas_get(eco->win);
|
||||
|
||||
|
||||
/* Event Handler for Module Updates */
|
||||
eco->mod_hdl = ecore_event_handler_add(E_EVENT_MODULE_UPDATE,
|
||||
_e_configure_module_update_cb, eco);
|
||||
|
||||
e_win_title_set(eco->win, _("Enlightenment Configuration"));
|
||||
e_win_name_class_set(eco->win, "E", "_configure");
|
||||
e_win_dialog_set(eco->win, 1);
|
||||
|
@ -121,7 +127,8 @@ e_configure_show(E_Container *con)
|
|||
e_win_centered_set(eco->win, 1);
|
||||
|
||||
eco->edje = edje_object_add(eco->evas);
|
||||
e_theme_edje_object_set(eco->edje, "base/theme/configure", "e/widgets/configure/main");
|
||||
e_theme_edje_object_set(eco->edje, "base/theme/configure",
|
||||
"e/widgets/configure/main");
|
||||
|
||||
eco->o_list = e_widget_list_add(eco->evas, 1, 1);
|
||||
edje_object_part_swallow(eco->edje, "e.swallow.content", eco->o_list);
|
||||
|
@ -184,6 +191,8 @@ e_configure_del(void)
|
|||
{
|
||||
if (_e_configure)
|
||||
{
|
||||
if (_e_configure->mod_hdl)
|
||||
ecore_event_handler_del(_e_configure->mod_hdl);
|
||||
e_object_del(E_OBJECT(_e_configure));
|
||||
_e_configure = NULL;
|
||||
}
|
||||
|
@ -461,6 +470,7 @@ _e_configure_fill_cat_list(void *data)
|
|||
evas_event_freeze(evas_object_evas_get(eco->cat_list));
|
||||
edje_freeze();
|
||||
e_widget_ilist_freeze(eco->cat_list);
|
||||
e_widget_ilist_clear(eco->cat_list);
|
||||
|
||||
for (l = e_configure_registry; l; l = l->next)
|
||||
{
|
||||
|
@ -493,3 +503,19 @@ _e_configure_fill_cat_list(void *data)
|
|||
edje_thaw();
|
||||
evas_event_thaw(evas_object_evas_get(eco->cat_list));
|
||||
}
|
||||
|
||||
static int
|
||||
_e_configure_module_update_cb(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Module_Update *ev;
|
||||
E_Configure *eco;
|
||||
int sel = 0;
|
||||
|
||||
if (type != E_EVENT_MODULE_UPDATE) return 1;
|
||||
eco = data;
|
||||
if (!eco) return;
|
||||
ev = event;
|
||||
sel = e_widget_ilist_selected_get(eco->cat_list);
|
||||
_e_configure_fill_cat_list(eco);
|
||||
e_widget_ilist_selected_set(eco->cat_list, sel);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue