1 #include "openbox/actions.h"
2 #include "openbox/screen.h"
10 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
11 static gpointer setup_add_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
12 static gpointer setup_remove_func(ObParseInst *i,
13 xmlDocPtr doc, xmlNodePtr node);
14 static gpointer setup_addcurrent_func(ObParseInst *i,
15 xmlDocPtr doc, xmlNodePtr node);
16 static gpointer setup_addlast_func(ObParseInst *i,
17 xmlDocPtr doc, xmlNodePtr node);
18 static gpointer setup_removecurrent_func(ObParseInst *i,
19 xmlDocPtr doc, xmlNodePtr node);
20 static gpointer setup_removelast_func(ObParseInst *i,
21 xmlDocPtr doc, xmlNodePtr node);
22 static void free_func(gpointer options);
23 static gboolean run_func(ObActionsData *data, gpointer options);
25 void action_addremovedesktop_startup(void)
27 actions_register("AddDesktop",
32 actions_register("RemoveDesktop",
37 actions_register("AddDesktopLast",
42 actions_register("RemoveDesktopLast",
43 setup_removelast_func,
47 actions_register("AddDesktopCurrent",
48 setup_addcurrent_func,
52 actions_register("RemoveDesktopCurrent",
53 setup_removecurrent_func,
59 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
64 o = g_new0(Options, 1);
66 if ((n = parse_find_node("where", node))) {
67 gchar *s = parse_string(doc, n);
68 if (!g_ascii_strcasecmp(s, "last"))
70 else if (!g_ascii_strcasecmp(s, "current"))
78 static gpointer setup_add_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
80 Options *o = setup_func(i, doc, node);
85 static gpointer setup_remove_func(ObParseInst *i,
86 xmlDocPtr doc, xmlNodePtr node)
88 Options *o = setup_func(i, doc, node);
93 static gpointer setup_addcurrent_func(ObParseInst *i,
94 xmlDocPtr doc, xmlNodePtr node)
96 Options *o = setup_add_func(i, doc, node);
101 static gpointer setup_addlast_func(ObParseInst *i,
102 xmlDocPtr doc, xmlNodePtr node)
104 Options *o = setup_add_func(i, doc, node);
109 static gpointer setup_removecurrent_func(ObParseInst *i,
110 xmlDocPtr doc, xmlNodePtr node)
112 Options *o = setup_remove_func(i, doc, node);
117 static gpointer setup_removelast_func(ObParseInst *i,
118 xmlDocPtr doc, xmlNodePtr node)
120 Options *o = setup_remove_func(i, doc, node);
125 static void free_func(gpointer options)
127 Options *o = options;
132 /* Always return FALSE because its not interactive */
133 static gboolean run_func(ObActionsData *data, gpointer options)
135 Options *o = options;
137 actions_client_move(data, TRUE);
140 screen_add_desktop(o->current);
142 screen_remove_desktop(o->current);
144 actions_client_move(data, FALSE);