Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : apps/e_utils

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


Modified Files:
        Makefile.am eaps.c fdo_menus.c main.c parse.c parse.h 
Added Files:
        fdo_desktops.c fdo_desktops.h fdo_icons.c fdo_icons.h 
Removed Files:
        category.c category.h 


Log Message:
Re arrange the code to allow easy seperation of the fdo bits.

===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- Makefile.am 7 Mar 2006 21:58:24 -0000       1.2
+++ Makefile.am 9 Aug 2006 23:37:54 -0000       1.3
@@ -15,12 +15,12 @@
 
 bin_PROGRAMS = e17genmenu
 
-e17genmenu_SOURCES = main.c global.c menus.c parse.c eaps.c icons.c \
-       category.c order.c sort.c fdo_menus.c fdo_paths.c dumb_tree.c \
+e17genmenu_SOURCES = main.c global.c menus.c parse.c eaps.c fdo_icons.c \
+       order.c sort.c fdo_desktops.c fdo_menus.c fdo_paths.c dumb_tree.c \
        xmlame.c
 
-noinst_HEADERS = global.h menus.h parse.h eaps.h icons.h \
-       category.h order.h sort.h fdo_menus.h fdo_paths.h \
+noinst_HEADERS = global.h menus.h parse.h eaps.h fdo_icons.h \
+       order.h sort.h fdo_desktops.h fdo_menus.h fdo_paths.h \
        dumb_tree.h xmlame.h
 
 e17genmenu_LDADD = @EET_LIBS@ @ECORE_LIBS@ @ENGRAVE_LIBS@
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/eaps.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- eaps.c      6 Aug 2006 02:07:33 -0000       1.7
+++ eaps.c      9 Aug 2006 23:37:54 -0000       1.8
@@ -1,7 +1,6 @@
 #include <ctype.h>
 #include "global.h"
 #include "config.h"
-#include "icons.h"
 #include "eaps.h"
 #include "parse.h"
 
@@ -10,6 +9,63 @@
 extern int not_found_count;
 
 static void _write_eap(Eet_File *ef, char *section, char *value);
+
+#define APPLICATIONICON 
PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_applications.png"
+#define COREICON 
PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_applications.png"
+#define EDITORICON PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_editors.png"
+#define EDUTAINMENTICON 
PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_edutainment.png"
+#define GAMESICON PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_games.png"
+#define GRAPHICSICON 
PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_graphics.png"
+#define INTERNETICON 
PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_network.png"
+#define MULTIMEDIAICON 
PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_multimedia.png"
+#define OFFICEICON 
PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_wordprocessing.png"
+#define PROGRAMMINGICON 
PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_development.png"
+#define SETTINGSICON 
PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_settings.png"
+#define SYSTEMICON PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_system.png"
+#define TOYSICON PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_toys.png"
+#define UTILITYICON 
PACKAGE_DATA_DIR"/data/e17genmenu/icons/package_utilities.png"
+static char *set_icon(char *token);
+
+
+static char *
+set_icon(char *token)
+{
+#ifdef DEBUG
+   fprintf(stderr, "Setting Icon: %s\n", token);
+#endif
+   if (strstr(token, "Core") != NULL)
+      return COREICON;
+   if (strstr(token, "Development") != NULL)
+      return PROGRAMMINGICON;
+   if (strstr(token, "Editors") != NULL)
+      return EDITORICON;
+   if (strstr(token, "Edutainment") != NULL)
+      return EDUTAINMENTICON;
+   if (strstr(token, "Game") != NULL)
+      return GAMESICON;
+   if (strstr(token, "Graphics") != NULL)
+      return GRAPHICSICON;
+   if (strstr(token, "Internet") != NULL)
+      return INTERNETICON;
+   if (strstr(token, "Office") != NULL)
+      return OFFICEICON;
+   if (strstr(token, "Programming") != NULL)
+      return PROGRAMMINGICON;
+   if (strstr(token, "Toys") != NULL)
+      return TOYSICON;
+   if (strstr(token, "Utilities") != NULL)
+      return UTILITYICON;
+   if ((strstr(token, "Accessories") != NULL) || (strstr(token, 
"Applications") != NULL))
+      return APPLICATIONICON;
+   if ((strstr(token, "Multimedia") != NULL) || (strstr(token, "Sound_Video") 
!= NULL))
+      return MULTIMEDIAICON;
+   if ((strstr(token, "Preferences") != NULL) || (strstr(token, "Settings") != 
NULL))
+      return SETTINGSICON;
+   if (strstr(token, "System") != NULL)
+      return SYSTEMICON;
+   return token;
+}
+
 
 /* Create a .directory.eap for this dir */
 void
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/fdo_menus.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- fdo_menus.c 26 Apr 2006 23:36:04 -0000      1.6
+++ fdo_menus.c 9 Aug 2006 23:37:54 -0000       1.7
@@ -18,8 +18,8 @@
 #include <Ecore.h>
 
 #include "global.h"
