Merge lp:~vikoadi/pantheon-photos/separate-library into lp:~pantheon-photos/pantheon-photos/trunk

Proposed by Viko Adi Rahmawan
Status: Merged
Approved by: Danielle Foré
Approved revision: 2614
Merged at revision: 2640
Proposed branch: lp:~vikoadi/pantheon-photos/separate-library
Merge into: lp:~pantheon-photos/pantheon-photos/trunk
Diff against target: 522 lines (+244/-139)
7 files modified
src/Resources.vala (+3/-1)
src/SearchFilter.vala (+0/-97)
src/library/Branch.vala (+21/-40)
src/library/PhotosPage.vala (+66/-0)
src/library/RawsPage.vala (+66/-0)
src/library/VideosPage.vala (+85/-0)
src/library/mk/library.mk (+3/-1)
To merge this branch: bzr merge lp:~vikoadi/pantheon-photos/separate-library
Reviewer Review Type Date Requested Status
meese Approve
Danielle Foré Pending
Review via email: mp+233867@code.launchpad.net

Commit message

* Move "Video" & "RAW" to the Library section on the Sidebar
* Remove redundant "Flagged" button from search toolbar.

Description of the change

* Move "Video" & "RAW" to the Library section on the Sidebar
* Remove redundant "Flagged" button from search toolbar.

To post a comment you must log in.
Revision history for this message
meese (meese) wrote :

Should hide the videos and raw pages when there's none in the library.Copy what the flagged page is doing with HideablePageEntry

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

I dont think it should be hidden. I think Photos, Videos and Raw Photos are like in one level. If Videos is hidden why "Photos" dont get hidden too.
Other than that, it gives clue that our Photos application can handle Videos and Raw file too. The Video sidebar in Files dont get hidden too.

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

Ofcourse Welcome screen need to be updated, but we can do that in other branch

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

I see your point about Raw maybe. But I agree with Maddie about videos. I don't think we should encourage users to store videos here.

The file browser is a different kind of app, you can add arbitrary locations to the source list there. In Photos, there's a finite number of Library sources/filters that we define.

Revision history for this message
meese (meese) wrote :

Hmm yeah actually I agree on leaving RAW there after rereading your comment. It's a fairly big plus for a default photo app to be able to develop raws and users should know about.

2610. By Viko Adi Rahmawan

hide VideosPage if its empty

2611. By Viko Adi Rahmawan

rearrage page, now its Photos, Raw Photos, then Videos

2612. By Viko Adi Rahmawan

merge trunk

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

What shoul i copyrighted the newly added files? Pantheon Photos Developers?

2613. By Viko Adi Rahmawan

fix little typo

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

The most convenient/defensible long term would probably be "elementary, LLC". But you could do photos developers or even yourself. It's up to you how you want to assign copyright.

2614. By Viko Adi Rahmawan

add copyright to files

Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote :

Ready for review

Revision history for this message
meese (meese) wrote :

looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Resources.vala'
2--- src/Resources.vala 2014-09-08 04:47:32 +0000
3+++ src/Resources.vala 2014-09-23 03:15:33 +0000
4@@ -118,10 +118,12 @@
5 public const string ICON_IMPORTING = "go-down";
6 public const string ICON_LAST_IMPORT = "document-open-recent";
7 public const string ICON_MISSING_FILES = "process-stop";
8-public const string ICON_PHOTOS = "folder-pictures";
9+public const string ICON_PHOTOS_PAGE = "folder-pictures";
10 public const string ICON_SINGLE_PHOTO = "image-x-generic";
11 public const string ICON_TRASH_EMPTY = "user-trash";
12 public const string ICON_TRASH_FULL = "user-trash-full";
13+public const string ICON_VIDEOS_PAGE = "folder-videos";
14+public const string ICON_RAW_PAGE = "accessories-camera";
15 public const string ICON_FLAGGED_PAGE = "edit-flag";
16
17 public const string ROTATE_CW_MENU = _("Rotate _Right");
18
19=== modified file 'src/SearchFilter.vala'
20--- src/SearchFilter.vala 2014-08-27 06:20:32 +0000
21+++ src/SearchFilter.vala 2014-09-23 03:15:33 +0000
22@@ -346,15 +346,7 @@
23 private Gtk.ComboBoxText rating_button;
24 private SearchViewFilter? search_filter = null;
25 private Gtk.Toolbar toolbar;
26- private Gtk.Label label_type;
27- private Gtk.Label label_flagged;
28 private Gtk.Label label_rating;
29- private Gtk.ToggleToolButton toolbtn_photos;
30- private Gtk.ToggleToolButton toolbtn_videos;
31- private Gtk.ToggleToolButton toolbtn_raw;
32- private Gtk.ToggleToolButton toolbtn_flag;
33- private Gtk.SeparatorToolItem sepr_mediatype_flagged;
34- private Gtk.SeparatorToolItem sepr_flagged_rating;
35
36 public SearchFilterToolbar () {
37 toolbar = new Gtk.Toolbar ();
38@@ -369,60 +361,6 @@
39 close_item.activate.connect ( () => close ());
40 close_menu.append (close_item);
41
42- // Type label and toggles
43- label_type = new Gtk.Label (_ ("Type"));
44- Gtk.ToolItem label_type_item = new Gtk.ToolItem ();
45- label_type_item.add (label_type);
46- toolbar.insert (label_type_item, -1);
47-
48- toolbtn_photos = new Gtk.ToggleToolButton ();
49- var photos_icon = new Gtk.Image.from_icon_name ("folder-pictures", Gtk.IconSize.MENU);
50- photos_icon.pixel_size = 16;
51- toolbtn_photos.set_icon_widget (photos_icon);
52- toolbtn_photos.tooltip_text = _ ("Photos");
53- toolbtn_photos.toggled.connect (on_photos_toggled);
54-
55- toolbtn_videos = new Gtk.ToggleToolButton ();
56- var videos_icon = new Gtk.Image.from_icon_name ("folder-videos", Gtk.IconSize.MENU);
57- videos_icon.pixel_size = 16;
58- toolbtn_videos.set_icon_widget (videos_icon);
59- toolbtn_videos.tooltip_text = _ ("Videos");
60- toolbtn_videos.toggled.connect (on_videos_toggled);
61-
62- toolbtn_raw = new Gtk.ToggleToolButton ();
63- var raw_icon = new Gtk.Image.from_icon_name ("accessories-camera", Gtk.IconSize.MENU);
64- raw_icon.pixel_size = 16;
65- toolbtn_raw.set_icon_widget (raw_icon);
66- toolbtn_raw.tooltip_text = _ ("RAW photos");
67- toolbtn_raw.toggled.connect (on_raw_toggled);
68-
69- toolbar.insert (toolbtn_photos, -1);
70- toolbar.insert (toolbtn_videos, -1);
71- toolbar.insert (toolbtn_raw, -1);
72-
73- // separator
74- sepr_mediatype_flagged = new Gtk.SeparatorToolItem ();
75- toolbar.insert (sepr_mediatype_flagged, -1);
76-
77- // Flagged label and toggle
78- label_flagged = new Gtk.Label (_ ("Flagged"));
79- Gtk.ToolItem label_flagged_item = new Gtk.ToolItem ();
80- label_flagged_item.add (label_flagged);
81- toolbar.insert (label_flagged_item, -1);
82-
83- toolbtn_flag = new Gtk.ToggleToolButton ();
84-
85- var flag_icon = new Gtk.Image.from_icon_name (Resources.ICON_FLAGGED_PAGE, Gtk.IconSize.MENU);
86- flag_icon.pixel_size = 16;
87- toolbtn_flag.set_icon_widget (flag_icon);
88- toolbtn_flag.tooltip_text = _ ("Flagged");
89- toolbtn_flag.toggled.connect (on_flagged_toggled);
90- toolbar.insert (toolbtn_flag, -1);
91-
92- // separator
93- sepr_flagged_rating = new Gtk.SeparatorToolItem ();
94- toolbar.insert (sepr_flagged_rating, -1);
95-
96 // Rating label and button
97 label_rating = new Gtk.Label (_ ("Rating"));
98 Gtk.ToolItem label_rating_item = new Gtk.ToolItem ();
99@@ -489,22 +427,6 @@
100 return false;
101 }
102
103- private void on_flagged_toggled () {
104- update ();
105- }
106-
107- private void on_videos_toggled () {
108- update ();
109- }
110-
111- private void on_photos_toggled () {
112- update ();
113- }
114-
115- private void on_raw_toggled () {
116- update ();
117- }
118-
119 private void on_search_text_changed () {
120 update ();
121 }
122@@ -565,10 +487,6 @@
123 assert (null != search_filter);
124
125 search_filter.set_search_filter (search_entry.text);
126- search_filter.flagged = toolbtn_flag.active;
127- search_filter.show_media_video = toolbtn_videos.active;
128- search_filter.show_media_photos = toolbtn_photos.active;
129- search_filter.show_media_raw = toolbtn_raw.active;
130
131 search_filter.set_rating_filter (filter);
132 rating_button.tooltip_text = Resources.get_rating_filter_tooltip (filter);
133@@ -580,21 +498,6 @@
134 rating_button.visible = ((criteria & SearchFilterCriteria.RATING) != 0);
135 label_rating.visible = ((criteria & SearchFilterCriteria.RATING) != 0);
136
137- label_flagged.visible = ((criteria & SearchFilterCriteria.FLAG) != 0);
138- toolbtn_flag.visible = ((criteria & SearchFilterCriteria.FLAG) != 0);
139-
140- label_type.visible = ((criteria & SearchFilterCriteria.MEDIA) != 0);
141- toolbtn_photos.visible = ((criteria & SearchFilterCriteria.MEDIA) != 0);
142- toolbtn_videos.visible = ((criteria & SearchFilterCriteria.MEDIA) != 0);
143- toolbtn_raw.visible = ((criteria & SearchFilterCriteria.MEDIA) != 0);
144-
145- // Ticket #3290, part IV - ensure that the separators
146- // are shown and/or hidden as needed.
147- sepr_mediatype_flagged.visible = (label_type.visible && label_flagged.visible);
148-
149- sepr_flagged_rating.visible = ((label_type.visible && label_rating.visible) ||
150- (label_flagged.visible && label_rating.visible));
151-
152 // Send update to view collection.
153 search_filter.refresh ();
154 }
155
156=== modified file 'src/library/Branch.vala'
157--- src/library/Branch.vala 2014-08-08 21:13:09 +0000
158+++ src/library/Branch.vala 2014-09-23 03:15:33 +0000
159@@ -11,6 +11,14 @@
160 get;
161 private set;
162 }
163+ public Library.VideosEntry videos_entry {
164+ get;
165+ private set;
166+ }
167+ public Library.RawsEntry raws_entry {
168+ get;
169+ private set;
170+ }
171 public Library.FlaggedSidebarEntry flagged_entry {
172 get;
173 private set;
174@@ -37,6 +45,8 @@
175 // outside the app.
176 private enum EntryPosition {
177 PHOTOS,
178+ RAWS,
179+ VIDEOS,
180 FLAGGED,
181 LAST_IMPORTED,
182 IMPORT_QUEUE,
183@@ -49,6 +59,8 @@
184 Sidebar.Branch.Options.STARTUP_OPEN_GROUPING, comparator);
185
186 photos_entry = new Library.PhotosEntry ();
187+ videos_entry = new Library.VideosEntry ();
188+ raws_entry = new Library.RawsEntry ();
189 trash_entry = new Library.TrashSidebarEntry ();
190 last_imported_entry = new Library.LastImportSidebarEntry ();
191 flagged_entry = new Library.FlaggedSidebarEntry ();
192@@ -56,8 +68,12 @@
193 import_queue_entry = new Library.ImportQueueSidebarEntry ();
194
195 insert (photos_entry, EntryPosition.PHOTOS);
196+ insert (raws_entry, EntryPosition.RAWS);
197 insert (trash_entry, EntryPosition.TRASH);
198
199+ videos_entry.visibility_changed.connect (on_videos_visibility_changed);
200+ on_videos_visibility_changed ();
201+
202 flagged_entry.visibility_changed.connect (on_flagged_visibility_changed);
203 on_flagged_visibility_changed ();
204
205@@ -76,6 +92,10 @@
206 graft (get_root (), entry);
207 }
208
209+ private void on_videos_visibility_changed () {
210+ update_entry_visibility (videos_entry, EntryPosition.VIDEOS);
211+ }
212+
213 private void on_flagged_visibility_changed () {
214 update_entry_visibility (flagged_entry, EntryPosition.FLAGGED);
215 }
216@@ -106,25 +126,6 @@
217 }
218 }
219
220-public class Library.PhotosEntry : Sidebar.SimplePageEntry {
221- private Icon icon = new ThemedIcon (Resources.ICON_PHOTOS);
222-
223- public PhotosEntry () {
224- }
225-
226- public override string get_sidebar_name () {
227- return _ ("Photos");
228- }
229-
230- public override Icon? get_sidebar_icon () {
231- return icon;
232- }
233-
234- protected override Page create_page () {
235- return new Library.MainPage ();
236- }
237-}
238-
239 public abstract class Library.HideablePageEntry : Sidebar.SimplePageEntry {
240 // container branch should listen to this signal
241 public signal void visibility_changed (bool visible);
242@@ -144,24 +145,4 @@
243
244 public HideablePageEntry () {
245 }
246-}
247-
248-public class Library.MainPage : CollectionPage {
249- public const string NAME = _ ("Library");
250-
251- public MainPage (ProgressMonitor? monitor = null) {
252- base (NAME);
253-
254- foreach (MediaSourceCollection sources in MediaCollectionRegistry.get_instance ().get_all ())
255- get_view ().monitor_source_collection (sources, new CollectionViewManager (this), null, null, monitor);
256- }
257-
258- protected override void get_config_photos_sort (out bool sort_order, out int sort_by) {
259- Config.Facade.get_instance ().get_library_photos_sort (out sort_order, out sort_by);
260- }
261-
262- protected override void set_config_photos_sort (bool sort_order, int sort_by) {
263- Config.Facade.get_instance ().set_library_photos_sort (sort_order, sort_by);
264- }
265-}
266-
267+}
268\ No newline at end of file
269
270=== added file 'src/library/PhotosPage.vala'
271--- src/library/PhotosPage.vala 1970-01-01 00:00:00 +0000
272+++ src/library/PhotosPage.vala 2014-09-23 03:15:33 +0000
273@@ -0,0 +1,66 @@
274+/* Copyright 2014 Pantheon Photos Developer (http://launchpad.net/pantheon-photos)
275+ *
276+ * This software is licensed under the GNU Lesser General Public License
277+ * (version 2.1 or later). See the COPYING file in this distribution.
278+ */
279+
280+public class Library.PhotosEntry : Sidebar.SimplePageEntry {
281+ protected Icon icon = new ThemedIcon (Resources.ICON_PHOTOS_PAGE);
282+
283+ public override string get_sidebar_name () {
284+ return _ ("Photos");
285+ }
286+
287+ public override Icon? get_sidebar_icon () {
288+ return icon;
289+ }
290+
291+ protected override Page create_page () {
292+ return new Library.PhotosPage ();
293+ }
294+}
295+
296+public class Library.PhotosPage : CollectionPage {
297+ public const string NAME = _ ("Photos");
298+
299+ private class PhotosViewManager : CollectionViewManager {
300+ public PhotosViewManager (Library.PhotosPage owner) {
301+ base (owner);
302+ }
303+
304+ public override bool include_in_view (DataSource source) {
305+ Photo photo = (Photo) source;
306+ return source is Photo && photo != null && photo.get_master_file_format () != PhotoFileFormat.RAW;
307+ }
308+ }
309+
310+ public PhotosPage (ProgressMonitor? monitor = null) {
311+ base (NAME);
312+
313+ view_manager = new PhotosViewManager (this);
314+
315+ foreach (MediaSourceCollection sources in MediaCollectionRegistry.get_instance ().get_all ())
316+ get_view ().monitor_source_collection (sources, view_manager, null, null, monitor);
317+ }
318+
319+ private class PhotosSearchViewFilter : CollectionPage.CollectionSearchViewFilter {
320+ public override uint get_criteria () {
321+ return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA |
322+ SearchFilterCriteria.RATING;
323+ }
324+ }
325+
326+ private ViewManager view_manager;
327+ private PhotosSearchViewFilter search_filter = new PhotosSearchViewFilter ();
328+
329+ protected override void get_config_photos_sort (out bool sort_order, out int sort_by) {
330+ Config.Facade.get_instance ().get_library_photos_sort (out sort_order, out sort_by);
331+ }
332+
333+ protected override void set_config_photos_sort (bool sort_order, int sort_by) {
334+ Config.Facade.get_instance ().set_library_photos_sort (sort_order, sort_by);
335+ }
336+ public override SearchViewFilter get_search_view_filter () {
337+ return search_filter;
338+ }
339+}
340\ No newline at end of file
341
342=== added file 'src/library/RawsPage.vala'
343--- src/library/RawsPage.vala 1970-01-01 00:00:00 +0000
344+++ src/library/RawsPage.vala 2014-09-23 03:15:33 +0000
345@@ -0,0 +1,66 @@
346+/* Copyright 2014 Pantheon Photos Developer (http://launchpad.net/pantheon-photos)
347+ *
348+ * This software is licensed under the GNU Lesser General Public License
349+ * (version 2.1 or later). See the COPYING file in this distribution.
350+ */
351+
352+public class Library.RawsEntry : Sidebar.SimplePageEntry {
353+ protected Icon icon = new ThemedIcon (Resources.ICON_RAW_PAGE);
354+
355+ public override string get_sidebar_name () {
356+ return _ ("RAW Photos");
357+ }
358+
359+ public override Icon? get_sidebar_icon () {
360+ return icon;
361+ }
362+
363+ protected override Page create_page () {
364+ return new Library.RawsPage ();
365+ }
366+}
367+
368+public class Library.RawsPage : CollectionPage {
369+ public const string NAME = _ ("Raws");
370+
371+ private class RawsViewManager : CollectionViewManager {
372+ public RawsViewManager (Library.RawsPage owner) {
373+ base (owner);
374+ }
375+
376+ public override bool include_in_view (DataSource source) {
377+ Photo photo = (Photo) source;
378+ return photo != null && photo.get_master_file_format () == PhotoFileFormat.RAW;
379+ }
380+ }
381+
382+ public RawsPage (ProgressMonitor? monitor = null) {
383+ base (NAME);
384+
385+ view_manager = new RawsViewManager (this);
386+
387+ foreach (MediaSourceCollection sources in MediaCollectionRegistry.get_instance ().get_all ())
388+ get_view ().monitor_source_collection (sources, view_manager, null, null, monitor);
389+ }
390+
391+ private class RawsSearchViewFilter : CollectionPage.CollectionSearchViewFilter {
392+ public override uint get_criteria () {
393+ return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA |
394+ SearchFilterCriteria.RATING;
395+ }
396+ }
397+
398+ private ViewManager view_manager;
399+ private RawsSearchViewFilter search_filter = new RawsSearchViewFilter ();
400+
401+ protected override void get_config_photos_sort (out bool sort_order, out int sort_by) {
402+ Config.Facade.get_instance ().get_library_photos_sort (out sort_order, out sort_by);
403+ }
404+
405+ protected override void set_config_photos_sort (bool sort_order, int sort_by) {
406+ Config.Facade.get_instance ().set_library_photos_sort (sort_order, sort_by);
407+ }
408+ public override SearchViewFilter get_search_view_filter () {
409+ return search_filter;
410+ }
411+}
412\ No newline at end of file
413
414=== added file 'src/library/VideosPage.vala'
415--- src/library/VideosPage.vala 1970-01-01 00:00:00 +0000
416+++ src/library/VideosPage.vala 2014-09-23 03:15:33 +0000
417@@ -0,0 +1,85 @@
418+/* Copyright 2014 Pantheon Photos Developer (http://launchpad.net/pantheon-photos)
419+ *
420+ * This software is licensed under the GNU Lesser General Public License
421+ * (version 2.1 or later). See the COPYING file in this distribution.
422+ */
423+
424+public class Library.VideosEntry : Library.HideablePageEntry {
425+ protected Icon icon = new ThemedIcon (Resources.ICON_VIDEOS_PAGE);
426+
427+ public VideosEntry () {
428+ Video.global.items_added.connect (on_item_altered);
429+ Video.global.items_removed.connect (on_item_altered);
430+
431+ visible = has_video ();
432+ }
433+
434+ ~VideosEntry () {
435+ Video.global.items_added.disconnect (on_item_altered);
436+ Video.global.items_removed.disconnect (on_item_altered);
437+ }
438+
439+ public override string get_sidebar_name () {
440+ return _ ("Videos");
441+ }
442+
443+ public override Icon? get_sidebar_icon () {
444+ return icon;
445+ }
446+
447+ protected override Page create_page () {
448+ return new Library.VideosPage ();
449+ }
450+
451+ private bool has_video () {
452+ return Video.global.get_count () > 0;
453+ }
454+
455+ private void on_item_altered (Gee.Iterable<DataObject> items) {
456+ visible = has_video ();
457+ }
458+}
459+
460+public class Library.VideosPage : CollectionPage {
461+ public const string NAME = _ ("Videos");
462+
463+ private class VideosViewManager : CollectionViewManager {
464+ public VideosViewManager (Library.VideosPage owner) {
465+ base (owner);
466+ }
467+
468+ public override bool include_in_view (DataSource source) {
469+ return source is Video;
470+ }
471+ }
472+
473+ public VideosPage (ProgressMonitor? monitor = null) {
474+ base (NAME);
475+
476+ view_manager = new VideosViewManager (this);
477+
478+ foreach (MediaSourceCollection sources in MediaCollectionRegistry.get_instance ().get_all ())
479+ get_view ().monitor_source_collection (sources, view_manager, null, null, monitor);
480+ }
481+
482+ private class VideosSearchViewFilter : CollectionPage.CollectionSearchViewFilter {
483+ public override uint get_criteria () {
484+ return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA |
485+ SearchFilterCriteria.RATING;
486+ }
487+ }
488+
489+ private ViewManager view_manager;
490+ private VideosSearchViewFilter search_filter = new VideosSearchViewFilter ();
491+
492+ protected override void get_config_photos_sort (out bool sort_order, out int sort_by) {
493+ Config.Facade.get_instance ().get_library_photos_sort (out sort_order, out sort_by);
494+ }
495+
496+ protected override void set_config_photos_sort (bool sort_order, int sort_by) {
497+ Config.Facade.get_instance ().set_library_photos_sort (sort_order, sort_by);
498+ }
499+ public override SearchViewFilter get_search_view_filter () {
500+ return search_filter;
501+ }
502+}
503\ No newline at end of file
504
505=== modified file 'src/library/mk/library.mk'
506--- src/library/mk/library.mk 2014-08-28 06:02:48 +0000
507+++ src/library/mk/library.mk 2014-09-23 03:15:33 +0000
508@@ -13,6 +13,9 @@
509 UNIT_FILES := \
510 LibraryWindow.vala \
511 Branch.vala \
512+ PhotosPage.vala \
513+ VideosPage.vala \
514+ RawsPage.vala \
515 TrashSidebarEntry.vala \
516 OfflineSidebarEntry.vala \
517 FlaggedSidebarEntry.vala \
518@@ -49,4 +52,3 @@
519
520 # unitize.mk must be called at the end of each UNIT_DIR.mk file.
521 include unitize.mk
522-

Subscribers

People subscribed via source and target branches