After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 790308 - Add client-level command stack
Add client-level command stack
Status: RESOLVED FIXED
Product: geary
Classification: Other
Component: client
master
Other Linux
: High enhancement
: 0.14.0
Assigned To: Geary Maintainers
Geary Maintainers
Depends on:
Blocks: 714233 774442
 
 
Reported: 2017-11-13 23:00 UTC by Michael Gratton
Modified: 2019-11-07 01:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Gratton 2017-11-13 23:00:34 UTC
To support both decent undo/redo support (Bug 714233) and to provide a means of keeping track of command completion for in-app notifications (Bug 774442), we should introduce a client-side notion of a Command and a CommandStack.

A Command would represent a specific end-user action like Archive, Move, Send or Trash, and there would be one subclass or interface implementation for each possible action. The command encapsulates all application state needed to execute the command (target account, folders, applicable conversations/messages) and provide methods that implement execute, undo and redo as needed for each, by making the appropriate calls to the engine's API. It would also hook into accounts/folders to receive notification of command completion or error, and notify the user of such.

CommandStack is obviously a stack for Command instances that asynchronously executes the command when one is pushed on, uses a cursor to keep track of the current undo/redo point, and executes a Command's undo and redo methods as needed. Each MainWindow instance probably wants to have its own CommandStack, so Undo/Redo operations in the one window make sense.

This is a pretty bog-standard notion of commands and a stack, so if there are resuable libraries out that there that support of the above we could look into it, but it's probably simple enough to roll our own — what could possibly go wrong?
Comment 1 Federico Bruni 2018-02-19 07:32:23 UTC
An undo action which I often miss is when you accidentally hit Backspace to delete some quoted text, which instead results in removing the whole quoted text altogether. You cannot undo this action, so you have to delete the draft and reply again (and be careful to use Canc instead as first key to delete text).
Comment 2 Michael Gratton 2018-03-03 01:55:23 UTC
Implementation note: This might want to be integrated somehow into Geary.App.EmailStore's existing operations (or vice-versa), especially if we want to provide some client-agnostic means of implementing such a stack based on the engine.
Comment 3 Michael Gratton 2019-11-07 01:09:14 UTC
This will be fixed in 3.36 courtesy https://gitlab.gnome.org/GNOME/geary/merge_requests/359