+#include "fdo_desktops.h"
 #include "fdo_paths.h"
-#include "parse.h"
 #include "xmlame.h"
 
 //#define DEBUG 1
@@ -81,7 +81,7 @@
 static int _fdo_menus_generate(const void *data, Dumb_Tree * tree, int 
element, int level);
 static void _fdo_menus_inherit_apps(void *value, void *user_data);
 static void _fdo_menus_select_app(void *value, void *user_data);
-static int _fdo_menus_apply_rules(struct _fdo_menus_generate_data 
*generate_data, Dumb_Tree * rule, char *key, Desktop * desktop);
+static int _fdo_menus_apply_rules(struct _fdo_menus_generate_data 
*generate_data, Dumb_Tree * rule, char *key, Fdo_Desktop * desktop);
 
 Dumb_Tree *
 fdo_menus_get(char *file, Dumb_Tree * merge_stack, int level)
@@ -1166,7 +1166,7 @@
 _fdo_menus_select_app(void *value, void *user_data)
 {
    Ecore_Hash_Node *node;
-   Desktop *desktop;
+   Fdo_Desktop *desktop;
    struct _fdo_menus_generate_data *generate_data;
    char *key, *app;
 
@@ -1175,7 +1175,7 @@
    key = (char *)node->key;
    app = (char *)node->value;
 
-   desktop = parse_desktop_ini_file(app);
+   desktop = fdo_desktops_parse_desktop_file(app);
 
    if ((generate_data->unallocated) && (desktop->allocated))
       return;
@@ -1201,7 +1201,7 @@
 }
 
 static int
-_fdo_menus_apply_rules(struct _fdo_menus_generate_data *generate_data, 
Dumb_Tree * rule, char *key, Desktop * desktop)
+_fdo_menus_apply_rules(struct _fdo_menus_generate_data *generate_data, 
Dumb_Tree * rule, char *key, Fdo_Desktop * desktop)
 {
    char type = 'O';
    int result = FALSE;
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/main.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- main.c      26 Apr 2006 08:24:48 -0000      1.6
+++ main.c      9 Aug 2006 23:37:54 -0000       1.7
@@ -2,8 +2,8 @@
 #include "config.h"
 #include "menus.h"
 #include "parse.h"
-#include "icons.h"
 #include "sort.h"
+#include "fdo_desktops.h"
 #include "fdo_menus.h"
 #include "fdo_paths.h"
 #include "xmlame.h"
@@ -142,7 +142,7 @@
    begin = ecore_time_get();
    fdo_paths_init();
    paths = ecore_time_get() - begin;
-   parse_ini_init();
+   fdo_desktops_init();
 
 #ifdef DEBUG
    /* You can iterate through the various path lists as needed. */
@@ -219,7 +219,7 @@
    }
 #endif
 
-   parse_ini_shutdown();
+   fdo_desktops_shutdown();
    fdo_paths_shutdown();
 
    /* Shutdown */
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/parse.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- parse.c     5 Jul 2006 02:54:42 -0000       1.9
+++ parse.c     9 Aug 2006 23:37:54 -0000       1.10
@@ -1,18 +1,21 @@
 #include "global.h"
 #include "config.h"
