From 5d350da82e9fc46aa59e59c255604429add2d1ed Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 22 Jun 2007 18:55:44 +0000 Subject: rename showmenu to menu --- openbox/actions/all.c | 2 +- openbox/actions/all.h | 2 +- openbox/actions/menu.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++ openbox/actions/showmenu.c | 57 ---------------------------------------------- 4 files changed, 59 insertions(+), 59 deletions(-) create mode 100644 openbox/actions/menu.c delete mode 100644 openbox/actions/showmenu.c (limited to 'openbox') diff --git a/openbox/actions/all.c b/openbox/actions/all.c index 7297d235..78bcb804 100644 --- a/openbox/actions/all.c +++ b/openbox/actions/all.c @@ -4,7 +4,7 @@ void action_all_startup() { action_execute_startup(); action_debug_startup(); - action_showmenu_startup(); + action_menu_startup(); action_showdesktop_startup(); action_reconfigure_startup(); action_exit_startup(); diff --git a/openbox/actions/all.h b/openbox/actions/all.h index 477b5fe9..b9ae7f43 100644 --- a/openbox/actions/all.h +++ b/openbox/actions/all.h @@ -5,7 +5,7 @@ void action_all_startup(); void action_execute_startup(); void action_debug_startup(); -void action_showmenu_startup(); +void action_menu_startup(); void action_showdesktop_startup(); void action_reconfigure_startup(); void action_exit_startup(); diff --git a/openbox/actions/menu.c b/openbox/actions/menu.c new file mode 100644 index 00000000..64a4d279 --- /dev/null +++ b/openbox/actions/menu.c @@ -0,0 +1,57 @@ +#include "openbox/actions.h" +#include "openbox/menu.h" +#include + +typedef struct { + gchar *name; +} Options; + +static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node); +static void free_func(gpointer options); +static gboolean run_func(ObActionsData *data, gpointer options); + +void action_menu_startup() +{ + actions_register("Menu", + setup_func, + free_func, + run_func, + NULL, NULL); +} + +static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) +{ + xmlNodePtr n; + Options *o; + + o = g_new0(Options, 1); + + if ((n = parse_find_node("menu", node))) + o->name = parse_string(doc, n); + return o; +} + +static void free_func(gpointer options) +{ + Options *o = options; + + if (o) { + g_free(o->name); + g_free(o); + } +} + +/* Always return FALSE because its not interactive */ +static gboolean run_func(ObActionsData *data, gpointer options) +{ + Options *o = options; + + /* you cannot call ShowMenu from inside a menu */ + if (data->uact == OB_USER_ACTION_MENU_SELECTION) return FALSE; + + if (o->name) { + menu_show(o->name, data->x, data->y, data->button != 0, data->client); + } + + return FALSE; +} diff --git a/openbox/actions/showmenu.c b/openbox/actions/showmenu.c deleted file mode 100644 index 4b12548f..00000000 --- a/openbox/actions/showmenu.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "openbox/actions.h" -#include "openbox/menu.h" -#include - -typedef struct { - gchar *name; -} Options; - -static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node); -static void free_func(gpointer options); -static gboolean run_func(ObActionsData *data, gpointer options); - -void action_showmenu_startup() -{ - actions_register("ShowMenu", - setup_func, - free_func, - run_func, - NULL, NULL); -} - -static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) -{ - xmlNodePtr n; - Options *o; - - o = g_new0(Options, 1); - - if ((n = parse_find_node("menu", node))) - o->name = parse_string(doc, n); - return o; -} - -static void free_func(gpointer options) -{ - Options *o = options; - - if (o) { - g_free(o->name); - g_free(o); - } -} - -/* Always return FALSE because its not interactive */ -static gboolean run_func(ObActionsData *data, gpointer options) -{ - Options *o = options; - - /* you cannot call ShowMenu from inside a menu */ - if (data->uact == OB_USER_ACTION_MENU_SELECTION) return FALSE; - - if (o->name) { - menu_show(o->name, data->x, data->y, data->button != 0, data->client); - } - - return FALSE; -} -- cgit v1.2.3