gconf-editor r1422 - in trunk: . src



Author: cosimoc
Date: Wed Oct  1 18:05:33 2008
New Revision: 1422
URL: http://svn.gnome.org/viewvc/gconf-editor?rev=1422&view=rev

Log:
2008-10-01  Cosimo Cecchi  <cosimoc gnome org>

	* src/gconf-bookmarks-dialog.c: (gconf_bookmarks_dialog_destroy),
	(gconf_bookmarks_dialog_populate_model),
	(gconf_bookmarks_dialog_update_gconf_key),
	(gconf_bookmarks_dialog_init):
	* src/gconf-bookmarks.c: (gconf_bookmarks_update_menu),
	(gconf_bookmarks_add_bookmark), (remove_notify_id),
	(gconf_bookmarks_hook_up_menu):
	* src/gconf-editor-window.c: (gconf_editor_window_finalize):
	* src/gconf-tree-model.c: (gconf_tree_model_finalize),
	(gconf_tree_model_class_init):
	Always unref the GConfClient objects retrieved with
	gconf_client_get_default ().


Modified:
   trunk/ChangeLog
   trunk/src/gconf-bookmarks-dialog.c
   trunk/src/gconf-bookmarks.c
   trunk/src/gconf-editor-window.c
   trunk/src/gconf-tree-model.c

Modified: trunk/src/gconf-bookmarks-dialog.c
==============================================================================
--- trunk/src/gconf-bookmarks-dialog.c	(original)
+++ trunk/src/gconf-bookmarks-dialog.c	Wed Oct  1 18:05:33 2008
@@ -47,6 +47,8 @@
 		gconf_client_remove_dir (client, BOOKMARKS_KEY, NULL);
 		dialog->notify_id = 0;
 	}
+
+	g_object_unref (client);
 	
 	if (GTK_OBJECT_CLASS (gconf_bookmarks_dialog_parent_class)->destroy) {
 		(* GTK_OBJECT_CLASS (gconf_bookmarks_dialog_parent_class)->destroy) (object);
@@ -89,6 +91,8 @@
 				    -1);
 	}
 	dialog->changing_model = FALSE;
+
+	g_object_unref (client);
 }
 
 static void
@@ -123,6 +127,8 @@
 	dialog->changing_key = TRUE;
 	gconf_client_set_list (client, BOOKMARKS_KEY,
 			       GCONF_VALUE_STRING, list, NULL);
+
+	g_object_unref (client);
 }
 
 static void
@@ -246,6 +252,8 @@
 						     dialog,
 						     NULL,
 						     NULL);
+
+	g_object_unref (client);
 }
 
 

Modified: trunk/src/gconf-bookmarks.c
==============================================================================
--- trunk/src/gconf-bookmarks.c	(original)
+++ trunk/src/gconf-bookmarks.c	Wed Oct  1 18:05:33 2008
@@ -92,11 +92,13 @@
 {
 	GSList *list, *tmp;
 	GtkWidget *menuitem, *window;
+	GConfClient *client;
 
 	window = g_object_get_data (G_OBJECT (menu), "editor-window");
+	client = gconf_client_get_default ();
 	
 	/* Get the old list and then set it */
-	list = gconf_client_get_list (gconf_client_get_default (),
+	list = gconf_client_get_list (client,
 				     "/apps/gconf-editor/bookmarks", GCONF_VALUE_STRING, NULL);
 
 	if (list != NULL) {
@@ -115,6 +117,8 @@
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
 		gtk_widget_show_all (menuitem);
 	}
+
+	g_object_unref (client);
 }
 
 static void
@@ -143,9 +147,12 @@
 gconf_bookmarks_add_bookmark (const char *path)
 {
 	GSList *list, *tmp;
+	GConfClient *client;
+
+	client = gconf_client_get_default ();
 
 	/* Get the old list and then set it */
-	list = gconf_client_get_list (gconf_client_get_default (),
+	list = gconf_client_get_list (client,
 				     "/apps/gconf-editor/bookmarks", GCONF_VALUE_STRING, NULL);
 
 	/* FIXME: We need error handling here, also this function leaks memory */
@@ -161,15 +168,21 @@
 	/* Append the new bookmark */
 	list = g_slist_append (list, g_strdup (path));
 	
-	gconf_client_set_list (gconf_client_get_default (),
+	gconf_client_set_list (client,
 			       "/apps/gconf-editor/bookmarks", GCONF_VALUE_STRING, list, NULL);
 	g_slist_free (list);
+	g_object_unref (client);
 }
 
 static void
 remove_notify_id (gpointer data)
 {
-	gconf_client_notify_remove (gconf_client_get_default (), GPOINTER_TO_INT (data));
+	GConfClient *client;
+
+	client = gconf_client_get_default ();
+	gconf_client_notify_remove (client, GPOINTER_TO_INT (data));
+
+	g_object_unref (client);
 }
 
 void
@@ -222,4 +235,6 @@
 		gtk_widget_set_sensitive (add_bookmark, FALSE);
 		gtk_widget_set_sensitive (edit_bookmarks, FALSE);
 	}
+
+	g_object_unref (client);
 }

Modified: trunk/src/gconf-editor-window.c
==============================================================================
--- trunk/src/gconf-editor-window.c	(original)
+++ trunk/src/gconf-editor-window.c	Wed Oct  1 18:05:33 2008
@@ -1392,10 +1392,9 @@
 		gconf_client_notify_remove (client, window->icons_notify_id);
 
 	g_object_unref (client);
-
-	/* FIXME: unref client?*/
+	g_object_unref (window->client);
 	
-	G_OBJECT_CLASS(gconf_editor_window_parent_class)->finalize (object);
+	G_OBJECT_CLASS (gconf_editor_window_parent_class)->finalize (object);
     
 }
 

Modified: trunk/src/gconf-tree-model.c
==============================================================================
--- trunk/src/gconf-tree-model.c	(original)
+++ trunk/src/gconf-tree-model.c	Wed Oct  1 18:05:33 2008
@@ -486,8 +486,22 @@
 }
 
 static void
+gconf_tree_model_finalize (GObject *obj)
+{
+	GConfTreeModel *model = GCONF_TREE_MODEL (obj);
+
+	if (model->client) {
+		g_object_unref (model->client);
+		model->client = NULL;
+	}
+
+	G_OBJECT_CLASS (gconf_tree_model_parent_class)->finalize (obj);
+}
+
+static void
 gconf_tree_model_class_init (GConfTreeModelClass *klass)
 {
+	G_OBJECT_CLASS (klass)->finalize = gconf_tree_model_finalize;
 }
 
 static void



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