Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : apps/e_utils

Dir     : e17/apps/e_utils/src/bin/e17genmenu/src/bin


Modified Files:
        menus.c parse.c parse.h 


Log Message:
Second major milestone reached.  Now it will actually populate the 
favourites menu with menus and items that match what the fdo menu system 
says.  It is still not doing all the merging of other menu files, that's 
being left until last to keep the amount of data generated down to a dull 
roar during early testing.

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/menus.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- menus.c     17 Feb 2006 14:11:07 -0000      1.9
+++ menus.c     19 Feb 2006 07:28:13 -0000      1.10
@@ -120,7 +120,7 @@
                   if (!strcmp(file, "kalarm.desktop"))
                      return;
                   /* Parse Desktop File */
-                  parse_desktop_file(strdup(path));
+                  parse_desktop_file(strdup(path), NULL);
                }
              else if (strstr(DEBIAN_DIRS, dir) != NULL)
                {
@@ -150,8 +150,8 @@
                path = (char *) list->elements[element + 1].element;
                pool  = (Ecore_Hash *) list->elements[element + 2].element;
                apps  = (Ecore_Hash *) list->elements[element + 4].element;
-printf("MAKING MENU - %s \t\t%s\n", path, name);
-               ecore_hash_for_each_node(apps, _menu_dump_each_hash_node, path);
+               printf("MAKING MENU - %s \t\t%s\n", path, name);
+               ecore_hash_for_each_node(apps, _menu_dump_each_hash_node, 
&path[11]);
            }
       }
    return 0;
@@ -166,6 +166,6 @@
    path = (char *) user_data;
    node = (Ecore_Hash_Node *) value;
    file = (char *) node->value;
-   printf("CREATING %s\n", file);
-   parse_desktop_file(strdup(file));
+   printf("MAKING EAP %s -> %s\n", path, file);
+   parse_desktop_file(strdup(file), path);
 }
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/parse.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- parse.c     18 Feb 2006 02:12:25 -0000      1.12
+++ parse.c     19 Feb 2006 07:28:13 -0000      1.13
@@ -120,19 +120,19 @@
 }
 
 void
-parse_desktop_file(char *path)
+parse_desktop_file(char *app, char *menu_path)
 {
    char *home, *eap_name;
    int overwrite;
    G_Eap *eap;
-   Ecore_Hash *desktop;
+   Desktop *desktop;
 
    home = get_home();
    overwrite = get_overwrite();
-   eap_name = get_eap_name(path);
+   eap_name = get_eap_name(app);
 
 #ifdef DEBUG
-   fprintf(stderr, "Parsing Desktop File %s\n", path);
+   fprintf(stderr, "Parsing Desktop File %s\n", app);
 #endif
 
    eap = calloc(1, sizeof(G_Eap));
@@ -140,44 +140,38 @@
    if (eap_name)
       free(eap_name);
 
-   desktop = parse_ini_file(path);
+   desktop = parse_desktop_ini_file(app);
    if (desktop)
       {
-         Ecore_Hash *group;
+         char *value;
 
-         group = (Ecore_Hash *) ecore_hash_get(desktop, "Desktop Entry");
-        if (group)
-           {
-              char *value;
-
-               value = (char *) ecore_hash_get(group, "Name");
-              if (value)   eap->name = strdup(value);
-               value = (char *) ecore_hash_get(group, "GenericName");
-              if (value)   eap->generic = strdup(value);
-               value = (char *) ecore_hash_get(group, "Comment");
-              if (value)   eap->comment = strdup(value);
-               value = (char *) ecore_hash_get(group, "Type");
-              if (value)   eap->type = strdup(value);
-               value = (char *) ecore_hash_get(group, "Categories");
-              if (value)   eap->categories = strdup(value);
-               value = (char *) ecore_hash_get(group, "Exec");
-              if (value)   eap->exec = strdup(value);
-               value = (char *) ecore_hash_get(group, "Icon");
-              if (value)   eap->icon = strdup(value);
-               value = (char *) ecore_hash_get(group, "X-KDE-StartupNotify");
-              if (value)   eap->startup = (!strcmp(value, "true")) ? "1" : "0";
-               value = (char *) ecore_hash_get(group, "StartupNotify");
-              if (value)   eap->startup = (!strcmp(value, "true")) ? "1" : "0";
-            }
+         value = (char *) ecore_hash_get(desktop->group, "Name");
+        if (value)   eap->name = strdup(value);
+         value = (char *) ecore_hash_get(desktop->group, "GenericName");
+        if (value)   eap->generic = strdup(value);
+         value = (char *) ecore_hash_get(desktop->group, "Comment");
+        if (value)   eap->comment = strdup(value);
+         value = (char *) ecore_hash_get(desktop->group, "Type");
+        if (value)   eap->type = strdup(value);
+         value = (char *) ecore_hash_get(desktop->group, "Categories");
+        if (value)   eap->categories = strdup(value);
+         value = (char *) ecore_hash_get(desktop->group, "Exec");
+        if (value)   eap->exec = strdup(value);
+         value = (char *) ecore_hash_get(desktop->group, "Icon");
+        if (value)   eap->icon = strdup(value);
+         value = (char *) ecore_hash_get(desktop->group, 
"X-KDE-StartupNotify");
+        if (value)   eap->startup = (!strcmp(value, "true")) ? "1" : "0";
+         value = (char *) ecore_hash_get(desktop->group, "StartupNotify");
+        if (value)   eap->startup = (!strcmp(value, "true")) ? "1" : "0";
       }
 
    /* Check If We Process */
    if (!eap->type)
-      process_file(path, eap);
+      process_file(app, menu_path, eap);
    if (eap->type)
      {
         if (!strcmp(eap->type, "Application"))
-           process_file(path, eap);
+           process_file(app, menu_path, eap);
      }
 
    /* Write Out Mapping File ? */
@@ -189,9 +183,10 @@
 
         FILE *f;
         char buff[MAX_PATH];
+        char map_path[MAX_PATH];
 
-        snprintf(path, sizeof(path), "%s/MAPPING", home);
-        f = fopen(path, "a+");
+        snprintf(map_path, sizeof(map_path), "%s/MAPPING", home);
+        f = fopen(map_path, "a+");
         if (!f)
           {
              fprintf(stderr, "ERROR: Cannot Open Mapping File\n");
@@ -206,7 +201,7 @@
 }
 
 void
-process_file(char *file, G_Eap *eap)
+process_file(char *file, char *menu_path, G_Eap *eap)
 {
    char *home, *window_class, *exec, *category, *icon;
    char path[MAX_PATH], order_path[MAX_PATH], buffer[MAX_PATH];
@@ -227,18 +222,27 @@
 
    if ((ecore_file_exists(path)) && (!overwrite))
      {
-        category = NULL;
-        if (eap->categories != NULL)
-          {
-             category = find_category(eap->categories);
-             if (category != NULL)
-               {
-                  snprintf(order_path, sizeof(order_path), "%s" EFAVDIR "/%s",
-                           home, category);
-                  modify_order(order_path, eap->eap_name);
-               }
-          }
-        return;
+        if (menu_path != NULL)
+           {
+              snprintf(order_path, sizeof(order_path), "%s" EFAVDIR "/%s",
+                     home, menu_path);
+              modify_order(order_path, eap->eap_name);
+          }
+       else
+          {
+              category = NULL;
+              if (eap->categories != NULL)
+                {
+                   category = find_category(eap->categories);
+                   if (category != NULL)
+                     {
+                        snprintf(order_path, sizeof(order_path), "%s" EFAVDIR 
"/%s",
+                                 home, category);
+                        modify_order(order_path, eap->eap_name);
+                     }
+                }
+              return;
+          }
      }
 
    if (eap->icon != NULL)
@@ -278,18 +282,28 @@
       write_eap(path, "app/window/class", window_class);
 
    snprintf(buffer, sizeof(buffer),
-            "enlightenment_eapp_cache_gen %s/.e/e/applications/all -r",
+            "enlightenment_eapp_cache_gen %s/.e/e/applications/all -r > 
/dev/null 2>&1",
             getenv("HOME"));
    system(buffer);
 
    category = NULL;
-   if (eap->categories != NULL)
+   if (menu_path != NULL)
+      {
+             snprintf(buffer, sizeof(buffer),
+                      "enlightenment_eapp_cache_gen 
%s/.e/e/applications/favorite/%s -r /dev/null 2>&1",
+                      getenv("HOME"), menu_path);
+             system(buffer);
+             snprintf(order_path, sizeof(order_path), "%s" EFAVDIR "/%s", home,
+                      menu_path);
+             modify_order(order_path, eap->eap_name);
+      }
+   else if (eap->categories != NULL)
      {
         category = find_category(eap->categories);
         if (category != NULL)
           {
              snprintf(buffer, sizeof(buffer),
-                      "enlightenment_eapp_cache_gen 
%s/.e/e/applications/favorite/%s -r",
+                      "enlightenment_eapp_cache_gen 
%s/.e/e/applications/favorite/%s -r /dev/null 2>&1",
                       getenv("HOME"), category);
              system(buffer);
              snprintf(order_path, sizeof(order_path), "%s" EFAVDIR "/%s", home,
@@ -372,7 +386,7 @@
 
    fclose(f);
 
-   process_file(file, eap);
+   process_file(file, NULL, eap);
    free(eap);
 }
 
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/parse.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- parse.h     18 Feb 2006 02:12:25 -0000      1.5
+++ parse.h     19 Feb 2006 07:28:13 -0000      1.6
@@ -23,9 +23,9 @@
 char *get_t(char *icon);
 char *parse_exec(char *exec);
 char *parse_buffer(char *b, char *section);
-void parse_desktop_file(char *path);
+void parse_desktop_file(char *app, char *menu_path);
 void parse_debian_file(char *file);
-void process_file(char *file, G_Eap *eap);
+void process_file(char *file, char *menu_path, G_Eap *eap);
 void parse_ini_init(void);
 Ecore_Hash *parse_ini_file(char *file);
 Desktop *parse_desktop_ini_file(char *file);




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to