move expand_tilde to ob_expand_tilde in openbox.c to make it global. use it on the command read in the menu parsing for pipe menus. use it on the command read for execute/restart actions.
Dana Jansens danakj@orodu.net
5 files changed,
21 insertions(+),
15 deletions(-)
M
openbox/action.c
→
openbox/action.c
@@ -730,8 +730,11 @@
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);
M
openbox/config.c
→
openbox/config.c
@@ -4,6 +4,7 @@ #include "mouse.h"
#include "prop.h" #include "translate.h" #include "parser/parse.h" +#include "openbox.h" gboolean config_focus_new; gboolean config_focus_follow;@@ -38,16 +39,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); -} /*@@ -228,7 +219,7 @@ gchar *c;
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 @@ gchar *c;
c = parse_string(doc, node); config_menu_files = g_slist_append(config_menu_files, - expand_tilde(c)); + ob_expand_tilde(c)); g_free(c); } }
M
openbox/openbox.c
→
openbox/openbox.c
@@ -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); +}
M
openbox/openbox.h
→
openbox/openbox.h
@@ -48,4 +48,6 @@ Cursor ob_cursor(ObCursor cursor);
KeyCode ob_keycode(ObKey key); +gchar *ob_expand_tilde(const gchar *f); + #endif