Merge lp:~purejava/pantheon-mail/trash-spam-source-list-context-entries into lp:~elementary-apps/pantheon-mail/trunk

Proposed by Ralph Plawetzki
Status: Merged
Approved by: Danielle Foré
Approved revision: 2004
Merged at revision: 2003
Proposed branch: lp:~purejava/pantheon-mail/trash-spam-source-list-context-entries
Merge into: lp:~elementary-apps/pantheon-mail/trunk
Diff against target: 152 lines (+39/-37)
7 files modified
data/ui/CMakeLists.txt (+1/-1)
data/ui/context_empty_menu.ui (+7/-0)
data/ui/toolbar_empty_menu.ui (+0/-7)
src/client/application/geary-controller.vala (+0/-6)
src/client/components/main-toolbar.vala (+3/-10)
src/client/sidebar/sidebar-common.vala (+0/-6)
src/client/sidebar/sidebar-tree.vala (+28/-7)
To merge this branch: bzr merge lp:~purejava/pantheon-mail/trash-spam-source-list-context-entries
Reviewer Review Type Date Requested Status
Danielle Foré Approve
Review via email: mp+288855@code.launchpad.net

Commit message

Make "Empty trash" and "Empty spam" available as context menus for the trash and the spam folder.

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

Instead of adding a removing files, please use "bzr mv" in the future. Probably doesn't need to be fixed in this branch because the files are so small, but if the files were larger it makes checking the diff for changes really difficult.

