]> Dogcows Code - chaz/openbox/blobdiff - plugins/menu/fifo_menu.c
adjust for changes to the parsing api.
[chaz/openbox] / plugins / menu / fifo_menu.c
index 3443294e2ced983b66c85e424956c6a71056bfb2..c096a9d3ac7975143d180e20f415c1051c82eef3 100644 (file)
@@ -1,3 +1,25 @@
+/*
+ * $Header$
+ *
+ * FFIO menu plugin
+ * Provides a menu from a FIFO located in ~/.openbox/fifo_menu/id
+ * Example:
+ * rc3:
+ *   <menu id="fonk" label="fonk" plugin="fifo_menu"></menu>
+ * Menu format
+ * <fifo_menu>
+ *    <item label="GLOVE.png">
+ *       <action name="execute">
+ *          <execute>
+ *             bsetbg "/home/woodblock/.openbox/backgrounds/GLOVE.png"
+ *          </execute>
+ *       </action>
+ *    </item>
+ *  </fifo_menu>
+ *
+ * If the attribute pid="true" is in the <menu>
+ */
+
 #include <glib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -79,6 +101,7 @@ void fifo_menu_handler(int fd, void *d) {
                         num_realloc);
 
         if (num_read == 0) { /* eof */
+            ObParseInst *i;
             xmlDocPtr doc;
             xmlNodePtr node;
 
@@ -87,17 +110,15 @@ void fifo_menu_handler(int fd, void *d) {
 
             FIFO_MENU_DATA(menu)->buf[FIFO_MENU_DATA(menu)->buflen] = '\0';
 
-            doc = xmlParseMemory(FIFO_MENU_DATA(menu)->buf,
-                                 FIFO_MENU_DATA(menu)->buflen);
+            i = parse_startup();
+
+            if (parse_load_mem(FIFO_MENU_DATA(menu)->buf,
+                               FIFO_MENU_DATA(menu)->buflen,
+                               "fifo_menu", &doc, &node))
+                parse_menu_full(i, doc, node, menu, FALSE);
+
+            parse_shutdown(i);
 
-            node = xmlDocGetRootElement(doc);
-            
-            if (node &&
-                !xmlStrcasecmp(node->name, (const xmlChar*) "fifo_menu")) {
-                if ((node = parse_find_node("item", node->xmlChildrenNode)))
-                    parse_menu_full(doc, node, menu, FALSE);
-            }
-            
             fifo_menu_clean_up(menu);
             
             event_remove_fd(FIFO_MENU_DATA(menu)->handler->fd);
This page took 0.02131 seconds and 4 git commands to generate.