Add the possibility to hide the GtkHTML Edit toolbar

Jan Holesovsky <[email protected]> Tue, 19 Jan 2010 14:40:02 +0100
Newsgroups gmane.comp.gnome.evolution.patches
Message-ID <[email protected]>
--=-U2Au6luEsDKC3u16opSD
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit

Hi,

When composing a mail, the GtkHTML Edit toolbar is highly annoying for
me ;-) - I write only plain-text mails, and the toolbar only wastes
place on my screen.

The attached patch adds the possibility to hide it, using the same menu
as where From/To/CC/BCC can be hidden (View).

Comments [or commit & push ;-)] appreciated.

Thank you,
Kendy

--=-U2Au6luEsDKC3u16opSD
Content-Disposition: attachment; filename="0003-Make-the-GtkHTML-Edit-Toolbar-configurable.patch"
Content-Type: text/x-patch; name="0003-Make-the-GtkHTML-Edit-Toolbar-configurable.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit

From 4f02913c05a569d4e5bc423276b229bf08d9b0a6 Mon Sep 17 00:00:00 2001
From: Jan Holesovsky <[email protected]>
Date: Mon, 18 Jan 2010 08:56:01 +0100
Subject: [PATCH] Make the GtkHTML Edit Toolbar configurable.

Make showing/hiding the GtkHTML Edit Toolbar in Composer configurable the same
way it is for the From/To/CC/... fields.  Particularly useful on smaller
screens when composing plain-text-only messages.
---
 composer/e-composer-actions.c  |    8 ++++++++
 composer/e-composer-actions.h  |    2 ++
 composer/e-composer-private.c  |   15 +++++++++++++++
 composer/evolution-composer.ui |    1 +
 mail/evolution-mail.schemas.in |   15 +++++++++++++++
 5 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c
index 7332c93..ee3445b 100644
--- a/composer/e-composer-actions.c
+++ b/composer/e-composer-actions.c
@@ -435,6 +435,14 @@ static GtkToggleActionEntry toggle_entries[] = {
 	  N_("Toggles whether the Reply-To field is displayed"),
 	  NULL,  /* Handled by property bindings */
 	  FALSE },
+
+	{ "view-edit-toolbar",
+	  NULL,
+	  N_("_Edit Toolbar"),
+	  NULL,
+	  N_("Toggles whether the Edit toolbar is displayed"),
+	  NULL,  /* Handled by property bindings */
+	  FALSE },
 };
 
 void
diff --git a/composer/e-composer-actions.h b/composer/e-composer-actions.h
index 18c75eb..164af78 100644
--- a/composer/e-composer-actions.h
+++ b/composer/e-composer-actions.h
@@ -61,5 +61,7 @@
 	E_COMPOSER_ACTION ((composer), "view-from")
 #define E_COMPOSER_ACTION_VIEW_REPLY_TO(composer) \
 	E_COMPOSER_ACTION ((composer), "view-reply-to")
+#define E_COMPOSER_ACTION_VIEW_EDIT_TOOLBAR(composer) \
+	E_COMPOSER_ACTION ((composer), "view-edit-toolbar")
 
 #endif /* E_COMPOSER_ACTIONS_H */
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index b0bc0c9..3ed8444 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -140,10 +140,12 @@ e_composer_private_constructed (EMsgComposer *composer)
 	gchar *filename;
 	gint ii;
 	GError *error = NULL;
+	GConfBridge *bridge;
 
 	editor = GTKHTML_EDITOR (composer);
 	html = gtkhtml_editor_get_html (editor);
 	ui_manager = gtkhtml_editor_get_ui_manager (editor);
+	bridge = gconf_bridge_get ();
 
 	if (composer->lite) {
 		widget = gtkhtml_editor_get_managed_widget (editor, "/main-menu");
@@ -347,6 +349,19 @@ e_composer_private_constructed (EMsgComposer *composer)
 			action, "active");
 	}
 
+	/* Show/hide the Edit toolbar */
+	widget = gtkhtml_editor_get_managed_widget (editor, "/edit-toolbar");
+	action = E_COMPOSER_ACTION_VIEW_EDIT_TOOLBAR (editor);
+	gconf_bridge_bind_property (
+		bridge, COMPOSER_GCONF_PREFIX "/show_edit_toolbar",
+		G_OBJECT (widget), "visible");
+	e_mutual_binding_new (
+		widget, "sensitive",
+		action, "sensitive");
+	e_mutual_binding_new (
+		widget, "visible",
+		action, "active");
+
 	/* Install a handler for inline images. */
 
 	/* XXX We no longer use GtkhtmlEditor::uri-requested because it
diff --git a/composer/evolution-composer.ui b/composer/evolution-composer.ui
index f0e9c01..1e896c0 100644
--- a/composer/evolution-composer.ui
+++ b/composer/evolution-composer.ui
@@ -32,6 +32,7 @@
         <menuitem action='view-reply-to'/>
         <menuitem action='view-cc'/>
         <menuitem action='view-bcc'/>
+        <menuitem action='view-edit-toolbar'/>
       </menu>
     </placeholder>
     <menu action='insert-menu'>
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index 09d875a..09bfadb 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -190,6 +190,21 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/evolution/mail/composer/show_edit_toolbar</key>
+      <applyto>/apps/evolution/mail/composer/show_edit_toolbar</applyto>
+      <owner>evolution-mail</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+         <short>Show "Edit" toolbar when sending a mail message</short>
+         <long>
+           Show the "Edit" toolbar when sending a mail message.  This
+           is controlled from the View menu when a mail account is chosen.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/evolution/mail/composer/show_post_from</key>
       <applyto>/apps/evolution/mail/composer/show_post_from</applyto>
       <owner>evolution-mail</owner>
-- 
1.6.0.2


--=-U2Au6luEsDKC3u16opSD
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Evolution-patches mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-patches

--=-U2Au6luEsDKC3u16opSD--