1 #include "openbox/actions.h"
2 #include "openbox/screen.h"
10 static gpointer
setup_func(xmlNodePtr node
);
11 static gpointer
setup_add_func(xmlNodePtr node
);
12 static gpointer
setup_remove_func(xmlNodePtr node
);
13 static void free_func(gpointer o
);
14 static gboolean
run_func(ObActionsData
*data
, gpointer options
);
15 /* 3.4-compatibility */
16 static gpointer
setup_addcurrent_func(xmlNodePtr node
);
17 static gpointer
setup_addlast_func(xmlNodePtr node
);
18 static gpointer
setup_removecurrent_func(xmlNodePtr node
);
19 static gpointer
setup_removelast_func(xmlNodePtr node
);
21 void action_addremovedesktop_startup(void)
23 actions_register("AddDesktop", setup_add_func
, free_func
, run_func
);
24 actions_register("RemoveDesktop", setup_remove_func
, free_func
, run_func
);
26 /* 3.4-compatibility */
27 actions_register("AddDesktopLast", setup_addlast_func
,
29 actions_register("RemoveDesktopLast", setup_removelast_func
,
31 actions_register("AddDesktopCurrent", setup_addcurrent_func
,
33 actions_register("RemoveDesktopCurrent", setup_removecurrent_func
,
37 static gpointer
setup_func(xmlNodePtr node
)
42 o
= g_slice_new0(Options
);
44 if ((n
= obt_xml_find_node(node
, "where"))) {
45 gchar
*s
= obt_xml_node_string(n
);
46 if (!g_ascii_strcasecmp(s
, "last"))
48 else if (!g_ascii_strcasecmp(s
, "current"))
56 static gpointer
setup_add_func(xmlNodePtr node
)
58 Options
*o
= setup_func(node
);
63 static gpointer
setup_remove_func(xmlNodePtr node
)
65 Options
*o
= setup_func(node
);
70 static void free_func(gpointer o
)
72 g_slice_free(Options
, o
);
75 /* Always return FALSE because its not interactive */
76 static gboolean
run_func(ObActionsData
*data
, gpointer options
)
80 actions_client_move(data
, TRUE
);
83 screen_add_desktop(o
->current
);
85 screen_remove_desktop(o
->current
);
87 actions_client_move(data
, FALSE
);
92 /* 3.4-compatibility */
93 static gpointer
setup_addcurrent_func(xmlNodePtr node
)
95 Options
*o
= setup_add_func(node
);
100 static gpointer
setup_addlast_func(xmlNodePtr node
)
102 Options
*o
= setup_add_func(node
);
107 static gpointer
setup_removecurrent_func(xmlNodePtr node
)
109 Options
*o
= setup_remove_func(node
);
114 static gpointer
setup_removelast_func(xmlNodePtr node
)
116 Options
*o
= setup_remove_func(node
);