evolution r35009 - in branches/mbarnes-composer: composer mail



Author: mbarnes
Date: Wed Feb 13 22:03:00 2008
New Revision: 35009
URL: http://svn.gnome.org/viewvc/evolution?rev=35009&view=rev

Log:
Miscellaneous refactoring.


Modified:
   branches/mbarnes-composer/composer/e-composer-actions.c
   branches/mbarnes-composer/composer/e-msg-composer.c
   branches/mbarnes-composer/composer/e-msg-composer.h
   branches/mbarnes-composer/mail/em-composer-utils.c

Modified: branches/mbarnes-composer/composer/e-composer-actions.c
==============================================================================
--- branches/mbarnes-composer/composer/e-composer-actions.c	(original)
+++ branches/mbarnes-composer/composer/e-composer-actions.c	Wed Feb 13 22:03:00 2008
@@ -215,14 +215,14 @@
           "mail-attachment",
 	  N_("_Attachment..."),
 	  "<Control>m",
-	  NULL,
+	  N_("Attach a file"),
 	  G_CALLBACK (action_attach_cb) },
 
 	{ "close",
 	  GTK_STOCK_CLOSE,
 	  N_("_Close"),
 	  "<Control>w",
-	  NULL,
+	  N_("Close the current file"),
 	  G_CALLBACK (action_close_cb) },
 
 	{ "print",
@@ -243,28 +243,28 @@
 	  GTK_STOCK_SAVE,
 	  N_("_Save"),
 	  "<Control>s",
-	  NULL,
+	  N_("Save the current file"),
 	  G_CALLBACK (action_save_cb) },
 
 	{ "save-as",
 	  GTK_STOCK_SAVE_AS,
 	  N_("Save _As..."),
 	  NULL,
-	  NULL,
+	  N_("Save the current file with a different name"),
 	  G_CALLBACK (action_save_as_cb) },
 
 	{ "save-draft",
 	  NULL,
 	  N_("Save _Draft"),
 	  "<Shift><Control>s",
-	  NULL,
+	  N_("Save as draft"),
 	  G_CALLBACK (action_save_draft_cb) },
 
 	{ "send",
 	  "mail-send",
 	  N_("S_end"),
 	  "<Control><Return>",
-	  NULL,
+	  N_("Send this message"),
 	  G_CALLBACK (action_send_cb) }
 };
 
@@ -274,35 +274,39 @@
 	  NULL,
 	  N_("PGP _Encrypt"),
 	  NULL,
-	  NULL,
-	  G_CALLBACK (action_pgp_encrypt_cb) },
+	  N_("Encrypt this message with PGP"),
+	  G_CALLBACK (action_pgp_encrypt_cb),
+	  FALSE },
 
 	{ "pgp-sign",
 	  NULL,
 	  N_("PGP _Sign"),
 	  NULL,
-	  NULL,
-	  G_CALLBACK (action_pgp_sign_cb) },
+	  N_("Sign this message with your PGP key"),
+	  G_CALLBACK (action_pgp_sign_cb),
+	  FALSE },
 
 	{ "smime-encrypt",
 	  NULL,
 	  N_("S/MIME En_crypt"),
 	  NULL,
-	  NULL,
-	  G_CALLBACK (action_smime_encrypt_cb) },
+	  N_("Encrypt this message with your S/MIME Encryption Certificate"),
+	  G_CALLBACK (action_smime_encrypt_cb),
+	  FALSE },
 
 	{ "smime-sign",
 	  NULL,
 	  N_("S/MIME Sig_n"),
 	  NULL,
-	  NULL,
-	  G_CALLBACK (action_smime_sign_cb) },
+	  N_("Sign this message with your S/MIME Signature Certificate"),
+	  G_CALLBACK (action_smime_sign_cb),
+	  FALSE },
 
 	{ "view-bcc",
 	  NULL,
 	  N_("_Bcc Field"),
 	  NULL,
-	  NULL,
+	  N_("Toggles whether the BCC field is displayed"),
 	  G_CALLBACK (action_view_bcc_cb),
 	  FALSE },
 
@@ -310,7 +314,7 @@
 	  NULL,
 	  N_("_Cc Field"),
 	  NULL,
