[evolution-patches] gconf unref fixes



don't leak refs to gconf-client

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
? composer/42798.patch
? composer/composer.patch
? filter/filters.dtd
? filter/pipe-filter-action.patch
? mail/43214.patch
? mail/43392.patch
? mail/crash.txt
? mail/empty-subject.patch
? mail/foo
? mail/message-tree.c
? mail/message-tree.h
Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.537
diff -u -r1.537 ChangeLog
--- composer/ChangeLog	20 May 2003 18:26:09 -0000	1.537
+++ composer/ChangeLog	21 May 2003 19:24:05 -0000
@@ -1,3 +1,21 @@
+2003-05-21  Jeffrey Stedfast  <fejj ximian com>
+
+	* e-msg-composer.c (composer_get_default_charset_setting): Same as the rest.
+	(setup_ui): We didn't even seem to be using the gconf client here. Removed.
+	(e_msg_composer_load_config): Unref the gconf client after we're finished.
+	(e_msg_composer_new): Same.
+	(e_msg_composer_new_post): Here too.
+	(e_msg_composer_set_view_from): And here.
+	(e_msg_composer_set_view_replyto): And here.
+	(e_msg_composer_set_view_cc): Here too.
+	(e_msg_composer_set_view_bcc): Again here.
+
+	* e-msg-composer-hdrs.c (create_from_optionmenu): Same as below.
+	(e_msg_composer_hdrs_set_from_account): Here too.
+
+	* e-msg-composer-attachment-bar.c (get_default_charset): Unref the
+	gconf client.
+
 2003-05-20  Larry Ewing  <lewing ximian com>
 
 	* e-msg-composer.c (composer_settings_update): set the various
Index: composer/e-msg-composer-attachment-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-attachment-bar.c,v
retrieving revision 1.66
diff -u -r1.66 e-msg-composer-attachment-bar.c
--- composer/e-msg-composer-attachment-bar.c	28 Apr 2003 15:58:43 -0000	1.66
+++ composer/e-msg-composer-attachment-bar.c	21 May 2003 19:24:06 -0000
@@ -730,6 +730,7 @@
 	
 	gconf = gconf_client_get_default ();
 	buf = gconf_client_get_string (gconf, "/apps/evolution/mail/composer/charset", NULL);
+	g_object_unref (gconf);
 	
 	if (buf != NULL) {
 		charset = e_iconv_charset_name (buf);
Index: composer/e-msg-composer-hdrs.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-hdrs.c,v
retrieving revision 1.111
diff -u -r1.111 e-msg-composer-hdrs.c
--- composer/e-msg-composer-hdrs.c	19 Apr 2003 22:10:35 -0000	1.111
+++ composer/e-msg-composer-hdrs.c	21 May 2003 19:24:07 -0000
@@ -308,6 +308,7 @@
 	
 	gconf = gconf_client_get_default ();
 	uid = gconf_client_get_string (gconf, "/apps/evolution/mail/default_account", NULL);
+	g_object_unref (gconf);
 	
 	/* Make list of account email addresses */
 	addresses = g_ptr_array_new ();
@@ -1009,10 +1010,11 @@
 	
 	omenu = GTK_OPTION_MENU (e_msg_composer_hdrs_get_from_omenu (hdrs));
 	
-	gconf = gconf_client_get_default ();
-	
-	if (!account_name)
+	if (!account_name) {
+		gconf = gconf_client_get_default ();
 		uid = gconf_client_get_string (gconf, "/apps/evolution/mail/default_account", NULL);
+		g_object_unref (gconf);
+	}
 	
 	/* find the item that represents the account and activate it */
 	l = hdrs->priv->from_options;
Index: composer/e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.392
diff -u -r1.392 e-msg-composer.c
--- composer/e-msg-composer.c	20 May 2003 18:26:09 -0000	1.392
+++ composer/e-msg-composer.c	21 May 2003 19:24:11 -0000
@@ -243,6 +243,8 @@
 	if (buf == NULL)
 		buf = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL);
 	
