]> Dogcows Code - chaz/openbox/blob - openbox/actions/restart.c
add restart action
[chaz/openbox] / openbox / actions / restart.c
1 #include "openbox/actions.h"
2 #include "openbox/openbox.h"
3
4 typedef struct {
5 gchar *cmd;
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 void action_restart_startup()
13 {
14 actions_register("Restart",
15 setup_func,
16 free_func,
17 run_func,
18 NULL, NULL);
19 }
20
21 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
22 {
23 xmlNodePtr n;
24 Options *o;
25
26 o = g_new0(Options, 1);
27
28 if ((n = parse_find_node("execute", node))) {
29 gchar *s = parse_string(doc, n);
30 o->cmd = parse_expand_tilde(s);
31 g_free(s);
32 }
33 return o;
34 }
35
36 static void free_func(gpointer options)
37 {
38 Options *o = options;
39
40 if (o) {
41 g_free(o->cmd);
42 g_free(o);
43 }
44 }
45
46 /* Always return FALSE because its not interactive */
47 static gboolean run_func(ObActionsData *data, gpointer options)
48 {
49 Options *o = options;
50
51 ob_restart_other(o->cmd);
52
53 return FALSE;
54 }
This page took 0.047818 seconds and 5 git commands to generate.