evolution r34963 - branches/mbarnes-composer/composer



Author: mbarnes
Date: Wed Feb  6 04:19:12 2008
New Revision: 34963
URL: http://svn.gnome.org/viewvc/evolution?rev=34963&view=rev

Log:
Wire up the View menu to GtkUIManager / GConfBridge / EComposerHeaderTable.


Modified:
   branches/mbarnes-composer/composer/e-composer-actions.c
   branches/mbarnes-composer/composer/e-composer-actions.h
   branches/mbarnes-composer/composer/e-msg-composer.c
   branches/mbarnes-composer/composer/e-msg-composer.h
   branches/mbarnes-composer/composer/evolution-composer.ui

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  6 04:19:12 2008
@@ -99,6 +99,90 @@
 	g_signal_emit_by_name (composer, "send");
 }
 
+static void
+action_view_bcc_cb (GtkToggleAction *action,
+                    EMsgComposer *composer)
+{
+	EComposerHeaderTable *table;
+	gboolean active;
+
+	table = e_msg_composer_get_header_table (composer);
+	active = gtk_toggle_action_get_active (action);
+
+	e_composer_header_table_set_header_visible (
+		table, E_COMPOSER_HEADER_BCC, active);
+}
+
+static void
+action_view_cc_cb (GtkToggleAction *action,
+                   EMsgComposer *composer)
+{
+	EComposerHeaderTable *table;
+	gboolean active;
+
+	table = e_msg_composer_get_header_table (composer);
+	active = gtk_toggle_action_get_active (action);
+
+	e_composer_header_table_set_header_visible (
+		table, E_COMPOSER_HEADER_CC, active);
+}
+
+static void
+action_view_from_cb (GtkToggleAction *action,
+                     EMsgComposer *composer)
+{
+	EComposerHeaderTable *table;
+	gboolean active;
+
+	table = e_msg_composer_get_header_table (composer);
+	active = gtk_toggle_action_get_active (action);
+
+	e_composer_header_table_set_header_visible (
+		table, E_COMPOSER_HEADER_FROM, active);
+}
+
+static void
+action_view_post_to_cb (GtkToggleAction *action,
+                        EMsgComposer *composer)
+{
+	EComposerHeaderTable *table;
+	gboolean active;
+
+	table = e_msg_composer_get_header_table (composer);
+	active = gtk_toggle_action_get_active (action);
+
+	e_composer_header_table_set_header_visible (
+		table, E_COMPOSER_HEADER_POST_TO, active);
+}
+
+static void
+action_view_reply_to_cb (GtkToggleAction *action,
+                         EMsgComposer *composer)
+{
+	EComposerHeaderTable *table;
+	gboolean active;
+
+	table = e_msg_composer_get_header_table (composer);
+	active = gtk_toggle_action_get_active (action);
+
+	e_composer_header_table_set_header_visible (
+		table, E_COMPOSER_HEADER_REPLY_TO, active);
+}
+
+static void
+action_view_to_cb (GtkToggleAction *action,
+                   EMsgComposer *composer)
+{
+	EComposerHeaderTable *table;
+	gboolean active;
+
+	table = e_msg_composer_get_header_table (composer);
+	active = gtk_toggle_action_get_active (action);
+
+	e_composer_header_table_set_header_visible (
+		table, E_COMPOSER_HEADER_TO, active);
+}
+
 static GtkActionEntry entries[] = {
 
 	{ "attach",
@@ -158,6 +242,57 @@
 	  G_CALLBACK (action_send_cb) }
 };
 
