Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e.h e_apps.c e_apps.h e_main.c 


Log Message:
.desktop files supported in .order files now.  Full path to .desktop file
required at the moment.

Not fully completed yet.  No icons, probably not fully integrated into
the current cache mechanism.  Some parts may not be entirely correct.

I gotta get some sleep soon, so I'm committing it now, and I'll double
check by updating everything after it's all checked in.

Works for me. (tm)  B-)


===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -3 -r1.50 -r1.51
--- e.h 18 Jun 2006 02:07:14 -0000      1.50
+++ e.h 14 Aug 2006 21:56:13 -0000      1.51
@@ -58,6 +58,7 @@
 #include <Ecore_Job.h>
 #include <Ecore_Txt.h>
 #include <Ecore_Config.h>
+#include <Ecore_Desktop.h>
 #include <Ecore_File.h>
 #include <Ecore_X_Atoms.h>
 #include <Ecore_X_Cursor.h>
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -3 -r1.147 -r1.148
--- e_apps.c    14 Aug 2006 15:22:44 -0000      1.147
+++ e_apps.c    14 Aug 2006 21:56:13 -0000      1.148
@@ -390,7 +390,10 @@
 
             a2 = NULL;
 
-            snprintf(buf, sizeof(buf), "%s/%s", a->path, s);
+            if (s[0] == '/')
+               snprintf(buf, sizeof(buf), "%s", s);
+            else
+               snprintf(buf, sizeof(buf), "%s/%s", a->path, s);
             if (ecore_file_exists(buf))
               {
                  a2 = e_app_new(buf, scan_subdirs);
@@ -408,7 +411,10 @@
                  pl = _e_apps_repositories;
                  while ((!a2) && (pl))
                    {
-                      snprintf(buf, sizeof(buf), "%s/%s", (char *)pl->data, s);
+                      if (s[0] == '/')
+                         snprintf(buf, sizeof(buf), "%s", s);
+                      else
+                         snprintf(buf, sizeof(buf), "%s/%s", (char *)pl->data, 
s);
                       a2 = e_app_new(buf, scan_subdirs);
                       pl = pl->next;
                    }
@@ -588,6 +594,7 @@
        
        file = l->data;
        if (!_e_app_is_eapp(file)) continue;
+// FIXME: onefang, check this for full path compliance.
         snprintf(buf, sizeof(buf), "%s/%s", _e_apps_path_all,
                 ecore_file_get_file(file));
        if (!ecore_file_download(file, buf, NULL, NULL, NULL)) continue;
@@ -647,6 +654,7 @@
    if (!strncmp(add->path, _e_apps_path_trash, strlen(_e_apps_path_trash)))
      {
        /* Move to all */
+// FIXME: onefang, check this for full path compliance.
        snprintf(buf, sizeof(buf), "%s/%s", _e_apps_path_all, 
ecore_file_get_file(add->path));
        if (ecore_file_exists(buf))
          snprintf(buf, sizeof(buf), "%s/%s", before->parent->path, 
ecore_file_get_file(add->path));
@@ -673,6 +681,7 @@
    if (!strncmp(add->path, _e_apps_path_trash, strlen(_e_apps_path_trash)))
      {
        /* Move to all */
+// FIXME: onefang, check this for full path compliance.
        snprintf(buf, sizeof(buf), "%s/%s", _e_apps_path_all, 
ecore_file_get_file(add->path));
        if (ecore_file_exists(buf))
          snprintf(buf, sizeof(buf), "%s/%s", parent->path, 
ecore_file_get_file(add->path));
@@ -784,6 +793,7 @@
 
    a->parent->subapps = evas_list_remove(a->parent->subapps, a);
    /* Check if this app is in a repository or in the parents dir */
+// FIXME: onefang, check this for full path compliance.
    snprintf(buf, sizeof(buf), "%s/%s", a->parent->path, 
ecore_file_get_file(a->path));
    if (ecore_file_exists(buf))
      {
@@ -1130,15 +1140,11 @@
 }
 
 
-
-
-
 EAPI void
 e_app_fields_fill(E_App *a, const char *path)
 {
-   Eet_File *ef;
    char *str, *v;
-   const char *lang;
+   const char *lang, *ext;
    int size;
    
    /* get our current language */
@@ -1150,50 +1156,86 @@
        lang = NULL;
      }
    if (!path) path = a->path;
-   ef = eet_open(path, EET_FILE_MODE_READ);
-   if (!ef) return;
 
-#define STORE(member) \
+   ext = strchr(path, '.');
+   if ((ext) && (strcmp(ext, ".desktop") == 0))
+   {   /* It's a .desktop file. */
+      Ecore_Desktop *desktop;
+
+      desktop = ecore_desktop_get(path, lang);
+      if (!desktop) return;
+      if (desktop)
+        {
+          if (desktop->name)  a->name = evas_stringshare_add(desktop->name);
+          if (desktop->generic)  a->generic = 
evas_stringshare_add(desktop->generic);
+          if (desktop->comment)  a->comment = 
evas_stringshare_add(desktop->comment);
+
+          if (desktop->exec)  a->exe = evas_stringshare_add(desktop->exec);
+          if (desktop->icon_class)  a->icon_class = 
evas_stringshare_add(desktop->icon_class);
+          if (desktop->window_class)  a->win_class = 
evas_stringshare_add(desktop->window_class);
+          if (desktop->startup)
+              a->startup_notify = *(desktop->startup);
+
+//        if (desktop->icon_path)  a->icon_path = 
evas_stringshare_add(desktop->icon_path);
+//        if (desktop->type)  a->type = evas_stringshare_add(desktop->type);
+//        if (desktop->categories)  a->categories = 
evas_stringshare_add(desktop->categories);
+      }
+   }
+   else
+   {   /* Must be an .eap file. */
+      Eet_File *ef;
+
+/* FIXME: This entire process seems inefficient, each of the strings gets 
duped then freed three times.
+ * On the other hand, raster wants .eaps to go away, so no big deal.  B-)
+ */
+
+#define STORE_N_FREE(member) \
    if (v) \
-     { \
-       str = alloca(size + 1); \
-       memcpy(str, v, size); \
-       str[size] = 0; \
-       a->member = evas_stringshare_add(str); \
-       free(v); \
-     }
-   v = _e_app_localized_val_get(ef, lang, "app/info/name", &size);
-   STORE(name);
-   v = _e_app_localized_val_get(ef, lang, "app/info/generic", &size);
-   STORE(generic);
-   v = _e_app_localized_val_get(ef, lang, "app/info/comment", &size);
-   STORE(comment);
-
-   v = eet_read(ef, "app/info/exe", &size);
-   STORE(exe);
-   v = eet_read(ef, "app/icon/class", &size);
-   STORE(icon_class);
-   v = eet_read(ef, "app/window/name", &size);
-   STORE(win_name);
-   v = eet_read(ef, "app/window/class", &size);
-   STORE(win_class);
-   v = eet_read(ef, "app/window/title", &size);
-   STORE(win_title);
-   v = eet_read(ef, "app/window/role", &size);
-   STORE(win_role);
-   v = eet_read(ef, "app/info/startup_notify", &size);
-   if (v)
-     {
-       a->startup_notify = *v;
-       free(v);
-     }
-   v = eet_read(ef, "app/info/wait_exit", &size);
-   if (v)
-     {
-       a->wait_exit = *v;
-       free(v);
-     }
-   eet_close(ef);
+      { \
+         str = alloca(size + 1); \
+        memcpy(str, (v), size); \
+        str[size] = 0; \
+        a->member = evas_stringshare_add(str); \
+        free(v); \
+      }
+
+      ef = eet_open(path, EET_FILE_MODE_READ);
+      if (!ef) return;
+
+      v = _e_app_localized_val_get(ef, lang, "app/info/name", &size);
+      STORE_N_FREE(name);
+      v = _e_app_localized_val_get(ef, lang, "app/info/generic", &size);
+      STORE_N_FREE(generic);
+      v = _e_app_localized_val_get(ef, lang, "app/info/comment", &size);
+      STORE_N_FREE(comment);
+
+      v = eet_read(ef, "app/info/exe", &size);
+      STORE_N_FREE(exe);
+      v = eet_read(ef, "app/icon/class", &size);
+      STORE_N_FREE(icon_class);
+      v = eet_read(ef, "app/window/name", &size);
+      STORE_N_FREE(win_name);
+      v = eet_read(ef, "app/window/class", &size);
+      STORE_N_FREE(win_class);
+      v = eet_read(ef, "app/window/title", &size);
+      STORE_N_FREE(win_title);
+      v = eet_read(ef, "app/window/role", &size);
+      STORE_N_FREE(win_role);
+      v = eet_read(ef, "app/info/startup_notify", &size);
+      if (v)
+        {
+          a->startup_notify = *v;
+          free(v);
+        }
+      v = eet_read(ef, "app/info/wait_exit", &size);
+      if (v)
+        {
+          a->wait_exit = *v;
+          free(v);
+        }
+      eet_close(ef);
+   }
+
 }
 
 static char *
@@ -1432,7 +1474,7 @@
        ecore_list_goto_first(files);
        while ((file = ecore_list_next(files)))
          {
-            if (file[0] != '.')
+            if (ecore_file_get_file(file)[0] != '.')
               ecore_list_append(files2, strdup(file));
          }
        ecore_list_destroy(files);
@@ -1655,7 +1697,7 @@
        
        a2 = l->data;
        if ((a2->deleted) || ((a2->orig) && (a2->orig->deleted))) continue;
-       if (!strcmp(ecore_file_get_file(a2->path), file)) return a2;
+       if (!strcmp(ecore_file_get_file(a2->path), ecore_file_get_file(file))) 
return a2;
      }
    return NULL;
 }
