Enlightenment CVS committal

Author  : handyande
Project : misc
Module  : engage

Dir     : misc/engage/src


Modified Files:
        config.c engage.h icon.c 


Log Message:
Add theme listener to config, so examine engage, change theme -> save will update the 
screen :) :)
hmm, only prob is it does not re-grab applink icons, only minwin ones - ideas?
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/config.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- config.c    19 May 2004 08:51:43 -0000      1.23
+++ config.c    25 May 2004 15:01:43 -0000      1.24
@@ -24,6 +24,22 @@
   options.zoom = ecore_config_int_get(key);
 }
 
+theme_listener(const char *key, const Ecore_Config_Type type, const int tag,
+                  void *data)    
+{ 
+  char           *path;
+  Evas_List      *icons;
+  options.theme = ecore_config_theme_get(key);
+
+  path = ecore_config_theme_with_path_get(key);
+  
+  icons = dock.icons;
+  while (icons) {
+    od_icon_reload((OD_Icon *)icons->data);
+    icons = evas_list_next(icons);
+  }
+} 
+
 int
 od_config_init(void)
 {
@@ -85,6 +101,7 @@
   options.height = ecore_config_int_get("engage.options.height");
   options.engine = ecore_config_string_get("engage.options.engine");
   options.theme = ecore_config_theme_get("engage.options.theme");
+  ecore_config_listen("theme", "engage.options.theme", theme_listener, 0, NULL);
   options.mode = ecore_config_int_get("engage.options.mode");
   options.grab_min_icons =
     ecore_config_int_get("engage.options.grab_min_icons");
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/engage.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- engage.h    10 May 2004 11:06:41 -0000      1.13
+++ engage.h    25 May 2004 15:01:44 -0000      1.14
@@ -51,6 +51,8 @@
 OD_Icon        *od_icon_new_minwin(Ecore_X_Window win);
 
 void            od_icon_grab(OD_Icon * icon, Ecore_X_Window win);
+void            od_icon_reload(OD_Icon * in);
+
 void            od_icon_del(OD_Icon * od_icon);
 void            od_icon_arrow_show(OD_Icon * icon);
 void            od_icon_arrow_hide(OD_Icon * icon);
@@ -113,7 +115,7 @@
 struct _OD_Icon {
   Evas_Object    *icon, *pic, *tt_txt, *tt_shd, *arrow;
   unsigned        state;        // see above
-  char           *name;
+  char           *name, *icon_file, *winclass;
   double          x, y;         // relative to evas
   double          scale;
   double          start_time;
===================================================================
RCS file: /cvsroot/enlightenment/misc/engage/src/icon.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- icon.c      13 May 2004 23:19:55 -0000      1.28
+++ icon.c      25 May 2004 15:01:44 -0000      1.29
@@ -183,27 +183,22 @@
   evas_object_resize(o, w, h);
 }
 
-
-OD_Icon        *
-od_icon_new(const char *winclass, const char *name, const char *icon_file)
+void
+od_icon_reload(OD_Icon * in)
 {
   const char     *icon_part = NULL;
-  OD_Icon        *ret = NULL;
-  char           *path;
+  char           *path, *winclass, *name, *icon_file;
 
   Evas_Object    *icon = NULL;
   Evas_Object    *pic = NULL;
   Evas_Object    *tt_txt = NULL;
   Evas_Object    *tt_shd = NULL;
 
-  assert(winclass);
-  assert(name);
-  assert(icon_file);
-
-  ret = (OD_Icon *) malloc(sizeof(OD_Icon));
-  memset(ret, 0, sizeof(OD_Icon));
-  ret->name = strdup(name);
-  icon = ret->icon = edje_object_add(evas);
+  icon = in->icon;
+  winclass = in->winclass;
+  name = in->name;
+  icon_file = in->icon_file;
+  pic = in->pic;
 
   path = ecore_config_theme_with_path_from_name_get(options.theme);
   if (edje_object_file_set(icon, path, "Main") > 0) {
@@ -245,7 +240,8 @@
                                                 od_object_resize_intercept_cb,
                                                 NULL);
     }
-    ret->pic = pic;
+
+    in->pic = pic;
     evas_object_layer_set(pic, 100);
     evas_object_move(pic, -50, -50);
     evas_object_resize(pic, 32, 32);
@@ -254,13 +250,13 @@
       edje_object_part_swallow(icon, "EngageIcon", pic);
     } else {
       evas_object_del(pic);
-      ret->pic = NULL;
+      in->pic = NULL;
     }
     if (edje_object_part_exists(icon, "EngageName")) {
       edje_object_part_text_set(icon, "EngageName", name);
     } else {
-      tt_txt = ret->tt_txt = evas_object_text_add(evas);
-      tt_shd = ret->tt_shd = evas_object_text_add(evas);
+      tt_txt = in->tt_txt = evas_object_text_add(evas);
+      tt_shd = in->tt_shd = evas_object_text_add(evas);
       evas_object_text_font_set(tt_txt, options.tt_fa, options.tt_fs);
       evas_object_text_text_set(tt_txt, name);
       evas_object_color_set(tt_txt,
@@ -278,19 +274,44 @@
       evas_object_layer_set(tt_shd, 199);
     }
     edje_object_signal_callback_add(icon, "engage,app,*", "*",
-                                    od_icon_edje_app_cb, ret);
+                                    od_icon_edje_app_cb, in);
     edje_object_signal_callback_add(icon, "engage,window,minimize*", "*",
-                                    od_icon_edje_win_minimize_cb, ret);
+                                    od_icon_edje_win_minimize_cb, in);
     edje_object_signal_callback_add(icon, "engage,window,raise*", "*",
-                                    od_icon_edje_win_raise_cb, ret);
+                                    od_icon_edje_win_raise_cb, in);
     evas_object_layer_set(icon, 100);
     evas_object_show(icon);
   } else {
     evas_object_del(icon);
-    ret->icon = NULL;
+    in->icon = NULL;
   }
   free(path);
 
+#ifdef HAVE_IMLIB
+  if (options.grab_min_icons != 0)
+    od_icon_grab(in, in->data.minwin.window);
+#endif
+
+}
+
+OD_Icon        *
+od_icon_new(const char *winclass, const char *name, const char *icon_file)
+{
+  OD_Icon        *ret = NULL;
+
+  assert(winclass);
+  assert(name);
+  assert(icon_file);
+
+  ret = (OD_Icon *) malloc(sizeof(OD_Icon));
+  memset(ret, 0, sizeof(OD_Icon));
+  ret->winclass = strdup(winclass);
+  ret->name = strdup(name);
+  ret->icon_file = strdup(icon_file);
+  ret->icon = edje_object_add(evas);
+
+  od_icon_reload(ret);
+
   return ret;
 }
 




-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to