-	  NULL,
+	  N_("Toggles whether the CC field is displayed"),
 	  G_CALLBACK (action_view_cc_cb),
 	  FALSE },
 
@@ -318,7 +322,7 @@
 	  NULL,
 	  N_("_From Field"),
 	  NULL,
-	  NULL,
+	  N_("Toggles whether the From chooser is displayed"),
 	  G_CALLBACK (action_view_from_cb),
 	  FALSE },
 
@@ -326,7 +330,7 @@
 	  NULL,
 	  N_("_Post-To Field"),
 	  NULL,
-	  NULL,
+	  N_("Toggles whether the Post-To field is displayed"),
 	  G_CALLBACK (action_view_post_to_cb),
 	  FALSE },
 
@@ -334,7 +338,7 @@
 	  NULL,
 	  N_("_Reply-To Field"),
 	  NULL,
-	  NULL,
+	  N_("Toggles whether the Reply-To field is displayed"),
 	  G_CALLBACK (action_view_reply_to_cb),
 	  FALSE },
 
@@ -342,7 +346,7 @@
 	  NULL,
 	  N_("_To Field"),
 	  NULL,
-	  NULL,
+	  N_("Toggles whether the To field is displayed"),
 	  G_CALLBACK (action_view_to_cb),
 	  FALSE }
 };

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	Wed Feb 13 22:03:00 2008
@@ -125,7 +125,43 @@
 #include <X11/XF86keysym.h>
 #endif
 
-#define COMPOSER_CURRENT_FOLDER_KEY "/apps/evolution/mail/composer/current_folder"
+/* Mail configuration keys */
+#define MAIL_GCONF_PREFIX \
+	"/apps/evolution/mail"
+#define MAIL_GCONF_CHARSET_KEY \
+	MAIL_GCONF_PREFIX "/format/charset"
+
+/* Composer configuration keys */
+#define COMPOSER_GCONF_PREFIX \
+	MAIL_GCONF_PREFIX "/composer"
+#define COMPOSER_GCONF_CHARSET_KEY \
+	COMPOSER_GCONF_PREFIX "/charset"
+#define COMPOSER_GCONF_CURRENT_FOLDER_KEY \
+	COMPOSER_GCONF_PREFIX "/current_folder"
+#define COMPOSER_GCONF_INLINE_SPELLING_KEY \
+	COMPOSER_GCONF_PREFIX "/inline_spelling"
+#define COMPOSER_GCONF_MAGIC_LINKS_KEY \
+	COMPOSER_GCONF_PREFIX "/magic_links"
+#define COMPOSER_GCONF_MAGIC_SMILEYS_KEY \
+	COMPOSER_GCONF_PREFIX "/magic_smileys"
+#define COMPOSER_GCONF_REQUEST_RECEIPT_KEY \
+	COMPOSER_GCONF_PREFIX "/request_receipt"
+#define COMPOSER_GCONF_TOP_SIGNATURE_KEY \
+	COMPOSER_GCONF_PREFIX "/top_signature"
+#define COMPOSER_GCONF_SEND_HTML_KEY \
+	COMPOSER_GCONF_PREFIX "/send_html"
+#define COMPOSER_GCONF_VIEW_BCC_KEY \
+	COMPOSER_GCONF_PREFIX "/view/Bcc"
+#define COMPOSER_GCONF_VIEW_CC_KEY \
+	COMPOSER_GCONF_PREFIX "/view/Cc"
+#define COMPOSER_GCONF_VIEW_FROM_KEY \
+	COMPOSER_GCONF_PREFIX "/view/From"
+#define COMPOSER_GCONF_VIEW_POST_TO_KEY \
+	COMPOSER_GCONF_PREFIX "/view/PostTo"
+#define COMPOSER_GCONF_VIEW_REPLY_TO_KEY \
+	COMPOSER_GCONF_PREFIX "/view/ReplyTo"
+#define COMPOSER_GCONF_WINDOW_PREFIX \
+	COMPOSER_GCONF_PREFIX "/window"
 
 #define d(x)
 
