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
=== modified file 'src/Page.vala'
--- src/Page.vala 2014-09-02 19:42:49 +0000
+++ src/Page.vala 2014-09-24 23:13:36 +0000
@@ -81,7 +81,7 @@
81 private Gtk.ActionGroup? action_group = null;81 private Gtk.ActionGroup? action_group = null;
82 private Gtk.ActionGroup[]? common_action_groups = null;82 private Gtk.ActionGroup[]? common_action_groups = null;
83 private GLib.List<Gtk.Widget>? contractor_menu_items = null;83 private GLib.List<Gtk.Widget>? contractor_menu_items = null;
8484 protected Gtk.Box header_box;
85 private uint[] merge_ids = new uint[0];85 private uint[] merge_ids = new uint[0];
8686
87 protected Page (string page_name) {87 protected Page (string page_name) {
@@ -144,7 +144,7 @@
144 }144 }
145 menu.show_all ();145 menu.show_all ();
146 }146 }
147 147
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) {
149 if (rating_menu_item != null) rating_menu_item.destroy ();149 if (rating_menu_item != null) rating_menu_item.destroy ();
150 rating_menu_item = new PhotoRatingMenuItem ();150 rating_menu_item = new PhotoRatingMenuItem ();
@@ -156,7 +156,7 @@
156 break;156 break;
157 pos++;157 pos++;
158 }158 }
159 159
160 menu.append (rating_menu_item);160 menu.append (rating_menu_item);
161 menu.reorder_child (rating_menu_item, pos);161 menu.reorder_child (rating_menu_item, pos);
162 rating_menu_item.activate.connect (on_rating_widget_activate);162 rating_menu_item.activate.connect (on_rating_widget_activate);
@@ -581,6 +581,11 @@
581 toolbar_path = path;581 toolbar_path = path;
582 }582 }
583583
584 public virtual Gtk.Box get_header_buttons () {
585 header_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
586 return header_box;
587 }
588
584 // Called from "realize"589 // Called from "realize"
585 private void attach_view_signals () {590 private void attach_view_signals () {
586 if (are_actions_attached)591 if (are_actions_attached)
@@ -1323,6 +1328,11 @@
1323 Resources.style_widget (this, Resources.PAGE_STYLESHEET);1328 Resources.style_widget (this, Resources.PAGE_STYLESHEET);
1324 }1329 }
13251330
1331 // Returns the name for the back button that goes to this page
1332 public virtual string get_back_name () {
1333 return get_page_name ();
1334 }
1335
1326 public void init_item_context_menu (string path) {1336 public void init_item_context_menu (string path) {
1327 item_context_menu_path = path;1337 item_context_menu_path = path;
1328 }1338 }
13291339
=== modified file 'src/PhotoPage.vala'
--- src/PhotoPage.vala 2014-09-13 03:34:09 +0000
+++ src/PhotoPage.vala 2014-09-24 23:13:36 +0000
@@ -2410,6 +2410,29 @@
2410 return toolbar;2410 return toolbar;
2411 }2411 }
24122412
2413 public override Gtk.Box get_header_buttons () {
2414 header_box = base.get_header_buttons ();
2415 LibraryWindow app = AppWindow.get_instance () as LibraryWindow;
2416 if (app == null)
2417 return header_box;
2418
2419 if (return_page != null) {
2420 var last_name = return_page.get_back_name ();
2421 // Back Button
2422 var back_button = new Gtk.Button ();
2423 back_button.clicked.connect (return_to_collection);
2424 back_button.get_style_context ().add_class ("back-button");
2425 back_button.can_focus = false;
2426 back_button.valign = Gtk.Align.CENTER;
2427 back_button.vexpand = false;
2428 back_button.visible = false;
2429 back_button.label = last_name;
2430 header_box.pack_start (back_button);
2431 }
2432
2433 return header_box;
2434 }
2435
2413 public bool not_trashed_view_filter (DataView view) {2436 public bool not_trashed_view_filter (DataView view) {
2414 return ! ((MediaSource) view.get_source ()).is_trashed ();2437 return ! ((MediaSource) view.get_source ()).is_trashed ();
2415 }2438 }
24162439
=== modified file 'src/camera/ImportPage.vala'
--- src/camera/ImportPage.vala 2014-08-08 21:13:09 +0000
+++ src/camera/ImportPage.vala 2014-09-24 23:13:36 +0000
@@ -817,12 +817,6 @@
817817
818 toolbar.insert (progress_item, -1);818 toolbar.insert (progress_item, -1);
819819
820 // Find button
821 Gtk.ToggleToolButton find_button = new Gtk.ToggleToolButton ();
822 find_button.set_related_action (get_action ("CommonDisplaySearchbar"));
823
824 toolbar.insert (find_button, -1);
825
826 // Separator820 // Separator
827 toolbar.insert (new Gtk.SeparatorToolItem (), -1);821 toolbar.insert (new Gtk.SeparatorToolItem (), -1);
828822
829823
=== modified file 'src/events/EventPage.vala'
--- src/events/EventPage.vala 2014-09-08 04:47:32 +0000
+++ src/events/EventPage.vala 2014-09-24 23:13:36 +0000
@@ -103,10 +103,32 @@
103 private void on_rename () {103 private void on_rename () {
104 LibraryWindow.get_app ().rename_event_in_sidebar (page_event);104 LibraryWindow.get_app ().rename_event_in_sidebar (page_event);
105 }105 }
106
107 public override Gtk.Box get_header_buttons () {
108 header_box = base.get_header_buttons ();
109 // Back Button
110 var back_button = new Gtk.Button ();
111 back_button.clicked.connect (back_to_master_clicked);
112 back_button.get_style_context ().add_class ("back-button");
113 back_button.can_focus = false;
114 back_button.valign = Gtk.Align.CENTER;
115 back_button.vexpand = false;
116 back_button.visible = false;
117 back_button.label = _("All Events");
118 header_box.pack_start (back_button);
119
120 return header_box;
121 }
122
123 public void back_to_master_clicked () {
124 LibraryWindow app = AppWindow.get_instance () as LibraryWindow;
125 app.switch_to_event_directory ();
126 }
127
106}128}
107129
108public class NoEventPage : CollectionPage {130public class NoEventPage : CollectionPage {
109 public const string NAME = _ ("No Event");131 public const string NAME = _("No Event");
110132
111 // This seems very similar to EventSourceCollection -> ViewManager133 // This seems very similar to EventSourceCollection -> ViewManager
112 private class NoEventViewManager : CollectionViewManager {134 private class NoEventViewManager : CollectionViewManager {
113135
=== modified file 'src/library/Branch.vala'
--- src/library/Branch.vala 2014-08-08 21:13:09 +0000
+++ src/library/Branch.vala 2014-09-24 23:13:36 +0000
@@ -163,5 +163,9 @@
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) {
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);
165 }165 }
166
167 public override string get_back_name () {
168 return _("All Photos");
169 }
166}170}
167171
168172
=== modified file 'src/library/LibraryWindow.vala'
--- src/library/LibraryWindow.vala 2014-09-07 01:47:31 +0000
+++ src/library/LibraryWindow.vala 2014-09-24 23:13:36 +0000
@@ -118,7 +118,6 @@
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> ();
119119
120 private LibraryPhotoPage photo_page = null;120 private LibraryPhotoPage photo_page = null;
121
122 // this is to keep track of cameras which initiate the app121 // this is to keep track of cameras which initiate the app
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> ();
124123
@@ -129,6 +128,7 @@
129 // AppWindows instead.128 // AppWindows instead.
130 private SearchFilterToolbar search_toolbar;129 private SearchFilterToolbar search_toolbar;
131130
131 private Gtk.Box page_header_box;
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);
133 private Gtk.Frame background_progress_frame = new Gtk.Frame (null);133 private Gtk.Frame background_progress_frame = new Gtk.Frame (null);
134 private Gtk.ProgressBar background_progress_bar = new Gtk.ProgressBar ();134 private Gtk.ProgressBar background_progress_bar = new Gtk.ProgressBar ();
@@ -137,7 +137,6 @@
137 private Gtk.Notebook notebook = new Gtk.Notebook ();137 private Gtk.Notebook notebook = new Gtk.Notebook ();
138 private Gtk.Box layout = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);138 private Gtk.Box layout = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
139 private Gtk.Box right_vbox;139 private Gtk.Box right_vbox;
140
141 private int current_progress_priority = 0;140 private int current_progress_priority = 0;
142 private uint background_progress_pulse_id = 0;141 private uint background_progress_pulse_id = 0;
143142
@@ -221,8 +220,19 @@
221 CameraTable.get_instance ().camera_added.connect (on_camera_added);220 CameraTable.get_instance ().camera_added.connect (on_camera_added);
222221
223 background_progress_bar.set_show_text (true);222 background_progress_bar.set_show_text (true);
224223 }
224
225 protected override void build_header_bar () {
226 // Left side of header bar
227 base.build_header_bar ();
228
229 // Right side of header bar
225 build_settings_header ();230 build_settings_header ();
231
232 // Find button
233 Gtk.ToggleToolButton find_button = new Gtk.ToggleToolButton ();
234 find_button.set_related_action (get_common_action ("CommonDisplaySearchbar"));
235 header.pack_end (find_button);
226 }236 }
227237
228 protected void build_settings_header () {238 protected void build_settings_header () {
@@ -692,7 +702,6 @@
692 CollectionPage collection;702 CollectionPage collection;
693 Photo start;703 Photo start;
694 bool can_fullscreen = get_fullscreen_photo (page, out collection, out start);704 bool can_fullscreen = get_fullscreen_photo (page, out collection, out start);
695
696 set_common_action_sensitive ("CommonEmptyTrash", can_empty_trash ());705 set_common_action_sensitive ("CommonEmptyTrash", can_empty_trash ());
697 set_common_action_visible ("CommonJumpToEvent", true);706 set_common_action_visible ("CommonJumpToEvent", true);
698 set_common_action_sensitive ("CommonJumpToEvent", can_jump_to_event ());707 set_common_action_sensitive ("CommonJumpToEvent", can_jump_to_event ());
@@ -979,6 +988,10 @@
979 switch_to_page (library_branch.photos_entry.get_page ());988 switch_to_page (library_branch.photos_entry.get_page ());
980 }989 }
981990
991 public void switch_to_event_directory () {
992 switch_to_page (events_branch.get_master_entry ().get_page ());
993 }
994
982 public void switch_to_event (Event event) {995 public void switch_to_event (Event event) {
983 Events.EventEntry? entry = events_branch.get_entry_for_event (event);996 Events.EventEntry? entry = events_branch.get_entry_for_event (event);
984 if (entry != null)997 if (entry != null)
@@ -1007,7 +1020,7 @@
1007 // before switching to it1020 // before switching to it
1008 spin_event_loop ();1021 spin_event_loop ();
1009 }1022 }
10101023
1011 photo_page.display_for_collection (controller, current);1024 photo_page.display_for_collection (controller, current);
1012 switch_to_page (photo_page);1025 switch_to_page (photo_page);
1013 }1026 }
@@ -1298,6 +1311,8 @@
1298 Gtk.Toolbar toolbar = current_page.get_toolbar ();1311 Gtk.Toolbar toolbar = current_page.get_toolbar ();
1299 if (toolbar != null)1312 if (toolbar != null)
1300 right_vbox.remove (toolbar);1313 right_vbox.remove (toolbar);
1314 if (page_header_box != null)
1315 header.remove (page_header_box);
13011316
1302 current_page.switching_from ();1317 current_page.switching_from ();
13031318
@@ -1315,7 +1330,9 @@
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,
1316 // which will then call this function again1331 // which will then call this function again
1317 base.set_current_page (page);1332 base.set_current_page (page);
13181333 page_header_box = page.get_header_buttons ();
1334 header.pack_start (page_header_box);
1335 header.show_all ();
1319 // if the visible page is the LibraryPhotoPage, we need to prevent single-click inline1336 // if the visible page is the LibraryPhotoPage, we need to prevent single-click inline
1320 // renaming in the sidebar because a single click while in the LibraryPhotoPage indicates1337 // renaming in the sidebar because a single click while in the LibraryPhotoPage indicates
1321 // the user wants to return to the controlling page ... that is, in this special case, the1338 // the user wants to return to the controlling page ... that is, in this special case, the
13221339
=== modified file 'ui/collection.ui'
--- ui/collection.ui 2014-08-28 14:41:02 +0000
+++ ui/collection.ui 2014-09-24 23:13:36 +0000
@@ -43,6 +43,5 @@
43 <separator />43 <separator />
44 <toolitem name="ToolPublish" action="Publish" />44 <toolitem name="ToolPublish" action="Publish" />
45 <separator />45 <separator />
46 <toolitem name="ToolFind" action="CommonDisplaySearchbar" />
47 </toolbar>46 </toolbar>
48</ui>47</ui>
49\ No newline at end of file48\ No newline at end of file
5049
=== modified file 'ui/offline.ui'
--- ui/offline.ui 2014-09-02 19:42:49 +0000
+++ ui/offline.ui 2014-09-24 23:13:36 +0000
@@ -6,7 +6,6 @@
6 <toolbar name="OfflineToolbar">6 <toolbar name="OfflineToolbar">
7 <toolitem name="ToolRemoveFromLibrary" action="RemoveFromLibrary" />7 <toolitem name="ToolRemoveFromLibrary" action="RemoveFromLibrary" />
8 <separator />8 <separator />
9 <toolitem name="ToolFind" action="CommonDisplaySearchbar" />
10 </toolbar>9 </toolbar>
11 10
12 <popup name="OfflineViewMenu" action="ViewMenu">11 <popup name="OfflineViewMenu" action="ViewMenu">
1312
=== modified file 'ui/trash.ui'
--- ui/trash.ui 2014-09-06 19:39:38 +0000
+++ ui/trash.ui 2014-09-24 23:13:36 +0000
@@ -13,7 +13,6 @@
13 </popup>13 </popup>
1414
15 <toolbar name="TrashToolbar">15 <toolbar name="TrashToolbar">
16 <toolitem name="ToolFind" action="CommonDisplaySearchbar" />
17 </toolbar>16 </toolbar>
1817
19 <popup name="TrashViewMenu" action="ViewMenu">18 <popup name="TrashViewMenu" action="ViewMenu">

Subscribers

People subscribed via source and target branches

to all changes: