openbox/openbox/actions/debug.c
2007-06-22 03:57:48 +00:00

51 lines
1 KiB
C

#include "openbox/actions.h"
#include <glib.h>
typedef struct {
gchar *str;
} Options;
static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
static void free_func(gpointer options);
static gboolean run_func(ObActionsData *data, gpointer options);
void action_debug_startup()
{
actions_register("Debug",
setup_func,
free_func,
run_func,
NULL, NULL);
}
static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
{
xmlNodePtr n;
Options *o;
o = g_new0(Options, 1);
if ((n = parse_find_node("string", node)))
o->str = parse_string(doc, n);
return o;
}
static void free_func(gpointer options)
{
Options *o = options;
if (o) {
g_free(o->str);
g_free(o);
}
}
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
Options *o = options;
if (o->str) g_print("%s\n", o->str);
return FALSE;
}