@@ -308,23 +344,29 @@
 static gchar *
 composer_get_default_charset_setting (void)
 {
-	GConfClient *gconf;
+	GConfClient *client;
 	const gchar *locale;
 	gchar *charset;
 
-	gconf = gconf_client_get_default ();
-	charset = gconf_client_get_string (gconf, "/apps/evolution/mail/composer/charset", NULL);
+	client = gconf_client_get_default ();
 
+	charset = gconf_client_get_string (
+		client, COMPOSER_GCONF_CHARSET_KEY, NULL);
+
+	/* See what charset the mailer is using.
+	 * XXX We should not have to know where this lives in GConf.
+	 *     Need a mail_config_get_default_charset() that does this. */
 	if (!charset || charset[0] == '\0') {
 		g_free (charset);
-		charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL);
+		charset = gconf_client_get_string (
+			client, MAIL_GCONF_CHARSET_KEY, NULL);
 		if (charset && charset[0] == '\0') {
 			g_free (charset);
 			charset = NULL;
 		}
 	}
 
-	g_object_unref (gconf);
+	g_object_unref (client);
 
 	if (!charset && (locale = e_iconv_locale_charset ()))
 		charset = g_strdup (locale);
@@ -1116,37 +1158,6 @@
 				 FALSE);
 }
 
-/**
- * e_msg_composer_set_attach_path
- * Attach path is used to be preset when choosing files. This function ensures same path
- * in editor and in composer.
- * @param composer Composer.
- * @param path Path to be used. Should not be NULL.
- **/
-void
-e_msg_composer_set_attach_path (EMsgComposer *composer, const gchar *path)
-{
-	GConfClient *gconf;
-	GError *error = NULL;
-
-	g_return_if_fail (composer != NULL);
-	g_return_if_fail (path != NULL);
-
-	/* FIXME Listen for property change notifications.
-	 *       (Remind me again why we can't use GConfBridge?) */
-
-	gconf = gconf_client_get_default ();
-	gconf_client_set_string (gconf, COMPOSER_CURRENT_FOLDER_KEY, path, &error);
-	g_object_unref (gconf);
-
-	if (error) {
-		g_warning ("Could not write current_folder setting: %s", error->message);
-		g_error_free (error);
-	}
-
-	gtkhtml_editor_set_current_folder (GTKHTML_EDITOR (composer), path);
-}
-
 static gchar *
 encode_signature_name (const gchar *name)
 {
@@ -1347,7 +1358,7 @@
 
 	 */
 
-	reply_signature_on_top = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/top_signature", NULL);
+	reply_signature_on_top = gconf_client_get_bool (gconf, COMPOSER_GCONF_TOP_SIGNATURE_KEY, NULL);
 
 	g_object_unref (gconf);
 
@@ -1540,14 +1551,6 @@
 	}
 }
 
-static void
-menu_file_save_draft_cb (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
-	g_signal_emit (data, signals[SAVE_DRAFT], 0, FALSE);
-	e_msg_composer_unset_changed (E_MSG_COMPOSER (data));
-	e_msg_composer_unset_autosaved (E_MSG_COMPOSER (data));
-}
-
 /* Menu callbacks.  */
 static void
 menu_file_save_cb (BonoboUIComponent *uic,
@@ -1583,14 +1586,6 @@
 }
 
 static void
-menu_file_send_cb (BonoboUIComponent *uic,
-		   gpointer data,
-		   const char *path)
-{
-	g_signal_emit (GTK_OBJECT (data), signals[SEND], 0);
-}
-
-static void
 menu_file_close_cb (BonoboUIComponent *uic,
 		    gpointer data,
 		    const char *path)
@@ -1663,20 +1658,6 @@
 }
 
 static void
