diff --git a/desktop/org.gnome.Geary.gschema.xml b/desktop/org.gnome.Geary.gschema.xml index f0068798..cac7a4d0 100644 --- a/desktop/org.gnome.Geary.gschema.xml +++ b/desktop/org.gnome.Geary.gschema.xml @@ -45,6 +45,12 @@ True if the folder list Paned is in the horizontal orientation. + + true + Show/hide formatting toolbar + True if the formatting toolbar in the composer is shown. + + 250 Position of message list pane diff --git a/src/client/application/application-configuration.vala b/src/client/application/application-configuration.vala index e2cc8f7b..89db44cf 100644 --- a/src/client/application/application-configuration.vala +++ b/src/client/application/application-configuration.vala @@ -22,6 +22,7 @@ public class Application.Configuration : Geary.BaseObject { public const string FOLDER_LIST_PANE_POSITION_HORIZONTAL_KEY = "folder-list-pane-position-horizontal"; public const string FOLDER_LIST_PANE_POSITION_KEY = "folder-list-pane-position"; public const string FOLDER_LIST_PANE_POSITION_VERTICAL_KEY = "folder-list-pane-position-vertical"; + public const string FORMATTING_TOOLBAR_VISIBLE = "formatting-toolbar-visible"; public const string MESSAGES_PANE_POSITION_KEY = "messages-pane-position"; public const string SEARCH_STRATEGY_KEY = "search-strategy"; public const string SINGLE_KEY_SHORTCUTS = "single-key-shortcuts"; @@ -104,6 +105,11 @@ public class Application.Configuration : Geary.BaseObject { get { return settings.get_boolean(FOLDER_LIST_PANE_HORIZONTAL_KEY); } } + public bool formatting_toolbar_visible { + get { return settings.get_boolean(FORMATTING_TOOLBAR_VISIBLE); } + set { settings.set_boolean(FORMATTING_TOOLBAR_VISIBLE, value); } + } + public int messages_pane_position { get { return settings.get_int(MESSAGES_PANE_POSITION_KEY); } set { settings.set_int(MESSAGES_PANE_POSITION_KEY, value); } diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala index 9253eab4..0a76f90b 100644 --- a/src/client/composer/composer-widget.vala +++ b/src/client/composer/composer-widget.vala @@ -131,6 +131,7 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { private const string ACTION_INSERT_LINK = "insert-link"; private const string ACTION_COMPOSE_AS_HTML = "compose-as-html"; private const string ACTION_SHOW_EXTENDED_HEADERS = "show-extended-headers"; + private const string ACTION_SHOW_FORMATTING = "show-formatting"; private const string ACTION_DISCARD = "discard"; private const string ACTION_DETACH = "detach"; private const string ACTION_SEND = "send"; @@ -186,6 +187,7 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { { ACTION_SELECT_DICTIONARY, on_select_dictionary }, { ACTION_SEND, on_send }, { ACTION_SHOW_EXTENDED_HEADERS, on_toggle_action, null, "false", on_show_extended_headers_toggled }, + { ACTION_SHOW_FORMATTING, on_toggle_action, null, "false", on_show_formatting }, }; public static void add_accelerators(Application.Client application) { @@ -310,6 +312,7 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { [GtkChild] private Gtk.Label from_label; + [GtkChild] private Gtk.Box from_row; [GtkChild] private Gtk.Label from_single; [GtkChild] @@ -347,8 +350,7 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { private EmailEntry reply_to_entry; private Components.EntryUndo reply_to_undo; - [GtkChild] - private Gtk.Label subject_label; + [GtkChild] private Gtk.Box subject_row; [GtkChild] private Gtk.Entry subject_entry; private Components.EntryUndo subject_undo; @@ -371,17 +373,10 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { private Gtk.Widget recipients; [GtkChild] private Gtk.Box header_area; - [GtkChild] - private Gtk.Box insert_buttons; - [GtkChild] - private Gtk.Box font_style_buttons; - [GtkChild] - private Gtk.Box list_buttons; + [GtkChild] private Gtk.Revealer formatting; [GtkChild] private Gtk.Button insert_link_button; [GtkChild] - private Gtk.Button remove_format_button; - [GtkChild] private Gtk.Button select_dictionary_button; [GtkChild] private Gtk.MenuButton menu_button; @@ -1150,6 +1145,11 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { ); } + this.composer_actions.change_action_state( + ACTION_SHOW_FORMATTING, + this.application.config.formatting_toolbar_visible + ); + get_action(Action.Edit.UNDO).set_enabled(false); get_action(Action.Edit.REDO).set_enabled(false); @@ -1435,20 +1435,17 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { case PresentationMode.DETACHED: case PresentationMode.PANED: this.recipients.set_visible(true); - this.subject_label.set_visible(true); - this.subject_entry.set_visible(true); + this.subject_row.visible = true; break; case PresentationMode.INLINE: this.recipients.set_visible(true); - this.subject_label.set_visible(false); - this.subject_entry.set_visible(false); + this.subject_row.visible = false; break; case PresentationMode.INLINE_COMPACT: this.recipients.set_visible(false); - this.subject_label.set_visible(false); - this.subject_entry.set_visible(false); + this.subject_row.visible = false; set_compact_header_recipients(); break; } @@ -2123,10 +2120,9 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { update_cursor_actions(); - this.insert_buttons.visible = compose_as_html; - this.font_style_buttons.visible = compose_as_html; - this.list_buttons.visible = compose_as_html; - this.remove_format_button.visible = compose_as_html; + var show_formatting = (SimpleAction) this.composer_actions.lookup_action(ACTION_SHOW_FORMATTING); + show_formatting.set_enabled(compose_as_html); + update_formatting_toolbar(); this.menu_button.menu_model = (compose_as_html) ? this.html_menu : this.plain_menu; @@ -2146,6 +2142,20 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { } } + private void update_formatting_toolbar() { + var show_formatting = (SimpleAction) this.composer_actions.lookup_action(ACTION_SHOW_FORMATTING); + var text_format = (SimpleAction) this.composer_actions.lookup_action(ACTION_TEXT_FORMAT); + this.formatting.reveal_child = text_format.get_state().get_string() == "html" && show_formatting.get_state().get_boolean(); + } + + private void on_show_formatting(SimpleAction? action, Variant? new_state) { + bool show_formatting = new_state.get_boolean(); + this.application.config.formatting_toolbar_visible = show_formatting; + action.set_state(new_state); + + update_formatting_toolbar(); + } + private void on_font_family(SimpleAction action, Variant? param) { this.editor.execute_editing_command_with_argument( "fontname", param.get_string() @@ -2392,7 +2402,7 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { // the from address had to be set private bool update_from_field() { this.from_multiple.changed.disconnect(on_from_changed); - this.from_single.visible = this.from_multiple.visible = this.from_label.visible = false; + this.from_single.visible = this.from_multiple.visible = this.from_row.visible = false; // Don't show in inline unless the current account has // multiple email accounts or aliases, since these will be replies to a @@ -2411,7 +2421,7 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface { return false; } - this.from_label.visible = true; + this.from_row.visible = true; this.from_label.set_mnemonic_widget(this.from_multiple); // Composer label (with mnemonic underscore) for the account selector // when choosing what address to send a message from. diff --git a/ui/composer-widget.ui b/ui/composer-widget.ui index 57ee5157..2899c6af 100644 --- a/ui/composer-widget.ui +++ b/ui/composer-widget.ui @@ -14,7 +14,6 @@ True False vertical - 2 True @@ -48,7 +47,7 @@ 6 vertical - + True False 6 @@ -343,10 +342,11 @@ - + True False 6 + 6 True @@ -467,461 +467,7 @@ True False - - - True - False - 6 - 6 - 4 - 6 - - - True - False - - - True - True - False - False - Undo last edit - edt.undo - True - - - True - False - 16 - edit-undo-symbolic - - - - - False - True - 0 - - - - - True - True - False - False - Redo last edit - edt.redo - True - - - True - False - 16 - edit-redo-symbolic - - - - - False - True - 1 - - - - - - False - True - 0 - - - - - True - False - - - True - True - False - False - Bold text - edt.bold - True - - - True - False - 16 - format-text-bold-symbolic - - - - - False - True - 0 - - - - - True - True - False - False - Italic text - edt.italic - True - - - True - False - 16 - format-text-italic-symbolic - - - - - False - True - 1 - - - - - True - True - False - False - Underline text - edt.underline - True - - - True - False - 16 - format-text-underline-symbolic - - - - - False - True - 2 - - - - - True - True - False - False - Strikethrough text - edt.strikethrough - True - - - True - False - 16 - format-text-strikethrough-symbolic - - - - - False - True - 3 - - - - - - False - True - 1 - - - - - True - False - - - True - True - False - False - Insert bulleted list - edt.ulist - True - - - True - False - 16 - format-unordered-list-symbolic - - - - - False - True - 0 - - - - - True - True - False - False - Insert numbered list - edt.olist - True - - - True - False - 16 - format-ordered-list-symbolic - - - - - False - True - 1 - - - - - - False - True - 2 - - - - - True - False - - - True - True - False - False - Indent or quote text - edt.indent - True - - - True - False - 16 - format-indent-more-symbolic - - - - - False - True - 0 - - - - - True - True - False - False - Un-indent or unquote text - edt.outdent - True - - - True - False - 16 - format-indent-less-symbolic - - - - - False - True - 1 - - - - - - False - True - 3 - - - - - True - False - - - True - True - False - False - Insert or update text link - edt.insert-link - True - - - True - False - 16 - insert-link-symbolic - - - - - False - True - 0 - - - - - True - True - False - False - Insert an image - edt.insert-image - True - - - True - False - 16 - insert-image-symbolic - - - - - False - True - 1 - - - - - - False - True - 4 - - - - - True - True - False - False - Remove text formatting - edt.remove-format - True - - - True - False - 16 - format-text-remove-symbolic - - - - - False - True - 5 - - - - - True - True - False - False - Select spell checking languages - win.select-dictionary - True - - - True - False - 16 - accessories-dictionary-symbolic - - - - - False - True - 6 - - - - - True - False - False - False - - - - - - False - True - end - 7 - - - - - True - True - end - 6 - 0 - - - - False - True - end - 8 - - - - - 0 - 0 - - + vertical True @@ -1011,10 +557,444 @@ - - 0 - 1 - + + + + True + slide-up + + + True + + + True + False + + + True + True + False + False + Bold text + edt.bold + True + + + True + False + 16 + format-text-bold-symbolic + + + + + False + True + 0 + + + + + True + True + False + False + Italic text + edt.italic + True + + + True + False + 16 + format-text-italic-symbolic + + + + + False + True + 1 + + + + + True + True + False + False + Underline text + edt.underline + True + + + True + False + 16 + format-text-underline-symbolic + + + + + False + True + 2 + + + + + True + True + False + False + Strikethrough text + edt.strikethrough + True + + + True + False + 16 + format-text-strikethrough-symbolic + + + + + False + True + 3 + + + + + + + + True + False + + + True + True + False + False + Insert bulleted list + edt.ulist + True + + + True + False + 16 + format-unordered-list-symbolic + + + + + False + True + 0 + + + + + True + True + False + False + Insert numbered list + edt.olist + True + + + True + False + 16 + format-ordered-list-symbolic + + + + + False + True + 1 + + + + + + + + True + False + + + True + True + False + False + Indent or quote text + edt.indent + True + + + True + False + 16 + format-indent-more-symbolic + + + + + False + True + 0 + + + + + True + True + False + False + Un-indent or unquote text + edt.outdent + True + + + True + False + 16 + format-indent-less-symbolic + + + + + False + True + 1 + + + + + + + + True + False + + + True + True + False + False + Insert or update text link + edt.insert-link + True + + + True + False + 16 + insert-link-symbolic + + + + + False + True + 0 + + + + + True + True + False + False + Insert an image + edt.insert-image + True + + + True + False + 16 + insert-image-symbolic + + + + + False + True + 1 + + + + + + + + True + True + False + False + Remove text formatting + edt.remove-format + True + + + True + False + 16 + format-text-remove-symbolic + + + + + + + + + + + True + + + True + False + + + True + True + False + False + Undo last edit + edt.undo + True + + + True + False + 16 + edit-undo-symbolic + + + + + False + True + 0 + + + + + True + True + False + False + Redo last edit + edt.redo + True + + + True + False + 16 + edit-redo-symbolic + + + + + False + True + 1 + + + + + + + + True + True + end + 6 + 0 + + + + + + True + False + False + False + + + True + view-more-symbolic + + + + + end + + + + + True + False + False + False + win.show-formatting + Show formatting toolbar + + + True + format-text-italic-symbolic + + + + + end + + + + + True + True + False + False + Select spell checking languages + win.select-dictionary + True + + + True + False + 16 + tools-check-spelling-symbolic + + + + + end + + +