Commit 2c1a285f authored by Emmanuele Bassi's avatar Emmanuele Bassi Committed by Emmanuele Bassi

Rename get_submenu() to create_menu(); rename gtk_action_get_submenu() to

2007-03-16  Emmanuele Bassi  <ebassi@gnome.org>

	* gtk/gtkaction.h:
	* gtk/gtkaction.c: Rename get_submenu() to create_menu();
	rename gtk_action_get_submenu() to gtk_action_create_menu().

	* gtk/gtkrecentaction.c: Update for GtkAction change.

	* gtk/gtkuimanager.c (update_node): Update for GtkAction change;
	also, use the menu from the GtkAction for both menuitem and
	toolitem nodes.

svn path=/trunk/; revision=17535
parent bd05c440
2007-03-16 Emmanuele Bassi <ebassi@gnome.org>
* gtk/gtkaction.h:
* gtk/gtkaction.c: Rename get_submenu() to create_menu();
rename gtk_action_get_submenu() to gtk_action_create_menu().
* gtk/gtkrecentaction.c: Update for GtkAction change.
* gtk/gtkuimanager.c (update_node): Update for GtkAction change;
also, use the menu from the GtkAction for both menuitem and
toolitem nodes.
2007-03-16 Xan Lopez <xan@gnome.org>
* gtk/gtkwidget.c: Fix documentation error in
......
......@@ -180,12 +180,12 @@ gtk_action_class_init (GtkActionClass *klass)
klass->create_menu_item = create_menu_item;
klass->create_tool_item = create_tool_item;
klass->create_menu = NULL;
klass->connect_proxy = connect_proxy;
klass->disconnect_proxy = disconnect_proxy;
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,
......@@ -1777,24 +1777,24 @@ gtk_action_disconnect_accelerator (GtkAction *action)
}
/**
* gtk_action_get_submenu:
* gtk_action_create_menu:
* @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.
* item or the toolbar item it creates, this function returns an
* instance of that menu.
*
* Return value: the menu item provided by the action, or %NULL.
*
* Since: 2.12
*/
GtkWidget *
gtk_action_get_submenu (GtkAction *action)
gtk_action_create_menu (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);
if (GTK_ACTION_GET_CLASS (action)->create_menu)
return GTK_ACTION_GET_CLASS (action)->create_menu (action);
return NULL;
}
......
......@@ -73,7 +73,7 @@ struct _GtkActionClass
void (* disconnect_proxy) (GtkAction *action,
GtkWidget *proxy);
GtkWidget *(* get_submenu) (GtkAction *action);
GtkWidget *(* create_menu) (GtkAction *action);
/* Padding for future expansion */
void (*_gtk_reserved2) (void);
......@@ -96,21 +96,21 @@ gboolean gtk_action_get_visible (GtkAction *action);
void gtk_action_set_visible (GtkAction *action,
gboolean visible);
void gtk_action_activate (GtkAction *action);
GtkWidget* gtk_action_create_icon (GtkAction *action,
GtkWidget * gtk_action_create_icon (GtkAction *action,
GtkIconSize icon_size);
GtkWidget* gtk_action_create_menu_item (GtkAction *action);
GtkWidget* gtk_action_create_tool_item (GtkAction *action);
GtkWidget * gtk_action_create_menu_item (GtkAction *action);
GtkWidget * gtk_action_create_tool_item (GtkAction *action);
GtkWidget * gtk_action_create_menu (GtkAction *action);
void gtk_action_connect_proxy (GtkAction *action,
GtkWidget *proxy);
void gtk_action_disconnect_proxy (GtkAction *action,
GtkWidget *proxy);
GSList* gtk_action_get_proxies (GtkAction *action);
GtkAction *gtk_widget_get_action (GtkWidget *widget);
GSList * gtk_action_get_proxies (GtkAction *action);
GtkAction * gtk_widget_get_action (GtkWidget *widget);
void gtk_action_connect_accelerator (GtkAction *action);
void gtk_action_disconnect_accelerator (GtkAction *action);
G_CONST_RETURN gchar *gtk_action_get_accel_path (GtkAction *action);
GClosure *gtk_action_get_accel_closure (GtkAction *action);
GtkWidget * gtk_action_get_submenu (GtkAction *action);
/* protected ... for use by child actions */
void gtk_action_block_activate_from (GtkAction *action,
......
......@@ -386,7 +386,7 @@ gtk_recent_action_disconnect_proxy (GtkAction *action,
}
static GtkWidget *
gtk_recent_action_get_submenu (GtkAction *action)
gtk_recent_action_create_menu (GtkAction *action)
{
GtkRecentAction *recent_action = GTK_RECENT_ACTION (action);
GtkRecentActionPrivate *priv = recent_action->priv;
......@@ -430,7 +430,7 @@ gtk_recent_action_create_menu_item (GtkAction *action)
GtkWidget *menu;
GtkWidget *menuitem;
menu = gtk_recent_action_get_submenu (action);
menu = gtk_recent_action_create_menu (action);
menuitem = g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, NULL);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
gtk_widget_show (menu);
......@@ -444,7 +444,7 @@ gtk_recent_action_create_tool_item (GtkAction *action)
GtkWidget *menu;
GtkWidget *toolitem;
menu = gtk_recent_action_get_submenu (action);
menu = gtk_recent_action_create_menu (action);
toolitem = g_object_new (GTK_TYPE_MENU_TOOL_BUTTON, NULL);
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (toolitem), menu);
gtk_widget_show (menu);
......@@ -652,7 +652,7 @@ gtk_recent_action_class_init (GtkRecentActionClass *klass)
action_class->disconnect_proxy = gtk_recent_action_disconnect_proxy;
action_class->create_menu_item = gtk_recent_action_create_menu_item;
action_class->create_tool_item = gtk_recent_action_create_tool_item;
action_class->get_submenu = gtk_recent_action_get_submenu;
action_class->create_menu = gtk_recent_action_create_menu;
action_class->menu_item_type = GTK_TYPE_IMAGE_MENU_ITEM;
action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
......
......@@ -2234,10 +2234,11 @@ update_node (GtkUIManager *self,
/* ... if the action already provides a menu, then use
* that menu instead of creating an empty one
*/
if (NODE_INFO (node->parent)->type == NODE_TYPE_TOOLITEM &&
GTK_ACTION_GET_CLASS (action)->get_submenu)
if ((NODE_INFO (node->parent)->type == NODE_TYPE_TOOLITEM ||
NODE_INFO (node->parent)->type == NODE_TYPE_MENUITEM) &&
GTK_ACTION_GET_CLASS (action)->create_menu)
{
menu = gtk_action_get_submenu (action);
menu = gtk_action_create_menu (action);
}
if (!menu)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment