EComposer: Add an option to hide edit toolbar
This commit is contained in:
committed by
Milan Crha
parent
7f3ea7a8f1
commit
6d044a1ef4
@@ -243,6 +243,11 @@
|
||||
<_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-edit-toolbar" type="b">
|
||||
<default>true</default>
|
||||
<_summary>Whether to always show edit toolbar</_summary>
|
||||
<_description>If set to “true”, the edit toolbar will be visible.</_description>
|
||||
</key>
|
||||
<key name="composer-toolbar-show-sign-encrypt" type="b">
|
||||
<default>false</default>
|
||||
<_summary>Whether to always show Sign and Encrypt buttons on the toolbar</_summary>
|
||||
|
||||
@@ -413,6 +413,14 @@ static GtkActionEntry async_entries[] = {
|
||||
|
||||
static GtkToggleActionEntry toggle_entries[] = {
|
||||
|
||||
{ "toolbar-show-edit",
|
||||
NULL,
|
||||
N_("Edit _toolbar"),
|
||||
NULL,
|
||||
N_("Edit toolbar"),
|
||||
NULL,
|
||||
FALSE },
|
||||
|
||||
{ "pgp-encrypt",
|
||||
NULL,
|
||||
N_("PGP _Encrypt"),
|
||||
@@ -596,6 +604,8 @@ e_composer_actions_init (EMsgComposer *composer)
|
||||
EHTMLEditor *editor;
|
||||
EContentEditor *cnt_editor;
|
||||
gboolean visible;
|
||||
GSettings *settings;
|
||||
GtkAction *action;
|
||||
GIcon *gcr_gnupg_icon;
|
||||
|
||||
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
|
||||
@@ -675,13 +685,20 @@ e_composer_actions_init (EMsgComposer *composer)
|
||||
|
||||
#undef init_toolbar_option
|
||||
|
||||
settings = e_util_ref_settings ("org.gnome.evolution.mail");
|
||||
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 */
|
||||
gcr_gnupg_icon = g_themed_icon_new ("gcr-gnupg");
|
||||
if (gcr_gnupg_icon) {
|
||||
GIcon *temp_icon;
|
||||
GIcon *action_icon;
|
||||
GEmblem *emblem;
|
||||
GtkAction *action;
|
||||
|
||||
emblem = g_emblem_new (gcr_gnupg_icon);
|
||||
|
||||
|
||||
@@ -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_EDIT(composer) \
|
||||
E_COMPOSER_ACTION ((composer), "toolbar-show-edit")
|
||||
#define E_COMPOSER_ACTION_TOOLBAR_PGP_ENCRYPT(composer) \
|
||||
E_COMPOSER_ACTION ((composer), "toolbar-pgp-encrypt")
|
||||
#define E_COMPOSER_ACTION_TOOLBAR_PGP_SIGN(composer) \
|
||||
|
||||
@@ -448,6 +448,11 @@ e_composer_private_constructed (EMsgComposer *composer)
|
||||
G_BINDING_SYNC_CREATE |
|
||||
G_BINDING_INVERT_BOOLEAN);
|
||||
|
||||
e_binding_bind_property (
|
||||
E_HTML_EDITOR_ACTION (editor, "paragraph-style-menu"), "visible",
|
||||
ACTION (TOOLBAR_SHOW_EDIT), "sensitive",
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
g_object_unref (settings);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<menuitem action='view-bcc'/>
|
||||
<separator/>
|
||||
<menuitem action='picture-gallery'/>
|
||||
<menuitem action='toolbar-show-edit'/>
|
||||
<separator/>
|
||||
<menuitem action='visually-wrap-long-lines'/>
|
||||
</menu>
|
||||
|
||||
@@ -685,7 +685,7 @@ html_editor_actions_notify_mode_cb (EHTMLEditor *editor,
|
||||
gtk_widget_set_sensitive (editor->priv->fg_color_combo_box, is_html);
|
||||
gtk_widget_set_sensitive (editor->priv->bg_color_combo_box, is_html);
|
||||
|
||||
if (is_html) {
|
||||
if (is_html && gtk_widget_get_visible (editor->priv->edit_toolbar)) {
|
||||
gtk_widget_show (editor->priv->html_toolbar);
|
||||
} else {
|
||||
gtk_widget_hide (editor->priv->html_toolbar);
|
||||
|
||||
@@ -793,6 +793,25 @@ e_html_editor_mode_to_bool_hide_in_markdown_cb (GBinding *binding,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
e_html_editor_edit_html_toolbar_visible_cb (GBinding *binding,
|
||||
const GValue *from_value,
|
||||
GValue *to_value,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean visible;
|
||||
EHTMLEditor *editor;
|
||||
|
||||
editor = user_data;
|
||||
g_return_val_if_fail (E_IS_HTML_EDITOR (editor), TRUE);
|
||||
|
||||
visible = g_value_get_boolean (from_value);
|
||||
|
||||
g_value_set_boolean (to_value, visible && editor->priv->mode == E_CONTENT_EDITOR_MODE_HTML);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
html_editor_set_property (GObject *object,
|
||||
guint property_id,
|
||||
@@ -906,7 +925,6 @@ html_editor_constructed (GObject *object)
|
||||
gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ);
|
||||
gtk_grid_attach (GTK_GRID (editor), widget, 0, 1, 1, 1);
|
||||
priv->html_toolbar = g_object_ref (widget);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
/* Construct the activity bar. */
|
||||
|
||||
@@ -1033,6 +1051,14 @@ html_editor_constructed (GObject *object)
|
||||
e_html_editor_mode_to_bool_hide_in_markdown_cb,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
e_binding_bind_property_full (
|
||||
priv->edit_toolbar, "visible",
|
||||
priv->html_toolbar, "visible",
|
||||
G_BINDING_SYNC_CREATE,
|
||||
e_html_editor_edit_html_toolbar_visible_cb,
|
||||
NULL, editor, NULL);
|
||||
|
||||
|
||||
g_signal_connect_after (object, "realize", G_CALLBACK (html_editor_realize), NULL);
|
||||
|
||||
settings = e_util_ref_settings ("org.gnome.evolution.mail");
|
||||
@@ -1042,6 +1068,11 @@ html_editor_constructed (GObject *object)
|
||||
editor, "paste-plain-prefer-pre",
|
||||
G_SETTINGS_BIND_GET);
|
||||
|
||||
g_settings_bind (
|
||||
settings, "composer-show-edit-toolbar",
|
||||
priv->edit_toolbar, "visible",
|
||||
G_SETTINGS_BIND_GET);
|
||||
|
||||
g_object_unref (settings);
|
||||
}
|
||||
|
||||
@@ -1783,6 +1814,7 @@ e_html_editor_set_mode (EHTMLEditor *editor,
|
||||
if (E_IS_MARKDOWN_EDITOR (editor->priv->use_content_editor)) {
|
||||
EMarkdownEditor *markdown_editor;
|
||||
GtkToolbar *toolbar;
|
||||
GSettings *settings;
|
||||
|
||||
markdown_editor = E_MARKDOWN_EDITOR (editor->priv->use_content_editor);
|
||||
|
||||
@@ -1794,7 +1826,10 @@ e_html_editor_set_mode (EHTMLEditor *editor,
|
||||
toolbar = GTK_TOOLBAR (editor->priv->edit_toolbar);
|
||||
gtk_toolbar_insert (toolbar, editor->priv->mode_tool_item, 0);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (editor->priv->edit_toolbar));
|
||||
settings = e_util_ref_settings ("org.gnome.evolution.mail");
|
||||
if (g_settings_get_boolean (settings, "composer-show-edit-toolbar"))
|
||||
gtk_widget_show (GTK_WIDGET (editor->priv->edit_toolbar));
|
||||
g_object_unref (settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user