about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJosh Rickmar <jrick@devio.us>2012-08-07 12:14:12 -0400
committerJosh Rickmar <jrick@devio.us>2012-08-07 12:14:12 -0400
commit1fd4fdf576854c4f6e9175876d6827171e7fc300 (patch)
tree9df6f3da29ebfa712f87c4554adf424dbe45bc4e
parentcaf699f484d466a12f1829671d80dbabad297826 (diff)
downloadxombrero-1fd4fdf576854c4f6e9175876d6827171e7fc300.tar.gz
Destroy a hidden arrow menu instead of simply unreferencing it. This
keeps the toplevel window count from incrementing each time the arrow
is clicked.
-rw-r--r--xombrero.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/xombrero.c b/xombrero.c
index f8b3df9..e8bc539 100644
--- a/xombrero.c
+++ b/xombrero.c
@@ -7929,6 +7929,13 @@ menuitem_response(struct tab *t)
 	gtk_notebook_set_current_page(notebook, t->tab_id);
 }
 
+int
+destroy_menu(GtkWidget *w, GdkEventFocus *e, void *notused)
+{
+	gtk_widget_destroy(w);
+	return (XT_CB_PASSTHROUGH);
+}
+
 gboolean
 arrow_cb(GtkWidget *w, GdkEventButton *event, gpointer user_data)
 {
@@ -7963,12 +7970,9 @@ arrow_cb(GtkWidget *w, GdkEventButton *event, gpointer user_data)
 		gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
 		    bevent->button, bevent->time);
 
-		/* unref object so it'll free itself when popped down */
-#if !GTK_CHECK_VERSION(3, 0, 0)
-		/* XXX does not need unref with gtk+3? */
-		g_object_ref_sink(menu);
-		g_object_unref(menu);
-#endif
+		g_object_connect(G_OBJECT(menu),
+		    "signal::hide", G_CALLBACK(destroy_menu), NULL,
+		    (char *)NULL);
 
 		return (TRUE /* eat event */);
 	}