+	g_object_unref (gconf);
+	
 	if (buf != NULL) {
 		charset = e_iconv_charset_name (buf);
 		g_free (buf);
@@ -2074,7 +2076,6 @@
 	BonoboUIContainer *container;
 	const char *default_charset;
 	gboolean hide_smime;
-	GConfClient *gconf;
 	
 	container = bonobo_window_get_ui_container (BONOBO_WINDOW (composer));
 	
@@ -2094,7 +2095,6 @@
 	
 	/* Populate the Charset Encoding menu and default it to whatever the user
 	   chose as his default charset in the mailer */
-	gconf = gconf_client_get_default ();
 	default_charset = composer_get_default_charset_setting ();
 	e_charset_picker_bonobo_ui_populate (composer->uic, "/menu/Edit/EncodingPlaceholder",
 					     default_charset,
@@ -2731,6 +2731,8 @@
 		gconf, "/apps/evolution/mail/composer/view/Bcc", NULL);
 	composer->view_subject = gconf_client_get_bool (
 		gconf, "/apps/evolution/mail/composer/view/Subject", NULL);
+	
+	g_object_unref (gconf);
 }
 
 static int
@@ -2970,14 +2972,13 @@
 				    "FormatHTML", TC_CORBA_boolean, composer->send_html,
 				    NULL);
 	
-
 	gconf = gconf_client_get_default ();
 	composer_settings_update (gconf, 0, NULL, composer);
 	gconf_client_add_dir (gconf, "/apps/evolution/mail/composer", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 	composer->notify_id = gconf_client_notify_add (gconf, "/apps/evolution/mail/composer",
 						       composer_settings_update, composer, NULL, NULL);
 	g_object_unref (gconf);
-
+	
 	editor_server = bonobo_widget_get_objref (BONOBO_WIDGET (composer->editor));
 	
 	/* FIXME: handle exceptions */
@@ -3081,6 +3082,7 @@
 	
 	gconf = gconf_client_get_default ();
 	send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
+	g_object_unref (gconf);
 	
 	new = create_composer (E_MSG_COMPOSER_VISIBLE_MASK_MAIL);
 	if (new) {
@@ -3108,6 +3110,7 @@
 	
 	gconf = gconf_client_get_default ();
 	send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
+	g_object_unref (gconf);
 	
 	new = create_composer (E_MSG_COMPOSER_VISIBLE_MASK_POST);
 	if (new) {
@@ -4608,6 +4611,7 @@
 	
 	gconf = gconf_client_get_default ();
 	gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/From", view_from, NULL);
+	g_object_unref (gconf);
 	
 	e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (composer->hdrs),
 					 e_msg_composer_get_visible_flags (composer));
@@ -4655,6 +4659,7 @@
 	
 	gconf = gconf_client_get_default ();
 	gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/ReplyTo", view_replyto, NULL);
+	g_object_unref (gconf);
 	
 	e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (composer->hdrs),
 					 e_msg_composer_get_visible_flags (composer));
@@ -4702,6 +4707,7 @@
 	
 	gconf = gconf_client_get_default ();
 	gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Cc", view_cc, NULL);
+	g_object_unref (gconf);
 	
 	e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (composer->hdrs),
 					 e_msg_composer_get_visible_flags (composer));
@@ -4749,6 +4755,7 @@
 	
 	gconf = gconf_client_get_default ();
 	gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Bcc", view_bcc, NULL);
+	g_object_unref (gconf);
 	
 	e_msg_composer_hdrs_set_visible (E_MSG_COMPOSER_HDRS (composer->hdrs),
 					 e_msg_composer_get_visible_flags (composer));
Index: filter/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/filter/ChangeLog,v
retrieving revision 1.367
diff -u -r1.367 ChangeLog
--- filter/ChangeLog	6 May 2003 17:54:19 -0000	1.367
+++ filter/ChangeLog	21 May 2003 19:24:14 -0000
@@ -1,3 +1,10 @@
+2003-05-21  Jeffrey Stedfast  <fejj ximian com>
+
+	* filter-source.c (filter_source_get_sources): Same as below.
+
+	* filter-label.c (xml_create): Unref the gconf client when we're
+	finished with it.
+
 2003-05-05  Jeffrey Stedfast  <fejj ximian com>
 
 	* filter-colour.c (format_sexp): Format the colour string in a way
