]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkmenutoolbutton.c
Deprecate widget flag: GTK_WIDGET_VISIBLE
[~andy/gtk] / gtk / gtkmenutoolbutton.c
index 10f2e68357cac87a09d80cf577c07fea293266ee..3e3cf0775119ff4afe239d8f415f291ba0dd9813 100644 (file)
@@ -1,4 +1,4 @@
-/* GTK - The GTK+ Toolkit
+/* GTK - The GIMP Toolkit
  *
  * Copyright (C) 2003 Ricardo Fernandez Pascual
  * Copyright (C) 2004 Paolo Borelli
@@ -152,7 +152,7 @@ gtk_menu_tool_button_state_changed (GtkWidget    *widget,
   GtkMenuToolButton *button = GTK_MENU_TOOL_BUTTON (widget);
   GtkMenuToolButtonPrivate *priv = button->priv;
 
-  if (!GTK_WIDGET_IS_SENSITIVE (widget) && priv->menu)
+  if (!gtk_widget_is_sensitive (widget) && priv->menu)
     {
       gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->menu));
     }
@@ -217,6 +217,19 @@ gtk_menu_tool_button_class_init (GtkMenuToolButtonClass *klass)
   widget_class->state_changed = gtk_menu_tool_button_state_changed;
   toolitem_class->toolbar_reconfigured = gtk_menu_tool_button_toolbar_reconfigured;
 
+  /**
+   * GtkMenuToolButton::show-menu:
+   * @button: the object on which the signal is emitted
+   *
+   * The ::show-menu signal is emitted before the menu is shown.
+   *
+   * It can be used to populate the menu on demand, using 
+   * gtk_menu_tool_button_get_menu(). 
+
+   * Note that even if you populate the menu dynamically in this way, 
+   * you must set an empty menu on the #GtkMenuToolButton beforehand,
+   * since the arrow is made insensitive if the menu is not set.
+   */
   signals[SHOW_MENU] =
     g_signal_new (I_("show-menu"),
                   G_OBJECT_CLASS_TYPE (klass),
@@ -331,7 +344,7 @@ arrow_button_toggled_cb (GtkToggleButton   *togglebutton,
     return;
 
   if (gtk_toggle_button_get_active (togglebutton) &&
-      !GTK_WIDGET_VISIBLE (priv->menu))
+      !gtk_widget_get_visible (GTK_WIDGET (priv->menu)))
     {
       /* we get here only when the menu is activated by a key
        * press, so that we can select the first menu item */
@@ -398,7 +411,7 @@ gtk_menu_tool_button_init (GtkMenuToolButton *button)
 
   g_signal_connect (arrow_button, "toggled",
                    G_CALLBACK (arrow_button_toggled_cb), button);
-  g_signal_connect (arrow_button, "button_press_event",
+  g_signal_connect (arrow_button, "button-press-event",
                    G_CALLBACK (arrow_button_button_press_event_cb), button);
 }
 
@@ -423,15 +436,14 @@ gtk_menu_tool_button_destroy (GtkObject *object)
                                            arrow_button_button_press_event_cb, 
                                            button);
     }
-  
-  if (GTK_OBJECT_CLASS (gtk_menu_tool_button_parent_class)->destroy)
-    (*GTK_OBJECT_CLASS (gtk_menu_tool_button_parent_class)->destroy) (object);
+
+  GTK_OBJECT_CLASS (gtk_menu_tool_button_parent_class)->destroy (object);
 }
 
 /**
  * gtk_menu_tool_button_new:
- * @icon_widget: a widget that will be used as icon widget, or %NULL
- * @label: a string that will be used as label, or %NULL
+ * @icon_widget: (allow-none): a widget that will be used as icon widget, or %NULL
+ * @label: (allow-none): a string that will be used as label, or %NULL
  *
  * Creates a new #GtkMenuToolButton using @icon_widget as icon and
  * @label as label.
@@ -532,7 +544,7 @@ gtk_menu_tool_button_set_menu (GtkMenuToolButton *button,
 
   if (priv->menu != GTK_MENU (menu))
     {
-      if (priv->menu && GTK_WIDGET_VISIBLE (priv->menu))
+      if (priv->menu && gtk_widget_get_visible (GTK_WIDGET (priv->menu)))
         gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->menu));
 
       if (priv->menu)
@@ -584,8 +596,8 @@ gtk_menu_tool_button_get_menu (GtkMenuToolButton *button)
  * gtk_menu_tool_button_set_arrow_tooltip:
  * @button: a #GtkMenuToolButton
  * @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 private tooltip text
+ * @tip_text: (allow-none): text to be used as tooltip text for tool_item
+ * @tip_private: (allow-none): text to be used as private tooltip text
  *
  * Sets the #GtkTooltips object to be used for arrow button which
  * pops up the menu. See gtk_tool_item_set_tooltip() for setting