]> Dogcows Code - chaz/openbox/blob - openbox/actions/restart.c
0afe8bf016c68f9415b9095deb7ff3fdb7c78cf5
[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(xmlNodePtr node);
9 static void free_func(gpointer options);
10 static gboolean run_func(ObActionsData *data, gpointer options);
11
12 void action_restart_startup(void)
13 {
14 actions_register("Restart", setup_func, free_func, run_func, NULL, NULL);
15 }
16
17 static gpointer setup_func(xmlNodePtr node)
18 {
19 xmlNodePtr n;
20 Options *o;
21
22 o = g_new0(Options, 1);
23
24 if ((n = obt_parse_find_node(node, "command")) ||
25 (n = obt_parse_find_node(node, "execute")))
26 {
27 gchar *s = obt_parse_node_string(n);
28 o->cmd = parse_expand_tilde(s);
29 g_free(s);
30 }
31 return o;
32 }
33
34 static void free_func(gpointer options)
35 {
36 Options *o = options;
37 g_free(o->cmd);
38 g_free(o);
39 }
40
41 /* Always return FALSE because its not interactive */
42 static gboolean run_func(ObActionsData *data, gpointer options)
43 {
44 Options *o = options;
45
46 ob_restart_other(o->cmd);
47
48 return FALSE;
49 }
This page took 0.037638 seconds and 3 git commands to generate.