-menu_format_html_cb (BonoboUIComponent           *component,
-		     const char                  *path,
-		     Bonobo_UIComponent_EventType type,
-		     const char                  *state,
-		     gpointer                     user_data)
-
-{
-	if (type != Bonobo_UIComponent_STATE_CHANGED)
-		return;
-
-	e_msg_composer_set_send_html (E_MSG_COMPOSER (user_data), atoi (state));
-}
-
-static void
 menu_insert_receipt_cb (BonoboUIComponent           *component,
 			const char                  *path,
 			Bonobo_UIComponent_EventType type,
@@ -1726,13 +1707,10 @@
 
 	BONOBO_UI_VERB ("FileSave", menu_file_save_cb),
 	BONOBO_UI_VERB ("FileSaveAs", menu_file_save_as_cb),
-	BONOBO_UI_VERB ("FileSaveDraft", menu_file_save_draft_cb),
 	BONOBO_UI_VERB ("FileClose", menu_file_close_cb),
 	BONOBO_UI_VERB ("Help", menu_help_cb),
 	BONOBO_UI_VERB ("FileAttach", menu_file_add_attachment_cb),
 
-	BONOBO_UI_VERB ("FileSend", menu_file_send_cb),
-
 	BONOBO_UI_VERB ("InsertXSendOptions", menu_send_options_cb),
 
 	BONOBO_UI_VERB_END
@@ -1791,14 +1769,6 @@
 					     composer);
 	g_free (charset);
 
-	/* Format -> HTML */
-	bonobo_ui_component_set_prop (
-		p->uic, "/commands/FormatHtml",
-		"state", p->send_html ? "1" : "0", NULL);
-	bonobo_ui_component_add_listener (
-		p->uic, "FormatHtml",
-		menu_format_html_cb, composer);
-
 	/* Insert/Request Receipt */
 	bonobo_ui_component_set_prop (
 		p->uic, "/commands/RequestReceipt",
@@ -2486,33 +2456,6 @@
 		g_object_unref (gconf);
 	}
 
-#if 0 /* GTKHTML-EDITOR */
-	if (p->persist_stream_interface != CORBA_OBJECT_NIL) {
-		Bonobo_Unknown_unref (p->persist_stream_interface, &ev);
-		CORBA_Object_release (p->persist_stream_interface, &ev);
-		p->persist_stream_interface = CORBA_OBJECT_NIL;
-	}
-
-	if (p->persist_file_interface != CORBA_OBJECT_NIL) {
-		Bonobo_Unknown_unref (p->persist_file_interface, &ev);
-		CORBA_Object_release (p->persist_file_interface, &ev);
-		p->persist_file_interface = CORBA_OBJECT_NIL;
-	}
-
-	if (p->eeditor_engine != CORBA_OBJECT_NIL) {
-		Bonobo_Unknown_unref (p->eeditor_engine, &ev);
-		CORBA_Object_release (p->eeditor_engine, &ev);
-		p->eeditor_engine = CORBA_OBJECT_NIL;
-	}
-
-	CORBA_exception_free (&ev);
-
-	if (p->eeditor_listener) {
-		bonobo_object_unref (p->eeditor_listener);
-		p->eeditor_listener = NULL;
-	}
-#endif
-
 	/* Chain up to parent's destroy () method. */
 	GTK_OBJECT_CLASS (parent_class)->destroy (object);
 }
@@ -2641,24 +2584,24 @@
 	class->send = em_utils_composer_send_cb;
 	class->save_draft = em_utils_composer_save_draft_cb;
 
-	signals[SEND] =
-		g_signal_new ("send",
-			      E_TYPE_MSG_COMPOSER,
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (EMsgComposerClass, send),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__VOID,
-			      G_TYPE_NONE, 0);
-
-	signals[SAVE_DRAFT] =
-		g_signal_new ("save-draft",
-			      E_TYPE_MSG_COMPOSER,
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (EMsgComposerClass, save_draft),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__BOOLEAN,
-			      G_TYPE_NONE,
-			      1, G_TYPE_BOOLEAN);
+	signals[SEND] = g_signal_new (
+		"send",
+		E_TYPE_MSG_COMPOSER,
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (EMsgComposerClass, send),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
+
+	signals[SAVE_DRAFT] = g_signal_new (
+		"save-draft",
+		E_TYPE_MSG_COMPOSER,
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (EMsgComposerClass, save_draft),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__BOOLEAN,
+		G_TYPE_NONE, 1,
+		G_TYPE_BOOLEAN);
 }
 
 static void
