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 global.c global.h main.c menus.c parse.c 
        sort.c 
Removed Files:
        fdo_desktops.c fdo_desktops.h fdo_icons.c fdo_icons.h 
        fdo_menus.c fdo_menus.h fdo_paths.c fdo_paths.h 


Log Message:
Updated to use the new ecore_desktop.

===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- Makefile.am 9 Aug 2006 23:37:54 -0000       1.3
+++ Makefile.am 11 Aug 2006 13:50:04 -0000      1.4
@@ -15,13 +15,8 @@
 
 bin_PROGRAMS = e17genmenu
 
-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
+e17genmenu_SOURCES = main.c global.c menus.c parse.c eaps.c order.c sort.c
 
-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
+noinst_HEADERS = global.h menus.h parse.h eaps.h order.h sort.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.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- eaps.c      9 Aug 2006 23:37:54 -0000       1.8
+++ eaps.c      11 Aug 2006 13:50:04 -0000      1.9
@@ -4,7 +4,7 @@
 #include "eaps.h"
 #include "parse.h"
 
-#define DEBUG 1
+//#define DEBUG 1
 
 extern int not_found_count;
 
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/global.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- global.c    29 Apr 2006 06:05:51 -0000      1.3
+++ global.c    11 Aug 2006 13:50:04 -0000      1.4
@@ -3,27 +3,6 @@
 
 /* Functions */
 char *