+static GtkToggleActionEntry toggle_entries[] = {
+
+	{ "view-bcc",
+	  NULL,
+	  N_("_Bcc Field"),
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_view_bcc_cb),
+	  FALSE },
+
+	{ "view-cc",
+	  NULL,
+	  N_("_Cc Field"),
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_view_cc_cb),
+	  FALSE },
+
+	{ "view-from",
+	  NULL,
+	  N_("_From Field"),
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_view_from_cb),
+	  FALSE },
+
+	{ "view-post-to",
+	  NULL,
+	  N_("_Post-To Field"),
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_view_post_to_cb),
+	  FALSE },
+
+	{ "view-reply-to",
+	  NULL,
+	  N_("_Reply-To Field"),
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_view_reply_to_cb),
+	  FALSE },
+
+	{ "view-to",
+	  NULL,
+	  N_("_To Field"),
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_view_to_cb),
+	  FALSE }
+};
+
 void
 e_msg_composer_actions_init (EMsgComposer *composer)
 {
@@ -175,6 +310,9 @@
 	gtk_action_group_add_actions (
 		action_group, entries,
 		G_N_ELEMENTS (entries), composer);
+	gtk_action_group_add_toggle_actions (
+		action_group, toggle_entries,
+		G_N_ELEMENTS (toggle_entries), composer);
 	gtk_ui_manager_insert_action_group (manager, action_group, 0);
 
 	/* Fine Tuning */

Modified: branches/mbarnes-composer/composer/e-composer-actions.h
==============================================================================
--- branches/mbarnes-composer/composer/e-composer-actions.h	(original)
+++ branches/mbarnes-composer/composer/e-composer-actions.h	Wed Feb  6 04:19:12 2008
@@ -20,5 +20,17 @@
 	E_COMPOSER_ACTION ((composer), "save-draft")
 #define E_COMPOSER_ACTION_SEND(composer) \
 	E_COMPOSER_ACTION ((composer), "send")
+#define E_COMPOSER_ACTION_VIEW_BCC(composer) \
+	E_COMPOSER_ACTION ((composer), "view-bcc")
+#define E_COMPOSER_ACTION_VIEW_CC(composer) \
+	E_COMPOSER_ACTION ((composer), "view-cc")
+#define E_COMPOSER_ACTION_VIEW_FROM(composer) \
+	E_COMPOSER_ACTION ((composer), "view-from")
+#define E_COMPOSER_ACTION_VIEW_POST_TO(composer) \
+	E_COMPOSER_ACTION ((composer), "view-post-to")
+#define E_COMPOSER_ACTION_VIEW_REPLY_TO(composer) \
+	E_COMPOSER_ACTION ((composer), "view-reply-to")
+#define E_COMPOSER_ACTION_VIEW_TO(composer) \
+	E_COMPOSER_ACTION ((composer), "view-to")
 
 #endif /* E_COMPOSER_ACTIONS_H */

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  6 04:19:12 2008
@@ -2946,6 +2946,31 @@
 	composer->priv->inline_images = inline_images;
 	composer->priv->inline_images_by_url = inline_images_by_url;
 
+	gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		"/apps/evolution/mail/composer/view/Bcc",
+		G_OBJECT (ACTION (VIEW_BCC)), "active");
+
+	gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		"/apps/evolution/mail/composer/view/Cc",
+		G_OBJECT (ACTION (VIEW_CC)), "active");
+
+	gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		"/apps/evolution/mail/composer/view/From",
+		G_OBJECT (ACTION (VIEW_FROM)), "active");
+
+	gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		"/apps/evolution/mail/composer/view/PostTo",
+		G_OBJECT (ACTION (VIEW_POST_TO)), "active");
+
+	gconf_bridge_bind_property (
+		gconf_bridge_get (),
+		"/apps/evolution/mail/composer/view/ReplyTo",
+		G_OBJECT (ACTION (VIEW_REPLY_TO)), "active");
+
 #if 0 /* GTKHTML-EDITOR */
 	/** @HookPoint-EMMenu: Main Mail Menu
 	 * @Id: org.gnome.evolution.mail.composer
@@ -4070,38 +4095,31 @@
 static void
 set_signature_gui (EMsgComposer *composer)
 {
-#if 0 /* GTKHTML-EDITOR */
-	CORBA_Environment ev;
+	GtkhtmlEditor *editor;
 	EComposerHeaderTable *table;
-	EMsgComposerPrivate *p = composer->priv;
 	ESignature *signature = NULL;
+	const gchar *data;
+	gchar *decoded;
 
+	editor = GTKHTML_EDITOR (composer);
 	table = e_msg_composer_get_header_table (composer);
 