@@ -2687,29 +2630,34 @@
 
 	gconf_bridge_bind_property (
 		gconf_bridge_get (),
-		"/apps/evolution/mail/composer/view/Bcc",
+		COMPOSER_GCONF_VIEW_BCC_KEY,
 		G_OBJECT (ACTION (VIEW_BCC)), "active");
 
 	gconf_bridge_bind_property (
 		gconf_bridge_get (),
-		"/apps/evolution/mail/composer/view/Cc",
+		COMPOSER_GCONF_VIEW_CC_KEY,
 		G_OBJECT (ACTION (VIEW_CC)), "active");
 
 	gconf_bridge_bind_property (
 		gconf_bridge_get (),
-		"/apps/evolution/mail/composer/view/From",
+		COMPOSER_GCONF_VIEW_FROM_KEY,
 		G_OBJECT (ACTION (VIEW_FROM)), "active");
 
 	gconf_bridge_bind_property (
 		gconf_bridge_get (),
-		"/apps/evolution/mail/composer/view/PostTo",
+		COMPOSER_GCONF_VIEW_POST_TO_KEY,
 		G_OBJECT (ACTION (VIEW_POST_TO)), "active");
 
 	gconf_bridge_bind_property (
 		gconf_bridge_get (),
-		"/apps/evolution/mail/composer/view/ReplyTo",
+		COMPOSER_GCONF_VIEW_REPLY_TO_KEY,
 		G_OBJECT (ACTION (VIEW_REPLY_TO)), "active");
 
+	gconf_bridge_bind_window (
+		gconf_bridge_get (),
+		COMPOSER_GCONF_WINDOW_PREFIX,
+		GTK_WINDOW (composer), TRUE, FALSE);
+
 #if 0 /* GTKHTML-EDITOR */
 	/** @HookPoint-EMMenu: Main Mail Menu
 	 * @Id: org.gnome.evolution.mail.composer
@@ -2900,43 +2848,43 @@
 }
 
 static void
-composer_settings_update (GConfClient *gconf, guint cnxn_id, GConfEntry *entry, gpointer data)
+msg_composer_update_preferences (GConfClient *client,
+                          guint cnxn_id,
+                          GConfEntry *entry,
+                          EMsgComposer *composer)
 {
-#if 0 /* GTKHTML-EDITOR */
-	gboolean bool;
-	EMsgComposer *composer = data;
-	EMsgComposerPrivate *p = composer->priv;
+	GtkhtmlEditor *editor;
+	gboolean enable;
+	GError *error = NULL;
 
-	bool = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/magic_smileys", NULL);
-	bonobo_widget_set_property (BONOBO_WIDGET (p->eeditor),
-				    "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 (p->eeditor),
-				    "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 (p->eeditor),
-				   "InlineSpelling", TC_CORBA_boolean, bool,
-				   NULL);
-#endif /* GTKHTML-EDITOR */
-}
+	editor = GTKHTML_EDITOR (composer);
 
-static void
-e_msg_composer_unrealize (GtkWidget *widget, gpointer data)
-{
-	EMsgComposer *composer = E_MSG_COMPOSER (widget);
-	GConfClient *gconf;
-	int width, height;
+	enable = gconf_client_get_bool (
+		client, COMPOSER_GCONF_INLINE_SPELLING_KEY, &error);
+	if (error == NULL)
+		gtkhtml_editor_set_inline_spelling (editor, enable);
+	else {
+		g_warning ("%s", error->message);
+		g_clear_error (&error);
+	}
 
-	gtk_window_get_size (GTK_WINDOW (composer), &width, &height);
+	enable = gconf_client_get_bool (
+		client, COMPOSER_GCONF_MAGIC_LINKS_KEY, &error);
+	if (error == NULL)
+		gtkhtml_editor_set_magic_links (editor, enable);
+	else {
+		g_warning ("%s", error->message);
+		g_clear_error (&error);
+	}
 
-	gconf = gconf_client_get_default ();
-	gconf_client_set_int (gconf, "/apps/evolution/mail/composer/width", width, NULL);
-	gconf_client_set_int (gconf, "/apps/evolution/mail/composer/height", height, NULL);
-	g_object_unref (gconf);
+	enable = gconf_client_get_bool (
+		client, COMPOSER_GCONF_MAGIC_SMILEYS_KEY, &error);
+	if (error == NULL)
+		gtkhtml_editor_set_magic_smileys (editor, enable);
+	else {
+		g_warning ("%s", error->message);
+		g_clear_error (&error);
+	}
 }
 
 /* Callbacks.  */
