Commit graph

5172 commits

Author SHA1 Message Date
Michael Gratton
c002285fef Geary.App.ConversationMonitor: Fix re-entrancy issues
Avoid some issues if a monitor is closed as it is still being opened,
clean up the API and implementation a bit.
2019-11-07 11:58:56 +11:00
Michael Gratton
800e53bc50 Improve application shutdown process
Ensure accounts being removed are de-selected and the cursor moved off
of their folders in the folder list so that as they are removed, their
folders are not selected in quick succession. Don't redudantly close
inboxes in Application.Controller::close_async, and merge the two parts
to the handling of account closing.
2019-11-07 11:58:56 +11:00
Michael Gratton
4adacb42be Move MainWindow folder management impl to MainWindow 2019-11-07 11:58:55 +11:00
Michael Gratton
ac0c015210 Application.Controller: Add convenience method 2019-11-07 11:58:55 +11:00
Michael Gratton
09fde274d3 Require MainWindow::select_folder to declare mode of interaction
By determining if selecting a folder is interactive or not, the
MainWindow can avoid enabling auto-marking of unread email.
2019-11-07 11:58:55 +11:00
Michael Gratton
3fb943cd6a Move folder selection and related handling to MainWindow
Move more main-window specific code out of Application.Controller,
allowing consolidation of all folder selection code in the one place
and allowing it to be revamped so as to support robust programmatic
selection of folders.
2019-11-07 11:58:55 +11:00
Michael Gratton
c601be4701 Prevent the same application action re-executed multiple times
Before Application.Controller executes an action, ensure it's not the
same action as was execued just before. This stops e.g. issues if
someone holds down Delete.

Fixes #578
2019-11-07 11:58:55 +11:00
Michael Gratton
358d864e35 Add location and conversation context properties to EmailCommand
Add context properties to EmailCommand so that MainWindow can (once
supported) re-select folder and modified conversations when undoing a
command.

Convert it into a full-blown abstract class so that subclasses don't all
need to re-implement it, and provide a default implementation of the
folder and email removal methods. Update command methods on
Application.Controller to get the required context objects.
2019-11-07 11:58:55 +11:00
Michael Gratton
acc243c472 Fix some bad container impl assumptions in MinimalFolder 2019-11-07 11:58:55 +11:00
Michael Gratton
5cc92ef964 Move email action handling to ConversationListBox
This allows a single widget to get constructed to handle email actions,
rather than every single ConversationEmail having to do so, and thus
related signals can also be moved to and emitted from
ConversationListBox, so that MainWindow only has to hook up to a single
object's signals for a conversation, not every email in the
conversation.
2019-11-07 11:58:55 +11:00
Michael Gratton
f9cf70cc0e Fix MainWindow shift button detection
Ensure shift button is assumed to be up on both focus in and focus out,
so when e.g. invoking the inspector the button is assumed to be
released. Remove the signal in preference for using notifiy when needed,
and ensure main toolbar state is updated on focus changes as well.
2019-11-07 11:58:55 +11:00
Michael Gratton
ce86e3aa50 Move policy decision for folders supporting trash to controller
This allows classes other than the main window to make the determination
for other folders.
2019-11-07 11:58:55 +11:00
Michael Gratton
5312241d44 Remove ConversationEmail::load_error
The class can just handle submitting problem reports directly rather
than handballing to MainWindow to do so.
2019-11-07 11:58:55 +11:00
Michael Gratton
01fc1abd55 Move View Source implementation to ConversationEmail
The only place it is used is in ConversationEmail, so move it there from
MainWindow and remove the signal.
2019-11-07 11:58:55 +11:00
Michael Gratton
7be9115ebc Rename client GtkUtil package to conform to style: Util.Gtk 2019-11-07 11:58:55 +11:00
Michael Gratton
de6ef699de Clean up attachment save code
Create new Application.AttachmentManager class and move code for saving
attachments there from both Application.Controller and MainWindow since
aside from needing the latter for dialogs it is independent of both.

Create new Components.AttachmentPane widget for diplaying attachents
for an email in the ConversationViewer.

Update ConversationEmail and ConversationMessage to use these two new
classes directly, rather than implementing save management itself or
requiring the MainWindow to wire up signals on these classes.
2019-11-07 11:58:55 +11:00
Michael Gratton
bcce3a3a83 Make GearyApplication::show_uri handle mailto: URIs
This lets us simplify several code paths where these were handled,
and remove a signal and handler from ConversationMessage.
2019-11-07 11:58:55 +11:00
Michael Gratton
50749d9823 Trivial translation comment cleanup 2019-11-07 11:58:55 +11:00
Michael Gratton
b4d3c60a61 Merge Controller.move_conversations and move_messages impls
Use the same implementation for moving conversations and messages so
that marking messages is notified in the same way as marking
conversations. Athough in the case of the latter, only a subset of the
messages in a conversation may get marked, it makes the UI notification
UI present more consistently.
2019-11-07 11:58:55 +11:00
Michael Gratton
a282dc546e Use Geary.FolderSupport.Archive when moving to archive special
This is needed for services like e.g. Gmail where Archive isn't
actually a folder, rather it's a lack of other labels.
2019-11-07 11:58:55 +11:00
Michael Gratton
84fd4eb50f Trim controller command stack when exogenous events occur
If some event like another email client causes folders or email to be
removed, the controller's command stack needs to be trimmed to remove
any commands that refer to these.

