]> icculus.org git repositories - dana/openbox.git/blob - openbox/actions/debug.c
Use ObConfigValue to parse gravity coords, remove parse special functions from config...
[dana/openbox.git] / openbox / actions / debug.c
1 #include "openbox/action.h"
2 #include "openbox/action_list_run.h"
3 #include "openbox/config_value.h"
4 #include "openbox/client_set.h"
5 #include <glib.h>
6
7 typedef struct {
8     gchar   *str;
9 } Options;
10
11 static gpointer setup_func(GHashTable *config);
12 static void     free_func(gpointer options);
13 static gboolean run_func(const ObClientSet *set,
14                          const ObActionListRun *data, gpointer options);
15
16 void action_debug_startup(void)
17 {
18     action_register("Debug", OB_ACTION_DEFAULT_FILTER_EMPTY,
19                     setup_func, free_func, run_func);
20 }
21
22 static gpointer setup_func(GHashTable *config)
23 {
24     ObConfigValue *v;
25     Options *o;
26
27     o = g_slice_new0(Options);
28
29     v = g_hash_table_lookup(config, "string");
30     if (v && config_value_is_string(v))
31         o->str = g_strdup(config_value_string(v));
32     return o;
33 }
34
35 static void free_func(gpointer options)
36 {
37     Options *o = options;
38     g_free(o->str);
39     g_slice_free(Options, o);
40 }
41
42 /* Always return FALSE because its not interactive */
43 static gboolean run_func(const ObClientSet *set,
44                          const ObActionListRun *data, gpointer options)
45 {
46     Options *o = options;
47
48     if (o->str) g_print("%s\n", o->str);
49
50     return FALSE;
51 }