[glade3] * plugins/gtk+/glade-gtk.c: Fixed floating project menus when context menu is fired (bug 141714).



commit f380b4036ae9ecd6e56d29971beb512fa52fed3c
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Fri Dec 17 03:58:21 2010 +0900

    	* plugins/gtk+/glade-gtk.c: Fixed floating project menus when context menu is fired (bug 141714).

 ChangeLog                |    2 ++
 plugins/gtk+/glade-gtk.c |   25 +++++++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8115674..f6c8d2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,8 @@
 	* gladeui/glade-editor-table.c: Fire a warning when entry is edited with no widget
 	  loaded, also change the ->loading flag strategy for blocking signal emission instead.
 
+	* plugins/gtk+/glade-gtk.c: Fixed floating project menus when context menu is fired (bug 141714).
+
 2010-12-15  Tristan Van Berkom <tristanvb openismus com>
 
 	* gladeui/glade-project.c: Cleanup glade_project_remove_object(), make sure row_deleted is
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index d19c4ae..3297df1 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -6722,6 +6722,8 @@ glade_gtk_menu_shell_action_activate (GladeWidgetAdaptor *adaptor,
 		GWA_GET_CLASS (GTK_TYPE_CONTAINER)->action_activate (adaptor,
 								     object,
 								     action_path);
+
+	gtk_menu_shell_deactivate (GTK_MENU_SHELL (object));
 }
 
 /* ----------------------------- GtkMenuItem ------------------------------ */
@@ -6747,16 +6749,20 @@ glade_gtk_menu_item_action_activate (GladeWidgetAdaptor *adaptor,
 				     GObject *object,
 				     const gchar *action_path)
 {
+	GObject *obj = NULL, *shell = NULL;
+	GladeWidget *w = glade_widget_get_from_gobject (object);
+		
+	while ((w = glade_widget_get_parent (w)))
+	{
+		obj = glade_widget_get_object (w);
+		if (GTK_IS_MENU_SHELL (obj)) shell = obj;
+	}
+
 	if (strcmp (action_path, "launch_editor") == 0)
 	{
-		GladeWidget *w = glade_widget_get_from_gobject (object);
-		
-		while ((w = glade_widget_get_parent (w)))
-		{
-			GObject *obj = glade_widget_get_object (w);
-			if (GTK_IS_MENU_SHELL (obj)) object = obj;
-		}
-		
+		if (shell)
+			object = shell;
+
 		if (GTK_IS_MENU_BAR (object))
 			glade_gtk_menu_shell_launch_editor (object, _("Edit Menu Bar"));
 		else if (GTK_IS_MENU (object))
@@ -6766,6 +6772,9 @@ glade_gtk_menu_item_action_activate (GladeWidgetAdaptor *adaptor,
 		GWA_GET_CLASS (GTK_TYPE_CONTAINER)->action_activate (adaptor,
 								     object,
 								     action_path);
+
+	if (shell)
+		gtk_menu_shell_deactivate (GTK_MENU_SHELL (shell));
 }
 
 



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