[gtk+] menu button: avoid property order dependencies



commit 18749136dad97a9cb8130fab392cde557d335a72
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Feb 22 12:49:24 2014 -0500

    menu button: avoid property order dependencies
    
    With the code as written, use-popover has to be set first,
    before the model. To avoid this ordering dependency, re-set
    the model when use-popover changes.

 gtk/gtkmenubutton.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index 763f110..dd966a4 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -1060,7 +1060,14 @@ gtk_menu_button_set_use_popover (GtkMenuButton *menu_button,
 
   priv->use_popover = use_popover;
 
+  g_object_freeze_notify (G_OBJECT (menu_button));
+
+  if (priv->model)
+    gtk_menu_button_set_menu_model (menu_button, priv->model);
+
   g_object_notify (G_OBJECT (menu_button), "use-popover");
+
+  g_object_thaw_notify (G_OBJECT (menu_button));
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]