Add private HeaderRow and EntryHeaderRow widgets for displaying editable
headers in the composer, convert to using that to wrap up common
properties and functionality for each of the header rows.
Create a new Composer.Editor widget and move all body web view and
action bar related code from the main widget there.
This helps to clearly delineate concerns of the two classes, it
substantially reduces the complexity of the main widget, and should
reduce the odds of further breakage like that fixed by the previous
commit less likely in the future.
Use CSS instead of widget props to ensure widgets have sufficient
white space.
This will allow adding additional action bars (e.g. by plugins) in a
more straight-forward manner.
We do not set double dots after the other labels so remove it for the
'From' label as well.
Therefore, adjust the .ui file to have the right label (with the
mnemonic underscore) and remove the adjustment of it in code.
- Use a MenuButton
- Separators between rows
- Make the popover narrower
- Put the country name below the language name, instead of in
parenthesis
- Ellipsize country/language names
- Move the attachment button(s) out of the headerbar into the action bar
- Add a cancel button
- Adjust some margins
- Set popover positions to top
- Remove subject from headerbar title to save horizontal space
This way, the composer fits on even smaller screens than before.
Works by simply listening to the size-allocate signal and changing the
orientation of a box if the allocated width is less than or equal to the
combined width of the two rows.
Splits the toolbar at the top of the composer into two action
bars at the bottom. One is always visible and contains undo, redo,
spellcheck, a menu, and a button to toggle the other action bar. The
other action bar contains the formatting buttons.
Also cleans up the margins around the fields at the top.
Implemented according to the mockups at
https://gitlab.gnome.org/Teams/Design/app-mockups/raw/master/mail/composer.png
Implemented according to the mockups at
<https://gitlab.gnome.org/Teams/Design/app-mockups/raw/master/mail/composer.png>.
- Use an animated revealer rather than instantly showing/hiding the
fields
- Include Cc in the "extended fields"
- Use a toggle button instead of a menu item to show/hide these fields,
for better discoverability
Introduce a new standard edit action group "edt" for editing actions
such as copy and undo, separate from the "win" window action group, so
that editing actions can be scoped to specific widgets and overridden
by children. Add new Action namespace with sub-namespaces for the
app, win and edt namespaces and move consts from GearyApplication there.
Update call sites and UI files, use consistent approach to setting up
action groups across all classes that use them.
* ui/composer-widget.ui: Make the info label esliipsisable, but give it a
reasonable minimum size.
* src/client/composer/composer-widget.vala (ComposerWidget): Set the info
label's tooltip with the text so it can still be read when ellipsed.
* src/client/composer/composer-widget.vala (Composer): Replace use of
inappropriate public properties and obtuse property bindings with a
subject_changed signal and private properties that update the info
label in their setter, so it's obvious how the whole thing works. Move
code for managing a detached compoer's window title to the
ComposerWindow class.
This attempts to solve bug
[#714921](https://bugzilla.gnome.org/show_bug.cgi?id=714921).
They are available as two buttons on the format bar, next to font
options. The icons I used are taken from a free icons site just for demo
purposes and should be replaced by new icons. Also I did not include
hotkeys mainly because I could not come up with a good one, also they
are pretty uncommon I think.
Also added new icons to icons/CMakeLists.txt
Don't rely ComposerState::state notify and property bindings firing when
the value hasn't actually changed to update the composer's UI. This is
works around Vala Bug 631267 landing.
* src/client/composer/composer-headerbar.vala (ComposerHeaderbar): Add
signal and methods to be called explicity on state changes, rather than
relying on being notified of ComposerWidget::state changing.
* src/client/composer/composer-widget.vala (ComposerWidget): Hook up new
ComposerHeaderbar signal and method. Remove notify and property
bindings on ::state property, move related code to new
::update_composer_view method and call that as needed. Remove
overridden ::show_all, because the UI state should now always be
consistent with ::state. Clean up various methods.
* src/client/composer/email-entry.vala (EmailEntry::EmailEntry): Make
widget visible by default, since we are no longer calling
ComposerWidget::show_all().
* src/client/application/geary-controller.vala: Don't call show all on
new composers, they now manage their visibility properly.
* ui/composer-headerbar.ui: Make toolbar icons visible by default.
* ui/composer-widget.ui: Make toolbar icons visible by default, set Send
button icon here rather than in the class.
We can't easily wrap ComposerWebView in a GtkScrolledWindow, since we
don't any notifications that the cursor has moved offscreen and hence the
view needs to be scrolled, so let the view do its own scrolling.
* ui/composer-widget.ui: Replace editor_scrolled with editor_container,
update uses.
* src/client/composer/composer-widget.vala (ComposerWidget): Rename
subject changed handler to something more generic, hook that up to the
to/cc/bcc & reply_to entries.
* ui/composer-widget.ui: Hook up multiple to on_envelope_changed, make
subject entry use that as well.
* src/client/composer/composer-web-view.vala (ComposerWebView): Add new
::command_stack_changed signal to manage undo/redo enabled state, hook
it up to a JS callback. Add ::is_empty property as a non-functioning
shim in lieu of can_undo going away. Remove ::can_undo and ::can_redo,
replace them with methods to actually fire an undo and redo.
* src/client/composer/composer-widget.vala (ComposerWidget): Use
ClientWebView::is_empty rather inplace of can_redo for determining
editing state. Remove old undo/redo signal hookups, replace with
::command_stack_changed and manage action enable state from there.
(ComposerWidget::action_entries): Add explicit actions for undo/redo,
since they need some custom code over on on the web process side.
(ComposerWidget::on_compose_as_html_toggled): Explciitly manage the
visibility of rich text toolbar buttons, don't rely on obscure
GtkBuilder magic that Glade doesn't support.
* ui/composer-web-view.js: Add a mutation observer for the message body
and explcit methods for firing undo/redo commands, so we can keep track
of how the command stack changes. As it does, fire commandStackChanged
messages back to the client process. Explicity set the message body as
content-editable after the document has been mutated for quotes, etc.
* ui/composer-widget.ui: Add bonus undo/redo toobar buttons for the
composer.
* src/client/application/geary-controller.vala
(GearyController::archive_or_delete_selection_async): Don't modify the
focus after archiving/trashing/deleting.
* src/client/components/pill-toolbar.vala, ui/composer-headerbar.ui,
ui/composer-widget.ui: Ensure all toolbar buttons are focusable but
have focus-on-click disabled.
* src/client/composer/composer-widget.vala (ComposerWidget): Add action
and callback that simply does a normal attachment for now.
* ui/composer-widget.ui: Add insert image button to the composer toobar.
Now using these instead of the old composer's actions. This led to quite
some changes:
* Use GLib.ActionEntry instead of Gtk.ActionEntry in
composer-widget.vala
* Action names can now be specified in the UI files.
* Use templates for the ComposerHeaderBar. Remove
Pillbar as superclass, since that was no longer necessary.
* Merge ComposerToolbar into ComposerWidget.
* Since actions can now be parameterized, some methods could be
merged (e.g. font size methods).
* The menu button in the composer now automatically uses a popover.
* Some methods and classes really deserved more comments.
* necessary POTFILES.in changes
Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>