Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_apps.c e_apps.h 


Log Message:
Check if the icon theme is different when searching for icons.  Keep
track of changes to the icon path in readiness for some cachin'.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -3 -r1.198 -r1.199
--- e_apps.c    22 Sep 2006 19:55:11 -0000      1.198
+++ e_apps.c    25 Sep 2006 14:17:42 -0000      1.199
@@ -1270,6 +1270,7 @@
           a->icon_time = desktop->icon_time;
            a->startup_notify = desktop->startup;
            a->wait_exit = desktop->wait_exit;
+           a->dirty_icon = 0;
 
 //        if (desktop->type)  a->type = evas_stringshare_add(desktop->type);
 //        if (desktop->categories)  a->categories = 
evas_stringshare_add(desktop->categories);
@@ -1427,6 +1428,7 @@
 //               desktop.categories = a->categories;
 
                ecore_desktop_save(desktop);
+               a->dirty_icon = 0;
               if (created)
                  E_FREE(desktop);
            }
@@ -1611,6 +1613,7 @@
    a->win_class = NULL;
    a->win_title = NULL;
    a->win_role = NULL;
+   a->dirty_icon = 0;
 }
 
 EAPI Ecore_List *
@@ -1742,15 +1745,28 @@
 e_app_icon_add(Evas *evas, E_App *a)
 {
    Evas_Object *o = NULL;
+   int theme_match = 0;
 
 #if DEBUG
 printf("e_app_icon_add(%s)   %s   %s   %s\n", a->path, a->icon_class, 
e_config->icon_theme, a->icon_path);
 #endif
-   if ((a->icon_path) && (a->icon_path[0] != 0))
+
+   /* First check to see if the icon theme is different. */
+   if ((e_config->icon_theme) && (a->icon_theme))
+     {
+        if (strcmp(e_config->icon_theme, a->icon_theme) == 0)
+          theme_match = 1;
+     }
+   else if ((e_config->icon_theme == NULL) && (a->icon_theme == NULL))
+        theme_match = 1;
+
+   /* Then check if we already know the icon path. */
+   if ((theme_match) && (a->icon_path) && (a->icon_path[0] != 0))
      o = _e_app_icon_path_add(evas, a);
    else
      {
        o = edje_object_add(evas);
+       /* Check the theme for icons. */
        if (!e_util_edje_icon_list_set(o, a->icon_class))
          {
             if (edje_object_file_set(o, a->path, "icon"))
@@ -1765,7 +1781,14 @@
                  v = (char *)ecore_desktop_icon_find(a->icon_class, NULL, 
e_config->icon_theme);
                  if (v)
                    {
+                       if (a->icon_path) evas_stringshare_del(a->icon_path);
                       a->icon_path = evas_stringshare_add(v);
+                      if (e_config->icon_theme)
+                        {
+                            if (a->icon_theme) 
evas_stringshare_del(a->icon_theme);
+                           a->icon_theme = 
evas_stringshare_add(e_config->icon_theme);
+                        }
+                      a->dirty_icon = 1;
                       free(v);
                    }
               }
@@ -1793,6 +1816,8 @@
 EAPI void
 e_app_icon_add_to_menu_item(E_Menu_Item *mi, E_App *a)
 {
+   int theme_match = 0;
+
    mi->app = a;
    /* 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. */
@@ -1800,17 +1825,28 @@
 #if DEBUG
 printf("e_app_icon_add_to_menu_item(%s)   %s   %s   %s\n", a->path, 
a->icon_class, e_config->icon_theme, a->icon_path);
 #endif
-   if ((a->icon_path) && (a->icon_path[0] != 0))
+   /* First check to see if the icon theme is different. */
+   if ((e_config->icon_theme) && (a->icon_theme))
+     {
+        if (strcmp(e_config->icon_theme, a->icon_theme) == 0)
+          theme_match = 1;
+     }
+   else if ((e_config->icon_theme == NULL) && (a->icon_theme == NULL))
+        theme_match = 1;
+
+   /* Then check if we already know the icon path. */
+   if ((theme_match) && (a->icon_path) && (a->icon_path[0] != 0))
       _e_app_icon_path_add_to_menu_item(mi, a);
    else
       {
+       /* Check the theme for icons. */
          if (!e_util_menu_item_edje_icon_list_set(mi, a->icon_class))
            {
                if (edje_file_group_exists(a->path, "icon"))
                  {
                      e_menu_item_icon_edje_set(mi, a->path, "icon");
                  }
-               else if ((a->icon_class))
+               else if ((a->icon_class))   /* If that fails, then this might 
be an FDO icon. */
                   {
                      char *v;
 
@@ -1818,7 +1854,14 @@
                     v = (char *) ecore_desktop_icon_find(a->icon_class, NULL, 
e_config->icon_theme);
                     if (v)
                        {
-                          a->icon_path = evas_stringshare_add(v);
+                           if (a->icon_path) 
evas_stringshare_del(a->icon_path);
+                          a->icon_path = evas_stringshare_add(v);
+                          if (e_config->icon_theme)
+                            {
+                                if (a->icon_theme) 
evas_stringshare_del(a->icon_theme);
+                               a->icon_theme = 
evas_stringshare_add(e_config->icon_theme);
+                            }
+                          a->dirty_icon = 1;
                           free(v);
                        }
                   }
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- e_apps.h    22 Sep 2006 14:56:41 -0000      1.43
+++ e_apps.h    25 Sep 2006 14:17:42 -0000      1.44
@@ -68,6 +68,8 @@
 
    unsigned char       deleted : 1; /* this app's file is deleted from disk */
 
+   unsigned char       dirty_icon : 1; /* this app's icon has been found, and 
the on disk cache needs to be updated. */
+
    /* Actually calling this st_mtime causes compile issues, must be some 
strange macros at work. */
    time_t              mtime;           /* For checking if the cache is valid. 
*/
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to