-get_home()
-{
-   char *d;
-   int length;
-   char home[MAX_PATH];
-
-   /* Get Home Dir, check for trailing '/', strip it */
-   snprintf(home, sizeof(home), "%s", getenv("HOME"));
-   d = strrchr(home, '/');
-   if (d)
-     {
-        if (strlen(d) == 1)
-          {
-             if (home[(length = strlen(home) - 1)] == '/')
-                home[length] = '\0';
-          }
-     }
-   return strdup(home);
-}
-
-char *
 get_desktop_dir()
 {
    int i, argc;
@@ -177,7 +156,7 @@
    Ecore_List *eaps = NULL;
 
    /* Check That Dir All Exists */
-   snprintf(path, sizeof(path), "%s" EAPPDIR, get_home());
+   snprintf(path, sizeof(path), "%s" EAPPDIR, ecore_desktop_get_home());
    if (!ecore_file_exists(path))
      {
         fprintf(stderr, "ERROR: %s doesn't exist. Where are the eapps ?\n", 
path);
@@ -200,7 +179,7 @@
 #ifdef DEBUG
              fprintf(stderr, "Backing Up %s\n", tmp);
 #endif
-             snprintf(dest, sizeof(dest), "%s/EapBackup", get_home());
+             snprintf(dest, sizeof(dest), "%s/EapBackup", 
ecore_desktop_get_home());
              if (!ecore_file_exists(dest))
                {
                   if (!ecore_file_mkdir(dest))
@@ -208,7 +187,7 @@
                }
 
              /* Copy The File */
-             snprintf(dest, sizeof(dest), "%s/EapBackup/%s", get_home(), file);
+             snprintf(dest, sizeof(dest), "%s/EapBackup/%s", 
ecore_desktop_get_home(), file);
              result = ecore_file_cp(tmp, dest);
              if (!result)
                 break;
@@ -227,7 +206,7 @@
    if ((!eap->icon) || (!eap->name) || (!eap->exec) || (!eap->window_class))
       return;
 
-   snprintf(path, sizeof(path), "%s/MAPPING", get_home());
+   snprintf(path, sizeof(path), "%s/MAPPING", ecore_desktop_get_home());
    f = fopen(path, "a+");
    if (!f)
      {
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/global.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- global.h    29 Apr 2006 06:05:51 -0000      1.4
+++ global.h    11 Aug 2006 13:50:04 -0000      1.5
@@ -6,9 +6,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <Ecore.h>
+#include <Ecore_Desktop.h>
 #include <Ecore_File.h>
 
-#define MAX_PATH 4096
 #define EFAVDIR "/.e/e/applications/favorite"
 #define EAPPDIR "/.e/e/applications/all"
 #define DEFAULTICON PACKAGE_DATA_DIR"/data/e17genmenu/icons/e.png"
@@ -32,7 +32,6 @@
 };
 
 /* Function Prototypes */
-char *get_home(void);
 char *get_desktop_dir(void);
 int get_overwrite(void);
 int get_fdo(void);
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/main.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- main.c      10 Aug 2006 07:37:42 -0000      1.8
+++ main.c      11 Aug 2006 13:50:04 -0000      1.9
@@ -3,10 +3,6 @@
 #include "menus.h"
 #include "parse.h"
 #include "sort.h"
-#include "fdo_desktops.h"
-#include "fdo_menus.h"
-#include "fdo_paths.h"
-#include "xmlame.h"
 
 //#define DEBUG 1
 
@@ -96,7 +92,7 @@
      }
 
    /* Check That Dir All Exists */
-   snprintf(path, sizeof(path), "%s" EAPPDIR, get_home());
+   snprintf(path, sizeof(path), "%s" EAPPDIR, ecore_desktop_get_home());
    if (!ecore_file_exists(path))
      {
         fprintf(stderr, "ERROR: %s doesn't exist. Where are the eapps?\n", 
path);
@@ -140,37 +136,37 @@
 
    /* Get the fdo paths. */
    begin = ecore_time_get();
-   fdo_paths_init();
+   ecore_desktop_paths_init();
    paths = ecore_time_get() - begin;
-   fdo_desktops_init();
+   ecore_desktop_init();
 
 //#ifdef DEBUG
    /* You can iterate through the various path lists as needed. */
-   ecore_list_goto_first(fdo_paths_config);
-   while ((this_path = ecore_list_next(fdo_paths_config)) != NULL)
+   ecore_list_goto_first(ecore_desktop_paths_config);
+   while ((this_path = ecore_list_next(ecore_desktop_paths_config)) != NULL)
       printf("FDO config path = %s\n", this_path);
-   ecore_list_goto_first(fdo_paths_menus);
-   while ((this_path = ecore_list_next(fdo_paths_menus)) != NULL)
+   ecore_list_goto_first(ecore_desktop_paths_menus);
+   while ((this_path = ecore_list_next(ecore_desktop_paths_menus)) != NULL)
       printf("FDO menu path = %s\n", this_path);
-   ecore_list_goto_first(fdo_paths_directories);
-   while ((this_path = ecore_list_next(fdo_paths_directories)) != NULL)
+   ecore_list_goto_first(ecore_desktop_paths_directories);
+   while ((this_path = ecore_list_next(ecore_desktop_paths_directories)) != 
NULL)
       printf("FDO directory path = %s\n", this_path);
-   ecore_list_goto_first(fdo_paths_desktops);
-   while ((this_path = ecore_list_next(fdo_paths_desktops)) != NULL)
+   ecore_list_goto_first(ecore_desktop_paths_desktops);
+   while ((this_path = ecore_list_next(ecore_desktop_paths_desktops)) != NULL)
       printf("FDO desktop path = %s\n", this_path);
-   ecore_list_goto_first(fdo_paths_icons);
-   while ((this_path = ecore_list_next(fdo_paths_icons)) != NULL)
+   ecore_list_goto_first(ecore_desktop_paths_icons);
+   while ((this_path = ecore_list_next(ecore_desktop_paths_icons)) != NULL)
       printf("FDO icon path = %s\n", this_path);
-   ecore_list_goto_first(fdo_paths_kde_legacy);
-   while ((this_path = ecore_list_next(fdo_paths_kde_legacy)) != NULL)
+   ecore_list_goto_first(ecore_desktop_paths_kde_legacy);
+   while ((this_path = ecore_list_next(ecore_desktop_paths_kde_legacy)) != 
NULL)
       printf("FDO kde legacy path = %s\n", this_path);
 //#endif
 
 
    /* Just being paranoid, and cause people have removed these during testing. 
*/
-   snprintf(path, sizeof(path), "%s/.e/e/applications/all", get_home());
+   snprintf(path, sizeof(path), "%s/.e/e/applications/all", 
ecore_desktop_get_home());
    ecore_file_mkpath(path);
-   snprintf(path, sizeof(path), "%s/.e/e/applications/favorite", get_home());
+   snprintf(path, sizeof(path), "%s/.e/e/applications/favorite", 
ecore_desktop_get_home());
    ecore_file_mkpath(path);
 
    begin = ecore_time_get();
@@ -185,7 +181,7 @@
    *
    * Currently I do this instead, it seems to work -
    */
-   snprintf(path, sizeof(path), 
"%s/.e/e/applications/favorite/.eap.cache.cfg", get_home());
+   snprintf(path, sizeof(path), 
"%s/.e/e/applications/favorite/.eap.cache.cfg", ecore_desktop_get_home());
    ecore_file_unlink(path);
 
    /* Update E Cache */
@@ -193,9 +189,9 @@
 #ifdef DEBUG
    fprintf(stderr, "Regenerating Eapp Caches...\n");
 #endif
-   snprintf(path, sizeof(path), "enlightenment_eapp_cache_gen %s" EAPPDIR " 
-r", get_home());
+   snprintf(path, sizeof(path), "enlightenment_eapp_cache_gen %s" EAPPDIR " 
-r", ecore_desktop_get_home());
    system(path);
-   snprintf(path, sizeof(path), "enlightenment_eapp_cache_gen 
%s/.e/e/applications/favorite -r", get_home());
+   snprintf(path, sizeof(path), "enlightenment_eapp_cache_gen 
%s/.e/e/applications/favorite -r", ecore_desktop_get_home());
    system(path);
    cache_time += ecore_time_get() - begin;
 
@@ -215,18 +211,18 @@
    /* This is just a test of parsing speed for the old weather data's huge xml 
file.  It passed the parse test.  B-) */
    {
       double weather;
-      Dumb_Tree *weather_xml;
+      Ecore_Desktop_Tree *weather_xml;
 
       begin = ecore_time_get();
-      weather_xml = xmlame_get("dir.xml");
+      weather_xml = ecore_desktop_xmlame_get("dir.xml");
       weather = ecore_time_get() - begin;
-      dumb_tree_dump(weather_xml, 0);
+      ecore_desktop_tree_dump(weather_xml, 0);
       printf("\nWeather horror parsed in %3.3f seconds.\n", weather);
    }
 #endif
 
-   fdo_desktops_shutdown();
-   fdo_paths_shutdown();
+   ecore_desktop_shutdown();
+   ecore_desktop_paths_shutdown();
 
    /* Shutdown */
    _e17genmenu_shutdown();
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/menus.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- menus.c     10 Aug 2006 07:37:42 -0000      1.5
+++ menus.c     11 Aug 2006 13:50:04 -0000      1.6
@@ -1,7 +1,5 @@
 #include "global.h"
 #include "config.h"
-#include "fdo_menus.h"
-#include "fdo_paths.h"
 #include "parse.h"
 #include "menus.h"
 
@@ -10,7 +8,7 @@
 extern int menu_count, item_count;
 extern double generate_time;
 
-static int _menu_make_apps(const void *data, Dumb_Tree * tree, int element, 
int level);
+static int _menu_make_apps(const void *data, Ecore_Desktop_Tree * tree, int 
element, int level);
 static void _menu_dump_each_hash_node(void *value, void *user_data);
 
 void
@@ -38,18 +36,18 @@
               check_for_dirs(KDE_DIRS);      /* FIXME: probably obsolete. */
               check_for_dirs(DEBIAN_DIRS);   /* FIXME: may or may not be 
obsolete. */
 
-              ecore_list_goto_first(fdo_paths_desktops);
-              while ((this_path = ecore_list_next(fdo_paths_desktops)) != NULL)
+              ecore_list_goto_first(ecore_desktop_paths_desktops);
+              while ((this_path = 
ecore_list_next(ecore_desktop_paths_desktops)) != NULL)
                  check_for_dirs(this_path);
-              ecore_list_goto_first(fdo_paths_kde_legacy);
-              while ((this_path = ecore_list_next(fdo_paths_kde_legacy)) != 
NULL)
+              ecore_list_goto_first(ecore_desktop_paths_kde_legacy);
+              while ((this_path = 
ecore_list_next(ecore_desktop_paths_kde_legacy)) != NULL)
                  check_for_dirs(this_path);
               generate_time = ecore_time_get() - begin;
           }
 
         printf("Converting freedesktop.org (fdo) menus.\n");
         /* Find the main menu file. */
-        menu_file = fdo_paths_search_for_file(FDO_PATHS_TYPE_MENU, menu, 1, 
NULL, NULL);
+        menu_file = 
ecore_desktop_paths_search_for_file(ecore_desktop_paths_menus, menu, 1, NULL, 
NULL);
         if (menu_file)
           {
              char *path;
@@ -57,14 +55,14 @@
              path = ecore_file_get_dir(menu_file);
              if (path)
                {
-                  Dumb_Tree *menus = NULL;
+                  Ecore_Desktop_Tree *menus = NULL;
 
                   /* convert the xml into menus */
-                  menus = fdo_menus_get(menu_file, NULL, 0);
+                  menus = ecore_desktop_menus_get(menu_file, NULL, 0);
                   if (menus)
                     {
                        /* create the .eap and order files from the menu */
-                       dumb_tree_foreach(menus, 0, _menu_make_apps, path);
+                       ecore_desktop_tree_foreach(menus, 0, _menu_make_apps, 
path);
                     }
                }
              E_FREE(path);
@@ -151,9 +149,9 @@
 }
 
 static int
-_menu_make_apps(const void *data, Dumb_Tree * tree, int element, int level)
+_menu_make_apps(const void *data, Ecore_Desktop_Tree * tree, int element, int 
level)
 {
-   if (tree->elements[element].type == DUMB_TREE_ELEMENT_TYPE_STRING)
+   if (tree->elements[element].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING)
      {
         if (strncmp((char *)tree->elements[element].element, "<MENU ", 6) == 0)
           {
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/parse.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- parse.c     9 Aug 2006 23:37:54 -0000       1.10
+++ parse.c     11 Aug 2006 13:50:04 -0000      1.11
@@ -1,8 +1,6 @@
 #include "global.h"
 #include "config.h"
 #include "eaps.h"
-#include "fdo_desktops.h"
-#include "fdo_icons.h"
 #include "order.h"
 #include "parse.h"
 
@@ -111,9 +109,9 @@
 {
    char *home;
    G_Eap *eap;
-   Fdo_Desktop *desktop;
+   Ecore_Desktop *desktop;
 
-   home = get_home();
+   home = ecore_desktop_get_home();
 
 #ifdef DEBUG
    fprintf(stderr, "Parsing Desktop File %s\n", app);
@@ -122,7 +120,7 @@
    eap = calloc(1, sizeof(G_Eap));
    eap->eap_name = get_eap_name(app);
 
-   desktop = fdo_desktops_parse_desktop_file(app);
+   desktop = ecore_desktop_parse_file(app);
    if (desktop)
      {
         if (desktop->name)
@@ -139,8 +137,6 @@
            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)
@@ -187,7 +183,7 @@
 static void
 _parse_process_file(char *file, char *menu_path, G_Eap *eap)
 {
-   char *home, *category;
+   char *home, *category, *icon_size, *icon_theme;
    char path[MAX_PATH], order_path[MAX_PATH];
    int overwrite;
 
@@ -198,7 +194,11 @@
    fprintf(stderr, "Processing File %s\n", file);
 #endif
 
-   home = get_home();
+   /* Get Icon Options */
+   icon_size = get_icon_size();
+   icon_theme = get_icon_theme();
+
+   home = ecore_desktop_get_home();
    overwrite = get_overwrite();
 
    snprintf(path, sizeof(path), "%s" EAPPDIR "/%s", home, eap->eap_name);
@@ -206,7 +206,10 @@
    if ((ecore_file_exists(path)) && (!overwrite))
         not_over_count++;
    else
-        write_icon(path, eap);
+      {
+         eap->icon_path = ecore_desktop_find_icon(eap->icon, icon_size, 
icon_theme);
+         write_icon(path, eap);
+      }
 
    category = NULL;
    if (menu_path != NULL)
@@ -298,10 +301,7 @@
              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;
           }
===================================================================
RCS file: /cvs/e/e17/apps/e_utils/src/bin/e17genmenu/sort.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- sort.c      7 Mar 2006 21:58:24 -0000       1.1
+++ sort.c      11 Aug 2006 13:50:04 -0000      1.2
@@ -66,7 +66,7 @@
    fprintf(stderr, "Sorting Menu %s...\n", path);
 #endif
 
-   home = get_home();
+   home = ecore_desktop_get_home();
    snprintf(path2, sizeof(path2), "%s/.order", path);
    if (!ecore_file_exists(path2))
       create_order(path2);
@@ -136,7 +136,7 @@
    fprintf(stderr, "Sorting Menus...\n");
 #endif
 
-   home = get_home();
+   home = ecore_desktop_get_home();
    snprintf(path, sizeof(path), "%s" EFAVDIR, home);
    list = (Ecore_List *)ecore_file_ls(path);
    if (!list)
@@ -169,7 +169,7 @@
    fprintf(stderr, "\nSorting Favorites Menu...\n");
 #endif
 
-   home = get_home();
+   home = ecore_desktop_get_home();
 
    snprintf(path, sizeof(path), "%s" EFAVDIR "/.order", home);
    if (!ecore_file_exists(path))



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