summaryrefslogtreecommitdiff
path: root/gtk/gtkaction.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2007-03-15 19:33:57 +0000
committerEmmanuele Bassi <ebassi@src.gnome.org>2007-03-15 19:33:57 +0000
commitccf49466a64602051ddffca43488b77576abeab2 (patch)
tree2695b60d9ff5e30516ee4950860bd3ac0a778254 /gtk/gtkaction.c
parent0b1c9b7cc26d293477a6823a40d3e1feebbd6df7 (diff)
downloadgtk+-ccf49466a64602051ddffca43488b77576abeab2.tar.gz
Add GtkActionClass::get_submenu() vfunc: actions providing a menu item or
2007-03-15 Emmanuele Bassi <ebassi@gnome.org> * gtk/gtkaction.[ch]: Add GtkActionClass::get_submenu() vfunc: actions providing a menu item or a menu tool button with already a submenu should return the GtkMenu widget. * gtk/gtkuimanager.c (update_node): If an action provides its own submenu, use it instead of adding an empty one * gtk/gtkrecentaction.[ch]: Add GtkRecentAction, an action implementing the GtkRecentChooser interface for displaying the list of recently used files into menus and toolbars generated using GtkUIManager. (#338843) * gtk/Makefile.am: * gtk/gtk.h: * gtk/gtk.symbols: Add GtkRecentAction API to the build. * tests/testactions.c: Exercise the GtkRecentAction API. svn path=/trunk/; revision=17524
Diffstat (limited to 'gtk/gtkaction.c')
-rw-r--r--gtk/gtkaction.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c
index 93e1484a89..ea3fe8f44a 100644
--- a/gtk/gtkaction.c
+++ b/gtk/gtkaction.c
@@ -147,10 +147,11 @@ static void gtk_action_sync_tooltip (GtkAction *action,
static GtkWidget *create_menu_item (GtkAction *action);
static GtkWidget *create_tool_item (GtkAction *action);
-static void connect_proxy (GtkAction *action,
- GtkWidget *proxy);
+static void connect_proxy (GtkAction *action,
+ GtkWidget *proxy);
static void disconnect_proxy (GtkAction *action,
GtkWidget *proxy);
+
static void closure_accel_activate (GClosure *closure,
GValue *return_value,
guint n_param_values,
@@ -184,6 +185,7 @@ gtk_action_class_init (GtkActionClass *klass)
klass->menu_item_type = GTK_TYPE_IMAGE_MENU_ITEM;
klass->toolbar_item_type = GTK_TYPE_TOOL_BUTTON;
+ klass->get_submenu = NULL;
g_object_class_install_property (gobject_class,
PROP_NAME,
@@ -1774,5 +1776,28 @@ gtk_action_disconnect_accelerator (GtkAction *action)
action->private_data->accel_closure);
}
+/**
+ * gtk_action_get_submenu:
+ * @action: a #GtkAction
+ *
+ * If @action provides a #GtkMenu widget as a submenu for the menu
+ * item or the toolbar item it creates, this function returns that
+ * widget.
+ *
+ * Return value: the menu item provided by the action, or %NULL.
+ *
+ * Since: 2.12
+ */
+GtkWidget *
+gtk_action_get_submenu (GtkAction *action)
+{
+ g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
+
+ if (GTK_ACTION_GET_CLASS (action)->get_submenu)
+ return GTK_ACTION_GET_CLASS (action)->get_submenu (action);
+
+ return NULL;
+}
+
#define __GTK_ACTION_C__
#include "gtkaliasdef.c"