]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktoolitem.c
Updated Basque translation.
[~andy/gtk] / gtk / gtktoolitem.c
index e7ac11a536541005b986fc3fb2c1e36c9e13c84c..2d73c228e030f08b40e58c6a4d4b3c2352fb76b1 100644 (file)
@@ -1,6 +1,6 @@
 /* gtktoolitem.c
  *
- * Copyright (C) 2002 Anders Carlsson <andersca@codefactory.se>
+ * Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
  * Copyright (C) 2002 James Henstridge <james@daa.com.au>
  * Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
  *
  * Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
+
+#include <string.h>
+
+#undef GTK_DISABLE_DEPRECATED /* GtkTooltips */
+
 #include "gtktoolitem.h"
 #include "gtkmarshalers.h"
-#include "gtktoolbar.h"
+#include "gtktoolshell.h"
 #include "gtkseparatormenuitem.h"
 #include "gtkintl.h"
 #include "gtkmain.h"
+#include "gtkprivate.h"
+#include "gtkalias.h"
 
-#include <string.h>
+/**
+ * SECTION:gtktoolitem
+ * @short_description: The base class of widgets that can be added to #GtkToolShell
+ *
+ * #GtkToolItem<!-- -->s are widgets that can appear on a toolbar. To
+ * create a toolbar item that contain something else than a button, use
+ * gtk_tool_item_new(). Use gtk_container_add() to add a child
+ * widget to the tool item.
+ *
+ * For toolbar items that contain buttons, see the #GtkToolButton,
+ * #GtkToggleToolButton and #GtkRadioToolButton classes.
+ *
+ * See the #GtkToolbar class for a description of the toolbar widget, and
+ * #GtkToolShell for a description of the tool shell interface.
+ */
+
+/**
+ * GtkToolItem:
+ *
+ * The GtkToolItem struct contains only private data.
+ * It should only be accessed through the functions described below.
+ */
 
 enum {
   CREATE_MENU_PROXY,
@@ -63,8 +92,6 @@ struct _GtkToolItemPrivate
   GtkWidget *menu_item;
 };
   
-static void gtk_tool_item_init       (GtkToolItem *toolitem);
-static void gtk_tool_item_class_init (GtkToolItemClass *class);
 static void gtk_tool_item_finalize    (GObject *object);
 static void gtk_tool_item_parent_set   (GtkWidget   *toolitem,
                                        GtkWidget   *parent);
@@ -76,6 +103,8 @@ static void gtk_tool_item_get_property (GObject         *object,
                                        guint            prop_id,
                                        GValue          *value,
                                        GParamSpec      *pspec);
+static void gtk_tool_item_property_notify (GObject      *object,
+                                          GParamSpec   *pspec);
 static void gtk_tool_item_realize       (GtkWidget      *widget);
 static void gtk_tool_item_unrealize     (GtkWidget      *widget);
 static void gtk_tool_item_map           (GtkWidget      *widget);
