]> Dogcows Code - chaz/openbox/commitdiff
move expand_tilde to ob_expand_tilde in openbox.c to make it global.
authorDana Jansens <danakj@orodu.net>
Mon, 1 Sep 2003 00:53:55 +0000 (00:53 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 1 Sep 2003 00:53:55 +0000 (00:53 +0000)
use it on the command read in the menu parsing for pipe menus.
use it on the command read for execute/restart actions.

openbox/action.c
openbox/config.c
openbox/menu.c
openbox/openbox.c
openbox/openbox.h

index d24e81e6f67af0688c45b8a18b5366ed14bf347c..7d06f12e46a29d647cadd4e8ee5eae24a3bff83e 100644 (file)
@@ -730,8 +730,11 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
     if (parse_attr_string("name", node, &actname)) {
         if ((act = action_from_string(actname))) {
             if (act->func == action_execute || act->func == action_restart) {
-                if ((n = parse_find_node("execute", node->xmlChildrenNode)))
-                    act->data.execute.path = parse_string(doc, n);
+                if ((n = parse_find_node("execute", node->xmlChildrenNode))) {
+                    gchar *s = parse_string(doc, n);
+                    act->data.execute.path = expand_tilde(s);
+                    g_free(s);
+                }
             } else if (act->func == action_showmenu) {
                 if ((n = parse_find_node("menu", node->xmlChildrenNode)))
                     act->data.showmenu.name = parse_string(doc, n);
index 24da306013c39975151be6b13f4ac6f656d08492..21f03d3e27dea11e6cc692469b2c9781e6534156 100644 (file)
@@ -4,6 +4,7 @@
 #include "prop.h"
 #include "translate.h"
 #include "parser/parse.h"
+#include "openbox.h"
 
 gboolean config_focus_new;
 gboolean config_focus_follow;
@@ -39,16 +40,6 @@ GSList *config_menu_files;
 gint config_resist_win;
 gint config_resist_edge;
 
-gchar *expand_tilde(const gchar *f)
-{
-    if (!f)
-        return NULL;
-    else if (f[0] != '~')
-        return g_strdup(f);
-    else
-        return g_strconcat(g_get_home_dir(), f+1, NULL);
-}
-
 /*
 
 <keybind key="C-x">
@@ -228,7 +219,7 @@ static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 
         g_free(config_theme);
         c = parse_string(doc, n);
-        config_theme = expand_tilde(c);
+        config_theme = ob_expand_tilde(c);
         g_free(c);
     }
     if ((n = parse_find_node("titleLayout", node))) {
@@ -343,7 +334,7 @@ static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, void *d)
 
             c = parse_string(doc, node);
             config_menu_files = g_slist_append(config_menu_files,
-                                               expand_tilde(c));
+                                               ob_expand_tilde(c));
             g_free(c);
         }
     }
index cf405720ab211cab138ba8dd930a4a1ce973b6a2..8cc1c872f2c642fb36704fceff3ccde993406922 100644 (file)
@@ -203,7 +203,7 @@ static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 
         if ((menu = menu_new(name, title, NULL))) {
             if (parse_attr_string("execute", node, &script)) {
-                menu->execute = g_strdup(script);
+                menu->execute = ob_expand_tilde(script);
             } else {
                 state->menus = g_slist_prepend(state->menus, menu);
                 parse_tree(i, doc, node->xmlChildrenNode);
index 521469606bdeb89063bc5fe8dc4f154da4b3e770..21f3a60604a6a0ba7854768668e069396feab506 100644 (file)
@@ -414,3 +414,13 @@ ObState ob_state()
 {
     return state;
 }
+
+gchar *ob_expand_tilde(const gchar *f)
+{
+    if (!f)
+        return NULL;
+    else if (f[0] != '~')
+        return g_strdup(f);
+    else
+        return g_strconcat(g_get_home_dir(), f+1, NULL);
+}
index 2f325dff919a76e001039bc49414ce95b1e6cec8..a01e792cff4426642c770258c33d813e4d29fb2d 100644 (file)
@@ -48,4 +48,6 @@ Cursor ob_cursor(ObCursor cursor);
 
 KeyCode ob_keycode(ObKey key);
 
+gchar *ob_expand_tilde(const gchar *f);
+
 #endif
This page took 0.037217 seconds and 4 git commands to generate.