~ubuntu-branches/ubuntu/raring/shotwell/raring

« back to all changes in this revision

Viewing changes to src/folders/Page.vala

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2013-03-19 09:25:40 UTC
  • mfrom: (1.2.17)
  • Revision ID: package-import@ubuntu.com-20130319092540-j8bsal9qjhm62te3
Tags: 0.14.0~pr1-0ubuntu1
* New upstream release (LP: #1154324)
* debian/control:
  - Bump build-depends on valac-0.18
  - Use standards version 3.9.4
* debian/rules:
  - Run configure manually, it no longer handles unknown args
* debian/patches/0001-Port-to-GStreamer-1.0.patch:
  - Applied upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2012-2013 Yorba Foundation
 
2
 *
 
3
 * This software is licensed under the GNU Lesser General Public License
 
4
 * (version 2.1 or later).  See the COPYING file in this distribution.
 
5
 */
 
6
 
 
7
public class Folders.Page : CollectionPage {
 
8
    private class FolderViewManager : CollectionViewManager {
 
9
        public File dir;
 
10
        
 
11
        public FolderViewManager(Folders.Page owner, File dir) {
 
12
            base (owner);
 
13
            
 
14
            this.dir = dir;
 
15
        }
 
16
        
 
17
        public override bool include_in_view(DataSource source) {
 
18
            int maxdepth = 10;
 
19
            int depth = 0;
 
20
 
 
21
            File myfile = ((MediaSource) source).get_file();
 
22
 
 
23
            while (myfile.has_parent(null) && depth < maxdepth) {
 
24
                if (myfile.get_parent().equal(dir))
 
25
                    return true;
 
26
              
 
27
                myfile = myfile.get_parent();
 
28
                depth++;
 
29
            }
 
30
            
 
31
            return false;
 
32
        }
 
33
    }
 
34
    
 
35
    private FolderViewManager view_manager;
 
36
    
 
37
    public Page(File dir) {
 
38
        base (dir.get_path());
 
39
        
 
40
        view_manager = new FolderViewManager(this, dir);
 
41
        
 
42
        foreach (MediaSourceCollection sources in MediaCollectionRegistry.get_instance().get_all())
 
43
            get_view().monitor_source_collection(sources, view_manager, null);
 
44
    }
 
45
    
 
46
    protected override void get_config_photos_sort(out bool sort_order, out int sort_by) {
 
47
        Config.Facade.get_instance().get_library_photos_sort(out sort_order, out sort_by);
 
48
    }
 
49
    
 
50
    protected override void set_config_photos_sort(bool sort_order, int sort_by) {
 
51
        Config.Facade.get_instance().set_library_photos_sort(sort_order, sort_by);
 
52
    }
 
53
}
 
54