Enlightenment CVS committal

Author  : englebass
Project : e17
Module  : libs/efreet

Dir     : e17/libs/efreet/src/bin


Modified Files:
        Makefile.am ef_menu.c main.c 
Added Files:
        ef_utils.c 


Log Message:
Function to add a new desktop to an existing menu.

===================================================================
RCS file: /cvs/e/e17/libs/efreet/src/bin/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Makefile.am 3 Feb 2007 13:05:30 -0000       1.1
+++ Makefile.am 7 Feb 2007 02:14:46 -0000       1.2
@@ -15,6 +15,7 @@
 ef_locale.c \
 ef_desktop.c \
 ef_menu.c \
+ef_utils.c \
 main.c
 
 
===================================================================
RCS file: /cvs/e/e17/libs/efreet/src/bin/ef_menu.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ef_menu.c   6 Feb 2007 02:16:33 -0000       1.2
+++ ef_menu.c   7 Feb 2007 02:14:46 -0000       1.3
@@ -1,3 +1,4 @@
+/* vim: set sw=4 ts=4 sts=4 et: */
 #include "Efreet.h"
 #include "efreet_private.h"
 
@@ -36,37 +37,84 @@
         printf("efreet_menu_get() returned NULL\n");
         return 0;
     }
-#if 0
-    if (strcmp(menu->name.internal, "Applications"))
-    {
-        printf("menu name didn't match\n");
-        return 0;
-    }
+    printf("\n");
+    efreet_menu_dump(menu, "");
+    efreet_menu_free(menu);
+
+    return 1;
+}
+
+int
+ef_cb_menu_save(void)
+{
+    Efreet_Menu *menu;
 
-    if (!menu->moves || ecore_list_nodes(menu->moves) != 2)
+//    menu = efreet_menu_get();
+    menu = efreet_menu_parse(PACKAGE_DATA_DIR"/efreet/test/test.menu");
+    if (!menu)
     {
-        printf("Missing moves\n");
+        printf("efreet_menu_get() returned NULL\n");
         return 0;
     }
+    unlink("/tmp/test.menu");
+    return efreet_menu_save(menu, "/tmp/test.menu");
+}
 
-    if (menu->current_move)
+int
+ef_cb_menu_edit(void)
+{
+    Efreet_Menu *menu, *entry;
+    Efreet_Desktop *desktop;
+
+//    menu = efreet_menu_get();
+    menu = efreet_menu_parse(PACKAGE_DATA_DIR"/efreet/test/test.menu");
+    if (!menu)
     {
-        printf("Current move still set\n");
+        printf("efreet_menu_get() returned NULL\n");
         return 0;
     }
+#if 0
+    printf("\n");
+    efreet_menu_dump(menu, "");
+    printf("\n");
+#endif
 
-    if (menu->filters)
+    desktop = efreet_desktop_get(PACKAGE_DATA_DIR"/efreet/test/test.desktop");
+    if (!desktop) 
     {
-        printf("Have filters when we shouldn't\n");
+        printf("No desktop found.\n");
         return 0;
     }
-    ef_menu_desktop_exec(menu);
+
+    efreet_menu_desktop_insert(menu, desktop, 0);
+#if 0
+    printf("\n");
+    efreet_menu_dump(menu, "");
+    printf("\n");
+#endif
+    ecore_list_goto_first(menu->entries);
+    entry = ecore_list_current(menu->entries);
+    if (desktop != entry->desktop) return 0;
+
+    efreet_menu_desktop_insert(menu, desktop, 2);
+#if 0
+    printf("\n");
+    efreet_menu_dump(menu, "");
+    printf("\n");
 #endif
+    ecore_list_goto_index(menu->entries, 2);
+    entry = ecore_list_current(menu->entries);
+    if (desktop != entry->desktop) return 0;
+
+    efreet_menu_desktop_insert(menu, desktop, -1);
+#if 0
     printf("\n");
     efreet_menu_dump(menu, "");
-    unlink("/tmp/test.menu");
-    efreet_menu_save(menu, "/tmp/test.menu");
-    efreet_menu_free(menu);
+    printf("\n");
+#endif
+    ecore_list_goto_last(menu->entries);
+    entry = ecore_list_current(menu->entries);
+    if (desktop != entry->desktop) return 0;
 
     return 1;
 }
===================================================================
RCS file: /cvs/e/e17/libs/efreet/src/bin/main.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- main.c      5 Feb 2007 02:06:05 -0000       1.2
+++ main.c      7 Feb 2007 02:14:46 -0000       1.3
@@ -22,7 +22,10 @@
 int ef_cb_desktop_file_id(void);
 #endif
 int ef_cb_menu_get(void);
+int ef_cb_menu_save(void);
+int ef_cb_menu_edit(void);
 int ef_cb_ini_long_line(void);
+int ef_cb_utils(void);
 
 typedef struct Efreet_Test Efreet_Test;
 struct Efreet_Test
@@ -51,6 +54,9 @@
     {"Desktop File ID", ef_cb_desktop_file_id},
 #endif
     {"Menu Parsing", ef_cb_menu_get},
+    {"Menu Save", ef_cb_menu_save},
+    {"Menu Edit", ef_cb_menu_edit},
+    {"Utils", ef_cb_utils},
     {NULL, NULL}
 };
 



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