Merge branch 'backport' into work
[mikachu/openbox.git] / openbox / actions / debug.c
1 #include "openbox/actions.h"
2 #include <glib.h>
3
4 typedef struct {
5     gchar   *str;
6 } Options;
7
8 static gpointer setup_func(xmlNodePtr node);
9 static void     free_func(gpointer options);
10 static gboolean run_func(ObActionsData *data, gpointer options);
11
12 void action_debug_startup(void)
13 {
14     actions_register("Debug", setup_func, free_func, run_func, NULL, NULL);
15 }
16
17 static gpointer setup_func(xmlNodePtr node)
18 {
19     xmlNodePtr n;
20     Options *o;
21
22     o = g_new0(Options, 1);
23
24     if ((n = obt_parse_find_node(node, "string")))
25         o->str = obt_parse_node_string(n);
26     return o;
27 }
28
29 static void free_func(gpointer options)
30 {
31     Options *o = options;
32     g_free(o->str);
33     g_free(o);
34 }
35
36 /* Always return FALSE because its not interactive */
37 static gboolean run_func(ObActionsData *data, gpointer options)
38 {
39     Options *o = options;
40
41     if (o->str) g_print("%s\n", o->str);
42
43     return FALSE;
44 }