@@ -92,36 +121,9 @@ static gboolean gtk_tool_item_real_set_tooltip (GtkToolItem *tool_item,
 static gboolean gtk_tool_item_create_menu_proxy (GtkToolItem *item);
 
 
-static GObjectClass *parent_class = NULL;
-static guint         toolitem_signals[LAST_SIGNAL] = { 0 };
+static guint toolitem_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gtk_tool_item_get_type (void)
-{
-  static GtkType type = 0;
-
-  if (!type)
-    {
-      static const GTypeInfo type_info =
-       {
-         sizeof (GtkToolItemClass),
-         (GBaseInitFunc) NULL,
-         (GBaseFinalizeFunc) NULL,
-         (GClassInitFunc) gtk_tool_item_class_init,
-         (GClassFinalizeFunc) NULL,
-         NULL,
-        
-         sizeof (GtkToolItem),
-         0, /* n_preallocs */
-         (GInstanceInitFunc) gtk_tool_item_init,
-       };
-
-      type = g_type_register_static (GTK_TYPE_BIN,
-                                    "GtkToolItem",
-                                    &type_info, 0);
-    }
-  return type;
-}
+G_DEFINE_TYPE (GtkToolItem, gtk_tool_item, GTK_TYPE_BIN)
 
 static void
 gtk_tool_item_class_init (GtkToolItemClass *klass)
@@ -129,13 +131,13 @@ gtk_tool_item_class_init (GtkToolItemClass *klass)
   GObjectClass *object_class;
   GtkWidgetClass *widget_class;
   
-  parent_class = g_type_class_peek_parent (klass);
   object_class = (GObjectClass *)klass;
   widget_class = (GtkWidgetClass *)klass;
   
   object_class->set_property = gtk_tool_item_set_property;
   object_class->get_property = gtk_tool_item_get_property;
   object_class->finalize = gtk_tool_item_finalize;
+  object_class->notify = gtk_tool_item_property_notify;
 
   widget_class->realize       = gtk_tool_item_realize;
   widget_class->unrealize     = gtk_tool_item_unrealize;
@@ -150,34 +152,35 @@ gtk_tool_item_class_init (GtkToolItemClass *klass)
   
   g_object_class_install_property (object_class,
                                   PROP_VISIBLE_HORIZONTAL,
-                                  g_param_spec_boolean ("visible_horizontal",
-                                                        _("Visible when horizontal"),
-                                                        _("Whether the toolbar item is visible when the toolbar is in a horizontal orientation."),
+                                  g_param_spec_boolean ("visible-horizontal",
+                                                        P_("Visible when horizontal"),
+                                                        P_("Whether the toolbar item is visible when the toolbar is in a horizontal orientation."),
                                                         TRUE,
-                                                        G_PARAM_READWRITE));
+                                                        GTK_PARAM_READWRITE));
   g_object_class_install_property (object_class,
                                   PROP_VISIBLE_VERTICAL,
-                                  g_param_spec_boolean ("visible_vertical",
-                                                        _("Visible when vertical"),
-                                                        _("Whether the toolbar item is visible when the toolbar is in a vertical orientation."),
+                                  g_param_spec_boolean ("visible-vertical",
+                                                        P_("Visible when vertical"),
+                                                        P_("Whether the toolbar item is visible when the toolbar is in a vertical orientation."),
                                                         TRUE,
-                                                        G_PARAM_READWRITE));
+                                                        GTK_PARAM_READWRITE));
   g_object_class_install_property (object_class,
                                   PROP_IS_IMPORTANT,
-                                  g_param_spec_boolean ("is_important",
-                                                        _("Is important"),
-                                                        _("Whether the toolbar item is considered important. When TRUE, toolbar buttons show text in GTK_TOOLBAR_BOTH_HORIZ mode"),
+                                  g_param_spec_boolean ("is-important",
+                                                        P_("Is important"),
+                                                        P_("Whether the toolbar item is considered important. When TRUE, toolbar buttons show text in GTK_TOOLBAR_BOTH_HORIZ mode"),
                                                         FALSE,
-                                                        G_PARAM_READWRITE));
+                                                        GTK_PARAM_READWRITE));
 
 /**
  * GtkToolItem::create-menu-proxy:
- * @toolitem: the object the signal was emitted on
+ * @tool_item: the object the signal was emitted on
  *
- * This signal is emitted when the toolbar is displaying an overflow menu.
- * In response the tool item should either 
+ * This signal is emitted when the toolbar needs information from @tool_item
+ * about whether the item should appear in the toolbar overflow menu. In
+ * response the tool item should either
  * <itemizedlist>
- * <listitem> call gtk_tool_item_set_proxy_menu_item() with a %NULL
+ * <listitem>call gtk_tool_item_set_proxy_menu_item() with a %NULL
  * pointer and return %TRUE to indicate that the item should not appear
  * in the overflow menu
  * </listitem>
@@ -190,11 +193,16 @@ gtk_tool_item_class_init (GtkToolItemClass *klass)
  * installs a menu item.
  * </listitem>
  * </itemizedlist>
- * 
+ *
+ * The toolbar may cache the result of this signal. When the tool item changes
+ * how it will respond to this signal it must call gtk_tool_item_rebuild_menu()
+ * to invalidate the cache and ensure that the toolbar rebuilds its overflow
+ * menu.
+ *
  * Return value: %TRUE if the signal was handled, %FALSE if not
  **/
   toolitem_signals[CREATE_MENU_PROXY] =