-	CORBA_exception_init (&ev);
-	if (GNOME_GtkHTML_Editor_Engine_searchByData (p->eeditor_engine, 1, "ClueFlow", "signature", "1", &ev)) {
-		gchar *name, *str = NULL;
-
-		str = GNOME_GtkHTML_Editor_Engine_getParagraphData (p->eeditor_engine, "signature_name", &ev);
-		if (ev._major == CORBA_NO_EXCEPTION && str) {
-			if (!strncmp (str, "uid:", 4)) {
-				name = decode_signature_name (str + 4);
-				signature = mail_config_get_signature_by_uid (name);
-				g_free (name);
-			} else if (!strncmp (str, "name:", 5)) {
-				name = decode_signature_name (str + 4);
-				signature = mail_config_get_signature_by_name (name);
-				g_free (name);
-			}
-			CORBA_free (str);
-		}
+	if (!gtkhtml_editor_search_by_data (editor, 1, "ClueFlow", "signature"))
+		return;
 
-		e_composer_header_table_set_signature (table, signature);
+	data = gtkhtml_editor_get_paragraph_data (editor, "signature_name");
+	if (g_str_has_prefix (data, "uid:")) {
+		decoded = decode_signature_name (data + 4);
+		signature = mail_config_get_signature_by_uid (decoded);
+		g_free (decoded);
+	} else if (g_str_has_prefix (data, "name:")) {
+		decoded = decode_signature_name (data + 5);
+		signature = mail_config_get_signature_by_name (decoded);
+		g_free (decoded);
 	}
-	CORBA_exception_free (&ev);
-#endif /* GTKHTML-EDITOR */
-}
 
+	e_composer_header_table_set_signature (table, signature);
+}
 
 /**
  * e_msg_composer_new_with_message:
@@ -4390,20 +4408,19 @@
 static void
 disable_editor (EMsgComposer *composer)
 {
-#if 0 /* GTKHTML-EDITOR */
-	CORBA_Environment ev;
-	EMsgComposerPrivate *p = composer->priv;
+	GtkhtmlEditor *editor;
 
-	CORBA_exception_init (&ev);
-	GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "editable-off", &ev);
-	CORBA_exception_free (&ev);
+	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
-	gtk_widget_set_sensitive (p->attachment_bar, FALSE);
+	editor = GTKHTML_EDITOR (composer);
 
-	bonobo_ui_component_set_prop (p->uic, "/menu/Edit", "sensitive", "0", NULL);
-	bonobo_ui_component_set_prop (p->uic, "/menu/Format", "sensitive", "0", NULL);
-	bonobo_ui_component_set_prop (p->uic, "/menu/Insert", "sensitive", "0", NULL);
-#endif /* GTKHTML-EDITOR */
+	gtkhtml_editor_run_command (editor, "editable-off");
+
+	gtk_action_set_sensitive (ACTION (EDIT_MENU), FALSE);
+	gtk_action_set_sensitive (ACTION (FORMAT_MENU), FALSE);
+	gtk_action_set_sensitive (ACTION (INSERT_MENU), FALSE);
+
+	gtk_widget_set_sensitive (composer->priv->attachment_bar, FALSE);
 }
 
 /**
@@ -5049,29 +5066,24 @@
 static void
 delete_old_signature (EMsgComposer *composer)
 {
-#if 0 /* GTKHTML-EDITOR */
-	CORBA_Environment ev;
-	EMsgComposerPrivate *p = composer->priv;
+	GtkhtmlEditor *editor;
 
-	/* printf ("delete_old_signature\n"); */
-	CORBA_exception_init (&ev);
-	GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "block-selection", &ev);
-	GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "cursor-bod", &ev);
-	if (GNOME_GtkHTML_Editor_Engine_searchByData (p->eeditor_engine, 1, "ClueFlow", "signature", "1", &ev)) {
-		/* printf ("found\n"); */
-		GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "select-paragraph", &ev);
-		GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "delete", &ev);
-		/* selection-move-right doesn't succeed means that we are already on the end of document */
-		/* if (!rv)
-		   break; */
-		GNOME_GtkHTML_Editor_Engine_setParagraphData (p->eeditor_engine, "signature", "0", &ev);
-		GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "delete-back", &ev);
+	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+	editor = GTKHTML_EDITOR (composer);
+
+	gtkhtml_editor_run_command (editor, "block-selection");
+	gtkhtml_editor_run_command (editor, "cursor-bod");
+
+	if (gtkhtml_editor_search_by_data (editor, 1, "ClueFlow", "signature")) {
+		gtkhtml_editor_run_command (editor, "select-paragraph");
+		gtkhtml_editor_run_command (editor, "delete");
+		gtkhtml_editor_set_paragraph_data (editor, "signature", "0");
+		gtkhtml_editor_run_command (editor, "delete-back");
 	}
-	GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "unblock-selection", &ev);
-	CORBA_exception_free (&ev);
-#endif /* GTKHTML-EDITOR */
-}
 
+	gtkhtml_editor_run_command (editor, "unblock-selection");
+}
 
 /**
  * e_msg_composer_show_sig:
@@ -5383,10 +5395,13 @@
 gboolean
 e_msg_composer_get_view_from (EMsgComposer *composer)
 {
-	EMsgComposerPrivate *p = composer->priv;
+	GtkToggleAction *action;
+
 	g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
 
-	return p->view_from;
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_FROM));
+
+	return gtk_toggle_action_get_active (action);
 }
 
 
@@ -5398,31 +5413,18 @@
  * Controls the state of the From selector
  */
 void
-e_msg_composer_set_view_from (EMsgComposer *composer, gboolean view_from)
+e_msg_composer_set_view_from (EMsgComposer *composer,
+                              gboolean active)
 {
-#if 0 /* GTKHTML-EDITOR */
-	EMsgComposerPrivate *p = composer->priv;
-	GConfClient *gconf;
+	GtkToggleAction *action;
 
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
-	if ((p->view_from && view_from) ||
-	    (!p->view_from && !view_from))
-		return;
-
-	p->view_from = view_from;
-	bonobo_ui_component_set_prop (p->uic, "/commands/ViewFrom",
-				      "state", p->view_from ? "1" : "0", NULL);
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_FROM));
 
-	gconf = gconf_client_get_default ();
-	gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/From", view_from, NULL);
-	g_object_unref (gconf);
-
-	update_header_visibility (composer);
-#endif /* GTKHTML-EDITOR */
+	gtk_toggle_action_set_active (action, active);
 }
 
-
 /**
  * e_msg_composer_get_view_replyto:
  * @composer: A message composer widget
@@ -5434,12 +5436,14 @@
 gboolean
 e_msg_composer_get_view_replyto (EMsgComposer *composer)
 {
-	EMsgComposerPrivate *p = composer->priv;
+	GtkToggleAction *action;
+
 	g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
 
-	return p->view_replyto;
-}
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_REPLY_TO));
 
+	return gtk_toggle_action_get_active (action);
+}
 
 /**
  * e_msg_composer_set_view_replyto:
@@ -5449,29 +5453,16 @@
  * Controls the state of the Reply-To selector
  */
 void
-e_msg_composer_set_view_replyto (EMsgComposer *composer, gboolean view_replyto)
+e_msg_composer_set_view_replyto (EMsgComposer *composer,
+                                 gboolean active)
 {
-#if 0 /* GTKHTML-EDITOR */
-	EMsgComposerPrivate *p = composer->priv;
-	GConfClient *gconf;
+	GtkToggleAction *action;
 
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
-	if ((p->view_replyto && view_replyto) ||
-	    (!p->view_replyto && !view_replyto))
-		return;
-
-	p->view_replyto = view_replyto;
-	bonobo_ui_component_set_prop (p->uic, "/commands/ViewReplyTo",
-				      "state", p->view_replyto ? "1" : "0", NULL);
-
-	/* we do this /only/ if the fields is in the visible_mask */
-	gconf = gconf_client_get_default ();
-	gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/ReplyTo", view_replyto, NULL);
-	g_object_unref (gconf);
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_REPLY_TO));
 
-	update_header_visibility (composer);
-#endif /* GTKHTML-EDITOR */
+	gtk_toggle_action_set_active (action, active);
 }
 
 
