Enlightenment CVS committal

Author  : handyande
Project : misc
Module  : engage

Dir     : misc/engage/src


Modified Files:
        icon.c 


Log Message:
Now the status icons are themed like app icons

===================================================================
RCS file: /cvs/e/misc/engage/src/icon.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- icon.c      6 Sep 2006 21:23:45 -0000       1.46
+++ icon.c      10 Sep 2006 21:36:08 -0000      1.47
@@ -163,7 +163,7 @@
 od_icon_reload(OD_Icon * in)
 {
   const char     *icon_part = NULL;
-  char           *path, *winclass, *name, *icon_file, *tmp;
+  char           *path, *winclass, *name, *icon_file;
 
   Evas_Object    *icon = NULL;
   Evas_Object    *pic = NULL;
@@ -183,66 +183,61 @@
     pic = NULL;
   }
   
-  /* if the icon file is an eet we have a sysicon */
+  edje_object_file_set(icon, path, "Main");
+  pic = edje_object_add(evas_object_evas_get(icon));
   if (in->type == system_icon) {
-    if (path)
-      free(path);
-    path = strdup(icon_file);
-  }
-
-  if (edje_object_file_set(icon, path, "Main")) {
-#if 0
-    fprintf(stderr, "Trying to find part for %s\n", winclass);
-#endif
-    if ((icon_part = edje_object_data_get(icon, winclass))) {
-      pic = edje_object_add(evas_object_evas_get(icon));
-      if (edje_object_file_set(pic, path, icon_part) > 0) {
+    edje_object_file_set(pic, icon_file, "Main");
+  } else if ((icon_part = edje_object_data_get(icon, winclass))) {
+    pic = edje_object_add(evas_object_evas_get(icon));
+    if (edje_object_file_set(pic, path, icon_part) > 0) {
 #if 0
-        fprintf(stderr, "Found icon part for %s(%s)\n", name, icon_part);
+      fprintf(stderr, "Found icon part for %s(%s)\n", name, icon_part);
 #endif
-      } else if (edje_object_file_set(pic, path, "Unknown") > 0) {
+    } else if (edje_object_file_set(pic, path, "Unknown") > 0) {
 #if 0
-        fprintf(stderr, "Didn't Find icon part for %s\n", name);
+      fprintf(stderr, "Didn't Find icon part for %s\n", name);
 #endif
-      } else {
-        evas_object_del(pic);
-        pic = NULL;
-      }
-    } else {
-      pic = e_app_icon_add(evas_object_evas_get(icon), in->a);
-    }
-
-    if (!pic) {
-      pic = evas_object_image_add(evas);
-      evas_object_image_file_set(pic, icon_file, NULL);
-      evas_object_image_alpha_set(pic, 1);
-      evas_object_image_smooth_scale_set(pic, 1);
-      evas_object_pass_events_set(pic, 1);
-      evas_object_intercept_resize_callback_add(pic,
-                                                od_object_resize_intercept_cb,
-                                                NULL);
-    }
-
-    in->pic = pic;
-    evas_object_layer_set(pic, 100);
-    evas_object_move(pic, -50, -50);
-    evas_object_resize(pic, 32, 32);
-    evas_object_show(pic);
-    if (edje_object_part_exists(icon, "EngageIcon")) {
-      edje_object_part_swallow(icon, "EngageIcon", pic);
-      evas_object_pass_events_set(pic, 1);
     } else {
       evas_object_del(pic);
-      in->pic = NULL;
+      pic = NULL;
     }
-    if (edje_object_part_exists(icon, "EngageName")) {
-      edje_object_part_text_set(icon, "EngageName", name);
-    }
-    evas_object_layer_set(icon, 100);
-    evas_object_show(icon);
+  } else {
+    pic = e_app_icon_add(evas_object_evas_get(icon), in->a);
+  }
+  if (!pic) {
+    pic = evas_object_image_add(evas);
+    evas_object_image_file_set(pic, icon_file, NULL);
+    evas_object_image_alpha_set(pic, 1);
+    evas_object_image_smooth_scale_set(pic, 1);
+    evas_object_pass_events_set(pic, 1);
+    evas_object_intercept_resize_callback_add(pic,
+                                              od_object_resize_intercept_cb,
+                                              NULL);
+  }
+  free(path);
 
+  in->pic = pic;
+  evas_object_layer_set(pic, 100);
+  evas_object_move(pic, -50, -50);
+  evas_object_resize(pic, 32, 32);
+  evas_object_show(pic);
+  if (edje_object_part_exists(icon, "EngageIcon")) {
+    edje_object_part_swallow(icon, "EngageIcon", pic);
+    evas_object_pass_events_set(pic, 1);
+  } else {
+    evas_object_del(pic);
+    in->pic = NULL;
+  }
+  if (edje_object_part_exists(icon, "EngageName")) {
+    edje_object_part_text_set(icon, "EngageName", name);
+  }
+  evas_object_layer_set(icon, 100);
+  evas_object_show(icon);
+
+  if (in->type == system_icon) {
+    char *tmp;
     // set tmp to be the last thing in the path
-    tmp = path;
+    tmp = icon_file;
     while(*tmp)tmp++;
     while(*tmp != '/' && tmp != path)tmp--;
     if(*tmp == '/') tmp++;
@@ -250,7 +245,7 @@
       // hook up battery status if it's the battery icon
       Battery *bat = malloc(sizeof(Battery));
       memset(bat,0,sizeof(Battery));
-      bat->object = icon;
+      bat->object = pic;
       bat->battery_check_mode = CHECK_NONE;
       bat->battery_prev_drain = 1;
       bat->battery_prev_ac = -1;
@@ -258,11 +253,7 @@
       _battery_cb_check(bat);
       bat->battery_check_timer = ecore_timer_add(5.0, _battery_cb_check, bat);
     }
-  } else {
-    evas_object_del(icon);
-    in->icon = NULL;
   }
-  free(path);
 
   if (in->data.applnk.count > 0)
     od_icon_arrow_show(in);



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to