summaryrefslogtreecommitdiff
path: root/src/folders/Page.vala
blob: eb3a84f4c015ca4ae37f0d2ba19ab728e1e85d30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* Copyright 2012-2015 Yorba Foundation
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

public class Folders.Page : CollectionPage {
    private class FolderViewManager : CollectionViewManager {
        public File dir;
        
        public FolderViewManager(Folders.Page owner, File dir) {
            base (owner);
            
            this.dir = dir;
        }
        
        public override bool include_in_view(DataSource source) {
            return ((MediaSource) source).get_file().has_prefix(dir);
        }
    }
    
    private FolderViewManager view_manager;
    
    public Page(File dir) {
        base (dir.get_path());
        
        view_manager = new FolderViewManager(this, dir);
        
        foreach (MediaSourceCollection sources in MediaCollectionRegistry.get_instance().get_all())
            get_view().monitor_source_collection(sources, view_manager, null);
    }
    
    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);
    }
}