-    g_signal_new ("create_menu_proxy",
+    g_signal_new (I_("create-menu-proxy"),
                  G_OBJECT_CLASS_TYPE (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (GtkToolItemClass, create_menu_proxy),
@@ -204,22 +212,22 @@ gtk_tool_item_class_init (GtkToolItemClass *klass)
 
 /**
  * GtkToolItem::toolbar-reconfigured:
- * @toolitem: the object the signal was emitted on
+ * @tool_item: the object the signal was emitted on
  *
  * This signal is emitted when some property of the toolbar that the
  * item is a child of changes. For custom subclasses of #GtkToolItem,
  * the default handler of this signal use the functions
  * <itemizedlist>
- * <listitem>gtk_toolbar_get_orientation()</listitem>
- * <listitem>gtk_toolbar_get_style()</listitem>
- * <listitem>gtk_toolbar_get_icon_size()</listitem>
- * <listitem>gtk_toolbar_get_relief_style()</listitem>
+ * <listitem>gtk_tool_shell_get_orientation()</listitem>
+ * <listitem>gtk_tool_shell_get_style()</listitem>
+ * <listitem>gtk_tool_shell_get_icon_size()</listitem>
+ * <listitem>gtk_tool_shell_get_relief_style()</listitem>
  * </itemizedlist>
  * to find out what the toolbar should look like and change
  * themselves accordingly.
  **/
   toolitem_signals[TOOLBAR_RECONFIGURED] =
-    g_signal_new ("toolbar_reconfigured",
+    g_signal_new (I_("toolbar-reconfigured"),
                  G_OBJECT_CLASS_TYPE (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (GtkToolItemClass, toolbar_reconfigured),
@@ -228,7 +236,7 @@ gtk_tool_item_class_init (GtkToolItemClass *klass)
                  G_TYPE_NONE, 0);
 /**
  * GtkToolItem::set-tooltip:
- * @toolitem: the object the signal was emitted on
+ * @tool_item: the object the signal was emitted on
  * @tooltips: the #GtkTooltips
  * @tip_text: the tooltip text
  * @tip_private: the tooltip private text
@@ -238,9 +246,12 @@ gtk_tool_item_class_init (GtkToolItemClass *klass)
  * set the item's tooltip.
  *
  * Return value: %TRUE if the signal was handled, %FALSE if not
+ *
+ * Deprecated: 2.12: With the new tooltip API, there is no
+ *   need to use this signal anymore.
  **/
   toolitem_signals[SET_TOOLTIP] =
-    g_signal_new ("set_tooltip",
+    g_signal_new (I_("set-tooltip"),
                  G_OBJECT_CLASS_TYPE (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (GtkToolItemClass, set_tooltip),
@@ -272,18 +283,20 @@ gtk_tool_item_finalize (GObject *object)
 {
   GtkToolItem *item = GTK_TOOL_ITEM (object);
 
+  g_free (item->priv->menu_item_id);
+
   if (item->priv->menu_item)
     g_object_unref (item->priv->menu_item);
-  
-  if (G_OBJECT_CLASS (parent_class)->finalize)
-    G_OBJECT_CLASS (parent_class)->finalize (object);
+
+  G_OBJECT_CLASS (gtk_tool_item_parent_class)->finalize (object);
 }
 
 static void
-gtk_tool_item_parent_set   (GtkWidget   *toolitem,
-                           GtkWidget   *prev_parent)
+gtk_tool_item_parent_set (GtkWidget   *toolitem,
+                         GtkWidget   *prev_parent)
 {
-  _gtk_tool_item_toolbar_reconfigured (GTK_TOOL_ITEM (toolitem));
+  if (GTK_WIDGET (toolitem)->parent != NULL)
+    gtk_tool_item_toolbar_reconfigured (GTK_TOOL_ITEM (toolitem));
 }
 
 static void
@@ -300,13 +313,14 @@ gtk_tool_item_set_property (GObject      *object,
       gtk_tool_item_set_visible_horizontal (toolitem, g_value_get_boolean (value));
       break;
     case PROP_VISIBLE_VERTICAL:
-      gtk_tool_item_set_visible_horizontal (toolitem, g_value_get_boolean (value));
+      gtk_tool_item_set_visible_vertical (toolitem, g_value_get_boolean (value));
       break;
     case PROP_IS_IMPORTANT:
       gtk_tool_item_set_is_important (toolitem, g_value_get_boolean (value));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
     }
 }
 
@@ -331,9 +345,21 @@ gtk_tool_item_get_property (GObject    *object,
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
     }
 }
 
+static void
+gtk_tool_item_property_notify (GObject    *object,
+                              GParamSpec *pspec)
+{
+  GtkToolItem *tool_item = GTK_TOOL_ITEM (object);
+
+  if (tool_item->priv->menu_item && strcmp (pspec->name, "sensitive") == 0)
+    gtk_widget_set_sensitive (tool_item->priv->menu_item,
+                             GTK_WIDGET_SENSITIVE (tool_item));
+}
+
 static void
 create_drag_window (GtkToolItem *toolitem)
 {
@@ -399,7 +425,7 @@ gtk_tool_item_unrealize (GtkWidget *widget)
 
   destroy_drag_window (toolitem);
   
-  GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
+  GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->unrealize (widget);
 }
 
 static void
@@ -408,7 +434,7 @@ gtk_tool_item_map (GtkWidget *widget)
   GtkToolItem *toolitem;
 
   toolitem = GTK_TOOL_ITEM (widget);
-  GTK_WIDGET_CLASS (parent_class)->map (widget);
+  GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->map (widget);
   if (toolitem->priv->drag_window)
     gdk_window_show (toolitem->priv->drag_window);
 }
@@ -421,7 +447,7 @@ gtk_tool_item_unmap (GtkWidget *widget)
   toolitem = GTK_TOOL_ITEM (widget);
   if (toolitem->priv->drag_window)
     gdk_window_hide (toolitem->priv->drag_window);
-  GTK_WIDGET_CLASS (parent_class)->unmap (widget);
+  GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->unmap (widget);
 }
 
 static void
@@ -519,10 +545,10 @@ gtk_tool_item_get_icon_size (GtkToolItem *tool_item)
   g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ICON_SIZE_LARGE_TOOLBAR);
 
   parent = GTK_WIDGET (tool_item)->parent;
-  if (!parent || !GTK_IS_TOOLBAR (parent))
+  if (!parent || !GTK_IS_TOOL_SHELL (parent))
     return GTK_ICON_SIZE_LARGE_TOOLBAR;
 
-  return gtk_toolbar_get_icon_size (GTK_TOOLBAR (parent));
+  return gtk_tool_shell_get_icon_size (GTK_TOOL_SHELL (parent));
 }
 
 /**
@@ -546,10 +572,10 @@ gtk_tool_item_get_orientation (GtkToolItem *tool_item)
   g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);
 
   parent = GTK_WIDGET (tool_item)->parent;
-  if (!parent || !GTK_IS_TOOLBAR (parent))
+  if (!parent || !GTK_IS_TOOL_SHELL (parent))
     return GTK_ORIENTATION_HORIZONTAL;
 
-  return gtk_toolbar_get_orientation (GTK_TOOLBAR (parent));
+  return gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (parent));
 }
 
 /**
@@ -589,10 +615,10 @@ gtk_tool_item_get_toolbar_style (GtkToolItem *tool_item)
   g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_TOOLBAR_ICONS);
 
   parent = GTK_WIDGET (tool_item)->parent;
-  if (!parent || !GTK_IS_TOOLBAR (parent))
+  if (!parent || !GTK_IS_TOOL_SHELL (parent))
     return GTK_TOOLBAR_ICONS;
 
-  return gtk_toolbar_get_style (GTK_TOOLBAR (parent));
+  return gtk_tool_shell_get_style (GTK_TOOL_SHELL (parent));
 }
 
 /**
@@ -617,10 +643,10 @@ gtk_tool_item_get_relief_style (GtkToolItem *tool_item)
   g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_RELIEF_NONE);
 
   parent = GTK_WIDGET (tool_item)->parent;
-  if (!parent || !GTK_IS_TOOLBAR (parent))
+  if (!parent || !GTK_IS_TOOL_SHELL (parent))
     return GTK_RELIEF_NONE;
 
-  return gtk_toolbar_get_relief_style (GTK_TOOLBAR (parent));
+  return gtk_tool_shell_get_relief_style (GTK_TOOL_SHELL (parent));
 }
 
 /**
@@ -762,7 +788,7 @@ gtk_tool_item_set_is_important (GtkToolItem *tool_item, gboolean is_important)
 
       gtk_widget_queue_resize (GTK_WIDGET (tool_item));
 
-      g_object_notify (G_OBJECT (tool_item), "is_important");
+      g_object_notify (G_OBJECT (tool_item), "is-important");
     }
 }
 
@@ -777,7 +803,7 @@ gtk_tool_item_real_set_tooltip (GtkToolItem *tool_item,
   if (!child)
     return FALSE;
 
-  gtk_tooltips_set_tip (tooltips, child, tip_text, tip_private);
+  gtk_widget_set_tooltip_text (child, tip_text);
 
   return TRUE;
 }
@@ -787,13 +813,15 @@ gtk_tool_item_real_set_tooltip (GtkToolItem *tool_item,
  * @tool_item: a #GtkToolItem: 
  * @tooltips: The #GtkTooltips object to be used
  * @tip_text: text to be used as tooltip text for @tool_item
- * @tip_private: text to be used as rpivate tooltip text
+ * @tip_private: text to be used as private tooltip text
  *
  * Sets the #GtkTooltips object to be used for @tool_item, the
  * text to be displayed as tooltip on the item and the private text
  * to be used. See gtk_tooltips_set_tip().
  * 
  * Since: 2.4
+ *
+ * Deprecated: 2.12: Use gtk_tool_item_set_tooltip_text() instead.
  **/
 void
 gtk_tool_item_set_tooltip (GtkToolItem *tool_item,
@@ -809,15 +837,63 @@ gtk_tool_item_set_tooltip (GtkToolItem *tool_item,
                 tooltips, tip_text, tip_private, &retval);
 }
 
+/**
+ * gtk_tool_item_set_tooltip_text:
+ * @tool_item: a #GtkToolItem: 
+ * @text: text to be used as tooltip for @tool_item
+ *
+ * Sets the text to be displayed as tooltip on the item.
+ * See gtk_widget_set_tooltip_text().
+ *
+ * Since: 2.12
+ **/
+void
+gtk_tool_item_set_tooltip_text (GtkToolItem *tool_item,
+                               const gchar *text)
+{
+  GtkWidget *child;
+
+  g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
+
+  child = GTK_BIN (tool_item)->child;
+
+  if (child)
+    gtk_widget_set_tooltip_text (child, text);
+}
+
+/**
+ * gtk_tool_item_set_tooltip_markup:
+ * @tool_item: a #GtkToolItem: 
+ * @markup: markup text to be used as tooltip for @tool_item
+ *
+ * Sets the markup text to be displayed as tooltip on the item.
+ * See gtk_widget_set_tooltip_markup().
+ *
+ * Since: 2.12
+ **/
+void
+gtk_tool_item_set_tooltip_markup (GtkToolItem *tool_item,
+                                 const gchar *markup)
+{
+  GtkWidget *child;
+
+  g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
+
+  child = GTK_BIN (tool_item)->child;
+
+  if (child)
+    gtk_widget_set_tooltip_markup (child, markup);
+}
+
 /**
  * gtk_tool_item_set_use_drag_window:
- * @toolitem: a #GtkToolItem 
- * @use_drag_window: Whether @toolitem has a drag window.
+ * @tool_item: a #GtkToolItem 
+ * @use_drag_window: Whether @tool_item has a drag window.
  * 
- * Sets whether @toolitem has a drag window. When %TRUE the
+ * Sets whether @tool_item has a drag window. When %TRUE the
  * toolitem can be used as a drag source through gtk_drag_source_set().
- * When @toolitem has a drag window it will intercept all events,
- * even those that would otherwise be sent to a child of @toolitem.
+ * When @tool_item has a drag window it will intercept all events,
+ * even those that would otherwise be sent to a child of @tool_item.
  * 
  * Since: 2.4
  **/
@@ -851,12 +927,12 @@ gtk_tool_item_set_use_drag_window (GtkToolItem *toolitem,
 
 /**
  * gtk_tool_item_get_use_drag_window:
- * @toolitem: a #GtkToolItem 
+ * @tool_item: a #GtkToolItem 
  * 
- * Returns whether @toolitem has a drag window. See
+ * Returns whether @tool_item has a drag window. See
  * gtk_tool_item_set_use_drag_window().
  * 
- * Return value: %TRUE if @toolitem uses a drag window.
+ * Return value: %TRUE if @tool_item uses a drag window.
  * 
  * Since: 2.4
  **/
@@ -870,10 +946,10 @@ gtk_tool_item_get_use_drag_window (GtkToolItem *toolitem)
 
 /**
  * gtk_tool_item_set_visible_horizontal:
- * @toolitem: a #GtkToolItem
- * @visible_horizontal: Whether @toolitem is visible when in horizontal mode
+ * @tool_item: a #GtkToolItem
+ * @visible_horizontal: Whether @tool_item is visible when in horizontal mode
  * 
- * Sets whether @toolitem is visible when the toolbar is docked horizontally.
+ * Sets whether @tool_item is visible when the toolbar is docked horizontally.
  * 
  * Since: 2.4
  **/
@@ -889,7 +965,7 @@ gtk_tool_item_set_visible_horizontal (GtkToolItem *toolitem,
     {
       toolitem->priv->visible_horizontal = visible_horizontal;
 
-      g_object_notify (G_OBJECT (toolitem), "visible_horizontal");
+      g_object_notify (G_OBJECT (toolitem), "visible-horizontal");
 
       gtk_widget_queue_resize (GTK_WIDGET (toolitem));
     }
@@ -897,12 +973,12 @@ gtk_tool_item_set_visible_horizontal (GtkToolItem *toolitem,
 
 /**
  * gtk_tool_item_get_visible_horizontal:
- * @toolitem: a #GtkToolItem 
+ * @tool_item: a #GtkToolItem 
  * 
- * Returns whether the @toolitem is visible on toolbars that are
+ * Returns whether the @tool_item is visible on toolbars that are
  * docked horizontally.
  * 
- * Return value: %TRUE if @toolitem is visible on toolbars that are
+ * Return value: %TRUE if @tool_item is visible on toolbars that are
  * docked horizontally.
  * 
  * Since: 2.4
@@ -917,14 +993,14 @@ gtk_tool_item_get_visible_horizontal (GtkToolItem *toolitem)
 
 /**
  * gtk_tool_item_set_visible_vertical:
- * @toolitem: a #GtkToolItem 
- * @visible_vertical: whether @toolitem is visible when the toolbar
+ * @tool_item: a #GtkToolItem 
+ * @visible_vertical: whether @tool_item is visible when the toolbar
  * is in vertical mode
  *
- * Sets whether @toolitem is visible when the toolbar is docked
+ * Sets whether @tool_item is visible when the toolbar is docked
  * vertically. Some tool items, such as text entries, are too wide to be
  * useful on a vertically docked toolbar. If @visible_vertical is %FALSE
- * @toolitem will not appear on toolbars that are docked vertically.
+ * @tool_item will not appear on toolbars that are docked vertically.
  * 
  * Since: 2.4
  **/
@@ -940,7 +1016,7 @@ gtk_tool_item_set_visible_vertical (GtkToolItem *toolitem,
     {
       toolitem->priv->visible_vertical = visible_vertical;
 
-      g_object_notify (G_OBJECT (toolitem), "visible_vertical");
+      g_object_notify (G_OBJECT (toolitem), "visible-vertical");
 
       gtk_widget_queue_resize (GTK_WIDGET (toolitem));
     }
@@ -948,12 +1024,12 @@ gtk_tool_item_set_visible_vertical (GtkToolItem *toolitem,
 
 /**
  * gtk_tool_item_get_visible_vertical:
- * @toolitem: a #GtkToolItem 
+ * @tool_item: a #GtkToolItem 
  * 
- * Returns whether @toolitem is visible when the toolbar is docked vertically.
+ * Returns whether @tool_item is visible when the toolbar is docked vertically.
  * See gtk_tool_item_set_visible_vertical().
  * 
- * Return value: Whether @toolitem is visible when the toolbar is docked vertically
+ * Return value: Whether @tool_item is visible when the toolbar is docked vertically
  * 
  * Since: 2.4
  **/
@@ -985,7 +1061,8 @@ gtk_tool_item_retrieve_proxy_menu_item (GtkToolItem *tool_item)
   
   g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), NULL);
 
-  g_signal_emit (tool_item, toolitem_signals[CREATE_MENU_PROXY], 0, &retval);
+  g_signal_emit (tool_item, toolitem_signals[CREATE_MENU_PROXY], 0,
+                &retval);
   
   return tool_item->priv->menu_item;
 }
@@ -1021,6 +1098,34 @@ gtk_tool_item_get_proxy_menu_item (GtkToolItem *tool_item,
   return NULL;
 }
 
+/**
+ * gtk_tool_item_rebuild_menu()
+ * @tool_item: a #GtkToolItem
+ * 
+ * Calling this function signals to the toolbar that the
+ * overflow menu item for @tool_item has changed. If the
+ * overflow menu is visible when this function it called,
+ * the menu will be rebuilt.
+ *
+ * The function must be called when the tool item
+ * changes what it will do in response to the "create_menu_proxy"
+ * signal.
+ * 
+ * Since: 2.6
+ **/
+void
+gtk_tool_item_rebuild_menu (GtkToolItem *tool_item)
+{
+  GtkWidget *widget;
+  
+  g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
+
+  widget = GTK_WIDGET (tool_item);
+
+  if (GTK_IS_TOOL_SHELL (widget->parent))
+    gtk_tool_shell_rebuild_menu (GTK_TOOL_SHELL (widget->parent));
+}
+
 /**
  * gtk_tool_item_set_proxy_menu_item:
  * @tool_item: a #GtkToolItem:
@@ -1042,20 +1147,21 @@ gtk_tool_item_set_proxy_menu_item (GtkToolItem *tool_item,
   g_return_if_fail (menu_item == NULL || GTK_IS_MENU_ITEM (menu_item));
   g_return_if_fail (menu_item_id != NULL);
 
-  if (tool_item->priv->menu_item_id)
-    g_free (tool_item->priv->menu_item_id);
+  g_free (tool_item->priv->menu_item_id);
       
   tool_item->priv->menu_item_id = g_strdup (menu_item_id);
 
   if (tool_item->priv->menu_item != menu_item)
     {
       if (tool_item->priv->menu_item)
-       g_object_unref (G_OBJECT (tool_item->priv->menu_item));
+       g_object_unref (tool_item->priv->menu_item);
       
       if (menu_item)
        {
-         g_object_ref (menu_item);
-         gtk_object_sink (GTK_OBJECT (menu_item));
+         g_object_ref_sink (menu_item);
+
+         gtk_widget_set_sensitive (menu_item,
+                                   GTK_WIDGET_SENSITIVE (tool_item));
        }
       
       tool_item->priv->menu_item = menu_item;
@@ -1063,22 +1169,34 @@ gtk_tool_item_set_proxy_menu_item (GtkToolItem *tool_item,
 }
 
 /**
- * _gtk_tool_item_toolbar_reconfigured:
- * @tool_item: a #GtkToolItem
- * 
- * Emits the signal #GtkToolItem::toolbar_reconfigured on @tool_item. This
- * internal function is called by #GtkToolbar when some aspect of its
- * configuration changes.
- * 
- * Since: 2.4
+ * gtk_tool_item_toolbar_reconfigured:
+ * @tool_item: a #GtkToolItem
+ *
+ * Emits the signal #GtkToolItem::toolbar_reconfigured on @tool_item.
+ * #GtkToolbar and other #GtkToolShell implementations use this function
+ * to notify children, when some aspect of their configuration changes.
+ *
+ * Since: 2.14
  **/
 void
-_gtk_tool_item_toolbar_reconfigured (GtkToolItem *tool_item)
+gtk_tool_item_toolbar_reconfigured (GtkToolItem *tool_item)
 {
+  /* The slightely inaccurate name "gtk_tool_item_toolbar_reconfigured" was
+   * choosen over "gtk_tool_item_tool_shell_reconfigured", since the function
+   * emits the "toolbar-reconfigured" signal, not "tool-shell-reconfigured".
+   * Its not possible to rename the signal, and emitting another name than
+   * indicated by the function name would be quite confusing. That's the
+   * price of providing stable APIs.
+   */
   g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
 
   g_signal_emit (tool_item, toolitem_signals[TOOLBAR_RECONFIGURED], 0);
   
+  if (tool_item->priv->drag_window)
+    gdk_window_raise (tool_item->priv->drag_window);
+
   gtk_widget_queue_resize (GTK_WIDGET (tool_item));
 }
 
+#define __GTK_TOOL_ITEM_C__
+#include "gtkaliasdef.c"