-#include "category.h"
 #include "eaps.h"
-#include "icons.h"
+#include "fdo_desktops.h"
+#include "fdo_icons.h"
 #include "order.h"
 #include "parse.h"
 
 extern int reject_count, not_over_count;
 
-static void _parse_desktop_del(Desktop * desktop);
+static char *_parse_buffer(char *b, char *section);
+static void _parse_process_file(char *file, char *menu_path, G_Eap *eap);
+char *_parse_find_category(char *category);
+
 
 #if 0
-char *
-get_t(char *icon)
+static char *
+_parse_get_t(char *icon)
 {
    char *ptr;
    char *d;
@@ -41,8 +44,9 @@
 }
 #endif
 
-char *
-parse_buffer(char *b, char *section)
+
+static char *
+_parse_buffer(char *b, char *section)
 {
    char *oldtoken, *token, *substr, *substr2, *str_ret;
 
@@ -85,7 +89,7 @@
 
    if (strrchr(t, '"'))
      {
-        d = get_t(t);
+        d = _parse_get_t(t);
         snprintf(p, sizeof(p), "%s", d);
      }
    else
@@ -101,12 +105,13 @@
    return str_ret;
 }
 
+
 void
 parse_desktop_file(char *app, char *menu_path)
 {
    char *home;
    G_Eap *eap;
-   Desktop *desktop;
+   Fdo_Desktop *desktop;
 
    home = get_home();
 
@@ -117,50 +122,38 @@
    eap = calloc(1, sizeof(G_Eap));
    eap->eap_name = get_eap_name(app);
 
-   desktop = parse_desktop_ini_file(app);
-   if ((desktop) && (desktop->group))
+   desktop = fdo_desktops_parse_desktop_file(app);
+   if (desktop)
      {
-        char *value;
-
-        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";
-        value = (char *)ecore_hash_get(desktop->group, "StartupWMClass");
-        if (value)
-           eap->window_class = strdup(value);
+        if (desktop->name)
+           eap->name = strdup(desktop->name);
+        if (desktop->generic)
+           eap->generic = strdup(desktop->generic);
+        if (desktop->comment)
+           eap->comment = strdup(desktop->comment);
+        if (desktop->type)
+           eap->type = strdup(desktop->type);
+        if (desktop->categories)
+           eap->categories = strdup(desktop->categories);
+        if (desktop->exec)
+           eap->exec = strdup(desktop->exec);
+        if (desktop->icon)
+           eap->icon = strdup(desktop->icon);
+        if (desktop->icon_path)
+          eap->icon_path = strdup(desktop->icon_path);
+        if (desktop->startup)
+           eap->startup = strdup(desktop->startup);
+        if (desktop->window_class)
+           eap->window_class = strdup(desktop->window_class);
      }
 
    /* Check If We Process */
    if (!eap->type)
-      process_file(app, menu_path, eap);
+      _parse_process_file(app, menu_path, eap);
    if (eap->type)
      {
         if (!strcmp(eap->type, "Application"))
-           process_file(app, menu_path, eap);
+           _parse_process_file(app, menu_path, eap);
      }
 
    /* Write Out Mapping File ? */
@@ -190,8 +183,9 @@
    free(eap);
 }
 
