summaryrefslogtreecommitdiff
path: root/openbox/actions.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-06-21 23:28:14 +0000
committerDana Jansens <danakj@orodu.net>2007-06-21 23:28:14 +0000
commit828d06f271392abbef75bb37e2635b2085bdef90 (patch)
tree37877f7f5b54891af122a441eb3f6f8837cb81a6 /openbox/actions.c
parent5e8ec2cb781ba07341a5970b3e829cc59a8cf332 (diff)
dont build the old action stuff.
config uses the new action stuff. add actions_parse_string
Diffstat (limited to 'openbox/actions.c')
-rw-r--r--openbox/actions.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/openbox/actions.c b/openbox/actions.c
index 6cd1d1cc..8d523dc8 100644
--- a/openbox/actions.c
+++ b/openbox/actions.c
@@ -100,36 +100,48 @@ static void actions_definition_unref(ObActionsDefinition *def)
}
}
-ObActionsAct* actions_parse(ObParseInst *i,
- xmlDocPtr doc,
- xmlNodePtr node)
+ObActionsAct* actions_parse_string(const gchar *name)
{
GSList *it;
- gchar *name;
ObActionsDefinition *def;
ObActionsAct *act = NULL;
- if (!parse_attr_string("name", node, &name)) return NULL;
-
/* find the requested action */
for (it = registered; it; it = g_slist_next(it)) {
def = it->data;
if (!g_ascii_strcasecmp(name, def->name))
break;
+ def = NULL;
}
/* if we found the action */
- if (it != NULL) {
+ if (def) {
act = g_new(ObActionsAct, 1);
act->ref = 1;
act->def = def;
actions_definition_ref(act->def);
- act->options = def->setup(i, doc, node->children);
+ act->options = NULL;
} else
g_message(_("Invalid action '%s' requested. No such action exists."),
name);
- g_free(name);
+ return act;
+}
+
+ObActionsAct* actions_parse(ObParseInst *i,
+ xmlDocPtr doc,
+ xmlNodePtr node)
+{
+ gchar *name;
+ ObActionsAct *act = NULL;
+
+ if (parse_attr_string("name", node, &name)) {
+ if ((act = actions_parse_string(name)))
+ /* there is more stuff to parse here */
+ act->options = act->def->setup(i, doc, node->children);
+
+ g_free(name);
+ }
return act;
}