evolution r35302 - branches/mbarnes-composer/composer



Author: mbarnes
Date: Tue Apr  1 20:29:26 2008
New Revision: 35302
URL: http://svn.gnome.org/viewvc/evolution?rev=35302&view=rev

Log:
Fix some initialization regressions.


Modified:
   branches/mbarnes-composer/composer/e-msg-composer.c

Modified: branches/mbarnes-composer/composer/e-msg-composer.c
==============================================================================
--- branches/mbarnes-composer/composer/e-msg-composer.c	(original)
+++ branches/mbarnes-composer/composer/e-msg-composer.c	Tue Apr  1 20:29:26 2008
@@ -2036,6 +2036,95 @@
 	gtkhtml_editor_set_changed (editor, TRUE);
 }
 
+static GObject *
+msg_composer_constructor (GType type,
+                          guint n_construct_properties,
+                          GObjectConstructParam *construct_properties)
+{
+	GObject *object;
+	EMsgComposer *composer;
+	GtkToggleAction *action;
+	GConfClient *client;
+	GArray *array;
+	gboolean active;
+	guint binding_id;
+
+	/* Chain up to parent's constructor() method. */
+	object = G_OBJECT_CLASS (parent_class)->constructor (
+		type, n_construct_properties, construct_properties);
+
+	composer = E_MSG_COMPOSER (object);
+	client = gconf_client_get_default ();
+	array = composer->priv->gconf_bridge_binding_ids;
+
+	/* Restore Persistent State */
+
+	binding_id = gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		COMPOSER_GCONF_CURRENT_FOLDER_KEY,
+		G_OBJECT (composer), "current-folder");
+	g_array_append_val (array, binding_id);
+
+	binding_id = gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		COMPOSER_GCONF_VIEW_BCC_KEY,
+		G_OBJECT (ACTION (VIEW_BCC)), "active");
+	g_array_append_val (array, binding_id);
+
+	binding_id = gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		COMPOSER_GCONF_VIEW_CC_KEY,
+		G_OBJECT (ACTION (VIEW_CC)), "active");
+	g_array_append_val (array, binding_id);
+
+	binding_id = gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		COMPOSER_GCONF_VIEW_FROM_KEY,
+		G_OBJECT (ACTION (VIEW_FROM)), "active");
+	g_array_append_val (array, binding_id);
+
+	binding_id = gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		COMPOSER_GCONF_VIEW_POST_TO_KEY,
+		G_OBJECT (ACTION (VIEW_POST_TO)), "active");
+	g_array_append_val (array, binding_id);
+
+	binding_id = gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		COMPOSER_GCONF_VIEW_REPLY_TO_KEY,
+		G_OBJECT (ACTION (VIEW_REPLY_TO)), "active");
+	g_array_append_val (array, binding_id);
+
+	binding_id = gconf_bridge_bind_window (
+		gconf_bridge_get (),
+		COMPOSER_GCONF_WINDOW_PREFIX,
+		GTK_WINDOW (composer), TRUE, FALSE);
+	g_array_append_val (array, binding_id);
+
+	/* Honor User Preferences */
+
+	active = gconf_client_get_bool (
+		client, COMPOSER_GCONF_SEND_HTML_KEY, NULL);
+	gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (composer), active);
+
+	action = GTK_TOGGLE_ACTION (ACTION (REQUEST_READ_RECEIPT));
+	active = gconf_client_get_bool (
+		client, COMPOSER_GCONF_REQUEST_RECEIPT_KEY, NULL);
+	gtk_toggle_action_set_active (action, active);
+
+	gconf_client_add_dir (
+		client, COMPOSER_GCONF_PREFIX,
+		GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+	composer->priv->notify_id = gconf_client_notify_add (
+		client, COMPOSER_GCONF_PREFIX, (GConfClientNotifyFunc)
+		msg_composer_update_preferences, composer, NULL, NULL);
+	msg_composer_update_preferences (client, 0, NULL, composer);
+
+	g_object_unref (client);
+
+	return object;
+}
+
 static void
 msg_composer_dispose (GObject *object)
 {
@@ -2560,6 +2649,7 @@
 	g_type_class_add_private (class, sizeof (EMsgComposerPrivate));
 
 	object_class = G_OBJECT_CLASS (class);
+	object_class->constructor = msg_composer_constructor;
 	object_class->dispose = msg_composer_dispose;
 	object_class->finalize = msg_composer_finalize;
 
@@ -2606,76 +2696,23 @@
 static void
 msg_composer_init (EMsgComposer *composer)
 {
-	EMsgComposerPrivate *p;
 	EComposerHeaderTable *table;
 #if 0 /* GTKHTML-EDITOR */
 	EMMenuTargetWidget *target;
 #endif
-	GtkToggleAction *action;
-	GConfClient *client;
-	GArray *array;
 	GtkHTML *html;
-	guint binding_id;
-	gboolean active;
 
 	composer->priv = E_MSG_COMPOSER_GET_PRIVATE (composer);
 
+	e_composer_private_init (composer);
+
 	all_composers = g_slist_prepend (all_composers, composer);
 	html = gtkhtml_editor_get_html (GTKHTML_EDITOR (composer));
 	table = E_COMPOSER_HEADER_TABLE (composer->priv->header_table);
-	client = gconf_client_get_default ();
-
-	e_composer_private_init (composer);
 
 	gtk_window_set_title (GTK_WINDOW (composer), _("Compose Message"));
 	gtk_window_set_icon_name (GTK_WINDOW (composer), "mail-message-new");
 
-	/* Persistent State */
-
-	array = composer->priv->gconf_bridge_binding_ids;
-
-	binding_id = gconf_bridge_bind_property (
-		gconf_bridge_get (),
-		COMPOSER_GCONF_CURRENT_FOLDER_KEY,
-		G_OBJECT (composer), "current-folder");
-	g_array_append_val (array, binding_id);
-
-	binding_id = gconf_bridge_bind_property (
-		gconf_bridge_get (),
-		COMPOSER_GCONF_VIEW_BCC_KEY,
-		G_OBJECT (ACTION (VIEW_BCC)), "active");
-	g_array_append_val (array, binding_id);
-
-	binding_id = gconf_bridge_bind_property (
-		gconf_bridge_get (),
-		COMPOSER_GCONF_VIEW_CC_KEY,
-		G_OBJECT (ACTION (VIEW_CC)), "active");
-	g_array_append_val (array, binding_id);
-
-	binding_id = gconf_bridge_bind_property (
-		gconf_bridge_get (),
-		COMPOSER_GCONF_VIEW_FROM_KEY,
-		G_OBJECT (ACTION (VIEW_FROM)), "active");
-	g_array_append_val (array, binding_id);
-
-	binding_id = gconf_bridge_bind_property (
-		gconf_bridge_get (),
-		COMPOSER_GCONF_VIEW_POST_TO_KEY,
-		G_OBJECT (ACTION (VIEW_POST_TO)), "active");
-	g_array_append_val (array, binding_id);
-
-	binding_id = gconf_bridge_bind_property (
-		gconf_bridge_get (),
-		COMPOSER_GCONF_VIEW_REPLY_TO_KEY,
-		G_OBJECT (ACTION (VIEW_REPLY_TO)), "active");
-	g_array_append_val (array, binding_id);
-
-	binding_id = gconf_bridge_bind_window (
-		gconf_bridge_get (),
-		COMPOSER_GCONF_WINDOW_PREFIX,
-		GTK_WINDOW (composer), TRUE, FALSE);
-	g_array_append_val (array, binding_id);
-
 	/* Drag-and-Drop Support */
 
 	gtk_drag_dest_set (
@@ -2739,49 +2776,28 @@
 
 	msg_composer_account_changed_cb (composer);
 
-	/* Honor User Preferences */
-
-	active = gconf_client_get_bool (
-		client, COMPOSER_GCONF_SEND_HTML_KEY, NULL);
-	gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (composer), active);
-
-	action = GTK_TOGGLE_ACTION (ACTION (REQUEST_READ_RECEIPT));
-	active = gconf_client_get_bool (
-		client, COMPOSER_GCONF_REQUEST_RECEIPT_KEY, NULL);
-	gtk_toggle_action_set_active (action, active);
-
-	gconf_client_add_dir (
-		client, COMPOSER_GCONF_PREFIX,
-		GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-	p->notify_id = gconf_client_notify_add (
-		client, COMPOSER_GCONF_PREFIX, (GConfClientNotifyFunc)
-		msg_composer_update_preferences, composer, NULL, NULL);
-	msg_composer_update_preferences (client, 0, NULL, composer);
-
 	/* Attachment Bar */
 
 	g_signal_connect (
-		p->attachment_bar, "button_press_event",
+		composer->priv->attachment_bar, "button_press_event",
 		G_CALLBACK (attachment_bar_button_press_event_cb), NULL);
 	g_signal_connect (
-		p->attachment_bar, "key_press_event",
+		composer->priv->attachment_bar, "key_press_event",
 		G_CALLBACK (attachment_bar_key_press_event_cb), NULL);
 	g_signal_connect (
-		p->attachment_bar, "popup-menu",
+		composer->priv->attachment_bar, "popup-menu",
 		G_CALLBACK (attachment_bar_popup_menu_cb), NULL);
 	g_signal_connect (
-		p->attachment_bar, "changed",
+		composer->priv->attachment_bar, "changed",
 		G_CALLBACK (attachment_bar_changed_cb), composer);
 	g_signal_connect_after (
-		p->attachment_expander, "notify::expanded",
+		composer->priv->attachment_expander, "notify::expanded",
 		G_CALLBACK (attachment_expander_notify_cb), composer);
 
 	e_composer_autosave_register (composer);
 
 	/* Initialization may have tripped the "changed" state. */
 	gtkhtml_editor_set_changed (GTKHTML_EDITOR (composer), FALSE);
-
-	g_object_unref (client);
 }
 
 GType



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