Other than that, works as intended :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/ui/CMakeLists.txt'
2--- data/ui/CMakeLists.txt 2016-02-17 01:21:06 +0000
3+++ data/ui/CMakeLists.txt 2016-03-12 07:54:38 +0000
4@@ -14,6 +14,6 @@
5 install(FILES message.ui DESTINATION ${UI_DEST})
6 install(FILES password-dialog.ui DESTINATION ${UI_DEST})
7 install(FILES remove_confirm.ui DESTINATION ${UI_DEST})
8-install(FILES toolbar_empty_menu.ui DESTINATION ${UI_DEST})
9+install(FILES context_empty_menu.ui DESTINATION ${UI_DEST})
10 install(FILES toolbar_mark_menu.ui DESTINATION ${UI_DEST})
11 install(FILES upgrade_dialog.ui DESTINATION ${UI_DEST})
12
13=== added file 'data/ui/context_empty_menu.ui'
14--- data/ui/context_empty_menu.ui 1970-01-01 00:00:00 +0000
15+++ data/ui/context_empty_menu.ui 2016-03-12 07:54:38 +0000
16@@ -0,0 +1,7 @@
17+<ui>
18+ <popup name="ContextEmptyMenu">
19+ <menuitem name="EmptySpam" action="GearyEmptySpam" />
20+ <menuitem name="EmptyTrash" action="GearyEmptyTrash" />
21+ </popup>
22+</ui>
23+
24
25=== removed file 'data/ui/toolbar_empty_menu.ui'
26--- data/ui/toolbar_empty_menu.ui 2015-01-13 21:48:16 +0000
27+++ data/ui/toolbar_empty_menu.ui 1970-01-01 00:00:00 +0000
28@@ -1,7 +0,0 @@
29-<ui>
30- <popup name="ToolbarEmptyMenu">
31- <menuitem name="EmptySpam" action="GearyEmptySpam" />
32- <menuitem name="EmptyTrash" action="GearyEmptyTrash" />
33- </popup>
34-</ui>
35-
36
37=== modified file 'src/client/application/geary-controller.vala'
38--- src/client/application/geary-controller.vala 2016-03-03 23:14:43 +0000
39+++ src/client/application/geary-controller.vala 2016-03-12 07:54:38 +0000
40@@ -475,12 +475,6 @@
41 entries += delete_message;
42 add_accelerator("<Shift>BackSpace", ACTION_DELETE_MESSAGE);
43
44- Gtk.ActionEntry empty_menu = { ACTION_EMPTY_MENU, "edit-clear-all-symbolic", null, null,
45- null, null };
46- empty_menu.label = _("Empty");
47- empty_menu.tooltip = _("Empty Spam or Trash folders");
48- entries += empty_menu;
49-
50 Gtk.ActionEntry empty_spam = { ACTION_EMPTY_SPAM, null, null, null, null, on_empty_spam };
51 empty_spam.label = _("Empty _Spam…");
52 entries += empty_spam;
53
54=== modified file 'src/client/components/main-toolbar.vala'
55--- src/client/components/main-toolbar.vala 2016-02-08 07:48:54 +0000
56+++ src/client/components/main-toolbar.vala 2016-03-12 07:54:38 +0000
57@@ -59,17 +59,11 @@
58 compose.image = new Gtk.Image.from_icon_name("mail-message-new", Gtk.IconSize.LARGE_TOOLBAR); //FIXME: For some reason doing Button.from_icon_name doesn't work
59 folder_header.pack_start(compose);
60
61- // Assemble the empty menu
62- GearyApplication.instance.load_ui_file("toolbar_empty_menu.ui");
63- Gtk.Menu empty_menu = (Gtk.Menu) GearyApplication.instance.ui_manager.get_widget("/ui/ToolbarEmptyMenu");
64+ // Set accel labels for EmptyTrash and EmptySpam context menus
65+ GearyApplication.instance.load_ui_file("context_empty_menu.ui");
66+ Gtk.Menu empty_menu = (Gtk.Menu) GearyApplication.instance.ui_manager.get_widget("/ui/ContextEmptyMenu");
67 empty_menu.foreach(GtkUtil.show_menuitem_accel_labels);
68
69- Gtk.MenuButton empty = new Gtk.MenuButton();
70- empty.halign = Gtk.Align.END;
71- empty.image = new Gtk.Image.from_icon_name("edit-clear", Gtk.IconSize.LARGE_TOOLBAR);
72- empty.popup = empty_menu;
73- empty.tooltip_text = _("Empty Spam or Trash folders");
74-
75 // Search bar.
76 search_entry.width_chars = 28;
77 search_entry.tooltip_text = _("Search all mail in account for keywords (Ctrl+S)");
78@@ -89,7 +83,6 @@
79 set_search_placeholder_text (DEFAULT_SEARCH_TEXT);
80
81 folder_header.pack_end (search_entry);
82- folder_header.pack_end (empty);
83 folder_header.pack_end (search_upgrade_progress_bar);
84
85 // Reply buttons
86
87=== modified file 'src/client/sidebar/sidebar-common.vala'
88--- src/client/sidebar/sidebar-common.vala 2015-02-06 20:43:33 +0000
89+++ src/client/sidebar/sidebar-common.vala 2016-03-12 07:54:38 +0000
90@@ -82,9 +82,3 @@
91 return emphasized;
92 }
93 }
94-
95-public interface Sidebar.Contextable : Object {
96- // Return null if the context menu should not be invoked for this event
97- public abstract Gtk.Menu? get_sidebar_context_menu(Gdk.EventButton event);
98-}
99-
100
101=== modified file 'src/client/sidebar/sidebar-tree.vala'
102--- src/client/sidebar/sidebar-tree.vala 2016-03-03 06:34:18 +0000
103+++ src/client/sidebar/sidebar-tree.vala 2016-03-12 07:54:38 +0000
104@@ -72,6 +72,7 @@
105 private bool mask_entry_selected_signal = false;
106 private weak EntryWrapper? selected_wrapper = null;
107 private Gtk.Menu? default_context_menu = null;
108+ private Gtk.Menu? context_menu = null;
109 private bool expander_called_manually = false;
110 private int expander_special_count = 0;
111 private bool is_internal_drag_in_progress = false;
112@@ -827,13 +828,33 @@
113 if (wrapper == null)
114 return false;
115
116- Sidebar.Contextable? contextable = wrapper.entry as Sidebar.Contextable;
117- if (contextable == null)
118- return false;
119-
120- Gtk.Menu? context_menu = contextable.get_sidebar_context_menu(event);
121- if (context_menu == null)
122- return false;
123+ Sidebar.SelectableEntry? selectable = wrapper.entry as Sidebar.SelectableEntry;
124+ if (selectable == null)
125+ return false;
126+
127+ FolderList.AbstractFolderEntry? abstract_folder_entry = selectable as FolderList.AbstractFolderEntry;
128+ if (abstract_folder_entry == null)
129+ return false;
130+
131+ Geary.Folder? folder = abstract_folder_entry.folder;
132+ Geary.SpecialFolderType type = folder.special_folder_type;
133+ Gtk.Action? menu_action = null;
134+
135+ switch (type) {
136+ case Geary.SpecialFolderType.TRASH:
137+ menu_action = GearyApplication.instance.actions.get_action(GearyController.ACTION_EMPTY_TRASH);
138+ break;
139+
140+ case Geary.SpecialFolderType.SPAM:
141+ menu_action = GearyApplication.instance.actions.get_action(GearyController.ACTION_EMPTY_SPAM);
142+ break;
143+
144+ default:
145+ return false;
146+ }
147+
148+ context_menu = new Gtk.Menu();
149+ context_menu.add(menu_action.create_menu_item());
150
151 if (event != null)
152 context_menu.popup(null, null, null, event.button, event.time);

Subscribers

People subscribed via source and target branches