]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkmenubutton.c
treeview: Don't emit cursor-changed in destruction
[~andy/gtk] / gtk / gtkmenubutton.c
index 168ac9b2bc5322162b7cee67fc74ef501569e6bb..95b2bc73b187ca0dac80335dc4e6ab83793eef00 100644 (file)
@@ -516,28 +516,13 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
                                                         P_("The dropdown menu."),
                                                         GTK_TYPE_MENU,
                                                         G_PARAM_READWRITE));
-   /**
-   * GtkMenuButton:menu:
-   *
-   * The #GtkMenu that will be popped up when the button is clicked.
-   * This property has been renamed to "popup".  "menu" will be
-   * removed before 3.6.0.
-   *
-   * Since: 3.6
-   */
-  g_object_class_install_property (gobject_class,
-                                   PROP_POPUP, /* [sic] */
-                                   g_param_spec_object ("menu",
-                                                        P_("menu"),
-                                                        P_("The dropdown menu."),
-                                                        GTK_TYPE_MENU,
-                                                        G_PARAM_DEPRECATED | G_PARAM_READWRITE));
+
   /**
    * GtkMenuButton:menu-model:
    *
    * The #GMenuModel from which the menu to pop up will be created.
    * See gtk_menu_button_set_menu_model() for the interaction with the
-   * #GtkMenuButton:menu property.
+   * #GtkMenuButton:popup property.
    *
    * Since: 3.6
    */
@@ -699,7 +684,7 @@ _gtk_menu_button_set_popup_with_func (GtkMenuButton                 *menu_button
       gtk_widget_set_sensitive (GTK_WIDGET (menu_button), FALSE);
     }
 
-  g_object_notify (G_OBJECT (menu_button), "menu");
+  g_object_notify (G_OBJECT (menu_button), "popup");
   g_object_notify (G_OBJECT (menu_button), "menu-model");
 }
 
@@ -747,31 +732,18 @@ gtk_menu_button_get_popup (GtkMenuButton *menu_button)
   return GTK_MENU (menu_button->priv->popup);
 }
 
-void
-gtk_menu_button_set_menu (GtkMenuButton *menu_button,
-                          GtkWidget     *menu)
-{
-  gtk_menu_button_set_popup (menu_button, menu);
-}
-
-GtkMenu *
-gtk_menu_button_get_menu (GtkMenuButton *menu_button)
-{
-  return gtk_menu_button_get_popup (menu_button);
-}
-
 /**
  * gtk_menu_button_set_menu_model:
  * @menu_button: a #GtkMenuButton
  * @menu_model: (allow-none): a #GMenuModel
  *
- * Sets the #GMenuModel from which the #GtkMenuButton:menu property will be
+ * Sets the #GMenuModel from which the #GtkMenuButton:popup property will be
  * filled in, or %NULL to disable the button.
  *
  * The #GtkMenu will be created with gtk_menu_new_from_model(), so actions
  * will be connected as documented there.
  *
- * If you #GtkMenuButton:menu * is already set, then its content will be lost
+ * If #GtkMenuButton:popup is already set, then its content will be lost
  * and replaced by our newly created #GtkMenu.
  *
  * Since: 3.6
@@ -819,6 +791,23 @@ gtk_menu_button_get_menu_model (GtkMenuButton *menu_button)
   return menu_button->priv->model;
 }
 
+static void
+set_align_widget_pointer (GtkMenuButton *menu_button,
+                          GtkWidget     *align_widget)
+{
+  GtkMenuButtonPrivate *priv;
+
+  priv = menu_button->priv;
+
+  if (priv->align_widget)
+    g_object_remove_weak_pointer (G_OBJECT (priv->align_widget), (gpointer *) &priv->align_widget);
+
+  priv->align_widget = align_widget;
+
+  if (align_widget)
+    g_object_add_weak_pointer (G_OBJECT (priv->align_widget), (gpointer *) &priv->align_widget);
+}
+
 /**
  * gtk_menu_button_set_align_widget:
  * @menu_button: a #GtkMenuButton
@@ -845,10 +834,7 @@ gtk_menu_button_set_align_widget (GtkMenuButton *menu_button,
   if (priv->align_widget == align_widget)
     return;
 
-  priv->align_widget = align_widget;
-
-  if (priv->align_widget)
-    g_object_add_weak_pointer (G_OBJECT (priv->align_widget), (gpointer *) &priv->align_widget);
+  set_align_widget_pointer (menu_button, align_widget);
 
   g_object_notify (G_OBJECT (menu_button), "align-widget");
 }
@@ -883,8 +869,8 @@ gtk_menu_button_get_align_widget (GtkMenuButton *menu_button)
  * If the menu when popped out would have collided with screen edges,
  * we will do our best to keep it inside the screen and fully visible.
  *
- * If you pass GTK_ARROW_NONE for a @direction, the menu will behave
- * as if you passed GTK_ARROW_DOWN (although you won't see any arrows).
+ * If you pass %GTK_ARROW_NONE for a @direction, the menu will behave
+ * as if you passed %GTK_ARROW_DOWN (although you won't see any arrows).
  *
  * Since: 3.6
  */
@@ -939,8 +925,11 @@ gtk_menu_button_dispose (GObject *object)
                                             menu_deactivate_cb,
                                             object);
       gtk_menu_detach (GTK_MENU (priv->popup));
+      priv->popup = NULL;
     }
 
+  set_align_widget_pointer (GTK_MENU_BUTTON (object), NULL);
+
   g_clear_object (&priv->model);
 
   G_OBJECT_CLASS (gtk_menu_button_parent_class)->dispose (object);