Introduce a custom CommandStack subclass that can update the stack and
use that as the account's stack, call it as needed when folders become
unavailable or email is permanently deleted.
2019-11-07 11:58:55 +11:00
Michael Gratton
a8849c9925 Update Application.CommandSequence
Make its list of commands private, implement firing state signals for
commands in its sequence.
2019-11-07 11:58:55 +11:00
Michael Gratton
5f3a162e2e Add status signals to Application.Command
Add executed, undone and redone signals to commands so that the code
that executed them can be informed of their individial statuses.
2019-11-05 11:35:31 +11:00
Michael Gratton
2acd7d659a Allow CommandStack subclasses to access the undo stack
The controller requires access so it can remove commands made
in-operable by external state changes, e.g. a folder being removed.
2019-11-05 11:35:31 +11:00
Michael Gratton
227b68e082 Make Application.Controller commands per-account
Give each account its own command stack, and use that when executing
commands for an account, since people are unlikely to select a different
account and expect commands for the previous account to work.
2019-11-05 11:35:31 +11:00
Michael Gratton
12e73b3d72 Remove Application.Controller::current_account
Property is per-window state and hence should not be present in the
app controller.
2019-11-05 11:35:31 +11:00
Michael Gratton
954f7fc315 Rename MainWindow::current_account and ::current_folder props
Rename to ::selected_account and ::selected_folder to better describe
what they mean.
2019-11-05 11:35:31 +11:00
Michael Gratton
ebc14c458a Don't initially notify on mark email commands
These already have visual feedback and are easily-undoable.
2019-11-05 11:35:31 +11:00
Michael Gratton
fe67993c8e Clean up MainWindow action definitions
Rename action consts and values to better reflect what they do.
2019-11-05 11:35:31 +11:00
Michael Gratton
19b1382345 Minor code style and doc comment update 2019-11-05 11:35:31 +11:00
Michael Gratton
0871039069 Implement emptying spam/trash as non-undoable commands 2019-11-05 11:35:31 +11:00
Michael Gratton
df780d72a1 Implement deleting conversations as non-undoable commands 2019-11-05 11:35:31 +11:00
Michael Gratton
3c06ddf0ba Implement copying conversations as a command
Not yet undoable, since the engine doens't support it. :(
2019-11-05 11:35:31 +11:00
Michael Gratton
0132981bdd Implement moving conversations as undoable commands 2019-11-05 11:35:31 +11:00
Michael Gratton
d8a864019d Implement conversation flag updating as undoable commands
This lets us undo marking as read/unread/starred/etc.
2019-11-05 11:35:31 +11:00
Michael Gratton
17ddb45150 Allow Command instances to denote whether they support undoing
Update CommanddStack to discard commands and the undo stack after
executing a command that is not undoable.
2019-11-05 11:35:31 +11:00
Michael Gratton
24c12a2add Move conversation selection and action updates to main window
Move the remaining main window action code from Application.Controller
to MainWindow.
2019-11-05 11:35:31 +11:00
Michael Gratton
95b819fe94 Application.Controller: Make context class publically accessible
Promote AccountContext inner class to be public, document its members
and provide accessor so other classes can look them up.
2019-11-05 11:35:31 +11:00
Michael Gratton
27d3fb62dc ConversationList: Minor selection-related perf tweak
Return a RO view of the existing selection object from
ConversationListView::get_selected_conversations.
2019-11-05 11:35:31 +11:00
Michael Gratton
66668a7575 Move per-message action handlers from Controller to MainWindow 2019-11-05 11:35:31 +11:00
Michael Gratton
d1d8bed53b Implement main toolbar composer actions 2019-11-05 11:35:31 +11:00
Michael Gratton
88eb8f5040 Implement an application-level command stack
This will provide the basis for handling undo/redo in the main window.
2019-11-05 11:35:31 +11:00
Michael Gratton
8e9f00295e Move GAction related code from app Controller to MainWindow
This moves a large nummber of the main window's concerns to the main
window, decouping a large number of dependencies from the controller to
the main window, and enables managing action and UI state per-window.
2019-11-05 11:35:31 +11:00
Michael Gratton
09f6fc094a Improve Geary.Account API for listing folders
Make both Account.list_folders and Account.get_special_folder not throw
any errors - either the folders exist, or they don't. Update call sites.
2019-11-05 11:35:31 +11:00
Michael Gratton
35007aa006 Merge branch 'mjog/fix-composer-undhandled-error-build-warning' into 'mainline'
Fix unhandled error build warning

See merge request GNOME/geary!358
2019-11-05 00:33:04 +00:00
Michael Gratton
09b8c8e5b9 Fix unhandled error build waning 2019-11-05 10:59:51 +11:00
Michael Gratton
a6773cebb8 Merge branch 'mjog/fix-null-message-ids' into 'mainline'
Fix issues with null message ids

See merge request GNOME/geary!357
2019-11-01 05:24:50 +00:00
Michael Gratton
47927aaff4 Make serialisation of Geary.Email.Field more usable 2019-11-01 15:48:19 +11:00
Michael Gratton
39b5f7922b Fix headers not being parsed due to case differences
Commit 8cd310be broke case-insensitive header parsing since it went
from using GMime's header class to using a Gee.Map for header response
lookup. This patch makes the map use case-insensitive keys.
2019-11-01 15:43:22 +11:00
Michael Gratton
e18c8fae93 ComposerWidget: Don't add invalid Message-ID to In-Reply-To
Although Message-ID is usually present, it may not be. If not, the
composer should not be added a null id to the In-Reply-To field.
2019-11-01 15:39:35 +11:00