[geary/wip/730682-refine-convo-list: 5/11] Remove folder actions from MainToolbar, and hence also GearyController.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/730682-refine-convo-list: 5/11] Remove folder actions from MainToolbar, and hence also GearyController.
- Date: Fri, 5 Jan 2018 04:21:01 +0000 (UTC)
commit 95e7831a42af85ebe8c8d24afec1ea52716bff87
Author: Michael James Gratton <mike vee net>
Date: Wed Jan 3 22:37:08 2018 +1100
Remove folder actions from MainToolbar, and hence also GearyController.
Now that the conversation list provides a GUI for folder-related actions,
we don't need them on the main toolbar.
src/client/application/geary-controller.vala | 349 +-------------------
src/client/components/main-toolbar.vala | 35 +--
src/client/components/main-window.vala | 13 +
.../conversation-list/conversation-list-view.vala | 31 --
ui/main-toolbar-menus.ui | 27 --
ui/main-toolbar.ui | 163 +---------
6 files changed, 23 insertions(+), 595 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 3bb6b9f..026cafb 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -25,23 +25,11 @@ public class GearyController : Geary.BaseObject {
public const string ACTION_REPLY_TO_MESSAGE = "reply-to-message";
public const string ACTION_REPLY_ALL_MESSAGE = "reply-all-message";
public const string ACTION_FORWARD_MESSAGE = "forward-message";
- public const string ACTION_ARCHIVE_CONVERSATION = "archive-conv";
- public const string ACTION_TRASH_CONVERSATION = "trash-conv";
- public const string ACTION_DELETE_CONVERSATION = "delete-conv";
public const string ACTION_EMPTY_SPAM = "empty-spam";
public const string ACTION_EMPTY_TRASH = "empty-trash";
public const string ACTION_UNDO = "undo";
public const string ACTION_FIND_IN_CONVERSATION = "conv-find";
public const string ACTION_ZOOM = "zoom";
- public const string ACTION_SHOW_MARK_MENU = "mark-conversation-menu";
- public const string ACTION_MARK_AS_READ = "mark-conversation-read";
- public const string ACTION_MARK_AS_UNREAD = "mark-conversation-unread";
- public const string ACTION_MARK_AS_STARRED = "mark-conversation-starred";
- public const string ACTION_MARK_AS_UNSTARRED = "mark-conversation-unstarred";
- public const string ACTION_MARK_AS_SPAM = "mark-conversation-spam";
- public const string ACTION_MARK_AS_NOT_SPAM = "mark-conversation-not-spam";
- public const string ACTION_COPY_MENU = "show-copy-menu";
- public const string ACTION_MOVE_MENU = "show-move-menu";
public const string ACTION_SEARCH = "search-conv";
public const string ACTION_CONVERSATION_LIST = "focus-conv-list";
public const string ACTION_TOGGLE_SEARCH = "toggle-search";
@@ -71,11 +59,9 @@ public class GearyController : Geary.BaseObject {
private Cancellable cancellable_folder = new Cancellable();
private Cancellable cancellable_search = new Cancellable();
private Cancellable cancellable_open_account = new Cancellable();
- private Cancellable cancellable_context_dependent_buttons = new Cancellable();
private Gee.HashMap<Geary.Account, Cancellable> inbox_cancellables
= new Gee.HashMap<Geary.Account, Cancellable>();
private ContactListStoreCache contact_list_store_cache = new ContactListStoreCache();
- private Geary.App.Conversation? last_deleted_conversation = null;
private Gee.LinkedList<ComposerWidget> composer_widgets = new Gee.LinkedList<ComposerWidget>();
private NewMessagesMonitor? new_messages_monitor = null;
private NewMessagesIndicator? new_messages_indicator = null;
@@ -107,19 +93,6 @@ public class GearyController : Geary.BaseObject {
{ACTION_REPLY_TO_MESSAGE, on_reply_to_message_action },
{ACTION_REPLY_ALL_MESSAGE, on_reply_all_message_action },
{ACTION_FORWARD_MESSAGE, on_forward_message_action },
- {ACTION_ARCHIVE_CONVERSATION, on_archive_conversation },
- {ACTION_TRASH_CONVERSATION, on_trash_conversation },
- {ACTION_DELETE_CONVERSATION, on_delete_conversation },
- {ACTION_COPY_MENU, on_show_copy_menu },
- {ACTION_MOVE_MENU, on_show_move_menu },
- // Message marking actions
- {ACTION_SHOW_MARK_MENU, on_show_mark_menu },
- {ACTION_MARK_AS_READ, on_mark_as_read },
- {ACTION_MARK_AS_UNREAD, on_mark_as_unread },
- {ACTION_MARK_AS_STARRED, on_mark_as_starred },
- {ACTION_MARK_AS_UNSTARRED, on_mark_as_unstarred },
- {ACTION_MARK_AS_SPAM, on_mark_as_spam_toggle },
- {ACTION_MARK_AS_NOT_SPAM, on_mark_as_spam_toggle },
// Message viewer
{ACTION_ZOOM, on_zoom, "s" },
};
@@ -128,7 +101,7 @@ public class GearyController : Geary.BaseObject {
* Fired when the currently selected account has changed.
*/
public signal void account_selected(Geary.Account? account);
-
+
/**
* Fired when the currently selected folder has changed.
*/
@@ -204,7 +177,6 @@ public class GearyController : Geary.BaseObject {
// Create the main window (must be done after creating actions.)
main_window = new MainWindow(this.application);
- main_window.on_shift_key.connect(on_shift_key);
main_window.notify["has-toplevel-focus"].connect(on_has_toplevel_focus);
setup_actions();
@@ -219,8 +191,6 @@ public class GearyController : Geary.BaseObject {
main_window.folder_list.folder_selected.connect(on_folder_selected);
main_window.folder_list.copy_conversation.connect(on_copy_conversation);
main_window.folder_list.move_conversation.connect(on_move_conversation);
- main_window.main_toolbar.copy_folder_menu.folder_selected.connect(on_copy_conversation);
- main_window.main_toolbar.move_folder_menu.folder_selected.connect(on_move_conversation);
main_window.search_bar.search_text_changed.connect((text) => { do_search(text); });
main_window.conversation_viewer.conversation_added.connect(
on_conversation_view_added
@@ -288,8 +258,6 @@ public class GearyController : Geary.BaseObject {
main_window.folder_list.folder_selected.disconnect(on_folder_selected);
main_window.folder_list.copy_conversation.disconnect(on_copy_conversation);
main_window.folder_list.move_conversation.disconnect(on_move_conversation);
- main_window.main_toolbar.copy_folder_menu.folder_selected.disconnect(on_copy_conversation);
- main_window.main_toolbar.move_folder_menu.folder_selected.disconnect(on_move_conversation);
main_window.conversation_viewer.conversation_added.disconnect(
on_conversation_view_added
);
@@ -410,22 +378,11 @@ public class GearyController : Geary.BaseObject {
private void setup_actions() {
this.main_window.add_action_entries(win_action_entries, this);
- add_window_accelerators(ACTION_MARK_AS_READ, { "<Ctrl>I", "<Shift>I" });
- add_window_accelerators(ACTION_MARK_AS_UNREAD, { "<Ctrl>U", "<Shift>U" });
- add_window_accelerators(ACTION_MARK_AS_STARRED, { "S" });
- add_window_accelerators(ACTION_MARK_AS_UNSTARRED, { "D" });
- add_window_accelerators(ACTION_MARK_AS_SPAM, { "<Ctrl>J", "exclam" }); // Exclamation mark (!)
- add_window_accelerators(ACTION_MARK_AS_NOT_SPAM, { "<Ctrl>J", "exclam" });
- add_window_accelerators(ACTION_COPY_MENU, { "L" });
- add_window_accelerators(ACTION_MOVE_MENU, { "M" });
add_window_accelerators(ACTION_NEW_MESSAGE, { "<Ctrl>N", "N" });
add_window_accelerators(ACTION_REPLY_TO_MESSAGE, { "<Ctrl>R", "R" });
add_window_accelerators(ACTION_REPLY_ALL_MESSAGE, { "<Ctrl><Shift>R", "<Shift>R" });
add_window_accelerators(ACTION_FORWARD_MESSAGE, { "<Ctrl>L", "F" });
add_window_accelerators(ACTION_FIND_IN_CONVERSATION, { "<Ctrl>F", "slash" });
- add_window_accelerators(ACTION_ARCHIVE_CONVERSATION, { "A" });
- add_window_accelerators(ACTION_TRASH_CONVERSATION, { "Delete", "BackSpace" });
- add_window_accelerators(ACTION_DELETE_CONVERSATION, { "<Shift>Delete", "<Shift>BackSpace" });
add_window_accelerators(ACTION_UNDO, { "<Ctrl>Z" });
add_window_accelerators(ACTION_ZOOM+("('in')"), { "<Ctrl>equal", "equal" });
add_window_accelerators(ACTION_ZOOM+("('out')"), { "<Ctrl>minus", "minus" });
@@ -1417,13 +1374,7 @@ public class GearyController : Geary.BaseObject {
// clear Revokable, as Undo is only available while a folder is selected
save_revokable(null, null);
-
- // re-enable copy/move to the last selected folder
- if (current_folder != null) {
- main_window.main_toolbar.copy_folder_menu.enable_disable_folder(current_folder, true);
- main_window.main_toolbar.move_folder_menu.enable_disable_folder(current_folder, true);
- }
-
+
current_folder = folder;
if (current_account != folder.account) {
@@ -1443,24 +1394,6 @@ public class GearyController : Geary.BaseObject {
if (!(current_folder is Geary.SearchFolder))
previous_non_search_folder = current_folder;
-
- main_window.main_toolbar.copy_folder_menu.clear();
- main_window.main_toolbar.move_folder_menu.clear();
- foreach(Geary.Folder f in current_folder.account.list_folders()) {
- main_window.main_toolbar.copy_folder_menu.add_folder(f);
- main_window.main_toolbar.move_folder_menu.add_folder(f);
- }
-
- // disable copy/move to the new folder
- if (current_folder != null) {
- main_window.main_toolbar.copy_folder_menu.enable_disable_folder(current_folder, false);
- main_window.main_toolbar.move_folder_menu.enable_disable_folder(current_folder, false);
- }
-
- this.main_window.main_toolbar.update_trash_buttons(
- current_folder_supports_trash() ||
- !(current_folder is Geary.FolderSupport.Remove)
- );
if (inboxes.values.contains(current_folder)) {
// Inbox selected, clear new messages if visible
@@ -1552,13 +1485,7 @@ public class GearyController : Geary.BaseObject {
if (available != null && available.size > 0) {
foreach (Geary.Folder folder in available) {
main_window.folder_list.add_folder(folder);
- if (folder.account == current_account) {
- if (!main_window.main_toolbar.copy_folder_menu.has_folder(folder))
- main_window.main_toolbar.copy_folder_menu.add_folder(folder);
- if (!main_window.main_toolbar.move_folder_menu.has_folder(folder))
- main_window.main_toolbar.move_folder_menu.add_folder(folder);
- }
-
+
// monitor the Inbox for notifications
if (folder.special_folder_type == Geary.SpecialFolderType.INBOX &&
!inboxes.has_key(folder.account)) {
@@ -1597,13 +1524,7 @@ public class GearyController : Geary.BaseObject {
for (int i = (unavailable.size - 1); i >= 0; i--) {
Geary.Folder folder = unavailable[i];
main_window.folder_list.remove_folder(folder);
- if (folder.account == current_account) {
- if (main_window.main_toolbar.copy_folder_menu.has_folder(folder))
- main_window.main_toolbar.copy_folder_menu.remove_folder(folder);
- if (main_window.main_toolbar.move_folder_menu.has_folder(folder))
- main_window.main_toolbar.move_folder_menu.remove_folder(folder);
- }
-
+
if (folder.special_folder_type == Geary.SpecialFolderType.INBOX &&
inboxes.has_key(folder.account)) {
inboxes.unset(folder.account);
@@ -1647,13 +1568,6 @@ public class GearyController : Geary.BaseObject {
old_cancellable.cancel();
}
- private void cancel_context_dependent_buttons() {
- Cancellable old_cancellable = cancellable_context_dependent_buttons;
- cancellable_context_dependent_buttons = new Cancellable();
-
- old_cancellable.cancel();
- }
-
// We need to include the second parameter, or valac doesn't recognize the function as matching
// GearyApplication.exiting's signature.
private bool on_application_exiting(GearyApplication sender, bool panicked) {
@@ -1663,17 +1577,6 @@ public class GearyController : Geary.BaseObject {
return sender.cancel_exit();
}
- private void on_shift_key(bool pressed) {
- if (main_window != null && main_window.main_toolbar != null
- && current_account != null && current_folder != null) {
- main_window.main_toolbar.update_trash_buttons(
- current_folder_supports_trash() &&
- current_folder is Geary.FolderSupport.Remove &&
- !pressed
- );
- }
- }
-
// this signal does not necessarily indicate that the application previously didn't have
// focus and now it does
private void on_has_toplevel_focus() {
@@ -1700,44 +1603,6 @@ public class GearyController : Geary.BaseObject {
return ids;
}
- private void on_show_mark_menu() {
- Geary.App.Conversation conversation =
- this.main_window.conversation_list.selected;
-
- bool unread_selected = conversation.is_unread();
- bool read_selected = false;
- bool starred_selected = false;
- bool unstarred_selected = false;
-
- // Only check the messages that "Mark as Unread" would mark, so we
- // don't add the menu option and have it not do anything.
- //
- // Sort by Date: field to correspond with ConversationViewer ordering
- Geary.Email? latest = conversation.get_latest_sent_email(
- Geary.App.Conversation.Location.IN_FOLDER_OUT_OF_FOLDER);
- if (latest != null && latest.email_flags != null
- && !latest.email_flags.contains(Geary.EmailFlags.UNREAD))
- read_selected = true;
-
- if (conversation.is_flagged()) {
- starred_selected = true;
- } else {
- unstarred_selected = true;
- }
-
- get_window_action(ACTION_MARK_AS_READ).set_enabled(unread_selected);
- get_window_action(ACTION_MARK_AS_UNREAD).set_enabled(read_selected);
- get_window_action(ACTION_MARK_AS_STARRED).set_enabled(unstarred_selected);
- get_window_action(ACTION_MARK_AS_UNSTARRED).set_enabled(starred_selected);
-
- bool in_spam_folder = current_folder.special_folder_type == Geary.SpecialFolderType.SPAM;
- get_window_action(ACTION_MARK_AS_NOT_SPAM).set_enabled(in_spam_folder);
- // If we're in Drafts/Outbox, we also shouldn't set a message as SPAM.
- get_window_action(ACTION_MARK_AS_SPAM).set_enabled(!in_spam_folder &&
- current_folder.special_folder_type != Geary.SpecialFolderType.DRAFTS &&
- current_folder.special_folder_type != Geary.SpecialFolderType.OUTBOX);
- }
-
private bool should_notify_new_messages(Geary.Folder folder) {
// A monitored folder must be selected to squelch notifications;
// if conversation list is at top of display, don't display
@@ -1772,83 +1637,6 @@ public class GearyController : Geary.BaseObject {
mark_email.begin(emails, flags_to_add, flags_to_remove);
}
- private void on_mark_as_read(SimpleAction action) {
- Geary.EmailFlags flags = new Geary.EmailFlags();
- flags.add(Geary.EmailFlags.UNREAD);
-
- Gee.ArrayList<Geary.EmailIdentifier> ids = get_selected_email_ids(false);
- mark_email.begin(ids, null, flags);
-
- ConversationListBox? list =
- main_window.conversation_viewer.current_list;
- if (list != null) {
- foreach (Geary.EmailIdentifier id in ids)
- list.mark_manual_read(id);
- }
- }
-
- private void on_mark_as_unread(SimpleAction action) {
- Geary.EmailFlags flags = new Geary.EmailFlags();
- flags.add(Geary.EmailFlags.UNREAD);
-
- Gee.ArrayList<Geary.EmailIdentifier> ids = get_selected_email_ids(true);
- mark_email.begin(ids, flags, null);
-
- ConversationListBox? list =
- main_window.conversation_viewer.current_list;
- if (list != null) {
- foreach (Geary.EmailIdentifier id in ids)
- list.mark_manual_unread(id);
- }
- }
-
- private void on_mark_as_starred(SimpleAction action) {
- Geary.EmailFlags flags = new Geary.EmailFlags();
- flags.add(Geary.EmailFlags.FLAGGED);
- mark_email.begin(get_selected_email_ids(true), flags, null);
- }
-
- private void on_mark_as_unstarred(SimpleAction action) {
- Geary.EmailFlags flags = new Geary.EmailFlags();
- flags.add(Geary.EmailFlags.FLAGGED);
- mark_email.begin(get_selected_email_ids(false), null, flags);
- }
-
- private void on_show_move_menu(SimpleAction? action) {
- this.main_window.main_toolbar.copy_conversation_button.activate();
- }
-
- private void on_show_copy_menu(SimpleAction? action) {
- this.main_window.main_toolbar.move_conversation_button.activate();
- }
-
- private async void mark_as_spam_toggle_async(Cancellable? cancellable) {
- Geary.Folder? destination_folder = null;
- if (current_folder.special_folder_type != Geary.SpecialFolderType.SPAM) {
- // Move to spam folder.
- try {
- destination_folder = yield current_account.get_required_special_folder_async(
- Geary.SpecialFolderType.SPAM, cancellable);
- } catch (Error e) {
- debug("Error getting spam folder: %s", e.message);
- }
- } else {
- // Move out of spam folder, back to inbox.
- try {
- destination_folder = current_account.get_special_folder(Geary.SpecialFolderType.INBOX);
- } catch (Error e) {
- debug("Error getting inbox folder: %s", e.message);
- }
- }
-
- if (destination_folder != null)
- on_move_conversation(destination_folder);
- }
-
- private void on_mark_as_spam_toggle(SimpleAction action) {
- mark_as_spam_toggle_async.begin(null);
- }
-
private void copy_email(Gee.Collection<Geary.EmailIdentifier> ids,
Geary.FolderPath destination) {
if (ids.size > 0) {
@@ -2301,21 +2089,6 @@ public class GearyController : Geary.BaseObject {
show_search_bar();
}
- private void on_archive_conversation(SimpleAction action) {
- archive_or_delete_selection_async.begin(true, false, cancellable_folder,
- on_archive_or_delete_selection_finished);
- }
-
- private void on_trash_conversation(SimpleAction action) {
- archive_or_delete_selection_async.begin(false, true, cancellable_folder,
- on_archive_or_delete_selection_finished);
- }
-
- private void on_delete_conversation(SimpleAction action) {
- archive_or_delete_selection_async.begin(false, false, cancellable_folder,
- on_archive_or_delete_selection_finished);
- }
-
private void on_empty_spam(SimpleAction action) {
on_empty_trash_or_spam(Geary.SpecialFolderType.SPAM);
}
@@ -2392,88 +2165,6 @@ public class GearyController : Geary.BaseObject {
}
}
}
-
- private bool current_folder_supports_trash() {
- return (current_folder != null && current_folder.special_folder_type != Geary.SpecialFolderType.TRASH
- && !current_folder.properties.is_local_only && current_account != null
- && (current_folder as Geary.FolderSupport.Move) != null);
- }
-
- private async void archive_or_delete_selection_async(bool archive, bool trash,
- Cancellable? cancellable) throws Error {
- if (!can_switch_conversation_view())
- return;
-
- ConversationListBox list_view =
- main_window.conversation_viewer.current_list;
- if (list_view != null &&
- list_view.conversation == last_deleted_conversation) {
- debug("Not archiving/trashing/deleting; viewed conversation is last deleted conversation");
- return;
- }
-
- Geary.App.Conversation? selected =
- this.main_window.conversation_list.selected;
- if (selected == null)
- return;
-
- this.last_deleted_conversation = selected;
-
- Gee.List<Geary.EmailIdentifier> ids = get_selected_email_ids(false);
- if (archive) {
- debug("Archiving selected messages");
-
- Geary.FolderSupport.Archive? supports_archive = current_folder as Geary.FolderSupport.Archive;
- if (supports_archive == null) {
- 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)"));
- }
-
- return;
- }
-
- if (trash) {
- debug("Trashing selected messages");
-
- if (current_folder_supports_trash()) {
- Geary.FolderPath trash_path = (yield current_account.get_required_special_folder_async(
- Geary.SpecialFolderType.TRASH, cancellable)).path;
- Geary.FolderSupport.Move? supports_move = current_folder as Geary.FolderSupport.Move;
- if (supports_move != null) {
- save_revokable(yield supports_move.move_email_async(ids, trash_path, cancellable),
- _("Undo trash (Ctrl+Z)"));
-
- return;
- }
- }
-
- debug("Folder %s doesn't support move or account %s doesn't have a trash folder",
- current_folder.to_string(), current_account.to_string());
- return;
- }
-
- debug("Deleting selected messages");
-
- Geary.FolderSupport.Remove? supports_remove = current_folder as Geary.FolderSupport.Remove;
- if (supports_remove == null) {
- debug("Folder %s doesn't support remove", current_folder.to_string());
- } else {
- if (this.main_window.confirm_delete())
- yield supports_remove.remove_email_async(ids, cancellable);
- else
- last_deleted_conversation = null;
- }
- }
-
- private void on_archive_or_delete_selection_finished(Object? source, AsyncResult result) {
- try {
- archive_or_delete_selection_async.end(result);
- } catch (Error e) {
- debug("Unable to archive/trash/delete messages: %s", e.message);
- }
- }
private void save_revokable(Geary.Revokable? new_revokable, string? description) {
// disconnect old revokable & blindly commit it
@@ -2637,38 +2328,6 @@ public class GearyController : Geary.BaseObject {
get_window_action(ACTION_REPLY_TO_MESSAGE).set_enabled(respond_sensitive);
get_window_action(ACTION_REPLY_ALL_MESSAGE).set_enabled(respond_sensitive);
get_window_action(ACTION_FORWARD_MESSAGE).set_enabled(respond_sensitive);
- get_window_action(ACTION_MOVE_MENU).set_enabled(sensitive && (current_folder is
Geary.FolderSupport.Move));
- get_window_action(ACTION_ARCHIVE_CONVERSATION).set_enabled(sensitive && (current_folder is
Geary.FolderSupport.Archive));
- get_window_action(ACTION_TRASH_CONVERSATION).set_enabled(sensitive &&
current_folder_supports_trash());
- get_window_action(ACTION_DELETE_CONVERSATION).set_enabled(sensitive && (current_folder is
Geary.FolderSupport.Remove));
-
- cancel_context_dependent_buttons();
- if (this.current_folder != null) {
- enable_context_dependent_buttons_async.begin(sensitive, cancellable_context_dependent_buttons);
- }
- }
-
- private async void enable_context_dependent_buttons_async(bool sensitive, Cancellable? cancellable) {
- Gee.Set<Type>? supported = null;
- try {
- supported = yield query_supported_operations(
- get_selected_email_ids(false), cancellable
- );
- } catch (Error e) {
- debug("Error checking for what operations are supported in the selected conversations: %s",
- e.message);
- }
-
- // Exit here if the user has cancelled.
- if (cancellable != null && cancellable.is_cancelled())
- return;
-
- get_window_action(ACTION_SHOW_MARK_MENU).set_enabled(
- sensitive && (typeof(Geary.FolderSupport.Mark) in supported)
- );
- get_window_action(ACTION_COPY_MENU).set_enabled(
- sensitive && (supported.contains(typeof(Geary.FolderSupport.Copy)))
- );
}
// Returns a list of composer windows for an account, or null if none.
diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala
index 09592a1..c725f25 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -10,19 +10,20 @@ public class MainToolbar : Gtk.Box {
// How wide the left pane should be. Auto-synced with our settings
public int left_pane_width { get; set; }
+
// Used to form the title of the folder header
public string account { get; set; }
public string folder { get; set; }
+
// Close button settings
public bool show_close_button { get; set; default = false; }
public bool show_close_button_left { get; private set; default = true; }
public bool show_close_button_right { get; private set; default = true; }
+
// Search and find bar
public bool search_open { get; set; default = false; }
public bool find_open { get; set; default = false; }
- // Copy and Move popovers
- public FolderPopover copy_folder_menu { get; private set; default = new FolderPopover(); }
- public FolderPopover move_folder_menu { get; private set; default = new FolderPopover(); }
+
// The tooltip of the Undo-button
public string undo_tooltip {
owned get { return this.undo_button.tooltip_text; }
@@ -49,16 +50,6 @@ public class MainToolbar : Gtk.Box {
[GtkChild]
private Gtk.HeaderBar conversation_header;
[GtkChild]
- private Gtk.MenuButton mark_conversation_button;
- [GtkChild]
- public Gtk.MenuButton copy_conversation_button;
- [GtkChild]
- public Gtk.MenuButton move_conversation_button;
- [GtkChild]
- private Gtk.Button trash_button;
- [GtkChild]
- private Gtk.Button delete_button;
- [GtkChild]
private Gtk.ToggleButton find_button;
// Other
@@ -66,11 +57,6 @@ public class MainToolbar : Gtk.Box {
private Gtk.Button undo_button;
public MainToolbar(Configuration config) {
- // Instead of putting a separator between the two headerbars, as other applications do,
- // we put a separator at the right end of the left headerbar. This greatly improves
- // the appearance under the Ambiance theme (see bug #746171). To get this separator to
- // line up with the handle of the pane, we need to extend the width of the left-hand
- // headerbar a bit. Six pixels is right both for Adwaita and Ambiance.
config.bind(Configuration.MESSAGES_PANE_POSITION_KEY, this, "left-pane-width",
SettingsBindFlags.GET);
this.bind_property("left-pane-width", this.folder_header, "width-request",
@@ -93,21 +79,15 @@ public class MainToolbar : Gtk.Box {
this.bind_property("show-close-button-right", this.conversation_header, "show-close-button",
BindingFlags.SYNC_CREATE);
- // Assemble the empty/mark menus
+ // Assemble the empty menu
Gtk.Builder builder = new Gtk.Builder.from_resource("/org/gnome/Geary/main-toolbar-menus.ui");
MenuModel empty_menu = (MenuModel) builder.get_object("empty_menu");
- MenuModel mark_menu = (MenuModel) builder.get_object("mark_conversation_menu");
// Setup folder header elements
this.empty_menu_button.popover = new Gtk.Popover.from_model(null, empty_menu);
this.bind_property("search-open", this.search_conversations_button, "active",
BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
- // Setup conversation header elements
- this.mark_conversation_button.popover = new Gtk.Popover.from_model(null, mark_menu);
- this.copy_conversation_button.popover = copy_folder_menu;
- this.move_conversation_button.popover = move_folder_menu;
-
this.bind_property("find-open", this.find_button, "active",
BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
@@ -158,11 +138,6 @@ public class MainToolbar : Gtk.Box {
this.selection_label.set_text(text);
}
- internal void update_trash_buttons(bool show_trash) {
- this.trash_button.set_visible(show_trash);
- this.delete_button.set_visible(!show_trash);
- }
-
private void set_window_buttons() {
string[] buttons = Gtk.Settings.get_default().gtk_decoration_layout.split(":");
if (buttons.length != 2) {
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 745ad5a..ec177a8 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -491,6 +491,19 @@ public class MainWindow : Gtk.ApplicationWindow {
private void setup_actions() {
add_action_entries(action_entries, this);
+
+ add_window_accelerators(ACTION_HIGHLIGHTED_ARCHIVE, { "A" });
+ add_window_accelerators(ACTION_HIGHLIGHTED_DELETE, { "<Shift>Delete", "<Shift>BackSpace" });
+ add_window_accelerators(ACTION_HIGHLIGHTED_MARK_READ, { "<Ctrl>I", "<Shift>I" });
+ add_window_accelerators(ACTION_HIGHLIGHTED_MARK_STARRED, { "S" });
+ add_window_accelerators(ACTION_HIGHLIGHTED_MARK_UNREAD, { "<Ctrl>U", "<Shift>U" });
+ add_window_accelerators(ACTION_HIGHLIGHTED_MARK_UNSTARRED, { "D" });
+ add_window_accelerators(ACTION_HIGHLIGHTED_JUNK, { "<Ctrl>J", "exclam" }); // Exclamation mark (!)
+ add_window_accelerators(ACTION_HIGHLIGHTED_TRASH, { "Delete", "BackSpace" });
+
+ add_window_accelerators(ACTION_SHOW_COPY, { "L" });
+ add_window_accelerators(ACTION_SHOW_MOVE, { "M" });
+
add_window_accelerators(ACTION_SELECTION_MODE_DISABLE, { "Escape", });
}
diff --git a/src/client/conversation-list/conversation-list-view.vala
b/src/client/conversation-list/conversation-list-view.vala
index ec4f72f..71f8af4 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -281,37 +281,6 @@ public class ConversationListView : Gtk.TreeView {
if (!get_selection().path_is_selected(path) &&
!GearyApplication.instance.controller.can_switch_conversation_view())
return true;
-
- if (event.button == 3 && event.type == Gdk.EventType.BUTTON_PRESS) {
- Geary.App.Conversation conversation = get_model().get_conversation_at_path(path);
-
- Menu context_menu_model = new Menu();
- context_menu_model.append(_("Delete conversation"),
"win."+GearyController.ACTION_DELETE_CONVERSATION);
-
- if (conversation.is_unread())
- context_menu_model.append(_("Mark as _Read"), "win."+GearyController.ACTION_MARK_AS_READ);
-
- if (conversation.has_any_read_message())
- context_menu_model.append(_("Mark as _Unread"),
"win."+GearyController.ACTION_MARK_AS_UNREAD);
-
- if (conversation.is_flagged())
- context_menu_model.append(_("U_nstar"), "win."+GearyController.ACTION_MARK_AS_UNSTARRED);
- else
- context_menu_model.append(_("_Star"), "win."+GearyController.ACTION_MARK_AS_STARRED);
-
- Menu actions_section = new Menu();
- actions_section.append(_("_Reply"), "win."+GearyController.ACTION_REPLY_TO_MESSAGE);
- actions_section.append(_("R_eply All"), "win."+GearyController.ACTION_REPLY_ALL_MESSAGE);
- actions_section.append(_("_Forward"), "win."+GearyController.ACTION_FORWARD_MESSAGE);
- context_menu_model.append_section(null, actions_section);
-
- Gtk.Menu context_menu = new Gtk.Menu.from_model(context_menu_model);
- context_menu.insert_action_group("win", this.main_window);
- context_menu.popup_at_pointer(event);
-
- // When the conversation under the mouse is selected, stop event propagation
- return get_selection().path_is_selected(path);
- }
return false;
}
diff --git a/ui/main-toolbar-menus.ui b/ui/main-toolbar-menus.ui
index 20e262f..4b51683 100644
--- a/ui/main-toolbar-menus.ui
+++ b/ui/main-toolbar-menus.ui
@@ -10,31 +10,4 @@
<attribute name="action">win.empty-trash</attribute>
</item>
</menu>
-
- <menu id="mark_conversation_menu">
- <item>
- <attribute name="label" translatable="yes">Mark as _Read</attribute>
- <attribute name="action">win.mark-conversation-read</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Mark as _Unread</attribute>
- <attribute name="action">win.mark-conversation-unread</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">_Star</attribute>
- <attribute name="action">win.mark-conversation-starred</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">U_nstar</attribute>
- <attribute name="action">win.mark-conversation-unstarred</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Mark as S_pam</attribute>
- <attribute name="action">win.mark-conversation-spam</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Mark as not S_pam</attribute>
- <attribute name="action">win.mark-conversation-not-spam</attribute>
- </item>
- </menu>
</interface>
diff --git a/ui/main-toolbar.ui b/ui/main-toolbar.ui
index 813c684..dca27b6 100644
--- a/ui/main-toolbar.ui
+++ b/ui/main-toolbar.ui
@@ -1,12 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
- <object class="GtkImage" id="archive_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">mail-archive-symbolic</property>
- </object>
<template class="MainToolbar" parent="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -235,83 +230,6 @@
</object>
</child>
<child>
- <object class="GtkBox" id="mark_copy_move_buttons">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuButton" id="mark_conversation_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="tooltip_text" translatable="yes">Mark conversation</property>
- <property name="action_name">win.mark-conversation-menu</property>
- <property name="always_show_image">True</property>
- <child>
- <object class="GtkImage" id="mark_message_image">
- <property name="can_focus">False</property>
- <property name="icon_name">marker-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkMenuButton" id="copy_conversation_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="tooltip_text" translatable="yes">Add label to conversation</property>
- <property name="always_show_image">True</property>
- <child>
- <object class="GtkImage" id="copy_message_image">
- <property name="can_focus">False</property>
- <property name="icon_name">tag-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkMenuButton" id="move_conversation_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="tooltip_text" translatable="yes">Move conversation</property>
- <property name="always_show_image">True</property>
- <child>
- <object class="GtkImage" id="move_message_image">
- <property name="can_focus">False</property>
- <property name="icon_name">folder-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <style>
- <class name="raised"/>
- <class name="linked"/>
- </style>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
<object class="GtkToggleButton" id="find_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -351,85 +269,6 @@
<property name="position">3</property>
</packing>
</child>
- <child>
- <object class="GtkBox" id="archive_trash_delete_buttons">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="archive_button">
- <property name="label" translatable="yes">_Archive</property>
- <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="tooltip_text" translatable="yes">Archive conversation (A)</property>
- <property name="action_name">win.archive-conv</property>
- <property name="image">archive_image</property>
- <property name="use_underline">True</property>
- <property name="always_show_image">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="trash_button">
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">False</property>
- <property name="no_show_all">True</property>
- <property name="tooltip_text" translatable="yes">Move conversation to Trash (Delete,
Backspace)</property>
- <property name="action_name">win.trash-conv</property>
- <property name="always_show_image">True</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">user-trash-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="delete_button">
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">False</property>
- <property name="no_show_all">True</property>
- <property name="tooltip_text" translatable="yes">Delete conversation
(Shift+Delete)</property>
- <property name="action_name">win.trash-conv</property>
- <property name="always_show_image">True</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">edit-delete-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <style>
- <class name="raised"/>
- <class name="linked"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- <property name="position">4</property>
- </packing>
- </child>
<style>
<class name="geary-titlebar"/>
<class name="geary-titlebar-right"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]