Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_apps.c e_apps.h e_int_menus.c e_menu.c e_menu.h 


Log Message:
Beginning to drag all the basic "show this icon for this app" code
together in one place to make it easy to keep it consistant.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -3 -r1.159 -r1.160
--- e_apps.c    31 Aug 2006 12:11:20 -0000      1.159
+++ e_apps.c    1 Sep 2006 09:01:52 -0000       1.160
@@ -1617,8 +1617,34 @@
               e_icon_file_set(o, a->icon_path);
               e_icon_fill_inside_set(o, 1);
             }
+           /* FIXME: if we still haven't found an icon, feed icon_class into 
the FDO lookup process. */
       }
    return o;
+}
+
+/* Search order? -
+ * 
+ * fixed path to icon
+ * an .edje icon in ~/.e/e/icons
+ * icon_class in theme
+ * icon from a->path in theme
+ * FDO search
+ * FDO search for icon_class
+ */
+
+EAPI void
+e_app_icon_add_to_menu_item(E_Menu_Item *mi, E_App *a)
+{
+   if (!e_util_menu_item_edje_icon_list_set(mi, a->icon_class))
+      {
+         /* e_menu_item_icon_edje_set() just tucks away the params, the actual 
call to edje_object_file_set() happens later. */
+         /* e_menu_item_icon_file_set() just tucks away the params, the actual 
call to e_icon_add() happens later. */
+         e_menu_item_icon_edje_set(mi, a->path, "icon");
+         if (a->icon_path)   /* If that fails, then this might be an FDO icon. 
*/
+           e_menu_item_icon_file_set(mi, a->icon_path);
+         /* FIXME: if we still haven't found an icon, feed icon_class into the 
FDO lookup process. */
+      }
+   return;
 }
 
 
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- e_apps.h    31 Aug 2006 02:27:05 -0000      1.37
+++ e_apps.h    1 Sep 2006 09:01:52 -0000       1.38
@@ -136,6 +136,7 @@
 EAPI void         e_app_fields_empty                      (E_App *a);
 EAPI int          e_app_valid_exe_get                     (E_App *a);
 EAPI Evas_Object *e_app_icon_add                          (Evas *evas, E_App 
*a);
+EAPI void         e_app_icon_add_to_menu_item             (E_Menu_Item *mi, 
E_App *a);
 
 #endif
 #endif
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_menus.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -3 -r1.155 -r1.156
--- e_int_menus.c       31 Aug 2006 05:01:48 -0000      1.155
+++ e_int_menus.c       1 Sep 2006 09:01:52 -0000       1.156
@@ -467,12 +467,7 @@
                  e_menu_item_label_set(mi, label);
                  if (a->exe)
                    {
-                      if (!((a->icon_class) && 
-                            (e_util_menu_item_edje_icon_list_set(mi, 
a->icon_class))))
-                         {     
-                            e_menu_item_icon_edje_set(mi, a->path, "icon");
-                            if (a->icon_path) e_menu_item_icon_path_set(mi, 
a->icon_path);
-                         }
+                       e_app_icon_add_to_menu_item(mi, a);
                       e_menu_item_callback_set(mi, _e_int_menus_apps_run, a);
                       e_menu_item_drag_callback_set(mi, 
_e_int_menus_apps_drag, a);
                       app_count++;
@@ -481,6 +476,7 @@
                    {
                       char buf[4096];
                       
+                       /* FIXME: .directory.eaps are obsolete, but have yet to 
be replaced by FDO stuff. */
                       snprintf(buf, sizeof(buf), "%s/.directory.eap", a->path);
                       if (!((a->icon_class) && 
                             (e_util_menu_item_edje_icon_list_set(mi, 
a->icon_class))))
@@ -946,14 +942,7 @@
        e_menu_item_callback_set(mi, _e_int_menus_lost_clients_item_cb, bd);
        a = bd->app;
        if (a)
-         {
-            if (!((a->icon_class) && 
-                  (e_util_menu_item_edje_icon_list_set(mi, a->icon_class))))
-               {
-                  e_menu_item_icon_edje_set(mi, a->path, "icon");
-                  if (a->icon_path) e_menu_item_icon_path_set(mi, 
a->icon_path);
-               }
-         }
+             e_app_icon_add_to_menu_item(mi, a);
      }
    e_object_free_attach_func_set(E_OBJECT(m), 
_e_int_menus_lost_clients_free_hook);
    e_object_data_set(E_OBJECT(m), borders);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_menu.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -3 -r1.63 -r1.64
--- e_menu.c    23 Aug 2006 03:39:02 -0000      1.63
+++ e_menu.c    1 Sep 2006 09:01:52 -0000       1.64
@@ -552,21 +552,6 @@
 }
 
 EAPI void
