]> Dogcows Code - chaz/openbox/blob - openbox/actions/debug.c
added the debug action
[chaz/openbox] / 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(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
9 static void free_func(gpointer options);
10 static gboolean run_func(ObActionsData *data, gpointer options);
11 /*
12 static gboolean i_input_func(guint initial_state,
13 XEvent *e,
14 gpointer options,
15 gboolean *used);
16 static void i_cancel_func(gpointer options);
17 */
18
19 void action_debug_startup()
20 {
21 actions_register("Debug",
22 setup_func,
23 free_func,
24 run_func,
25 NULL, NULL);
26 }
27
28 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
29 {
30 xmlNodePtr n;
31 Options *o;
32
33 o = g_new0(Options, 1);
34
35 if ((n = parse_find_node("string", node)))
36 o->str = parse_string(doc, n);
37 return o;
38 }
39
40 static void free_func(gpointer options)
41 {
42 Options *o = options;
43
44 if (o) {
45 g_free(o->str);
46 g_free(o);
47 }
48 }
49
50 /* Always return FALSE because its not interactive */
51 static gboolean run_func(ObActionsData *data, gpointer options)
52 {
53 Options *o = options;
54
55 if (o->str) g_print("%s\n", o->str);
56
57 return FALSE;
58 }
This page took 0.03522 seconds and 4 git commands to generate.