Change "plain" to "exact" for If's <title>
[openbox.git] / openbox / actions / showmenu.c
blob485a31d5a7e06880eee48d0f1f6aef512db13911
1 #include "openbox/actions.h"
2 #include "openbox/menu.h"
3 #include <glib.h>
5 typedef struct {
6 gchar *name;
7 } Options;
9 static gpointer setup_func(xmlNodePtr node);
10 static void free_func(gpointer options);
11 static gboolean run_func(ObActionsData *data, gpointer options);
13 void action_showmenu_startup(void)
15 actions_register("ShowMenu", setup_func, free_func, run_func);
18 static gpointer setup_func(xmlNodePtr node)
20 xmlNodePtr n;
21 Options *o;
23 o = g_slice_new0(Options);
25 if ((n = obt_xml_find_node(node, "menu")))
26 o->name = obt_xml_node_string(n);
27 return o;
30 static void free_func(gpointer options)
32 Options *o = options;
33 g_free(o->name);
34 g_slice_free(Options, o);
37 /* Always return FALSE because its not interactive */
38 static gboolean run_func(ObActionsData *data, gpointer options)
40 Options *o = options;
42 /* you cannot call ShowMenu from inside a menu */
43 if (data->uact != OB_USER_ACTION_MENU_SELECTION && o->name)
44 menu_show(o->name, data->x, data->y, data->button != 0, data->client);
46 return FALSE;