@@ -3113,7 +3061,7 @@
 	EMsgComposer *composer;
 	EComposerHeaderTable *table;
 	GtkWidget *vbox, *expander_hbox;
-	GConfClient *gconf;
+	GConfClient *client;
 	GList *icon_list;
 	EMsgComposerPrivate *p;
 
@@ -3207,17 +3155,17 @@
 
 	gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (composer), p->send_html);
 
-	gconf = gconf_client_get_default ();
-	composer_settings_update (gconf, 0, NULL, composer);
-	e_msg_composer_set_request_receipt (composer, gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/request_receipt", NULL));
-	gconf_client_add_dir (gconf, "/apps/evolution/mail/composer", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-	p->notify_id = gconf_client_notify_add (gconf, "/apps/evolution/mail/composer",
-						       composer_settings_update, composer, NULL, NULL);
-	gtk_window_set_default_size (GTK_WINDOW (composer),
-				     gconf_client_get_int (gconf, "/apps/evolution/mail/composer/width", NULL),
-				     gconf_client_get_int (gconf, "/apps/evolution/mail/composer/height", NULL));
-	g_signal_connect (composer, "unrealize", G_CALLBACK (e_msg_composer_unrealize), NULL);
-	g_object_unref (gconf);
+	/* Listen for user preference updates. */
+	client = gconf_client_get_default ();
+	msg_composer_update_preferences (client, 0, NULL, composer);
+	e_msg_composer_set_request_receipt (composer, gconf_client_get_bool (client, COMPOSER_GCONF_REQUEST_RECEIPT_KEY, NULL));
+	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);
+	g_object_unref (client);
 
 	/* Attachment editor, wrapped into an EScrollFrame.  It's
 	   hidden in an EExpander. */
@@ -3278,7 +3226,8 @@
 	gtk_widget_show (vbox);
 
 	gconf_bridge_bind_property (
-		gconf_bridge_get (), COMPOSER_CURRENT_FOLDER_KEY,
+		gconf_bridge_get (),
+		COMPOSER_GCONF_CURRENT_FOLDER_KEY,
 		G_OBJECT (composer), "current-folder");
 
 #if 0 /* GTKHTML-EDITOR */
@@ -3332,14 +3281,8 @@
 EMsgComposer *
 e_msg_composer_new_with_type (int type)
 {
-	gboolean send_html;
-	GConfClient *gconf;
 	EMsgComposer *new;
 
-	gconf = gconf_client_get_default ();
-	send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
-	g_object_unref (gconf);
-
 	switch (type) {
 	case E_MSG_COMPOSER_MAIL:
 		new = create_composer (E_MSG_COMPOSER_VISIBLE_MASK_MAIL);
@@ -3352,7 +3295,6 @@
 	}
 
 	if (new) {
-		e_msg_composer_set_send_html (new, send_html);
 		set_editor_signature (new);
 		set_editor_text (new, "", TRUE);
 	}
@@ -3969,9 +3911,11 @@
 			printf ("restoring draft flag '%s'\n", flags[i]);
 
 			if (g_ascii_strcasecmp (flags[i], "text/html") == 0)
-				e_msg_composer_set_send_html (composer, TRUE);
+				gtkhtml_editor_set_html_mode (
+					GTKHTML_EDITOR (composer), TRUE);
 			else if (g_ascii_strcasecmp (flags[i], "text/plain") == 0)
-				e_msg_composer_set_send_html (composer, FALSE);
+				gtkhtml_editor_set_html_mode (
+					GTKHTML_EDITOR (composer), FALSE);
 			else if (g_ascii_strcasecmp (flags[i], "pgp-sign") == 0) {
 				action = GTK_TOGGLE_ACTION (ACTION (PGP_SIGN));
 				gtk_toggle_action_set_active (action, TRUE);
@@ -4405,7 +4349,7 @@
 	table = e_msg_composer_get_header_table (composer);
 
 	set_editor_text (composer, _("<b>(The composer contains a non-text message body, which cannot be edited.)</b>"), FALSE);
-	e_msg_composer_set_send_html (composer, FALSE);
+	gtkhtml_editor_set_html_mode (GTKHTML_EDITOR (composer), FALSE);
 	disable_editor (composer);
 
 	g_free (p->mime_body);
@@ -4865,70 +4809,6 @@
 
 
 /**
- * e_msg_composer_set_send_html:
- * @composer: A message composer widget
- * @send_html: Whether the composer should have the "Send HTML" flag set
- *
- * Set the status of the "Send HTML" toggle item.  The user can override it.
- **/
-void
-e_msg_composer_set_send_html (EMsgComposer *composer,
-			      gboolean send_html)
-{
-#if 0 /* GTKHTML-EDITOR */
-	CORBA_Environment ev;
-	EMsgComposerPrivate *p = composer->priv;
-
-	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
-	if (p->send_html && send_html)
-		return;
-
-	if (!p->send_html && !send_html)
-		return;
-
-	p->send_html = send_html;
-
-	CORBA_exception_init (&ev);
-	GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "block-redraw", &ev);
-	CORBA_exception_free (&ev);
-
-	bonobo_ui_component_set_prop (p->uic, "/commands/FormatHtml",
-				      "state", p->send_html ? "1" : "0", NULL);
-
-	/* let the editor know which mode we are in */
-	bonobo_widget_set_property (BONOBO_WIDGET (p->eeditor),
-				    "FormatHTML", TC_CORBA_boolean,
-				    p->send_html, NULL);
-
-
-	CORBA_exception_init (&ev);
-	GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "unblock-redraw", &ev);
-	CORBA_exception_free (&ev);
-#endif /* GTKHTML-EDITOR */
-}
-
-
-/**
- * e_msg_composer_get_send_html:
- * @composer: A message composer widget
- *
- * Get the status of the "Send HTML mail" flag.
- *
- * Return value: The status of the "Send HTML mail" flag.
- **/
-gboolean
-e_msg_composer_get_send_html (EMsgComposer *composer)
-{
-	EMsgComposerPrivate *p = composer->priv;
-
-	g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
-
-	return p->send_html;
-}
-
-
-/**
  * e_msg_composer_get_request_receipt
  * @composer: A message composer widget
  *

Modified: branches/mbarnes-composer/composer/e-msg-composer.h
==============================================================================
--- branches/mbarnes-composer/composer/e-msg-composer.h	(original)
+++ branches/mbarnes-composer/composer/e-msg-composer.h	Wed Feb 13 22:03:00 2008
@@ -121,9 +121,6 @@
                                                                           gboolean           save_html_object_data);
 CamelMimeMessage        *e_msg_composer_get_message_draft                (EMsgComposer      *composer);
 void                     e_msg_composer_show_sig_file                    (EMsgComposer      *composer);
-gboolean                 e_msg_composer_get_send_html                    (EMsgComposer      *composer);
-void                     e_msg_composer_set_send_html                    (EMsgComposer      *composer,
-									  gboolean           send_html);
 
 gboolean                 e_msg_composer_get_request_receipt              (EMsgComposer *composer);
 void                     e_msg_composer_set_request_receipt              (EMsgComposer *composer,

Modified: branches/mbarnes-composer/mail/em-composer-utils.c
==============================================================================
--- branches/mbarnes-composer/mail/em-composer-utils.c	(original)
+++ branches/mbarnes-composer/mail/em-composer-utils.c	Wed Feb 13 22:03:00 2008
@@ -251,7 +251,7 @@
 {
 	CamelMimeMessage *message = NULL;
 	EDestination **recipients, **recipients_bcc;
-	gboolean send_html, confirm_html;
+	gboolean html_mode, send_html, confirm_html;
 	CamelInternetAddress *cia;
 	int hidden = 0, shown = 0;
 	int num = 0, num_bcc = 0, num_post = 0;
@@ -333,13 +333,15 @@
 			goto finished;
 	}
 
+	html_mode = gtkhtml_editor_get_html_mode (GTKHTML_EDITOR (composer));
 	send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
 	confirm_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", NULL);
 
 	/* Only show this warning if our default is to send html.  If it isn't, we've
 	   manually switched into html mode in the composer and (presumably) had a good
 	   reason for doing this. */
-	if (e_msg_composer_get_send_html (composer) && send_html && confirm_html) {
+	if (html_mode && send_html && confirm_html) {
+
 		gboolean html_problem = FALSE;
 
 		if (recipients) {



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