Enlightenment CVS committal

Author  : devilhorns
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/modules/conf


Modified Files:
        e_conf.c 


Log Message:
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.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/modules/conf/e_conf.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_conf.c    31 Oct 2007 13:30:19 -0000      1.4
+++ e_conf.c    24 Nov 2007 10:12:36 -0000      1.5
@@ -22,6 +22,7 @@
    Evas_Object *close;
    
    Evas_List *cats;
+   Ecore_Event_Handler *mod_hdl;
 };
 
 struct _E_Configure_CB
@@ -57,6 +58,7 @@
 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 @@
    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_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 @@
 {
    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 @@
    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)
      {
@@ -492,4 +502,20 @@
    e_widget_ilist_thaw(eco->cat_list);
    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);
 }



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to