Merge lp:~meese/pantheon-photos/searchbutton-header into lp:~pantheon-photos/pantheon-photos/trunk
- searchbutton-header
- Merge into trunk
Proposed by
meese
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 2701 | ||||||||
Proposed branch: | lp:~meese/pantheon-photos/searchbutton-header | ||||||||
Merge into: | lp:~pantheon-photos/pantheon-photos/trunk | ||||||||
Diff against target: |
290 lines (+86/-19) 9 files modified
src/Page.vala (+13/-3) src/PhotoPage.vala (+23/-0) src/camera/ImportPage.vala (+0/-6) src/events/EventPage.vala (+23/-1) src/library/Branch.vala (+4/-0) src/library/LibraryWindow.vala (+23/-6) ui/collection.ui (+0/-1) ui/offline.ui (+0/-1) ui/trash.ui (+0/-1) |
||||||||
To merge this branch: | bzr merge lp:~meese/pantheon-photos/searchbutton-header | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Viko Adi Rahmawan (community) | Needs Fixing | ||
Danielle Foré | ux | Approve | |
elementary Apps team | code | Pending | |
Review via email: mp+233661@code.launchpad.net |
Commit message
moves search button to headerbar and adds back button
Description of the change
moves search button to headerbar and adds back button for photo pages (same commit because code changes in the same area)
To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote : | # |
Revision history for this message
meese (meese) wrote : | # |
Fixed
Revision history for this message
Danielle Foré (danrabbit) wrote : | # |
Looks good to me, thanks Maddie :)
review:
Approve
(ux)
Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote : | # |
Any reason not to use return_
PhotoPage.vala also save previous CollectionPage in return_page variable, you seems to duplicate with last_checkerboa
review:
Needs Information
Revision history for this message
meese (meese) wrote : | # |
fixed
Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote : | # |
Will likely need merge trunk and adjustment for get_back_name after my branch got merged.
now Photos and Raw Photos have their own child class of in PhotosPage.vala and RawsPage.vala respectively. And Library.MainPage is no more being used anywhere else
review:
Needs Fixing
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/Page.vala' | |||
2 | --- src/Page.vala 2014-09-02 19:42:49 +0000 | |||
3 | +++ src/Page.vala 2014-09-24 23:13:36 +0000 | |||
4 | @@ -81,7 +81,7 @@ | |||
5 | 81 | private Gtk.ActionGroup? action_group = null; | 81 | private Gtk.ActionGroup? action_group = null; |
6 | 82 | private Gtk.ActionGroup[]? common_action_groups = null; | 82 | private Gtk.ActionGroup[]? common_action_groups = null; |
7 | 83 | private GLib.List<Gtk.Widget>? contractor_menu_items = null; | 83 | private GLib.List<Gtk.Widget>? contractor_menu_items = null; |
9 | 84 | 84 | protected Gtk.Box header_box; | |
10 | 85 | private uint[] merge_ids = new uint[0]; | 85 | private uint[] merge_ids = new uint[0]; |
11 | 86 | 86 | ||
12 | 87 | protected Page (string page_name) { | 87 | protected Page (string page_name) { |
13 | @@ -144,7 +144,7 @@ | |||
14 | 144 | } | 144 | } |
15 | 145 | menu.show_all (); | 145 | menu.show_all (); |
16 | 146 | } | 146 | } |
18 | 147 | 147 | ||
19 | 148 | protected void populate_rating_widget_menu_item (Gtk.Menu menu, string placeholder_ui) { | 148 | protected void populate_rating_widget_menu_item (Gtk.Menu menu, string placeholder_ui) { |
20 | 149 | if (rating_menu_item != null) rating_menu_item.destroy (); | 149 | if (rating_menu_item != null) rating_menu_item.destroy (); |
21 | 150 | rating_menu_item = new PhotoRatingMenuItem (); | 150 | rating_menu_item = new PhotoRatingMenuItem (); |
22 | @@ -156,7 +156,7 @@ | |||
23 | 156 | break; | 156 | break; |
24 | 157 | pos++; | 157 | pos++; |
25 | 158 | } | 158 | } |
27 | 159 | 159 | ||
28 | 160 | menu.append (rating_menu_item); | 160 | menu.append (rating_menu_item); |
29 | 161 | menu.reorder_child (rating_menu_item, pos); | 161 | menu.reorder_child (rating_menu_item, pos); |
30 | 162 | rating_menu_item.activate.connect (on_rating_widget_activate); | 162 | rating_menu_item.activate.connect (on_rating_widget_activate); |
31 | @@ -581,6 +581,11 @@ | |||
32 | 581 | toolbar_path = path; | 581 | toolbar_path = path; |
33 | 582 | } | 582 | } |
34 | 583 | 583 | ||
35 | 584 | public virtual Gtk.Box get_header_buttons () { | ||
36 | 585 | header_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); | ||
37 | 586 | return header_box; | ||
38 | 587 | } | ||
39 | 588 | |||
40 | 584 | // Called from "realize" | 589 | // Called from "realize" |
41 | 585 | private void attach_view_signals () { | 590 | private void attach_view_signals () { |
42 | 586 | if (are_actions_attached) | 591 | if (are_actions_attached) |
43 | @@ -1323,6 +1328,11 @@ | |||
44 | 1323 | Resources.style_widget (this, Resources.PAGE_STYLESHEET); | 1328 | Resources.style_widget (this, Resources.PAGE_STYLESHEET); |
45 | 1324 | } | 1329 | } |
46 | 1325 | 1330 | ||
47 | 1331 | // Returns the name for the back button that goes to this page | ||
48 | 1332 | public virtual string get_back_name () { | ||
49 | 1333 | return get_page_name (); | ||
50 | 1334 | } | ||
51 | 1335 | |||
52 | 1326 | public void init_item_context_menu (string path) { | 1336 | public void init_item_context_menu (string path) { |
53 | 1327 | item_context_menu_path = path; | 1337 | item_context_menu_path = path; |
54 | 1328 | } | 1338 | } |
55 | 1329 | 1339 | ||
56 | === modified file 'src/PhotoPage.vala' | |||
57 | --- src/PhotoPage.vala 2014-09-13 03:34:09 +0000 | |||
58 | +++ src/PhotoPage.vala 2014-09-24 23:13:36 +0000 | |||
59 | @@ -2410,6 +2410,29 @@ | |||
60 | 2410 | return toolbar; | 2410 | return toolbar; |
61 | 2411 | } | 2411 | } |
62 | 2412 | 2412 | ||
63 | 2413 | public override Gtk.Box get_header_buttons () { | ||
64 | 2414 | header_box = base.get_header_buttons (); | ||
65 | 2415 | LibraryWindow app = AppWindow.get_instance () as LibraryWindow; | ||
66 | 2416 | if (app == null) | ||
67 | 2417 | return header_box; | ||
68 | 2418 | |||
69 | 2419 | if (return_page != null) { | ||
70 | 2420 | var last_name = return_page.get_back_name (); | ||
71 | 2421 | // Back Button | ||
72 | 2422 | var back_button = new Gtk.Button (); | ||
73 | 2423 | back_button.clicked.connect (return_to_collection); | ||
74 | 2424 | back_button.get_style_context ().add_class ("back-button"); | ||
75 | 2425 | back_button.can_focus = false; | ||
76 | 2426 | back_button.valign = Gtk.Align.CENTER; | ||
77 | 2427 | back_button.vexpand = false; | ||
78 | 2428 | back_button.visible = false; | ||
79 | 2429 | back_button.label = last_name; | ||
80 | 2430 | header_box.pack_start (back_button); | ||
81 | 2431 | } | ||
82 | 2432 | |||
83 | 2433 | return header_box; | ||
84 | 2434 | } | ||
85 | 2435 | |||
86 | 2413 | public bool not_trashed_view_filter (DataView view) { | 2436 | public bool not_trashed_view_filter (DataView view) { |
87 | 2414 | return ! ((MediaSource) view.get_source ()).is_trashed (); | 2437 | return ! ((MediaSource) view.get_source ()).is_trashed (); |
88 | 2415 | } | 2438 | } |
89 | 2416 | 2439 | ||
90 | === modified file 'src/camera/ImportPage.vala' | |||
91 | --- src/camera/ImportPage.vala 2014-08-08 21:13:09 +0000 | |||
92 | +++ src/camera/ImportPage.vala 2014-09-24 23:13:36 +0000 | |||
93 | @@ -817,12 +817,6 @@ | |||
94 | 817 | 817 | ||
95 | 818 | toolbar.insert (progress_item, -1); | 818 | toolbar.insert (progress_item, -1); |
96 | 819 | 819 | ||
97 | 820 | // Find button | ||
98 | 821 | Gtk.ToggleToolButton find_button = new Gtk.ToggleToolButton (); | ||
99 | 822 | find_button.set_related_action (get_action ("CommonDisplaySearchbar")); | ||
100 | 823 | |||
101 | 824 | toolbar.insert (find_button, -1); | ||
102 | 825 | |||
103 | 826 | // Separator | 820 | // Separator |
104 | 827 | toolbar.insert (new Gtk.SeparatorToolItem (), -1); | 821 | toolbar.insert (new Gtk.SeparatorToolItem (), -1); |
105 | 828 | 822 | ||
106 | 829 | 823 | ||
107 | === modified file 'src/events/EventPage.vala' | |||
108 | --- src/events/EventPage.vala 2014-09-08 04:47:32 +0000 | |||
109 | +++ src/events/EventPage.vala 2014-09-24 23:13:36 +0000 | |||
110 | @@ -103,10 +103,32 @@ | |||
111 | 103 | private void on_rename () { | 103 | private void on_rename () { |
112 | 104 | LibraryWindow.get_app ().rename_event_in_sidebar (page_event); | 104 | LibraryWindow.get_app ().rename_event_in_sidebar (page_event); |
113 | 105 | } | 105 | } |
114 | 106 | |||
115 | 107 | public override Gtk.Box get_header_buttons () { | ||
116 | 108 | header_box = base.get_header_buttons (); | ||
117 | 109 | // Back Button | ||
118 | 110 | var back_button = new Gtk.Button (); | ||
119 | 111 | back_button.clicked.connect (back_to_master_clicked); | ||
120 | 112 | back_button.get_style_context ().add_class ("back-button"); | ||
121 | 113 | back_button.can_focus = false; | ||
122 | 114 | back_button.valign = Gtk.Align.CENTER; | ||
123 | 115 | back_button.vexpand = false; | ||
124 | 116 | back_button.visible = false; | ||
125 | 117 | back_button.label = _("All Events"); | ||
126 | 118 | header_box.pack_start (back_button); | ||
127 | 119 | |||
128 | 120 | return header_box; | ||
129 | 121 | } | ||
130 | 122 | |||
131 | 123 | public void back_to_master_clicked () { | ||
132 | 124 | LibraryWindow app = AppWindow.get_instance () as LibraryWindow; | ||
133 | 125 | app.switch_to_event_directory (); | ||
134 | 126 | } | ||
135 | 127 | |||
136 | 106 | } | 128 | } |
137 | 107 | 129 | ||
138 | 108 | public class NoEventPage : CollectionPage { | 130 | public class NoEventPage : CollectionPage { |
140 | 109 | public const string NAME = _ ("No Event"); | 131 | public const string NAME = _("No Event"); |
141 | 110 | 132 | ||
142 | 111 | // This seems very similar to EventSourceCollection -> ViewManager | 133 | // This seems very similar to EventSourceCollection -> ViewManager |
143 | 112 | private class NoEventViewManager : CollectionViewManager { | 134 | private class NoEventViewManager : CollectionViewManager { |
144 | 113 | 135 | ||
145 | === modified file 'src/library/Branch.vala' | |||
146 | --- src/library/Branch.vala 2014-08-08 21:13:09 +0000 | |||
147 | +++ src/library/Branch.vala 2014-09-24 23:13:36 +0000 | |||
148 | @@ -163,5 +163,9 @@ | |||
149 | 163 | protected override void set_config_photos_sort (bool sort_order, int sort_by) { | 163 | protected override void set_config_photos_sort (bool sort_order, int sort_by) { |
150 | 164 | Config.Facade.get_instance ().set_library_photos_sort (sort_order, sort_by); | 164 | Config.Facade.get_instance ().set_library_photos_sort (sort_order, sort_by); |
151 | 165 | } | 165 | } |
152 | 166 | |||
153 | 167 | public override string get_back_name () { | ||
154 | 168 | return _("All Photos"); | ||
155 | 169 | } | ||
156 | 166 | } | 170 | } |
157 | 167 | 171 | ||
158 | 168 | 172 | ||
159 | === modified file 'src/library/LibraryWindow.vala' | |||
160 | --- src/library/LibraryWindow.vala 2014-09-07 01:47:31 +0000 | |||
161 | +++ src/library/LibraryWindow.vala 2014-09-24 23:13:36 +0000 | |||
162 | @@ -118,7 +118,6 @@ | |||
163 | 118 | private Gee.HashMap<Page, Sidebar.Entry> page_map = new Gee.HashMap<Page, Sidebar.Entry> (); | 118 | private Gee.HashMap<Page, Sidebar.Entry> page_map = new Gee.HashMap<Page, Sidebar.Entry> (); |
164 | 119 | 119 | ||
165 | 120 | private LibraryPhotoPage photo_page = null; | 120 | private LibraryPhotoPage photo_page = null; |
166 | 121 | |||
167 | 122 | // this is to keep track of cameras which initiate the app | 121 | // this is to keep track of cameras which initiate the app |
168 | 123 | private static Gee.HashSet<string> initial_camera_uris = new Gee.HashSet<string> (); | 122 | private static Gee.HashSet<string> initial_camera_uris = new Gee.HashSet<string> (); |
169 | 124 | 123 | ||
170 | @@ -129,6 +128,7 @@ | |||
171 | 129 | // AppWindows instead. | 128 | // AppWindows instead. |
172 | 130 | private SearchFilterToolbar search_toolbar; | 129 | private SearchFilterToolbar search_toolbar; |
173 | 131 | 130 | ||
174 | 131 | private Gtk.Box page_header_box; | ||
175 | 132 | private Gtk.Box top_section = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); | 132 | private Gtk.Box top_section = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); |
176 | 133 | private Gtk.Frame background_progress_frame = new Gtk.Frame (null); | 133 | private Gtk.Frame background_progress_frame = new Gtk.Frame (null); |
177 | 134 | private Gtk.ProgressBar background_progress_bar = new Gtk.ProgressBar (); | 134 | private Gtk.ProgressBar background_progress_bar = new Gtk.ProgressBar (); |
178 | @@ -137,7 +137,6 @@ | |||
179 | 137 | private Gtk.Notebook notebook = new Gtk.Notebook (); | 137 | private Gtk.Notebook notebook = new Gtk.Notebook (); |
180 | 138 | private Gtk.Box layout = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); | 138 | private Gtk.Box layout = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); |
181 | 139 | private Gtk.Box right_vbox; | 139 | private Gtk.Box right_vbox; |
182 | 140 | |||
183 | 141 | private int current_progress_priority = 0; | 140 | private int current_progress_priority = 0; |
184 | 142 | private uint background_progress_pulse_id = 0; | 141 | private uint background_progress_pulse_id = 0; |
185 | 143 | 142 | ||
186 | @@ -221,8 +220,19 @@ | |||
187 | 221 | CameraTable.get_instance ().camera_added.connect (on_camera_added); | 220 | CameraTable.get_instance ().camera_added.connect (on_camera_added); |
188 | 222 | 221 | ||
189 | 223 | background_progress_bar.set_show_text (true); | 222 | background_progress_bar.set_show_text (true); |
191 | 224 | 223 | } | |
192 | 224 | |||
193 | 225 | protected override void build_header_bar () { | ||
194 | 226 | // Left side of header bar | ||
195 | 227 | base.build_header_bar (); | ||
196 | 228 | |||
197 | 229 | // Right side of header bar | ||
198 | 225 | build_settings_header (); | 230 | build_settings_header (); |
199 | 231 | |||
200 | 232 | // Find button | ||
201 | 233 | Gtk.ToggleToolButton find_button = new Gtk.ToggleToolButton (); | ||
202 | 234 | find_button.set_related_action (get_common_action ("CommonDisplaySearchbar")); | ||
203 | 235 | header.pack_end (find_button); | ||
204 | 226 | } | 236 | } |
205 | 227 | 237 | ||
206 | 228 | protected void build_settings_header () { | 238 | protected void build_settings_header () { |
207 | @@ -692,7 +702,6 @@ | |||
208 | 692 | CollectionPage collection; | 702 | CollectionPage collection; |
209 | 693 | Photo start; | 703 | Photo start; |
210 | 694 | bool can_fullscreen = get_fullscreen_photo (page, out collection, out start); | 704 | bool can_fullscreen = get_fullscreen_photo (page, out collection, out start); |
211 | 695 | |||
212 | 696 | set_common_action_sensitive ("CommonEmptyTrash", can_empty_trash ()); | 705 | set_common_action_sensitive ("CommonEmptyTrash", can_empty_trash ()); |
213 | 697 | set_common_action_visible ("CommonJumpToEvent", true); | 706 | set_common_action_visible ("CommonJumpToEvent", true); |
214 | 698 | set_common_action_sensitive ("CommonJumpToEvent", can_jump_to_event ()); | 707 | set_common_action_sensitive ("CommonJumpToEvent", can_jump_to_event ()); |
215 | @@ -979,6 +988,10 @@ | |||
216 | 979 | switch_to_page (library_branch.photos_entry.get_page ()); | 988 | switch_to_page (library_branch.photos_entry.get_page ()); |
217 | 980 | } | 989 | } |
218 | 981 | 990 | ||
219 | 991 | public void switch_to_event_directory () { | ||
220 | 992 | switch_to_page (events_branch.get_master_entry ().get_page ()); | ||
221 | 993 | } | ||
222 | 994 | |||
223 | 982 | public void switch_to_event (Event event) { | 995 | public void switch_to_event (Event event) { |
224 | 983 | Events.EventEntry? entry = events_branch.get_entry_for_event (event); | 996 | Events.EventEntry? entry = events_branch.get_entry_for_event (event); |
225 | 984 | if (entry != null) | 997 | if (entry != null) |
226 | @@ -1007,7 +1020,7 @@ | |||
227 | 1007 | // before switching to it | 1020 | // before switching to it |
228 | 1008 | spin_event_loop (); | 1021 | spin_event_loop (); |
229 | 1009 | } | 1022 | } |
231 | 1010 | 1023 | ||
232 | 1011 | photo_page.display_for_collection (controller, current); | 1024 | photo_page.display_for_collection (controller, current); |
233 | 1012 | switch_to_page (photo_page); | 1025 | switch_to_page (photo_page); |
234 | 1013 | } | 1026 | } |
235 | @@ -1298,6 +1311,8 @@ | |||
236 | 1298 | Gtk.Toolbar toolbar = current_page.get_toolbar (); | 1311 | Gtk.Toolbar toolbar = current_page.get_toolbar (); |
237 | 1299 | if (toolbar != null) | 1312 | if (toolbar != null) |
238 | 1300 | right_vbox.remove (toolbar); | 1313 | right_vbox.remove (toolbar); |
239 | 1314 | if (page_header_box != null) | ||
240 | 1315 | header.remove (page_header_box); | ||
241 | 1301 | 1316 | ||
242 | 1302 | current_page.switching_from (); | 1317 | current_page.switching_from (); |
243 | 1303 | 1318 | ||
244 | @@ -1315,7 +1330,9 @@ | |||
245 | 1315 | // do this prior to changing selection, as the change will fire a cursor-changed event, | 1330 | // do this prior to changing selection, as the change will fire a cursor-changed event, |
246 | 1316 | // which will then call this function again | 1331 | // which will then call this function again |
247 | 1317 | base.set_current_page (page); | 1332 | base.set_current_page (page); |
249 | 1318 | 1333 | page_header_box = page.get_header_buttons (); | |
250 | 1334 | header.pack_start (page_header_box); | ||
251 | 1335 | header.show_all (); | ||
252 | 1319 | // if the visible page is the LibraryPhotoPage, we need to prevent single-click inline | 1336 | // if the visible page is the LibraryPhotoPage, we need to prevent single-click inline |
253 | 1320 | // renaming in the sidebar because a single click while in the LibraryPhotoPage indicates | 1337 | // renaming in the sidebar because a single click while in the LibraryPhotoPage indicates |
254 | 1321 | // the user wants to return to the controlling page ... that is, in this special case, the | 1338 | // the user wants to return to the controlling page ... that is, in this special case, the |
255 | 1322 | 1339 | ||
256 | === modified file 'ui/collection.ui' | |||
257 | --- ui/collection.ui 2014-08-28 14:41:02 +0000 | |||
258 | +++ ui/collection.ui 2014-09-24 23:13:36 +0000 | |||
259 | @@ -43,6 +43,5 @@ | |||
260 | 43 | <separator /> | 43 | <separator /> |
261 | 44 | <toolitem name="ToolPublish" action="Publish" /> | 44 | <toolitem name="ToolPublish" action="Publish" /> |
262 | 45 | <separator /> | 45 | <separator /> |
263 | 46 | <toolitem name="ToolFind" action="CommonDisplaySearchbar" /> | ||
264 | 47 | </toolbar> | 46 | </toolbar> |
265 | 48 | </ui> | 47 | </ui> |
266 | 49 | \ No newline at end of file | 48 | \ No newline at end of file |
267 | 50 | 49 | ||
268 | === modified file 'ui/offline.ui' | |||
269 | --- ui/offline.ui 2014-09-02 19:42:49 +0000 | |||
270 | +++ ui/offline.ui 2014-09-24 23:13:36 +0000 | |||
271 | @@ -6,7 +6,6 @@ | |||
272 | 6 | <toolbar name="OfflineToolbar"> | 6 | <toolbar name="OfflineToolbar"> |
273 | 7 | <toolitem name="ToolRemoveFromLibrary" action="RemoveFromLibrary" /> | 7 | <toolitem name="ToolRemoveFromLibrary" action="RemoveFromLibrary" /> |
274 | 8 | <separator /> | 8 | <separator /> |
275 | 9 | <toolitem name="ToolFind" action="CommonDisplaySearchbar" /> | ||
276 | 10 | </toolbar> | 9 | </toolbar> |
277 | 11 | 10 | ||
278 | 12 | <popup name="OfflineViewMenu" action="ViewMenu"> | 11 | <popup name="OfflineViewMenu" action="ViewMenu"> |
279 | 13 | 12 | ||
280 | === modified file 'ui/trash.ui' | |||
281 | --- ui/trash.ui 2014-09-06 19:39:38 +0000 | |||
282 | +++ ui/trash.ui 2014-09-24 23:13:36 +0000 | |||
283 | @@ -13,7 +13,6 @@ | |||
284 | 13 | </popup> | 13 | </popup> |
285 | 14 | 14 | ||
286 | 15 | <toolbar name="TrashToolbar"> | 15 | <toolbar name="TrashToolbar"> |
287 | 16 | <toolitem name="ToolFind" action="CommonDisplaySearchbar" /> | ||
288 | 17 | </toolbar> | 16 | </toolbar> |
289 | 18 | 17 | ||
290 | 19 | <popup name="TrashViewMenu" action="ViewMenu"> | 18 | <popup name="TrashViewMenu" action="ViewMenu"> |
Can we change the one that says "Library" to "All Photos"?
Also, can we add one from a specific event back to "All Events"?