@@ -5486,10 +5477,13 @@
 gboolean
 e_msg_composer_get_view_to (EMsgComposer *composer)
 {
-	EMsgComposerPrivate *p = composer->priv;
+	GtkToggleAction *action;
+
 	g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
 
-	return p->view_to;
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_TO));
+
+	return gtk_toggle_action_get_active (action);
 }
 
 
@@ -5501,34 +5495,19 @@
  * Controls the state of the To selector
  */
 void
-e_msg_composer_set_view_to (EMsgComposer *composer, gboolean view_to)
+e_msg_composer_set_view_to (EMsgComposer *composer,
+                            gboolean active)
 {
-#if 0 /* GTKHTML-EDITOR */
-	EMsgComposerPrivate *p = composer->priv;
-	GConfClient *gconf;
+	GtkToggleAction *action;
 
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
-	if ((p->view_to && view_to) ||
-	    (!p->view_to && !view_to))
-		return;
-
-	p->view_to = view_to;
-	bonobo_ui_component_set_prop (p->uic, "/commands/ViewTo",
-				      "state", p->view_to ? "1" : "0", NULL);
-
-	if (composer->priv->visible_mask & E_MSG_COMPOSER_VISIBLE_TO) {
-		gconf = gconf_client_get_default ();
-		gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/To", view_to, NULL);
-		g_object_unref (gconf);
-	}
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_TO));
 
-	update_header_visibility (composer);
-#endif /* GTKHTML-EDITOR */
+	gtk_toggle_action_set_active (action, active);
 }
 
 
-
 /**
  * e_msg_composer_get_view_postto:
  * @composer: A message composer widget
@@ -5540,10 +5519,13 @@
 gboolean
 e_msg_composer_get_view_postto (EMsgComposer *composer)
 {
-	EMsgComposerPrivate *p = composer->priv;
+	GtkToggleAction *action;
+
 	g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
 
-	return p->view_postto;
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_POST_TO));
+
+	return gtk_toggle_action_get_active (action);
 }
 
 
@@ -5555,34 +5537,19 @@
  * Controls the state of the PostTo selector
  */
 void
-e_msg_composer_set_view_postto (EMsgComposer *composer, gboolean view_postto)
+e_msg_composer_set_view_postto (EMsgComposer *composer,
+                                gboolean active)
 {
-#if 0 /* GTKHTML-EDITOR */
-	GConfClient *gconf;
-	EMsgComposerPrivate *p = composer->priv;
+	GtkToggleAction *action;
 
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
-	if ((p->view_postto && view_postto) ||
-	    (!p->view_postto && !view_postto))
-		return;
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_POST_TO));
 
-	p->view_postto = view_postto;
-	bonobo_ui_component_set_prop (p->uic, "/commands/ViewPostTo",
-				      "state", p->view_postto ? "1" : "0", NULL);
-
-	if (composer->priv->visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO) {
-		gconf = gconf_client_get_default ();
-		gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/PostTo", view_postto, NULL);
-		g_object_unref (gconf);
-	}
-
-	update_header_visibility (composer);
-#endif /* GTKHTML-EDITOR */
+	gtk_toggle_action_set_active (action, active);
 }
 
 
-
 /**
  * e_msg_composer_get_view_cc:
  * @composer: A message composer widget
@@ -5594,10 +5561,13 @@
 gboolean
 e_msg_composer_get_view_cc (EMsgComposer *composer)
 {
-	EMsgComposerPrivate *p = composer->priv;
+	GtkToggleAction *action;
+
 	g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
 
-	return p->view_cc;
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_CC));
+
+	return gtk_toggle_action_get_active (action);
 }
 
 
@@ -5609,34 +5579,19 @@
  * Controls the state of the CC display
  */
 void
