]> Dogcows Code - chaz/openbox/blob - openbox/actions/debug.c
more using g_slice_new() instead of g_new()
[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(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);
15 }
16
17 static gpointer setup_func(xmlNodePtr node)
18 {
19 xmlNodePtr n;
20 Options *o;
21
22 o = g_slice_new0(Options);
23
24 if ((n = obt_xml_find_node(node, "string")))
25 o->str = obt_xml_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_slice_free(Options, 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 }
This page took 0.031818 seconds and 4 git commands to generate.