[geary/mjog/account-command-stacks: 47/77] Clean up MainWindow action definitions
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/account-command-stacks: 47/77] Clean up MainWindow action definitions
- Date: Tue, 5 Nov 2019 00:37:02 +0000 (UTC)
commit fe67993c8eb09e5129e1510ffa27ce04e9183473
Author: Michael Gratton <mike vee net>
Date: Sun Oct 6 20:44:48 2019 +1100
Clean up MainWindow action definitions
Rename action consts and values to better reflect what they do.
src/client/components/main-window.vala | 119 ++++++++++-----------
.../conversation-list/conversation-list-view.vala | 6 +-
ui/main-toolbar-menus.ui | 16 ++-
ui/main-toolbar.ui | 11 +-
4 files changed, 73 insertions(+), 79 deletions(-)
---
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 7e7fe2bf..2c23bde0 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -11,29 +11,27 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
// Named actions.
- public const string ACTION_ARCHIVE_CONVERSATION = "archive-conv";
+ public const string ACTION_ARCHIVE_CONVERSATION = "archive-conversation";
public const string ACTION_CONVERSATION_DOWN = "down-conversation";
- public const string ACTION_CONVERSATION_LIST = "focus-conv-list";
+ public const string ACTION_CONVERSATION_LIST = "focus-conversation-list";
public const string ACTION_CONVERSATION_UP = "up-conversation";
- public const string ACTION_COPY_MENU = "show-copy-menu";
- public const string ACTION_DELETE_CONVERSATION = "delete-conv";
+ public const string ACTION_DELETE_CONVERSATION = "delete-conversation";
public const string ACTION_EMPTY_SPAM = "empty-spam";
public const string ACTION_EMPTY_TRASH = "empty-trash";
- public const string ACTION_FIND_IN_CONVERSATION = "conv-find";
- public const string ACTION_FORWARD_MESSAGE = "forward-message";
- public const string ACTION_MARK_AS_READ = "mark-message-read";
- public const string ACTION_MARK_AS_STARRED = "mark-message-starred";
- public const string ACTION_MARK_AS_UNREAD = "mark-message-unread";
- public const string ACTION_MARK_AS_UNSTARRED = "mark-message-unstarred";
- public const string ACTION_MOVE_MENU = "show-move-menu";
- public const string ACTION_REPLY_ALL_MESSAGE = "reply-all-message";
- public const string ACTION_REPLY_TO_MESSAGE = "reply-to-message";
- public const string ACTION_SEARCH = "search-conv";
- public const string ACTION_SHOW_MARK_MENU = "mark-message-menu";
- public const string ACTION_TOGGLE_FIND = "toggle-find";
- public const string ACTION_TOGGLE_SEARCH = "toggle-search";
- public const string ACTION_TOGGLE_SPAM = "toggle-message-spam";
- public const string ACTION_TRASH_CONVERSATION = "trash-conv";
+ public const string ACTION_FIND_IN_CONVERSATION = "find-in-conversation";
+ public const string ACTION_FORWARD_CONVERSATION = "forward-conversation";
+ public const string ACTION_MARK_AS_READ = "mark-conversation-read";
+ public const string ACTION_MARK_AS_STARRED = "mark-conversation-starred";
+ public const string ACTION_MARK_AS_UNREAD = "mark-conversation-unread";
+ public const string ACTION_MARK_AS_UNSTARRED = "mark-conversation-unstarred";
+ public const string ACTION_REPLY_ALL_CONVERSATION = "reply-all-conversation";
+ public const string ACTION_REPLY_CONVERSATION = "reply-conversation";
+ public const string ACTION_SEARCH = "search";
+ public const string ACTION_SHOW_COPY_MENU = "show-copy-menu";
+ public const string ACTION_SHOW_MARK_MENU = "show-mark-menu";
+ public const string ACTION_SHOW_MOVE_MENU = "show-move-menu";
+ public const string ACTION_TOGGLE_SPAM = "toggle-conversation-spam";
+ public const string ACTION_TRASH_CONVERSATION = "trash-conversation";
public const string ACTION_ZOOM = "zoom";
private const int STATUS_BAR_HEIGHT = 18;
@@ -41,47 +39,48 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
private const int MIN_CONVERSATION_COUNT = 50;
private const ActionEntry[] win_action_entries = {
- {GearyApplication.ACTION_CLOSE, on_close },
- {GearyApplication.ACTION_UNDO, on_undo },
- {GearyApplication.ACTION_REDO, on_redo },
-
- {ACTION_CONVERSATION_LIST, on_conversation_list },
- {ACTION_FIND_IN_CONVERSATION, on_find_in_conversation_action },
- {ACTION_SEARCH, on_search_activated },
- {ACTION_EMPTY_SPAM, on_empty_spam },
- {ACTION_EMPTY_TRASH, on_empty_trash },
+ { GearyApplication.ACTION_CLOSE, on_close },
+ { GearyApplication.ACTION_UNDO, on_undo },
+ { GearyApplication.ACTION_REDO, on_redo },
+
+ { ACTION_CONVERSATION_LIST, on_conversation_list },
+ { ACTION_FIND_IN_CONVERSATION, on_find_in_conversation_action },
+ { ACTION_SEARCH, on_search_activated },
+ { ACTION_EMPTY_SPAM, on_empty_spam },
+ { ACTION_EMPTY_TRASH, on_empty_trash },
// Message actions
- {ACTION_REPLY_TO_MESSAGE, on_reply_conversation },
- {ACTION_REPLY_ALL_MESSAGE, on_reply_all_conversation },
- {ACTION_FORWARD_MESSAGE, on_forward_conversation },
- {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 },
- {ACTION_CONVERSATION_UP, on_conversation_up },
- {ACTION_CONVERSATION_DOWN, on_conversation_down },
+ { ACTION_REPLY_CONVERSATION, on_reply_conversation },
+ { ACTION_REPLY_ALL_CONVERSATION, on_reply_all_conversation },
+ { ACTION_FORWARD_CONVERSATION, on_forward_conversation },
+ { ACTION_ARCHIVE_CONVERSATION, on_archive_conversation },
+ { ACTION_TRASH_CONVERSATION, on_trash_conversation },
+ { ACTION_DELETE_CONVERSATION, on_delete_conversation },
+ { ACTION_SHOW_COPY_MENU, on_show_copy_menu },
+ { ACTION_SHOW_MOVE_MENU, on_show_move_menu },
+ { ACTION_CONVERSATION_UP, on_conversation_up },
+ { ACTION_CONVERSATION_DOWN, on_conversation_down },
// 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_TOGGLE_SPAM, on_mark_as_spam_toggle },
+ { 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_TOGGLE_SPAM, on_mark_as_spam_toggle },
// Message viewer
- {ACTION_ZOOM, on_zoom, "s" },
+ { ACTION_ZOOM, on_zoom, "s" },
};
public static void add_window_accelerators(GearyApplication owner) {
// Marking actions
//
- // Unmark is the primary action
+ // Unread is the primary action, so it doesn't get the <Shift>
+ // modifier
owner.add_window_accelerators(
- ACTION_MARK_AS_READ, { "<Ctrl><Shift>U", "<Shift>I" }
+ ACTION_MARK_AS_UNREAD, { "<Ctrl>U", "<Shift>U" }
);
owner.add_window_accelerators(
- ACTION_MARK_AS_UNREAD, { "<Ctrl>U", "<Shift>U" }
+ ACTION_MARK_AS_READ, { "<Ctrl><Shift>U", "<Shift>I" }
);
// Ephy uses Ctrl+D for bookmarking
owner.add_window_accelerators(
@@ -96,21 +95,21 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
// Replying & forwarding
owner.add_window_accelerators(
- ACTION_REPLY_TO_MESSAGE, { "<Ctrl>R", "R" }
+ ACTION_REPLY_CONVERSATION, { "<Ctrl>R", "R" }
);
owner.add_window_accelerators(
- ACTION_REPLY_ALL_MESSAGE, { "<Ctrl><Shift>R", "<Shift>R" }
+ ACTION_REPLY_ALL_CONVERSATION, { "<Ctrl><Shift>R", "<Shift>R" }
);
owner.add_window_accelerators(
- ACTION_FORWARD_MESSAGE, { "<Ctrl>L", "F" }
+ ACTION_FORWARD_CONVERSATION, { "<Ctrl>L", "F" }
);
// Moving & labelling
owner.add_window_accelerators(
- ACTION_COPY_MENU, { "<Ctrl>L", "L" }
+ ACTION_SHOW_COPY_MENU, { "<Ctrl>L", "L" }
);
owner.add_window_accelerators(
- ACTION_MOVE_MENU, { "<Ctrl>M", "M" }
+ ACTION_SHOW_MOVE_MENU, { "<Ctrl>M", "M" }
);
owner.add_window_accelerators(
ACTION_ARCHIVE_CONVERSATION, { "<Ctrl>K", "A", "Y" }
@@ -1085,21 +1084,21 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
this.current_folder != null &&
this.current_folder.special_folder_type != DRAFTS
);
- get_action(ACTION_REPLY_TO_MESSAGE).set_enabled(reply_sensitive);
- get_action(ACTION_REPLY_ALL_MESSAGE).set_enabled(reply_sensitive);
- get_action(ACTION_FORWARD_MESSAGE).set_enabled(reply_sensitive);
+ get_action(ACTION_REPLY_CONVERSATION).set_enabled(reply_sensitive);
+ get_action(ACTION_REPLY_ALL_CONVERSATION).set_enabled(reply_sensitive);
+ get_action(ACTION_FORWARD_CONVERSATION).set_enabled(reply_sensitive);
bool move_enabled = (
sensitive && (current_folder is Geary.FolderSupport.Move)
);
this.main_toolbar.move_message_button.set_sensitive(move_enabled);
- get_action(ACTION_MOVE_MENU).set_enabled(move_enabled);
+ get_action(ACTION_SHOW_MOVE_MENU).set_enabled(move_enabled);
bool copy_enabled = (
sensitive && (current_folder is Geary.FolderSupport.Copy)
);
this.main_toolbar.copy_message_button.set_sensitive(copy_enabled);
- get_action(ACTION_COPY_MENU).set_enabled(move_enabled);
+ get_action(ACTION_SHOW_COPY_MENU).set_enabled(move_enabled);
get_action(ACTION_ARCHIVE_CONVERSATION).set_enabled(
sensitive && (current_folder is Geary.FolderSupport.Archive)
@@ -1154,11 +1153,11 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
sensitive &&
(typeof(Geary.FolderSupport.Mark) in supported_operations)
);
- get_action(ACTION_COPY_MENU).set_enabled(
+ get_action(ACTION_SHOW_COPY_MENU).set_enabled(
sensitive &&
(supported_operations.contains(typeof(Geary.FolderSupport.Copy)))
);
- get_action(ACTION_MOVE_MENU).set_enabled(
+ get_action(ACTION_SHOW_MOVE_MENU).set_enabled(
sensitive &&
(supported_operations.contains(typeof(Geary.FolderSupport.Move)))
);
diff --git a/src/client/conversation-list/conversation-list-view.vala
b/src/client/conversation-list/conversation-list-view.vala
index 3050935d..d1df162f 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -356,9 +356,9 @@ public class ConversationListView : Gtk.TreeView, Geary.BaseInterface {
context_menu_model.append(_("_Star"), "win."+MainWindow.ACTION_MARK_AS_STARRED);
Menu actions_section = new Menu();
- actions_section.append(_("_Reply"), "win."+MainWindow.ACTION_REPLY_TO_MESSAGE);
- actions_section.append(_("R_eply All"), "win."+MainWindow.ACTION_REPLY_ALL_MESSAGE);
- actions_section.append(_("_Forward"), "win."+MainWindow.ACTION_FORWARD_MESSAGE);
+ actions_section.append(_("_Reply"), "win."+MainWindow.ACTION_REPLY_CONVERSATION);
+ actions_section.append(_("R_eply All"), "win."+MainWindow.ACTION_REPLY_ALL_CONVERSATION);
+ actions_section.append(_("_Forward"), "win."+MainWindow.ACTION_FORWARD_CONVERSATION);
context_menu_model.append_section(null, actions_section);
// Use a popover rather than a regular context menu since
diff --git a/ui/main-toolbar-menus.ui b/ui/main-toolbar-menus.ui
index ca3f53b3..68f9959a 100644
--- a/ui/main-toolbar-menus.ui
+++ b/ui/main-toolbar-menus.ui
@@ -3,27 +3,23 @@
<menu id="mark_message_menu">
<item>
<attribute name="label" translatable="yes">Mark as _Read</attribute>
- <attribute name="action">win.mark-message-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-message-unread</attribute>
+ <attribute name="action">win.mark-conversation-unread</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Star</attribute>
- <attribute name="action">win.mark-message-starred</attribute>
+ <attribute name="action">win.mark-conversation-starred</attribute>
</item>
<item>
<attribute name="label" translatable="yes">U_nstar</attribute>
- <attribute name="action">win.mark-message-unstarred</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-message-spam</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Mark as not S_pam</attribute>
- <attribute name="action">win.mark-message-not-spam</attribute>
+ <attribute name="label" translatable="yes">Toggle as S_pam</attribute>
+ <attribute name="action">win.toggle-conversation-spam</attribute>
</item>
</menu>
<menu id="main_menu">
diff --git a/ui/main-toolbar.ui b/ui/main-toolbar.ui
index dcd813bd..353b9ff1 100644
--- a/ui/main-toolbar.ui
+++ b/ui/main-toolbar.ui
@@ -111,7 +111,7 @@
<property name="focus_on_click">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Reply</property>
- <property name="action_name">win.reply-to-message</property>
+ <property name="action_name">win.reply-conversation</property>
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="reply_sender_image">
@@ -134,7 +134,7 @@
<property name="focus_on_click">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Reply All</property>
- <property name="action_name">win.reply-all-message</property>
+ <property name="action_name">win.reply-all-conversation</property>
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="reply_all_image">
@@ -157,7 +157,7 @@
<property name="focus_on_click">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Forward</property>
- <property name="action_name">win.forward-message</property>
+ <property name="action_name">win.forward-conversation</property>
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="forward_image">
@@ -189,7 +189,6 @@
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">False</property>
- <property name="action_name">win.mark-message-menu</property>
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="mark_message_image">
@@ -288,7 +287,7 @@
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">False</property>
- <property name="action_name">win.archive-conv</property>
+ <property name="action_name">win.archive-conversation</property>
<property name="image">archive_image</property>
<property name="use_underline">True</property>
<property name="always_show_image">True</property>
@@ -305,7 +304,7 @@
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">False</property>
- <property name="action_name">win.trash-conv</property>
+ <property name="action_name">win.trash-conversation</property>
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="trash_delete_image">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]