-void
-process_file(char *file, char *menu_path, G_Eap *eap)
+
+static void
+_parse_process_file(char *file, char *menu_path, G_Eap *eap)
 {
    char *home, *category;
    char path[MAX_PATH], order_path[MAX_PATH];
@@ -209,9 +203,6 @@
 
    snprintf(path, sizeof(path), "%s" EAPPDIR "/%s", home, eap->eap_name);
 
-   if (eap->icon != NULL)
-      eap->icon_path = find_icon(eap->icon);
-
    if ((ecore_file_exists(path)) && (!overwrite))
         not_over_count++;
    else
@@ -225,7 +216,7 @@
      }
    else if (eap->categories != NULL)
      {
-        category = find_category(eap->categories);
+        category = _parse_find_category(eap->categories);
         if (category != NULL)
           {
              snprintf(order_path, sizeof(order_path), "%s" EFAVDIR "/Generated 
Menus/%s", home, category);
@@ -235,6 +226,7 @@
    return;
 }
 
+
 void
 parse_debian_file(char *file)
 {
@@ -275,38 +267,41 @@
            buffer[length - 1] = '\0';
         if (strstr(buffer, "title"))
           {
-             name = parse_buffer(buffer, "title=");
+             name = _parse_buffer(buffer, "title=");
              eap->name = strdup(name);
           }
         if (strstr(buffer, "longtitle"))
           {
-             generic = parse_buffer(buffer, "longtitle=");
+             generic = _parse_buffer(buffer, "longtitle=");
              eap->generic = strdup(generic);
           }
         if (strstr(buffer, "description"))
           {
-             comment = parse_buffer(buffer, "description=");
+             comment = _parse_buffer(buffer, "description=");
              eap->comment = strdup(comment);
           }
         if (strstr(buffer, "section"))
           {
-             category = parse_buffer(buffer, "section=");
+             category = _parse_buffer(buffer, "section=");
              eap->categories = strdup(category);
           }
         if (strstr(buffer, "command"))
           {
-             exec = parse_buffer(buffer, "command=");
+             exec = _parse_buffer(buffer, "command=");
              eap->exec = strdup(exec);
           }
         if (strstr(buffer, "icon"))
           {
-             icon = parse_buffer(buffer, "icon128x128");
-             if (!icon) icon = parse_buffer(buffer, "icon96x96");
-             if (!icon) icon = parse_buffer(buffer, "icon48x48");
-             if (!icon) icon = parse_buffer(buffer, "icon32x32");
-             if (!icon) icon = parse_buffer(buffer, "icon");
+             icon = _parse_buffer(buffer, "icon128x128");
+             if (!icon) icon = _parse_buffer(buffer, "icon96x96");
+             if (!icon) icon = _parse_buffer(buffer, "icon48x48");
+             if (!icon) icon = _parse_buffer(buffer, "icon32x32");
+             if (!icon) icon = _parse_buffer(buffer, "icon");
              if (icon)
+            {
                 eap->icon = strdup(icon);
+               eap->icon_path = find_icon(eap->icon);
+            }
              else
                 eap->icon = NULL;
           }
@@ -315,194 +310,88 @@
 
    fclose(f);
 
-   process_file(file, NULL, eap);
+   _parse_process_file(file, NULL, eap);
    free(eap);
 }
 
-void
-parse_ini_init()
-{
-   if (!ini_file_cache)
-     {
-        ini_file_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
-        if (ini_file_cache)
-          {
-             ecore_hash_set_free_key(ini_file_cache, free);
-             ecore_hash_set_free_value(ini_file_cache, (Ecore_Free_Cb) 
ecore_hash_destroy);
-          }
-     }
-   if (!desktop_cache)
-     {
-        desktop_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
-        if (desktop_cache)
-          {
-             ecore_hash_set_free_key(desktop_cache, free);
-             ecore_hash_set_free_value(desktop_cache, (Ecore_Free_Cb) 
_parse_desktop_del);
-          }
-     }
-}
 
-Ecore_Hash *
-parse_ini_file(char *file)
+#define CATEGORIES 
"Accessibility:Accessories:Amusement:AudioVideo:Core:Development:Education:Game:Graphics:Multimedia:Network:Office:Programming:Settings:System:TextEditor:Utility:Video"
+
+char *
+_parse_find_category(char *category)
 {
-   Ecore_Hash *result;
+   char *token, *cat;
 
-   result = ecore_hash_new(ecore_str_hash, ecore_str_compare);
-   if (result)
+   cat = NULL;
+   token = strtok(strdup(CATEGORIES), ":");
+   while (token)
      {
-        FILE *f;
-        char buffer[MAX_PATH];
-        Ecore_Hash *current = NULL;
-
-        f = fopen(file, "r");
-        if (!f)
-          {
-             fprintf(stderr, "ERROR: Cannot Open File %s\n", file);
-             ecore_hash_destroy(result);
-             return NULL;
-          }
-        ecore_hash_set_free_key(result, free);
-        ecore_hash_set_free_value(result, (Ecore_Free_Cb) ecore_hash_destroy);
-        *buffer = '\0';
-#ifdef DEBUG
-        fprintf(stdout, "PARSING INI %s\n", file);
-#endif
-        while (fgets(buffer, sizeof(buffer), f) != NULL)
+        /* Check If this token is in supplied $t */
+        if (strstr(category, token) != NULL)
           {
-             char *c;
-             char *key;
-             char *value;
-
-             c = buffer;
-             /* Strip preceeding blanks. */
-             while (((*c == ' ') || (*c == '\t')) && (*c != '\n') && (*c != 
'\0'))
-                c++;
-             /* Skip blank lines and comments */
-             if ((*c == '\0') || (*c == '\n') || (*c == '#'))
-                continue;
-             if (*c == '[')     /* New group. */
-               {
-                  key = c + 1;
-                  while ((*c != ']') && (*c != '\n') && (*c != '\0'))
-                     c++;
-                  *c++ = '\0';
-                  current = ecore_hash_new(ecore_str_hash, ecore_str_compare);
-                  if (current)
-                    {
-                       ecore_hash_set_free_key(current, free);
-                       ecore_hash_set_free_value(current, free);
-                       ecore_hash_set(result, strdup(key), current);
-#ifdef DEBUG
-                       fprintf(stdout, "  GROUP [%s]\n", key);
-#endif
-                    }
+             if (strstr(token, "Development") != NULL)
+               {
+                  cat = "Programming";
                }
-             else if (current)  /* key=value pair of current group. */
+             else if (strstr(token, "Game") != NULL)
                {
-                  key = c;
-                  /* Find trailing blanks or =. */
-                  while ((*c != '=') && (*c != ' ') && (*c != '\t') && (*c != 
'\n') && (*c != '\0'))
-                     c++;
-                  if (*c != '=')        /* Find equals. */
-                    {
-                       *c++ = '\0';
-                       while ((*c != '=') && (*c != '\n') && (*c != '\0'))
-                          c++;
-                    }
-                  if (*c == '=')        /* Equals found. */
-                    {
-                       *c++ = '\0';
-                       /* Strip preceeding blanks. */
-                       while (((*c == ' ') || (*c == '\t')) && (*c != '\n') && 
(*c != '\0'))
-                          c++;
-                       value = c;
-                       /* Find end. */
-                       while ((*c != '\n') && (*c != '\0'))
-                          c++;
-                       *c++ = '\0';
-                       /* FIXME: should strip space at end, then unescape 
value. */
-                       ecore_hash_set(current, strdup(key), strdup(value));
-#ifdef DEBUG
-                       fprintf(stdout, "    %s=%s\n", key, value);
-#endif
-                    }
+                  cat = "Games";
                }
-
-          }
-        buffer[0] = (char)0;
-
-        fclose(f);
-        ecore_hash_set(ini_file_cache, strdup(file), result);
-     }
-   return result;
-}
-
-Desktop *
-parse_desktop_ini_file(char *file)
-{
-   Desktop *result;
-
-   result = (Desktop *) ecore_hash_get(desktop_cache, file);
-   if (!result)
-     {
-        result = calloc(1, sizeof(Desktop));
-        if (result)
-          {
-             result->data = parse_ini_file(file);
-             if (result->data)
-               {
-                  result->group = (Ecore_Hash *) ecore_hash_get(result->data, 
"Desktop Entry");
-                  if (!result->group)
-                     result->group = (Ecore_Hash *) 
ecore_hash_get(result->data, "KDE Desktop Entry");
-                  if (result->group)
-                    {
-                       char *temp;
-
-                       temp = (char *)ecore_hash_get(result->group, 
"Categories");
-                       if (temp)
-                          result->Categories = dumb_tree_from_paths(temp);
-                       temp = (char *)ecore_hash_get(result->group, 
"OnlyShowIn");
-                       if (temp)
-                          result->OnlyShowIn = dumb_tree_from_paths(temp);
-                       temp = (char *)ecore_hash_get(result->group, 
"NotShowIn");
-                       if (temp)
-                          result->NotShowIn = dumb_tree_from_paths(temp);
-                    }
-                  ecore_hash_set(desktop_cache, strdup(file), result);
+             else if ((strstr(token, "AudioVideo") != NULL) ||
+                      (strstr(token, "Sound") != NULL) || (strstr(token, 
"Video") != NULL) || (strstr(token, "Multimedia") != NULL))
+               {
+                  cat = "Multimedia";
+               }
+             else if (strstr(token, "Net") != NULL)
+               {
+                  cat = "Internet";
+               }
+             else if (strstr(token, "Education") != NULL)
+               {
+                  cat = "Edutainment";
+               }
+             else if (strstr(token, "Amusement") != NULL)
+               {
+                  cat = "Toys";
+               }
+             else if (strstr(token, "System") != NULL)
+               {
+                  cat = "System";
+               }
+             else if ((strstr(token, "Shells") != NULL) || (strstr(token, 
"Utility") != NULL) || (strstr(token, "Tools") != NULL))
+               {
+                  cat = "Utilities";
+               }
+             else if ((strstr(token, "Viewers") != NULL) || (strstr(token, 
"Editors") != NULL) || (strstr(token, "Text") != NULL))
+               {
+                  cat = "Editors";
+               }
+             else if (strstr(token, "Graphics") != NULL)
+               {
+                  cat = "Graphics";
+               }
+             else if ((strstr(token, "WindowManagers") != NULL) || 
(strstr(token, "Core") != NULL))
+               {
+                  cat = "Core";
+               }
+             else if ((strstr(token, "Settings") != NULL) || (strstr(token, 
"Accessibility") != NULL))
+               {
+                  cat = "Settings";
+               }
+             else if (strstr(token, "Office") != NULL)
+               {
+                  cat = "Office";
                }
              else
                {
-                  free(result);
-                  result = NULL;
+                  cat = "Core";
                }
           }
+        token = strtok(NULL, ":");
      }
-   return result;
-}
-
-static void
-_parse_desktop_del(Desktop * desktop)
-{
-   if (desktop->NotShowIn)
-      dumb_tree_del(desktop->NotShowIn);
-   if (desktop->OnlyShowIn)
-      dumb_tree_del(desktop->OnlyShowIn);
-   if (desktop->Categories)
-      dumb_tree_del(desktop->Categories);
-   free(desktop);
-}
-
-void
-parse_ini_shutdown()
-{
-   if (ini_file_cache)
-     {
-        ecore_hash_destroy(ini_file_cache);
-        ini_file_cache = NULL;
-     }
-   if (desktop_cache)
-     {
-        ecore_hash_destroy(desktop_cache);
-        desktop_cache = NULL;
-     }
+   if (token)
+      free(token);
+   if (!cat)
+      cat = "Core";
+   return strdup(cat);
 }
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/parse.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- parse.h     29 Apr 2006 06:05:51 -0000      1.2
+++ parse.h     9 Aug 2006 23:37:54 -0000       1.3
@@ -7,26 +7,8 @@
 #include <Ecore_Data.h>
 #include "dumb_tree.h"
 
-typedef struct _Desktop Desktop;
-struct _Desktop
-{
-   Ecore_Hash *data, *group;
-   Dumb_Tree *Categories, *OnlyShowIn, *NotShowIn;      /* FIXME: Better to 
have these as hashes. */
-   int NoDisplay, Hidden, allocated;
-};
-
-Ecore_Hash *ini_file_cache;
-Ecore_Hash *desktop_cache;
-
 /* Function Prototypes */
-char *get_t(char *icon);
-char *parse_buffer(char *b, char *section);
 void parse_desktop_file(char *app, char *menu_path);
 void parse_debian_file(char *file);
-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);
-void parse_ini_shutdown(void);
 
 #endif



-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to