Move undo to in app notifications
This commit is contained in:
parent
86465bf331
commit
e2896f303c
3 changed files with 16 additions and 42 deletions
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* Primary controller for a application instance.
|
||||
* Primary controller for an application instance.
|
||||
*
|
||||
* @see GearyAplication
|
||||
*/
|
||||
|
|
@ -172,6 +172,10 @@ public class Application.Controller : Geary.BaseObject {
|
|||
private uint operation_count = 0;
|
||||
private Geary.Revokable? revokable = null;
|
||||
|
||||
// Store the description for the revokable for tooltip display.
|
||||
// This was previously stored within the context of undo button of the main toolbar.
|
||||
private string revokable_description { get; set; }
|
||||
|
||||
// List of windows we're waiting to close before Geary closes.
|
||||
private Gee.List<ComposerWidget> waiting_to_close = new Gee.ArrayList<ComposerWidget>();
|
||||
|
||||
|
|
@ -1702,7 +1706,7 @@ public class Application.Controller : Geary.BaseObject {
|
|||
Cancellable? cancellable) {
|
||||
try {
|
||||
save_revokable(yield source_folder.move_email_async(ids, destination, cancellable),
|
||||
_("Undo move (Ctrl+Z)"));
|
||||
ngettext("Moved %d message to %s", "Moved %d messages to %s", ids.size).printf(ids.size, destination.to_string()));
|
||||
} catch (Error err) {
|
||||
debug("%s: Unable to move %d emails: %s", source_folder.to_string(), ids.size,
|
||||
err.message);
|
||||
|
|
@ -2302,7 +2306,7 @@ public class Application.Controller : Geary.BaseObject {
|
|||
Geary.FolderPath trash_path = (yield current_account.get_required_special_folder_async(
|
||||
Geary.SpecialFolderType.TRASH, cancellable)).path;
|
||||
save_revokable(yield supports_move.move_email_async(ids, trash_path, cancellable),
|
||||
_("Undo trash (Ctrl+Z)"));
|
||||
ngettext("Trashed %d message", "Trashed %d messages", ids.size).printf(ids.size));
|
||||
} else {
|
||||
debug("Folder %s doesn't support move or account %s doesn't have a trash folder",
|
||||
current_folder.to_string(), current_account.to_string());
|
||||
|
|
@ -2352,7 +2356,7 @@ public class Application.Controller : Geary.BaseObject {
|
|||
debug("Folder %s doesn't support archive", current_folder.to_string());
|
||||
} else {
|
||||
save_revokable(yield supports_archive.archive_email_async(ids, cancellable),
|
||||
_("Undo archive (Ctrl+Z)"));
|
||||
ngettext("Archived %d message", "Archived %d messages", ids.size).printf(ids.size));
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -2385,7 +2389,8 @@ public class Application.Controller : Geary.BaseObject {
|
|||
}
|
||||
|
||||
// store new revokable
|
||||
revokable = new_revokable;
|
||||
this.revokable = new_revokable;
|
||||
this.revokable_description = description;
|
||||
|
||||
// connect to new revokable
|
||||
if (revokable != null) {
|
||||
|
|
@ -2395,11 +2400,11 @@ public class Application.Controller : Geary.BaseObject {
|
|||
}
|
||||
|
||||
if (this.main_window != null) {
|
||||
if (revokable != null && description != null)
|
||||
this.main_window.main_toolbar.undo_tooltip = description;
|
||||
else
|
||||
this.main_window.main_toolbar.undo_tooltip = _("Undo (Ctrl+Z)");
|
||||
|
||||
if (this.revokable != null && this.revokable_description != null) {
|
||||
InAppNotification ian = new InAppNotification(this.revokable_description);
|
||||
ian.set_button(_("Undo"), "win." + GearyApplication.ACTION_UNDO);
|
||||
this.main_window.add_notification(ian);
|
||||
}
|
||||
update_revokable_action();
|
||||
}
|
||||
}
|
||||
|
|
@ -2422,8 +2427,7 @@ public class Application.Controller : Geary.BaseObject {
|
|||
if (committed_revokable == null)
|
||||
return;
|
||||
|
||||
// use existing description
|
||||
save_revokable(committed_revokable, this.main_window.main_toolbar.undo_tooltip);
|
||||
save_revokable(committed_revokable, this.revokable_description);
|
||||
}
|
||||
|
||||
private void on_revoke() {
|
||||
|
|
|
|||
|
|
@ -26,11 +26,6 @@ public class MainToolbar : Gtk.Box {
|
|||
public int selected_conversations { get; set; }
|
||||
// Whether to show the trash or the delete button
|
||||
public bool show_trash_button { get; set; default = true; }
|
||||
// The tooltip of the Undo-button
|
||||
public string undo_tooltip {
|
||||
owned get { return this.undo_button.tooltip_text; }
|
||||
set { this.undo_button.tooltip_text = value; }
|
||||
}
|
||||
|
||||
// Folder header elements
|
||||
[GtkChild]
|
||||
|
|
@ -57,10 +52,6 @@ public class MainToolbar : Gtk.Box {
|
|||
[GtkChild]
|
||||
private Gtk.ToggleButton find_button;
|
||||
|
||||
// Other
|
||||
[GtkChild]
|
||||
private Gtk.Button undo_button;
|
||||
|
||||
// Load these at construction time
|
||||
private Gtk.Image trash_image = new Gtk.Image.from_icon_name("user-trash-symbolic", Gtk.IconSize.MENU);
|
||||
private Gtk.Image delete_image = new Gtk.Image.from_icon_name("edit-delete-symbolic", Gtk.IconSize.MENU);
|
||||
|
|
|
|||
|
|
@ -277,27 +277,6 @@
|
|||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="undo_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="action_name">win.undo</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="undo_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">edit-undo-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="archive_trash_delete_buttons">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue