Re: [evolution-patches] composer settings



On Tue, 2003-05-20 at 12:43, Jeffrey Stedfast wrote:
> er, this probably applies to the patch I just commented on a few minutes
> ago - but is it really necessary to g_object_unref() the gconf object? I
> don't think you are supposed to do that? I got the impression that
> gconf_client_get_default() did not return a ref'd object.
> 

Your impression is wrong, ir refs on every return.  We are leaking refs
like mad, but since there is only one of them it probably isn't that big
of a deal.

> if we are supposed to unref it, I guess the mailer leaks references to
> it all over the place.
> 
> anyways, other than that, this patch looks okay.
> 

Somehow I left out a 

gconf_client_add_dir (gconf, "/apps/evolution/mail/composer", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);

at e-msg-composer.c:2977

fixed patch included.

--Larry


? e-msg-composer.c.activate.c
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.536
diff -u -p -r1.536 ChangeLog
--- ChangeLog	16 May 2003 16:55:07 -0000	1.536
+++ ChangeLog	20 May 2003 17:55:30 -0000
@@ -1,3 +1,12 @@
+2003-05-20  Larry Ewing  <lewing ximian com>
+
+	* e-msg-composer.c (composer_settings_update): set the various
+	bonobo properties that are composer preferences.
+	(create_composer): add notification of gconf changes.
+	(destroy): disconnect notification.
+
+	* e-msg-composer.h: keep the gcond notify handler id.
+
 2003-05-15  Jeffrey Stedfast  <fejj ximian com>
 
 	* e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
Index: e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.391
diff -u -p -r1.391 e-msg-composer.c
--- e-msg-composer.c	29 Apr 2003 16:55:52 -0000	1.391
+++ e-msg-composer.c	20 May 2003 17:55:31 -0000
@@ -2441,7 +2441,6 @@ destroy (GtkObject *object)
 	
 	/* FIXME?  I assume the Bonobo widget will get destroyed
            normally?  */
-	
 	if (composer->address_dialog != NULL) {
 		gtk_widget_destroy (composer->address_dialog);
 		composer->address_dialog = NULL;
@@ -2451,6 +2450,13 @@ destroy (GtkObject *object)
 		composer->hdrs = NULL;
 	}
 	
+	if (composer->notify_id) {
+		GConfClient *gconf = gconf_client_get_default ();
+		gconf_client_notify_remove (gconf, composer->notify_id);
+		composer->notify_id = 0;
+		g_object_unref (gconf);
+	}		
+
 	if (composer->persist_stream_interface != CORBA_OBJECT_NIL) {
 		Bonobo_Unknown_unref (composer->persist_stream_interface, &ev);
 		CORBA_Object_release (composer->persist_stream_interface, &ev);
@@ -2859,6 +2865,28 @@ setup_cut_copy_paste (EMsgComposer *comp
 	g_signal_connect (entry, "focus-out-event", G_CALLBACK (composer_entry_focus_out_event_cb), composer);
 }
 
+static void
+composer_settings_update (GConfClient *gconf, guint cnxn_id, GConfEntry *entry, gpointer data)
+{
+	gboolean bool;
+	EMsgComposer *composer = data;
+
+	bool = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/magic_smileys", NULL);
+	bonobo_widget_set_property (BONOBO_WIDGET (composer->editor),
+				    "MagicSmileys", TC_CORBA_boolean, bool,
+				    NULL);
+
+	bool = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/magic_links", NULL);
+	bonobo_widget_set_property (BONOBO_WIDGET (composer->editor),
+				    "MagicLinks", TC_CORBA_boolean, bool,
+				    NULL);
+
+	bool = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/inline_spelling", NULL);
+	bonobo_widget_set_property (BONOBO_WIDGET (composer->editor),
+				   "InlineSpelling", TC_CORBA_boolean, bool,
+				   NULL);
+}
+
 static EMsgComposer *
 create_composer (int visible_mask)
 {
@@ -2866,6 +2894,7 @@ create_composer (int visible_mask)
 	GtkWidget *vbox;
 	Bonobo_Unknown editor_server;
 	CORBA_Environment ev;
+	GConfClient *gconf;
 	int vis;
 	
 	composer = g_object_new (E_TYPE_MSG_COMPOSER, "win_name", _("Compose a message"), NULL);
@@ -2941,6 +2970,14 @@ create_composer (int visible_mask)
 				    "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 */
Index: e-msg-composer.h
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.h,v
retrieving revision 1.82
diff -u -p -r1.82 e-msg-composer.h
--- e-msg-composer.h	1 Apr 2003 23:41:14 -0000	1.82
+++ e-msg-composer.h	20 May 2003 17:55:31 -0000
@@ -104,6 +104,8 @@ struct _EMsgComposer {
 	GtkWidget *sig_omenu;
 	
 	CamelMimeMessage *redirect;
+	
+	guint notify_id;
 };
 
 struct _EMsgComposerClass {


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