changeset 26198:cb3c6ec9291e

merge of '6034e4df300b7da5e8fc3095e128f6215af903ab' and '6f6a810b0411a1e2b7a1bba79dae2b02ea200d19'
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sat, 21 Feb 2009 05:15:28 +0000
parents 1830d339f9b9 (diff) 9b0761b77218 (current diff)
children 6cf36f68033c
files pidgin/gtkmedia.c
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkmedia.c	Sat Feb 21 05:01:10 2009 +0000
+++ b/pidgin/gtkmedia.c	Sat Feb 21 05:15:28 2009 +0000
@@ -58,6 +58,7 @@
 	GstElement *send_level;
 	GstElement *recv_level;
 
+	GtkItemFactory *item_factory;
 	GtkWidget *menubar;
 	GtkWidget *statusbar;
 
@@ -241,7 +242,6 @@
 static GtkWidget *
 setup_menubar(PidginMedia *window)
 {
-	GtkItemFactory *item_factory;
 	GtkAccelGroup *accel_group;
 	GtkWidget *menu;
 
@@ -249,19 +249,20 @@
 	gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
 	g_object_unref(accel_group);
 
-	item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR,
+	window->priv->item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR,
 			"<main>", accel_group);
 
-	gtk_item_factory_set_translate_func(item_factory,
+	gtk_item_factory_set_translate_func(window->priv->item_factory,
 			(GtkTranslateFunc)item_factory_translate_func,
 			NULL, NULL);
 
-	gtk_item_factory_create_items(item_factory, menu_item_count,
-			menu_items, window);
+	gtk_item_factory_create_items(window->priv->item_factory,
+			menu_item_count, menu_items, window);
 	g_signal_connect(G_OBJECT(accel_group), "accel-changed",
 			G_CALLBACK(pidgin_save_accels_cb), NULL);
 
-	menu = gtk_item_factory_get_widget(item_factory, "<main>");
+	menu = gtk_item_factory_get_widget(
+			window->priv->item_factory, "<main>");
 
 	gtk_widget_show(menu);
 	return menu;
@@ -377,6 +378,11 @@
 		gtkmedia->priv->media = NULL;
 	}
 
+	if (gtkmedia->priv->item_factory) {
+		g_object_unref(gtkmedia->priv->item_factory);
+		gtkmedia->priv->item_factory = NULL;
+	}
+
 	if (gtkmedia->priv->send_level) {
 		gst_object_unref(gtkmedia->priv->send_level);
 		gtkmedia->priv->send_level = NULL;