-e_msg_composer_set_view_cc (EMsgComposer *composer, gboolean view_cc)
+e_msg_composer_set_view_cc (EMsgComposer *composer,
+                            gboolean active)
 {
-#if 0 /* GTKHTML-EDITOR */
-	GConfClient *gconf;
-	EMsgComposerPrivate *p = composer->priv;
+	GtkToggleAction *action;
 
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
-	if ((p->view_cc && view_cc) ||
-	    (!p->view_cc && !view_cc))
-		return;
-
-	p->view_cc = view_cc;
-	bonobo_ui_component_set_prop (p->uic, "/commands/ViewCC",
-				      "state", p->view_cc ? "1" : "0", NULL);
-
-	if (composer->priv->visible_mask & E_MSG_COMPOSER_VISIBLE_CC) {
-		gconf = gconf_client_get_default ();
-		gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Cc", view_cc, NULL);
-		g_object_unref (gconf);
-	}
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_CC));
 
-	update_header_visibility (composer);
-#endif /* GTKHTML-EDITOR */
+	gtk_toggle_action_set_active (action, active);
 }
 
 
-
 /**
  * e_msg_composer_get_view_bcc:
  * @composer: A message composer widget
@@ -5648,11 +5603,13 @@
 gboolean
 e_msg_composer_get_view_bcc (EMsgComposer *composer)
 {
-	EMsgComposerPrivate *p = composer->priv;
+	GtkToggleAction *action;
 
 	g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
 
-	return p->view_bcc;
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_BCC));
+
+	return gtk_toggle_action_get_active (action);
 }
 
 
@@ -5664,34 +5621,19 @@
  * Controls the state of the BCC display
  */
 void
-e_msg_composer_set_view_bcc (EMsgComposer *composer, gboolean view_bcc)
+e_msg_composer_set_view_bcc (EMsgComposer *composer,
+                             gboolean active)
 {
-#if 0 /* GTKHTML-EDITOR */
-	GConfClient *gconf;
-	EMsgComposerPrivate *p = composer->priv;
+	GtkToggleAction *action;
 
 	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
-	if ((p->view_bcc && view_bcc) ||
-	    (!p->view_bcc && !view_bcc))
-		return;
-
-	p->view_bcc = view_bcc;
-	bonobo_ui_component_set_prop (p->uic, "/commands/ViewBCC",
-				      "state", p->view_bcc ? "1" : "0", NULL);
-
-	if (composer->priv->visible_mask & E_MSG_COMPOSER_VISIBLE_BCC) {
-		gconf = gconf_client_get_default ();
-		gconf_client_set_bool (gconf, "/apps/evolution/mail/composer/view/Bcc", view_bcc, NULL);
-		g_object_unref (gconf);
-	}
+	action = GTK_TOGGLE_ACTION (ACTION (VIEW_BCC));
 
-	update_header_visibility (composer);
-#endif /* GTKHTML-EDITOR */
+	gtk_toggle_action_set_active (action, active);
 }
 
 
-
 /**
  * e_msg_composer_get_request_receipt
  * @composer: A message composer widget
@@ -6198,42 +6140,32 @@
 void
 e_msg_composer_delete (EMsgComposer *composer)
 {
-#if 0 /* GTKHTML-EDITOR */
-	EMsgComposerPrivate *p = composer->priv;
-	CORBA_Environment ev;
+	GtkhtmlEditor *editor;
+	const gchar *data;
 
-	CORBA_exception_init (&ev);
+	g_return_if_fail (E_IS_MSG_COMPOSER (composer));
 