Index: filter/filter-label.c
===================================================================
RCS file: /cvs/gnome/evolution/filter/filter-label.c,v
retrieving revision 1.13
diff -u -r1.13 filter-label.c
--- filter/filter-label.c	20 Nov 2002 20:24:24 -0000	1.13
+++ filter/filter-label.c	21 May 2003 19:24:14 -0000
@@ -177,4 +177,6 @@
 		l = l->next;
 	}
 	g_slist_free (list);
+	
+	g_object_unref (gconf);
 }
Index: filter/filter-source.c
===================================================================
RCS file: /cvs/gnome/evolution/filter/filter-source.c,v
retrieving revision 1.20
diff -u -r1.20 filter-source.c
--- filter/filter-source.c	26 Mar 2003 20:28:54 -0000	1.20
+++ filter/filter-source.c	21 May 2003 19:24:15 -0000
@@ -345,12 +345,16 @@
 {
 	EAccountList *accounts;
 	const EAccount *account;
+	GConfClient *gconf;
 	EIterator *it;
 	char *uri;
 	CamelURL *url;
-
+	
 	/* should this get the global object from mail? */
-	accounts = e_account_list_new(gconf_client_get_default());
+	gconf = gconf_client_get_default ();
+	accounts = e_account_list_new (gconf);
+	g_object_unref (gconf);
+	
 	for (it = e_list_get_iterator((EList *)accounts);
 	     e_iterator_is_valid(it);
 	     e_iterator_next(it)) {
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2736
diff -u -r1.2736 ChangeLog
--- mail/ChangeLog	21 May 2003 15:27:53 -0000	1.2736
+++ mail/ChangeLog	21 May 2003 19:24:55 -0000
@@ -1,3 +1,41 @@
+2003-05-21  Jeffrey Stedfast  <fejj ximian com>
+
+	* mail-account-gui.c (sig_add_new_signature): Unref the gconf client.
+
+	* folder-browser.c (save_cursor_pos): Unref the gconf client after
+	using it.
+	(folder_browser_set_message_preview): Same.
+	(folder_browser_toggle_preview): Here too.
+	(folder_browser_toggle_threads): And here.
+	(folder_browser_toggle_hide_deleted): Here as well.
+	(folder_browser_set_message_display_style): And here.
+	(fb_resize_cb): Here.
+	(paned_realised): And here.
+	(done_message_selected): And everywhere.
+
+	* folder-browser-ui.c (folder_browser_ui_add_message): Unref the
+	gconf client when we're finished with it.
+	(folder_browser_ui_add_list): Same.
+	(folder_browser_ui_add_global): Here too.
+
+	* component-factory.c (owner_unset_cb): Unref the gconf client
+	when we're finished with it.
+
+	* mail-config.c (mail_config_write_on_exit): On exit, free our
+	objects and such.
+
+	* mail-callbacks.c (ask_confirm_for_unwanted_html_mail): Unref the
+	gconf client when we're finished with it.
+	(ask_confirm_for_empty_subject): Same.
+	(ask_confirm_for_only_bcc): Here too.
+	(composer_get_message): And here.
+	(create_msg_composer): Here too.
+	(mail_generate_reply): And here.
+	(forward): Same here.
+	(transfer_msg_done): And here too.
+	(delete_msg): And here.
+	(confirm_expunge): Here too.
+
 2003-05-20  Jeffrey Stedfast  <fejj ximian com>
 
 	* mail-importer.c: Updated copyright years.
Index: mail/component-factory.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/component-factory.c,v
retrieving revision 1.326
diff -u -r1.326 component-factory.c
--- mail/component-factory.c	20 May 2003 14:53:59 -0000	1.326
+++ mail/component-factory.c	21 May 2003 19:24:56 -0000
@@ -912,12 +912,11 @@
 static void
 owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data)
 {
-	GConfClient *gconf;
+	GConfClient *gconf = gconf_client_get_default();
 	CORBA_Environment ev;
 	int i;
 	EIterator *it;
 
-	gconf = gconf_client_get_default ();
 	for (i=0;i<sizeof(shell_component_handlers)/sizeof(shell_component_handlers[0]);i++)
 		g_signal_handler_disconnect((GtkObject *)shell_component, shell_component_handlers[i].hand);
 	
@@ -976,6 +975,8 @@
 			break;
 		}
 	}
