diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 09:06:59 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 09:06:59 +0200 |
commit | 4ea2cc3bd4a7d9b1c54a9d33e6a1cf82e7c8c21d (patch) | |
tree | d2e54377d14d604356c86862a326f64ae64dadd6 /src/library/FlaggedPage.vala |
Imported Upstream version 0.18.1upstream/0.18.1
Diffstat (limited to 'src/library/FlaggedPage.vala')
-rw-r--r-- | src/library/FlaggedPage.vala | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/library/FlaggedPage.vala b/src/library/FlaggedPage.vala new file mode 100644 index 0000000..28bc57b --- /dev/null +++ b/src/library/FlaggedPage.vala @@ -0,0 +1,54 @@ +/* Copyright 2010-2014 Yorba Foundation + * + * This software is licensed under the GNU LGPL (version 2.1 or later). + * See the COPYING file in this distribution. + */ + +public class FlaggedPage : CollectionPage { + public const string NAME = _("Flagged"); + + private class FlaggedViewManager : CollectionViewManager { + public FlaggedViewManager(FlaggedPage owner) { + base (owner); + } + + public override bool include_in_view(DataSource source) { + Flaggable? flaggable = source as Flaggable; + + return (flaggable != null) && flaggable.is_flagged(); + } + } + + private class FlaggedSearchViewFilter : CollectionPage.CollectionSearchViewFilter { + public override uint get_criteria() { + return SearchFilterCriteria.TEXT | SearchFilterCriteria.MEDIA | + SearchFilterCriteria.RATING; + } + } + + private ViewManager view_manager; + private Alteration prereq = new Alteration("metadata", "flagged"); + private FlaggedSearchViewFilter search_filter = new FlaggedSearchViewFilter(); + + public FlaggedPage() { + base (NAME); + + view_manager = new FlaggedViewManager(this); + + foreach (MediaSourceCollection sources in MediaCollectionRegistry.get_instance().get_all()) + get_view().monitor_source_collection(sources, view_manager, prereq); + } + + protected override void get_config_photos_sort(out bool sort_order, out int sort_by) { + Config.Facade.get_instance().get_library_photos_sort(out sort_order, out sort_by); + } + + protected override void set_config_photos_sort(bool sort_order, int sort_by) { + Config.Facade.get_instance().set_library_photos_sort(sort_order, sort_by); + } + + public override SearchViewFilter get_search_view_filter() { + return search_filter; + } +} + |