Enlightenment CVS committal

Author  : englebass
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_int_config_modules.c e_module.c 


Log Message:
Although modules use .desktop files, they are not E_Apps.
Use Efreet_Desktop directly on the .desktop files.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_int_config_modules.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- e_int_config_modules.c      28 Dec 2006 14:15:10 -0000      1.47
+++ e_int_config_modules.c      24 Mar 2007 09:27:40 -0000      1.48
@@ -29,9 +29,9 @@
 
 struct _CFModule
 {
-   char *name;
-   char *path;
-   int state;
+   char           *name;
+   Efreet_Desktop *desktop;
+   int             state;
 };
 
 struct _E_Config_Dialog_Data
@@ -157,7 +157,6 @@
         m = l->data;
         cfdata->modules = evas_list_remove_list(cfdata->modules, l);
         E_FREE(m->name);
-        E_FREE(m->path);
         E_FREE(m);
      }
    E_FREE(cfdata->modname);
@@ -347,7 +346,7 @@
 
    m1 = data1;
    m2 = data2;
-   return (strcmp((const char*)m1->name, (const char*)m2->name));
+   return (strcmp(m1->name, m2->name));
 }
 
 static void 
@@ -430,18 +429,14 @@
    Evas_List *l;
    Ecore_List *dirs = NULL;
 
-   if (cfdata->modules) 
+   while ((l = cfdata->modules))
      {
-       while ((l = cfdata->modules))
-         {
-            CFModule *m;
+       CFModule *m;
 
-            m = l->data;
-            cfdata->modules = evas_list_remove_list(cfdata->modules, l);
-            E_FREE(m->name);
-            E_FREE(m->path);
-            E_FREE(m);
-         }
+       m = l->data;
+       cfdata->modules = evas_list_remove_list(cfdata->modules, l);
+       E_FREE(m->name);
+       E_FREE(m);
      }
 
    for (l = e_path_dir_list_get(path_modules); l; l = l->next)
@@ -459,19 +454,20 @@
                  ecore_list_goto_first(dirs);
                  while ((mod = ecore_list_next(dirs)))
                    {
+                      Efreet_Desktop *ef;
                       CFModule *m;
-                      char buff[4096];
+                      char buf[4096];
+
+                      snprintf(buf, sizeof(buf), "%s/%s/module.desktop", 
epd->dir, mod);
+                      if (!ecore_file_exists(buf)) continue;
+                      ef = efreet_desktop_get(buf);
+                      if (!ef) continue;
 
                       m = E_NEW(CFModule, 1);
-                      if (m)
-                        {
-                           snprintf(buff, sizeof(buff), "%s/%s", epd->dir, 
-                                    mod);
-                           m->name = strdup(mod);
-                           m->path = strdup(buff);
-                           cfdata->modules = 
-                             evas_list_append(cfdata->modules, m);
-                        }
+                      m->desktop = ef;
+                      m->name = strdup(mod);
+                      cfdata->modules = 
+                         evas_list_append(cfdata->modules, m);
                    }
                  ecore_list_destroy(dirs);
               }
@@ -506,29 +502,34 @@
    for (l = cfdata->modules; l; l = l->next)
      {
        CFModule *cm;
-       Evas_Object *oc;
 
        cm = l->data;
        if (cm)
          {
-            E_App *a;
-            
+            Evas_Object *oc = NULL;
+
             cm->state = MOD_UNLOADED;
             m = e_module_find(cm->name);
-            if (m)
-              {
-                 if (m->enabled) cm->state = MOD_ENABLED;
-              }
-            snprintf(buf, sizeof(buf), "%s/module.desktop", cm->path);
-            
-            a = e_app_new(buf, 1);
-            if (a)
+            if ((m) && (m->enabled)) cm->state = MOD_ENABLED;
+
+            if (cm->desktop->icon)
               {
-                  oc = e_app_icon_add(a, cfdata->evas);
-                 e_widget_ilist_append(cfdata->gui.list, oc, a->name, 
-                                       NULL, NULL, cm->name);
-                 e_object_unref(E_OBJECT(a));
+                 const char *icon;
+
+                 icon = efreet_icon_path_find(e_config->icon_theme, 
cm->desktop->icon, "64x64");
+                 if (!icon)
+                   {
+                      char *path;
+                      path = ecore_file_get_dir(cm->desktop->orig_path);
+                      snprintf(buf, sizeof(buf), "%s/%s.edj",
+                               path, cm->desktop->icon);
+                      icon = buf;
+                      free(path);
+                   }
+                 oc = e_util_icon_add(icon, cfdata->evas);
               }
+            e_widget_ilist_append(cfdata->gui.list, oc, cm->desktop->name, 
+                                  NULL, NULL, cm->name);
          }
      }
 
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_module.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -3 -r1.74 -r1.75
--- e_module.c  24 Mar 2007 07:02:09 -0000      1.74
+++ e_module.c  24 Mar 2007 09:27:40 -0000      1.75
@@ -359,7 +359,8 @@
 {
    E_Dialog *dia;
    E_Border *bd;
-   char eap[4096];
+   char buf[PATH_MAX];
+   const char *icon = NULL;
 
    dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", 
"_module_dialog");
    if (!dia) return;
@@ -367,20 +368,24 @@
    e_dialog_title_set(dia, title);
    if (m)
      {
-       snprintf(eap, sizeof(eap), "%s/module.desktop", e_module_dir_get(m));
-       if (ecore_file_exists(eap))
-         {
-            E_App *app;
+       Efreet_Desktop *desktop;
+
+       snprintf(buf, sizeof(buf), "%s/module.desktop", e_module_dir_get(m));
 
-            app = e_app_new(eap, 0);
-            if (app)
+       desktop = efreet_desktop_get(buf);
+       if ((desktop) && (desktop->icon))
+         {
+            icon = efreet_icon_path_find(e_config->icon_theme, desktop->icon, 
"64x64");
+            if (!icon)
               {
-                 dia->icon_object = e_app_icon_add(app, 
e_win_evas_get(dia->win));
-                 edje_extern_object_min_size_set(dia->icon_object, 64, 64);
-                 edje_object_part_swallow(dia->bg_object, "e.swallow.icon", 
dia->icon_object);
-                 evas_object_show(dia->icon_object);
-                 e_object_unref(E_OBJECT(app));
+                 snprintf(buf, sizeof(buf), "%s/%s.edj",
+                       e_module_dir_get(m), desktop->icon);
+                 icon = buf;
               }
+            dia->icon_object = e_util_icon_add(icon, e_win_evas_get(dia->win));
+            edje_extern_object_min_size_set(dia->icon_object, 64, 64);
+            edje_object_part_swallow(dia->bg_object, "e.swallow.icon", 
dia->icon_object);
+            evas_object_show(dia->icon_object);
          }
      }
    else
@@ -394,7 +399,7 @@
    if (!m) return;
    bd = dia->win->border;
    if (!bd) return;
-   bd->internal_icon = evas_stringshare_add(eap);
+   bd->internal_icon = evas_stringshare_add(icon);
 }
 
 /* local subsystem functions */



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