+
+	g_object_unref(gconf);
 }
 
 static void
Index: mail/folder-browser-ui.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/folder-browser-ui.c,v
retrieving revision 1.79
diff -u -r1.79 folder-browser-ui.c
--- mail/folder-browser-ui.c	13 May 2003 16:12:10 -0000	1.79
+++ mail/folder-browser-ui.c	21 May 2003 19:24:58 -0000
@@ -514,7 +514,7 @@
 {
 	BonoboUIComponent *uic = fb->uicomp;
 	FolderBrowserSelectionState prev_state;
-	GConfClient *gconf;
+	GConfClient *gconf = gconf_client_get_default();
 	int style;
 	
 	if (fb->sensitise_state) {
@@ -524,8 +524,6 @@
 	
 	ui_add (fb, "message", message_verbs, message_pixcache);
 	
-	gconf = gconf_client_get_default ();
-	
 	/* Display Style */
 	style = gconf_client_get_int (gconf, "/apps/evolution/mail/display/message_style", NULL);
 	style = style >= 0 && style < MAIL_CONFIG_DISPLAY_MAX ? style : 0;
@@ -550,17 +548,17 @@
 	/* Charset picker */
 	e_charset_picker_bonobo_ui_populate (uic, "/menu/View", FB_DEFAULT_CHARSET,
 					     folder_browser_charset_changed, fb);
+
+	g_object_unref(gconf);
 }
 
 void 
 folder_browser_ui_add_list (FolderBrowser *fb)
 {
 	BonoboUIComponent *uic = fb->uicomp;
-	GConfClient *gconf;
+	GConfClient *gconf = gconf_client_get_default();
 	int state;
 	
-	gconf = gconf_client_get_default ();
-	
 	if (fb->sensitise_state) {
 		g_hash_table_destroy (fb->sensitise_state);
 		fb->sensitise_state = NULL;
@@ -595,6 +593,8 @@
 	/* View menu */
 	if (fb->view_instance == NULL)
 		folder_browser_ui_setup_view_menus (fb);
+
+	g_object_unref(gconf);
 }
 
 void 
@@ -610,7 +610,7 @@
 {
 	BonoboUIComponent *uic = fb->uicomp;
 	gboolean show_preview;
-	GConfClient *gconf;
+	GConfClient *gconf = gconf_client_get_default();
 	int paned_size;
 	
 	if (fb->sensitise_state) {
@@ -620,8 +620,6 @@
 	
 	ui_add (fb, "global", global_verbs, global_pixcache);
 	
-	gconf = gconf_client_get_default ();
-	
 	/* (Pre)view pane size (do this first because it affects the
            preview settings - see folder_browser_set_message_preview()
            internals for details) */
@@ -643,6 +641,8 @@
 	/* Stop button */
 	/* TODO: Go through cache, but we can't becaus eof mail-mt.c:set_stop at the moment */
 	bonobo_ui_component_set_prop (uic, "/commands/MailStop", "sensitive", "0", NULL);
+
+	g_object_unref(gconf);
 }
 
 void 
Index: mail/folder-browser.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/folder-browser.c,v
retrieving revision 1.344
diff -u -r1.344 folder-browser.c
--- mail/folder-browser.c	14 May 2003 18:47:10 -0000	1.344
+++ mail/folder-browser.c	21 May 2003 19:25:02 -0000
@@ -160,12 +160,9 @@
 {
 	FolderBrowser *folder_browser;
 	CORBA_Environment ev;
-	GConfClient *gconf;
 	
 	folder_browser = FOLDER_BROWSER (object);
-	
-	gconf = gconf_client_get_default ();
-	
+		
 	CORBA_exception_init (&ev);
 	
 	if (folder_browser->seen_id != 0) {
@@ -1123,6 +1120,7 @@
 	
 	gconf = gconf_client_get_default ();
 	paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);
+	g_object_unref (gconf);
 	
 	adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (fb->message_list));
 	y += adj->value - ((paned_size - height) / 2);
@@ -1158,7 +1156,8 @@
 	
 	gconf = gconf_client_get_default ();
 	paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);
-	
+	g_object_unref (gconf);
+
 	if (show_preview) {
 		y = save_cursor_pos (folder_browser);
 		gtk_paned_set_position (GTK_PANED (folder_browser->vpaned), paned_size);
@@ -1300,13 +1299,18 @@
 {
 	FolderBrowser *fb = user_data;
 	gboolean bstate;
+	GConfClient *gconf;
 
 	if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL)
 		return;
 	
 	bstate = atoi(state);
 	e_meta_set_bool(fb->meta, "show_preview", bstate);
-	gconf_client_set_bool (gconf_client_get_default(), "/apps/evolution/mail/display/show_preview", bstate, NULL);
+	
+	gconf = gconf_client_get_default ();
+	gconf_client_set_bool (gconf, "/apps/evolution/mail/display/show_preview", bstate, NULL);
+	g_object_unref (gconf);
+	
 	folder_browser_set_message_preview (fb, bstate);
 }
 
@@ -1320,13 +1324,18 @@
 	FolderBrowser *fb = user_data;
 	int prev_state;
 	gboolean bstate;
+	GConfClient *gconf;
 	
 	if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL)
 		return;
 
 	bstate = atoi(state);
 	e_meta_set_bool(fb->meta, "thread_list", bstate);
-	gconf_client_set_bool (gconf_client_get_default (), "/apps/evolution/mail/display/thread_list", bstate, NULL);
+	
+	gconf = gconf_client_get_default ();
+	gconf_client_set_bool (gconf, "/apps/evolution/mail/display/thread_list", bstate, NULL);
+	g_object_unref (gconf);
+	
 	message_list_set_threaded (fb->message_list, bstate);
 	
 	prev_state = fb->selection_state;
@@ -1350,6 +1359,7 @@
 	gconf = gconf_client_get_default ();
 	gconf_client_set_bool (gconf, "/apps/evolution/mail/display/show_deleted",
 			       !atoi (state), NULL);
+	g_object_unref (gconf);
 	
 	if (!(fb->folder && (fb->folder->folder_flags & CAMEL_FOLDER_IS_TRASH)))
 		message_list_set_hidedeleted (fb->message_list, atoi (state));
@@ -1364,7 +1374,6 @@
 {
 	extern char *message_display_styles[];
 	FolderBrowser *fb = user_data;
-	GConfClient *gconf;
 	int i;
 	
 	if (type != Bonobo_UIComponent_STATE_CHANGED
@@ -1372,17 +1381,17 @@
 	    || fb->message_list == NULL)
 		return;
 	
-	gconf = gconf_client_get_default ();
-	
-	printf ("message display style: %s\n", path);
-	
 	for (i = 0; i < MAIL_CONFIG_DISPLAY_MAX; i++) {
 		if (strstr (message_display_styles[i], path)) {
 			fb->mail_display->display_style = i;
 			mail_display_redisplay (fb->mail_display, TRUE);
 			
-			if (fb->pref_master)
+			if (fb->pref_master) {
+				GConfClient *gconf = gconf_client_get_default ();
+				
 				gconf_client_set_int (gconf, "/apps/evolution/mail/display/message_style", i, NULL);
+				g_object_unref (gconf);
+			}
 			return;
 		}
 	}
@@ -2312,13 +2321,14 @@
 static gboolean
 fb_resize_cb (GtkWidget *w, GdkEventButton *e, FolderBrowser *fb)
 {
-	GConfClient *gconf;
-
-	gconf = gconf_client_get_default ();
 
-	if (GTK_WIDGET_REALIZED (w) && fb->preview_shown)
+	if (GTK_WIDGET_REALIZED (w) && fb->preview_shown) {
+		GConfClient *gconf = gconf_client_get_default ();
+		
 		gconf_client_set_int (gconf, "/apps/evolution/mail/display/paned_size", gtk_paned_get_position (GTK_PANED (w)), NULL);
-
+		g_object_unref (gconf);
+	}
+	
 	return FALSE;
 }
 
@@ -2326,10 +2336,12 @@
 static void
 paned_realised(GtkWidget *w, FolderBrowser *fb)
 {
+	GConfClient *gconf = gconf_client_get_default ();
 	int size;
-
-	size = gconf_client_get_int (gconf_client_get_default (), "/apps/evolution/mail/display/paned_size", NULL);
+	
+	size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);
 	gtk_paned_set_position (GTK_PANED (fb->vpaned), size);
+	g_object_unref (gconf);
 }
 
 static void
@@ -2415,8 +2427,6 @@
 	GConfClient *gconf;
 	int timeout;
 	
-	gconf = gconf_client_get_default ();
-	
 	if (folder != fb->folder || fb->mail_display == NULL)
 		return;
 	
@@ -2433,6 +2443,7 @@
 	
 	/* pain, if we have pending stuff, re-run */
 	if (fb->pending_uid) {
+		g_object_unref (gconf);
 		g_free (fb->loading_uid);
 		fb->loading_uid = fb->pending_uid;
 		fb->pending_uid = NULL;
@@ -2457,6 +2468,8 @@
 		else
 			do_mark_seen (fb);
 	}
+	
+	g_object_unref (gconf);
 }
 
 /* ok we waited enough, display it anyway (see below) */