-	if (GNOME_GtkHTML_Editor_Engine_isParagraphEmpty (p->eeditor_engine, &ev)) {
-		CORBA_char *orig;
-		CORBA_char *signature;
+	editor = GTKHTML_EDITOR (composer);
 
-		orig = GNOME_GtkHTML_Editor_Engine_getParagraphData (p->eeditor_engine, "orig", &ev);
-		if (ev._major == CORBA_NO_EXCEPTION) {
-			if (orig && *orig == '1') {
-				GNOME_GtkHTML_Editor_Engine_setParagraphData (p->eeditor_engine, "orig", "0", &ev);
+	if (!gtkhtml_editor_is_paragraph_empty (composer))
+		return;
 
-				GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "indent-zero", &ev);
-				GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "style-normal", &ev);
-				GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "text-default-color", &ev);
-				GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "italic-off", &ev);
-				GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "insert-paragraph", &ev);
-				GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "delete-back", &ev);
-			}
-			CORBA_free (orig);
-		}
-		signature = GNOME_GtkHTML_Editor_Engine_getParagraphData (p->eeditor_engine, "signature", &ev);
-		if (ev._major == CORBA_NO_EXCEPTION) {
-			if (signature && *signature == '1')
-				GNOME_GtkHTML_Editor_Engine_setParagraphData (p->eeditor_engine, "signature", "0", &ev);
-			CORBA_free (signature);
-		}
-	}
-	CORBA_exception_free (&ev);
-#endif /* GTKHTML-EDITOR */
+	data = gtkhtml_editor_get_paragraph_data (editor, "orig");
+	if (data != NULL && *data == '1') {
+		gtkhtml_editor_set_paragraph_data (editor, "orig", "0");
+		gtkhtml_editor_run_command (editor, "indent-zero");
+		gtkhtml_editor_run_command (editor, "style-normal");
+		gtkhtml_editor_run_command (editor, "text-default-color");
+		gtkhtml_editor_run_command (editor, "italic-off");
+		gtkhtml_editor_run_command (editor, "insert-paragraph");
+		gtkhtml_editor_run_command (editor, "delete-back");
+	}
+
+	data = gtkhtml_editor_get_paragraph_data (editor, "signature");
+	if (data != NULL && *data == '1')
+		gtkhtml_editor_set_paragraph_data (editor, "signature", "0");
 }
 
-
 gchar *
 e_msg_composer_resolve_image_url (EMsgComposer *composer, gchar *url)
 {

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  6 04:19:12 2008
@@ -124,22 +124,22 @@
 
 gboolean                 e_msg_composer_get_view_from                    (EMsgComposer      *composer);
 void                     e_msg_composer_set_view_from                    (EMsgComposer      *composer,
-									  gboolean           view_from);
+									  gboolean           active);
 gboolean                 e_msg_composer_get_view_to                      (EMsgComposer      *composer);
 void                     e_msg_composer_set_view_to                      (EMsgComposer      *composer,
-									  gboolean           view_replyto);
+									  gboolean           active);
 gboolean                 e_msg_composer_get_view_replyto                 (EMsgComposer      *composer);
 void                     e_msg_composer_set_view_replyto                 (EMsgComposer      *composer,
-									  gboolean           view_replyto);
+									  gboolean           active);
 gboolean                 e_msg_composer_get_view_postto                  (EMsgComposer      *composer);
 void                     e_msg_composer_set_view_postto                  (EMsgComposer      *composer,
-									  gboolean           view_replyto);
+									  gboolean           active);
 gboolean                 e_msg_composer_get_view_cc                      (EMsgComposer      *composer);
 void                     e_msg_composer_set_view_cc                      (EMsgComposer      *composer,
-									  gboolean           view_cc);
+									  gboolean           active);
 gboolean                 e_msg_composer_get_view_bcc                     (EMsgComposer      *composer);
 void                     e_msg_composer_set_view_bcc                     (EMsgComposer      *composer,
-									  gboolean           view_bcc);
+									  gboolean           active);
 
 gboolean                 e_msg_composer_get_request_receipt              (EMsgComposer *composer);
 void                     e_msg_composer_set_request_receipt              (EMsgComposer *composer,

Modified: branches/mbarnes-composer/composer/evolution-composer.ui
==============================================================================
--- branches/mbarnes-composer/composer/evolution-composer.ui	(original)
+++ branches/mbarnes-composer/composer/evolution-composer.ui	Wed Feb  6 04:19:12 2008
@@ -14,6 +14,16 @@
         <menuitem action='close'/>
       </menu>
     </placeholder>
+    <placeholder name='pre-insert-menu'>
+      <menu action='view-menu'>
+        <menuitem action='view-from'/>
+        <menuitem action='view-to'/>
+        <menuitem action='view-post-to'/>
+        <menuitem action='view-reply-to'/>
+        <menuitem action='view-cc'/>
+        <menuitem action='view-bcc'/>
+      </menu>
+    </placeholder>
   </menubar>
   <toolbar name='main-toolbar'>
     <placeholder name='pre-main-toolbar'>



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