@@ -1890,7 +1932,10 @@
             else
               {
                  /* If we still haven't found it, it is new! */
-                 snprintf(buf, sizeof(buf), "%s/%s", app->path, s);
+                 if (s[0] == '/')
+                    snprintf(buf, sizeof(buf), "%s", s);
+                 else
+                    snprintf(buf, sizeof(buf), "%s/%s", app->path, s);
                  a2 = e_app_new(buf, 1);
                  if (a2)
                    {
@@ -1912,7 +1957,10 @@
                       pl = _e_apps_repositories;
                       while ((!a2) && (pl))
                         {
-                           snprintf(buf, sizeof(buf), "%s/%s", (char 
*)pl->data, s);
+                           if (s[0] == '/')
+                              snprintf(buf, sizeof(buf), "%s", s);
+                           else
+                              snprintf(buf, sizeof(buf), "%s/%s", (char 
*)pl->data, s);
                            a2 = e_app_new(buf, 1);
                            pl = pl->next;
                         }
@@ -2005,7 +2053,7 @@
      return 0;
 
    p++;
-   if ((strcasecmp(p, "eap")))
+   if ((strcasecmp(p, "eap")) && (strcasecmp(p, "desktop")))
      return 0;
 
    return 1;
@@ -2258,7 +2306,10 @@
 //     printf("Cache scan finish.\n");
        return 0;
      }
-   snprintf(buf, sizeof(buf), "%s/%s", sc->path, s);
+   if (s[0] == '/')
+      snprintf(buf, sizeof(buf), "%s", s);
+   else
+      snprintf(buf, sizeof(buf), "%s/%s", sc->path, s);
    is_dir = ecore_file_is_dir(buf);
    if (_e_app_is_eapp(s) || is_dir)
      {
@@ -2312,7 +2363,10 @@
        E_App *a2;
        
        ac2 = l->data;
-       snprintf(buf, sizeof(buf), "%s/%s", path, ac2->file);
+       if (ac2->file[0] == '/')
+          snprintf(buf, sizeof(buf), "%s", ac2->file);
+       else
+          snprintf(buf, sizeof(buf), "%s/%s", path, ac2->file);
        if ((ac2->is_dir) && (scan_subdirs))
          {
             a2 = e_app_new(buf, scan_subdirs);
@@ -2347,7 +2401,10 @@
                  a2 = NULL;
                  while ((!a2) && (pl))
                    {
-                      snprintf(buf, sizeof(buf), "%s/%s", (char *)pl->data, 
ac2->file);
+                      if (ac2->file[0] == '/')
+                         snprintf(buf, sizeof(buf), "%s", ac2->file);
+                      else
+                         snprintf(buf, sizeof(buf), "%s/%s", (char *)pl->data, 
ac2->file);
                       a2 = e_app_new(buf, scan_subdirs);
                       pl = pl->next;
                    }
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- e_apps.h    20 Jul 2006 11:19:08 -0000      1.33
+++ e_apps.h    14 Aug 2006 21:56:13 -0000      1.34
@@ -38,6 +38,7 @@
    const char         *exe; /* command to execute, NULL if directory */
    
    const char         *path; /* path to .eet containing icons etc. etc. */
+//   const char         *icon_path; /* path to icon file, in case it is 
different from path. */
 
    const char         *win_name; /* window name */
    const char         *win_class; /* window class */
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_main.c,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -3 -r1.174 -r1.175
--- e_main.c    12 Aug 2006 13:26:25 -0000      1.174
+++ e_main.c    14 Aug 2006 21:56:13 -0000      1.175
@@ -371,6 +371,16 @@
        _e_main_shutdown(-1);
      }
    _e_main_shutdown_push(ecore_ipc_shutdown);
+
+   /* init FDO desktop */
+   if (!ecore_desktop_init())
+     {
+       e_error_message_show(_("Enlightenment cannot initialize the FDO desktop 
system.\n"
+                              "Perhaps you are out of memory?"));
+       _e_main_shutdown(-1);
+     }
+   _e_main_shutdown_push(ecore_desktop_shutdown);
+
    /* init the evas wrapper */
    if (!ecore_evas_init())
      { 



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