Index: mail/mail-account-gui.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-account-gui.c,v
retrieving revision 1.131
diff -u -r1.131 mail-account-gui.c
--- mail/mail-account-gui.c	20 May 2003 15:53:45 -0000	1.131
+++ mail/mail-account-gui.c	21 May 2003 19:25:03 -0000
@@ -1299,6 +1299,7 @@
 	
 	gconf = gconf_client_get_default ();
 	send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
+	g_object_unref (gconf);
 	
 	parent = gtk_widget_get_toplevel (w);
 	parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
Index: mail/mail-callbacks.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-callbacks.c,v
retrieving revision 1.444
diff -u -r1.444 mail-callbacks.c
--- mail/mail-callbacks.c	21 May 2003 15:27:53 -0000	1.444
+++ mail/mail-callbacks.c	21 May 2003 19:25:06 -0000
@@ -248,8 +248,10 @@
 	
 	gconf = gconf_client_get_default ();
 	
-	if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", NULL))
+	if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", NULL)) {
+		g_object_unref (gconf);
 		return TRUE;
+	}
 	
 	/* FIXME: this wording sucks */
 	str = g_string_new (_("You are sending an HTML-formatted message. Please make sure that\n"
@@ -270,6 +272,8 @@
 	
 	gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", show_again, NULL);
 	
+	g_object_unref (gconf);
+	
 	return res;
 }
 
@@ -281,14 +285,18 @@
 	
 	gconf = gconf_client_get_default ();
 	
-	if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/empty_subject", NULL))
+	if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/empty_subject", NULL)) {
+		g_object_unref (gconf);
 		return TRUE;
+	}
 	
 	res = e_question ((GtkWindow *) composer, GTK_RESPONSE_YES, &show_again,
 			  _("This message has no subject.\nReally send?"));
 	
 	gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/empty_subject", show_again, NULL);
 	