-e_menu_item_icon_path_set(E_Menu_Item *mi, const char *icon)
-{
-   E_OBJECT_CHECK(mi);
-   E_OBJECT_TYPE_CHECK(mi, E_MENU_ITEM_TYPE);
-   if (((mi->icon_path) && (icon) && (!strcmp(icon, mi->icon_path))) ||
-       ((!mi->icon_path) && (!icon))) 
-     return;
-   if (mi->icon_path) evas_stringshare_del(mi->icon_path);
-   mi->icon_path = NULL;
-   if (icon) mi->icon_path = evas_stringshare_add(icon);
-   mi->changed = 1;
-   mi->menu->changed = 1;
-}
-
-EAPI void
 e_menu_item_icon_file_set(E_Menu_Item *mi, const char *icon)
 {
    E_OBJECT_CHECK(mi);
@@ -1068,7 +1053,6 @@
    mi->menu->items = evas_list_remove(mi->menu->items, mi);
    if (mi->icon) evas_stringshare_del(mi->icon);
    if (mi->icon_key) evas_stringshare_del(mi->icon_key);
-   if (mi->icon_path) evas_stringshare_del(mi->icon_path);
    if (mi->label) evas_stringshare_del(mi->label);
    free(mi);
 }
@@ -1223,16 +1207,9 @@
             
             if (mi->icon)
               {
-                 /* Try a the usual suspects first. */
-                 if (!mi->icon_key)
-                   {
-                      o = e_icon_add(mi->menu->evas);
-                      mi->icon_object = o;
-                      e_icon_file_set(o, mi->icon);
-                      e_icon_fill_inside_set(o, 1);
-                      e_icon_size_get(mi->icon_object, &icon_w, &icon_h);
-                   }
-                 else
+                 /* This is done this way to match up with how e_app_icon_add 
does it. */
+                  mi->icon_object = NULL;   /* Just coz I'm paranoid, may not 
be needed. */
+                 if (mi->icon_key)
                    {
                       Evas_Coord iww, ihh;
 
@@ -1245,14 +1222,11 @@
                             icon_h = ihh;
                          }
                    }
-
-                 if ((!mi->icon_object) && (mi->icon_path))   /* If that 
fails, then this might be an FDO icon. */
+                 if (!mi->icon_object)
                    {
-                      /* Free the aborted object first. */
-                       if (mi->icon_object) evas_object_del(mi->icon_object);
                       o = e_icon_add(mi->menu->evas);
                       mi->icon_object = o;
-                      e_icon_file_set(o, mi->icon_path);
+                      e_icon_file_set(o, mi->icon);
                       e_icon_fill_inside_set(o, 1);
                       e_icon_size_get(mi->icon_object, &icon_w, &icon_h);
                    }
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_menu.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- e_menu.h    22 Aug 2006 08:38:24 -0000      1.22
+++ e_menu.h    1 Sep 2006 09:01:52 -0000       1.23
@@ -84,7 +84,6 @@
    E_Menu        *menu;
    const char    *icon;
    const char    *icon_key;
-   const char    *icon_path;
    const char    *label;
    E_Menu        *submenu;
    
@@ -184,7 +183,6 @@
 EAPI E_Menu_Item *e_menu_item_new(E_Menu *m);
 EAPI E_Menu_Item *e_menu_item_nth(E_Menu *m, int n);
 EAPI int          e_menu_item_num_get(E_Menu_Item *mi);
-EAPI void         e_menu_item_icon_path_set(E_Menu_Item *mi, const char *icon);
 EAPI void         e_menu_item_icon_file_set(E_Menu_Item *mi, const char *icon);
 EAPI void         e_menu_item_icon_edje_set(E_Menu_Item *mi, const char *icon, 
const char *key);
 EAPI void         e_menu_item_label_set(E_Menu_Item *mi, const char *label);



-------------------------------------------------------------------------
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