if windows on screen are going to be moved, then do the ReplayPointer before that...
[mikachu/openbox.git] / 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(void)
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("command", node)) ||
29         (n = parse_find_node("execute", node)))
30     {
31         gchar *s = parse_string(doc, n);
32         o->cmd = parse_expand_tilde(s);
33         g_free(s);
34     }
35     return o;
36 }
37
38 static void free_func(gpointer options)
39 {
40     Options *o = options;
41
42     if (o) {
43         g_free(o->cmd);
44         g_free(o);
45     }
46 }
47
48 /* Always return FALSE because its not interactive */
49 static gboolean run_func(ObActionsData *data, gpointer options)
50 {
51     Options *o = options;
52
53     ob_restart_other(o->cmd);
54
55     return FALSE;
56 }