+	g_object_unref (gconf);
+	
 	return res;
 }
 
@@ -301,8 +309,10 @@
 	
 	gconf = gconf_client_get_default ();
 	
-	if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/only_bcc", NULL))
+	if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/only_bcc", NULL)) {
+		g_object_unref (gconf);
 		return TRUE;
+	}
 	
 	/* If the user is mailing a hidden contact list, it is possible for
 	   them to create a message with only Bcc recipients without really
@@ -325,6 +335,8 @@
 	
 	gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/only_bcc", show_again, NULL);
 	
+	g_object_unref (gconf);
+	
 	return res;
 }
 
@@ -533,6 +545,8 @@
 	if (recipients)
 		e_destination_freev (recipients);
 	
+	g_object_unref (gconf);
+	
 	return message;
 }
 
@@ -765,6 +779,7 @@
 	
 	gconf = gconf_client_get_default ();
 	send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
+	g_object_unref (gconf);
 	
 	if (post)
 		composer = e_msg_composer_new_post ();
@@ -996,8 +1011,6 @@
 	time_t date;
 	char *url;
 	
-	gconf = gconf_client_get_default ();
-	
 	if (mode == REPLY_POST) {
 		composer = e_msg_composer_new_post ();
 		if (composer != NULL) {
@@ -1167,6 +1180,8 @@
 			me = mail_config_get_account_by_source_url (source);
 	}
 	
+	gconf = gconf_client_get_default ();
+	
 	/* set body text here as we want all ignored words to take effect */
 	switch (gconf_client_get_int (gconf, "/apps/evolution/mail/format/reply_style", NULL)) {
 	case MAIL_CONFIG_REPLY_DO_NOT_QUOTE:
@@ -1199,6 +1214,8 @@
 		break;
 	}
 	
