Merge lp:~meese/pantheon-photos/searchbutton-header into lp:~pantheon-photos/pantheon-photos/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
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.
2624. By meese

add back button to header bar

Revision history for this message
Danielle Foré (danrabbit) wrote :

Can we change the one that says "Library" to "All Photos"?

Also, can we add one from a specific event back to "All Events"?

2625. By meese

Changes 'Library' to 'All Photos' for back button and adds all events back button

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_to_collection function of PhotoPage.vala?
PhotoPage.vala also save previous CollectionPage in return_page variable, you seems to duplicate with last_checkerboard_page.

review: Needs Information
2626. By meese

fix

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 private Gtk.ActionGroup? action_group = null;
6 private Gtk.ActionGroup[]? common_action_groups = null;
7 private GLib.List<Gtk.Widget>? contractor_menu_items = null;
8-
9+ protected Gtk.Box header_box;
10 private uint[] merge_ids = new uint[0];
11
12 protected Page (string page_name) {
13@@ -144,7 +144,7 @@
14 }
15 menu.show_all ();
16 }
17-
18+
19 protected void populate_rating_widget_menu_item (Gtk.Menu menu, string placeholder_ui) {
20 if (rating_menu_item != null) rating_menu_item.destroy ();
21 rating_menu_item = new PhotoRatingMenuItem ();
22@@ -156,7 +156,7 @@
23 break;
24 pos++;
25 }
26-
27+
28 menu.append (rating_menu_item);
29 menu.reorder_child (rating_menu_item, pos);
30 rating_menu_item.activate.connect (on_rating_widget_activate);
31@@ -581,6 +581,11 @@
32 toolbar_path = path;
33 }
34
35+ public virtual Gtk.Box get_header_buttons () {
36+ header_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
37+ return header_box;
38+ }
39+
40 // Called from "realize"
41 private void attach_view_signals () {
42 if (are_actions_attached)
43@@ -1323,6 +1328,11 @@
44 Resources.style_widget (this, Resources.PAGE_STYLESHEET);
45 }
46
47+ // Returns the name for the back button that goes to this page
48+ public virtual string get_back_name () {
49+ return get_page_name ();
50+ }
51+
52 public void init_item_context_menu (string path) {
53 item_context_menu_path = path;
54 }
55
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 return toolbar;
61 }
62
63+ public override Gtk.Box get_header_buttons () {
64+ header_box = base.get_header_buttons ();
65+ LibraryWindow app = AppWindow.get_instance () as LibraryWindow;
66+ if (app == null)
67+ return header_box;
68+
69+ if (return_page != null) {
70+ var last_name = return_page.get_back_name ();
71+ // Back Button
72+ var back_button = new Gtk.Button ();
73+ back_button.clicked.connect (return_to_collection);
74+ back_button.get_style_context ().add_class ("back-button");
75+ back_button.can_focus = false;
76+ back_button.valign = Gtk.Align.CENTER;
77+ back_button.vexpand = false;
78+ back_button.visible = false;
79+ back_button.label = last_name;
80+ header_box.pack_start (back_button);
81+ }
82+
83+ return header_box;
84+ }
85+
86 public bool not_trashed_view_filter (DataView view) {
87 return ! ((MediaSource) view.get_source ()).is_trashed ();
88 }
89
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
95 toolbar.insert (progress_item, -1);
96
97- // Find button
98- Gtk.ToggleToolButton find_button = new Gtk.ToggleToolButton ();
99- find_button.set_related_action (get_action ("CommonDisplaySearchbar"));
100-
101- toolbar.insert (find_button, -1);
102-
103 // Separator
104 toolbar.insert (new Gtk.SeparatorToolItem (), -1);
105
106
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 private void on_rename () {
112 LibraryWindow.get_app ().rename_event_in_sidebar (page_event);
113 }
114+
115+ public override Gtk.Box get_header_buttons () {
116+ header_box = base.get_header_buttons ();
117+ // Back Button
118+ var back_button = new Gtk.Button ();
119+ back_button.clicked.connect (back_to_master_clicked);
120+ back_button.get_style_context ().add_class ("back-button");
121+ back_button.can_focus = false;
122+ back_button.valign = Gtk.Align.CENTER;
123+ back_button.vexpand = false;
124+ back_button.visible = false;
125+ back_button.label = _("All Events");
126+ header_box.pack_start (back_button);
127+
128+ return header_box;
129+ }
130+
131+ public void back_to_master_clicked () {
132+ LibraryWindow app = AppWindow.get_instance () as LibraryWindow;
133+ app.switch_to_event_directory ();
134+ }
135+
136 }
137
138 public class NoEventPage : CollectionPage {
139- public const string NAME = _ ("No Event");
140+ public const string NAME = _("No Event");
141
142 // This seems very similar to EventSourceCollection -> ViewManager
143 private class NoEventViewManager : CollectionViewManager {
144
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 protected override void set_config_photos_sort (bool sort_order, int sort_by) {
150 Config.Facade.get_instance ().set_library_photos_sort (sort_order, sort_by);
151 }
152+
153+ public override string get_back_name () {
154+ return _("All Photos");
155+ }
156 }
157
158
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 private Gee.HashMap<Page, Sidebar.Entry> page_map = new Gee.HashMap<Page, Sidebar.Entry> ();
164
165 private LibraryPhotoPage photo_page = null;
166-
167 // this is to keep track of cameras which initiate the app
168 private static Gee.HashSet<string> initial_camera_uris = new Gee.HashSet<string> ();
169
170@@ -129,6 +128,7 @@
171 // AppWindows instead.
172 private SearchFilterToolbar search_toolbar;
173
174+ private Gtk.Box page_header_box;
175 private Gtk.Box top_section = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
176 private Gtk.Frame background_progress_frame = new Gtk.Frame (null);
177 private Gtk.ProgressBar background_progress_bar = new Gtk.ProgressBar ();
178@@ -137,7 +137,6 @@
179 private Gtk.Notebook notebook = new Gtk.Notebook ();
180 private Gtk.Box layout = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
181 private Gtk.Box right_vbox;
182-
183 private int current_progress_priority = 0;
184 private uint background_progress_pulse_id = 0;
185
186@@ -221,8 +220,19 @@
187 CameraTable.get_instance ().camera_added.connect (on_camera_added);
188
189 background_progress_bar.set_show_text (true);
190-
191+ }
192+
193+ protected override void build_header_bar () {
194+ // Left side of header bar
195+ base.build_header_bar ();
196+
197+ // Right side of header bar
198 build_settings_header ();
199+
200+ // Find button
201+ Gtk.ToggleToolButton find_button = new Gtk.ToggleToolButton ();
202+ find_button.set_related_action (get_common_action ("CommonDisplaySearchbar"));
203+ header.pack_end (find_button);
204 }
205
206 protected void build_settings_header () {
207@@ -692,7 +702,6 @@
208 CollectionPage collection;
209 Photo start;
210 bool can_fullscreen = get_fullscreen_photo (page, out collection, out start);
211-
212 set_common_action_sensitive ("CommonEmptyTrash", can_empty_trash ());
213 set_common_action_visible ("CommonJumpToEvent", true);
214 set_common_action_sensitive ("CommonJumpToEvent", can_jump_to_event ());
215@@ -979,6 +988,10 @@
216 switch_to_page (library_branch.photos_entry.get_page ());
217 }
218
219+ public void switch_to_event_directory () {
220+ switch_to_page (events_branch.get_master_entry ().get_page ());
221+ }
222+
223 public void switch_to_event (Event event) {
224 Events.EventEntry? entry = events_branch.get_entry_for_event (event);
225 if (entry != null)
226@@ -1007,7 +1020,7 @@
227 // before switching to it
228 spin_event_loop ();
229 }
230-
231+
232 photo_page.display_for_collection (controller, current);
233 switch_to_page (photo_page);
234 }
235@@ -1298,6 +1311,8 @@
236 Gtk.Toolbar toolbar = current_page.get_toolbar ();
237 if (toolbar != null)
238 right_vbox.remove (toolbar);
239+ if (page_header_box != null)
240+ header.remove (page_header_box);
241
242 current_page.switching_from ();
243
244@@ -1315,7 +1330,9 @@
245 // do this prior to changing selection, as the change will fire a cursor-changed event,
246 // which will then call this function again
247 base.set_current_page (page);
248-
249+ page_header_box = page.get_header_buttons ();
250+ header.pack_start (page_header_box);
251+ header.show_all ();
252 // if the visible page is the LibraryPhotoPage, we need to prevent single-click inline
253 // renaming in the sidebar because a single click while in the LibraryPhotoPage indicates
254 // the user wants to return to the controlling page ... that is, in this special case, the
255
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 <separator />
261 <toolitem name="ToolPublish" action="Publish" />
262 <separator />
263- <toolitem name="ToolFind" action="CommonDisplaySearchbar" />
264 </toolbar>
265 </ui>
266\ No newline at end of file
267
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 <toolbar name="OfflineToolbar">
273 <toolitem name="ToolRemoveFromLibrary" action="RemoveFromLibrary" />
274 <separator />
275- <toolitem name="ToolFind" action="CommonDisplaySearchbar" />
276 </toolbar>
277
278 <popup name="OfflineViewMenu" action="ViewMenu">
279
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 </popup>
285
286 <toolbar name="TrashToolbar">
287- <toolitem name="ToolFind" action="CommonDisplaySearchbar" />
288 </toolbar>
289
290 <popup name="TrashViewMenu" action="ViewMenu">

Subscribers

People subscribed via source and target branches

to all changes: