[evolution] EComposer: Add an option to hide main toolbar



commit 436b7a2c5f64b6e64d7252ab28ee641f96d4a700
Author: Cédric Bellegarde <cedric bellegarde adishatz org>
Date:   Fri Jul 1 13:35:09 2022 +0200

    EComposer: Add an option to hide main toolbar

 data/org.gnome.evolution.mail.gschema.xml.in |  5 +++++
 src/composer/e-composer-actions.c            | 16 ++++++++++++++++
 src/composer/e-composer-actions.h            |  2 ++
 src/composer/e-composer-private.c            |  5 +++++
 src/composer/evolution-composer.ui           |  1 +
 5 files changed, 29 insertions(+)
---
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index 0b67d0bc63..1d9981beed 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -242,6 +242,11 @@
       <default>10</default>
       <_summary>Number of To and CC recipients to ask “prompt-on-many-to-cc-recips” from</_summary>
       <_description>When to ask, when the number of To and CC recipients reaches this value.</_description>
+    </key>
+     <key name="composer-show-main-toolbar" type="b">
+      <default>true</default>
+      <_summary>Whether to always show main toolbar</_summary>
+      <_description>If set to “true”, the main toolbar will be visible.</_description>
     </key>
     <key name="composer-show-edit-toolbar" type="b">
       <default>true</default>
diff --git a/src/composer/e-composer-actions.c b/src/composer/e-composer-actions.c
index 815c399788..9db085be45 100644
--- a/src/composer/e-composer-actions.c
+++ b/src/composer/e-composer-actions.c
@@ -413,6 +413,14 @@ static GtkActionEntry async_entries[] = {
 
 static GtkToggleActionEntry toggle_entries[] = {
 
+       { "toolbar-show-main",
+         NULL,
+         N_("_Main toolbar"),
+         NULL,
+         N_("Main toolbar"),
+         NULL,
+         FALSE },
+
        { "toolbar-show-edit",
          NULL,
          N_("Edit _toolbar"),
@@ -668,11 +676,19 @@ e_composer_actions_init (EMsgComposer *composer)
        #undef init_toolbar_option
 
        settings = e_util_ref_settings ("org.gnome.evolution.mail");
+
+       action = ACTION (TOOLBAR_SHOW_MAIN);
+       g_settings_bind (
+               settings, "composer-show-main-toolbar",
+               action, "active",
+               G_SETTINGS_BIND_DEFAULT);
+
        action = ACTION (TOOLBAR_SHOW_EDIT);
        g_settings_bind (
                settings, "composer-show-edit-toolbar",
                action, "active",
                G_SETTINGS_BIND_DEFAULT);
+
        g_object_unref (settings);
 
        /* Borrow a GnuPG icon from gcr to distinguish between GPG and S/MIME Sign/Encrypt actions */
diff --git a/src/composer/e-composer-actions.h b/src/composer/e-composer-actions.h
index 25f2a26a84..32bddbc470 100644
--- a/src/composer/e-composer-actions.h
+++ b/src/composer/e-composer-actions.h
@@ -56,6 +56,8 @@
        E_COMPOSER_ACTION ((composer), "smime-encrypt")
 #define E_COMPOSER_ACTION_SMIME_SIGN(composer) \
        E_COMPOSER_ACTION ((composer), "smime-sign")
+#define E_COMPOSER_ACTION_TOOLBAR_SHOW_MAIN(composer) \
+       E_COMPOSER_ACTION ((composer), "toolbar-show-main")
 #define E_COMPOSER_ACTION_TOOLBAR_SHOW_EDIT(composer) \
        E_COMPOSER_ACTION ((composer), "toolbar-show-edit")
 #define E_COMPOSER_ACTION_TOOLBAR_PGP_ENCRYPT(composer) \
diff --git a/src/composer/e-composer-private.c b/src/composer/e-composer-private.c
index 0aff0e0341..224d218e40 100644
--- a/src/composer/e-composer-private.c
+++ b/src/composer/e-composer-private.c
@@ -309,6 +309,11 @@ e_composer_private_constructed (EMsgComposer *composer)
        gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
        gtk_widget_show (widget);
 
+       e_binding_bind_property (
+               ACTION (TOOLBAR_SHOW_MAIN), "active",
+               widget, "visible",
+               G_BINDING_SYNC_CREATE);
+
        /* Construct the header table. */
 
        widget = e_composer_header_table_new (client_cache);
diff --git a/src/composer/evolution-composer.ui b/src/composer/evolution-composer.ui
index f67e553f08..3937287796 100644
--- a/src/composer/evolution-composer.ui
+++ b/src/composer/evolution-composer.ui
@@ -33,6 +33,7 @@
         <menuitem action='view-bcc'/>
         <separator/>
         <menuitem action='picture-gallery'/>
+        <menuitem action='toolbar-show-main'/>
         <menuitem action='toolbar-show-edit'/>
         <separator/>
         <menuitem action='visually-wrap-long-lines'/>


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