+	g_object_unref (gconf);
+	
 	/* Set the subject of the new message. */
 	subject = (char *) camel_mime_message_get_subject (message);
 	if (!subject)
@@ -1501,6 +1518,7 @@
 	
 	gconf = gconf_client_get_default ();
 	style = gconf_client_get_int (gconf, "/apps/evolution/mail/format/forward_style", NULL);
+	g_object_unref (gconf);
 	
 	if (style == MAIL_CONFIG_FORWARD_ATTACHED)
 		forward_attached (widget, user_data);
@@ -1662,6 +1680,7 @@
 	if (ok && !FOLDER_BROWSER_IS_DESTROYED (fb)) {
 		gconf = gconf_client_get_default ();
 		hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
+		g_object_unref (gconf);
 		
 		row = e_tree_row_of_node (fb->message_list->tree,
 					  e_tree_get_cursor (fb->message_list->tree));
@@ -2545,8 +2564,6 @@
 	if (FOLDER_BROWSER_IS_DESTROYED (fb))
 		return;
 	
-	gconf = gconf_client_get_default ();
-	
 	deleted = flag_messages (fb, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN,
 				 CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN);
 	
@@ -2555,7 +2572,9 @@
 		row = e_tree_row_of_node (fb->message_list->tree,
 					  e_tree_get_cursor (fb->message_list->tree));
 		
+		gconf = gconf_client_get_default ();
 		hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL);
+		g_object_unref (gconf);
 		
 		/* If this is the last message and deleted messages
                    are hidden, select the previous */
@@ -2681,8 +2700,10 @@
 	
 	gconf = gconf_client_get_default ();
 	
-	if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/expunge", NULL))
+	if (!gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/expunge", NULL)) {
+		g_object_unref (gconf);
 		return TRUE;
+	}
 	
 	res = e_question (FB_WINDOW (fb), GTK_RESPONSE_NO, &show_again,
 			  _("This operation will permanently erase all messages marked as\n"
@@ -2690,6 +2711,8 @@
 			    "\nReally erase these messages?"));
 	
 	gconf_client_set_bool (gconf, "/apps/evolution/mail/prompts/expunge", show_again, NULL);
+	
+	g_object_unref (gconf);
 	
 	return res;
 }
Index: mail/mail-config.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
retrieving revision 1.277
diff -u -r1.277 mail-config.c
--- mail/mail-config.c	20 May 2003 14:54:00 -0000	1.277
+++ mail/mail-config.c	21 May 2003 19:25:07 -0000
@@ -653,6 +653,11 @@
 	
 	/* now do cleanup */
 	mail_config_clear ();
+	
+	g_object_unref (config->gconf);
+	g_ptr_array_free (config->mime_types, TRUE);
+	
+	g_free (config);
 }
 
 /* Accessor functions */


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