~victored/pantheon-photos/lp-1332967

« back to all changes in this revision

Viewing changes to src/library/LibraryWindow.vala

  • Committer: RabbitBot
  • Author(s): Victor Martinez
  • Date: 2014-06-12 20:20:45 UTC
  • mfrom: (2523.2.3 pantheon-photos)
  • Revision ID: rabbitbot-20140612202045-scbjwuksaqy76f4h
- Group 'Photos', 'Flagged', 'Last Import', 'Import Queue', 'Offline', and 'Trash' sidebar entries under a new category called 'Library'.
- Move 'Trash' sidebar entry below 'Last Import'.
- Use bold text with no icons for Category headers. Fixes lp:1275115.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
    // outside the app.
43
43
    private enum SidebarRootPosition {
44
44
        LIBRARY,
45
 
        FLAGGED,
46
 
        LAST_IMPORTED,
47
45
        CAMERAS,
48
 
        IMPORT_QUEUE,
49
46
        SAVED_SEARCH,
50
47
        EVENTS,
51
48
        FOLDERS,
52
49
        TAGS,
53
 
        TRASH,
54
 
        OFFLINE
55
50
    }
56
51
    
57
52
    public enum TargetType {
114
109
    private Library.Branch library_branch = new Library.Branch();
115
110
    private Tags.Branch tags_branch = new Tags.Branch();
116
111
    private Folders.Branch folders_branch = new Folders.Branch();
117
 
    private Library.TrashBranch trash_branch = new Library.TrashBranch();
118
112
    private Events.Branch events_branch = new Events.Branch();
119
 
    private Library.OfflineBranch offline_branch = new Library.OfflineBranch();
120
 
    private Library.FlaggedBranch flagged_branch = new Library.FlaggedBranch();
121
 
    private Library.LastImportBranch last_import_branch = new Library.LastImportBranch();
122
 
    private Library.ImportQueueBranch import_queue_branch = new Library.ImportQueueBranch();
123
113
    private Camera.Branch camera_branch = new Camera.Branch();
124
114
    private Searches.Branch saved_search_branch = new Searches.Branch();
125
115
    private bool page_switching_enabled = true;
172
162
        sidebar_tree.graft(library_branch, SidebarRootPosition.LIBRARY);
173
163
        sidebar_tree.graft(tags_branch, SidebarRootPosition.TAGS);
174
164
        sidebar_tree.graft(folders_branch, SidebarRootPosition.FOLDERS);
175
 
        sidebar_tree.graft(trash_branch, SidebarRootPosition.TRASH);
176
165
        sidebar_tree.graft(events_branch, SidebarRootPosition.EVENTS);
177
 
        sidebar_tree.graft(offline_branch, SidebarRootPosition.OFFLINE);
178
 
        sidebar_tree.graft(flagged_branch, SidebarRootPosition.FLAGGED);
179
 
        sidebar_tree.graft(last_import_branch, SidebarRootPosition.LAST_IMPORTED);
180
 
        sidebar_tree.graft(import_queue_branch, SidebarRootPosition.IMPORT_QUEUE);
181
166
        sidebar_tree.graft(camera_branch, SidebarRootPosition.CAMERAS);
182
167
        sidebar_tree.graft(saved_search_branch, SidebarRootPosition.SAVED_SEARCH);
183
168
        
207
192
        menubar.no_show_all = true;
208
193
        
209
194
        // create the main layout & start at the Library page
210
 
        create_layout(library_branch.get_main_page());
 
195
        create_layout(library_branch.photos_entry.get_page());
211
196
        
212
197
        // settings that should persist between sessions
213
198
        load_configuration();
879
864
    }
880
865
 
881
866
    public void enqueue_batch_import(BatchImport batch_import, bool allow_user_cancel) {
882
 
        import_queue_branch.enqueue_and_schedule(batch_import, allow_user_cancel);
 
867
        library_branch.import_queue_entry.enqueue_and_schedule(batch_import, allow_user_cancel);
883
868
    }
884
869
    
885
870
    private void import_reporter(ImportManifest manifest) {
1025
1010
    }
1026
1011
    
1027
1012
    public void switch_to_library_page() {
1028
 
        switch_to_page(library_branch.get_main_page());
 
1013
        switch_to_page(library_branch.photos_entry.get_page());
1029
1014
    }
1030
1015
    
1031
1016
    public void switch_to_event(Event event) {
1062
1047
    }
1063
1048
    
1064
1049
    public void switch_to_import_queue_page() {
1065
 
        switch_to_page(import_queue_branch.get_queue_page());
 
1050
        switch_to_page(library_branch.import_queue_entry.get_page());
1066
1051
    }
1067
1052
    
1068
1053
    private void on_camera_added(DiscoveredCamera camera) {
1449
1434
    private void on_destroying_page(Sidebar.PageRepresentative entry, Page page) {
1450
1435
        // if page is the current page, switch to fallback before destroying
1451
1436
        if (page == get_current_page())
1452
 
            switch_to_page(library_branch.get_main_page());
 
1437
            switch_to_page(library_branch.photos_entry.get_page());
1453
1438
        
1454
1439
        remove_from_notebook(page);
1455
1440
        
1467
1452
        // if the currently selected item is removed, want to jump to fallback page (which
1468
1453
        // depends on the item that was selected)
1469
1454
        
 
1455
        Library.LastImportSidebarEntry last_import_entry = library_branch.last_imported_entry;
 
1456
        
1470
1457
        // Importing... -> Last Import (if available)
1471
 
        if (selectable is Library.ImportQueueSidebarEntry && last_import_branch.get_show_branch()) {
1472
 
            switch_to_page(last_import_branch.get_main_entry().get_page());
 
1458
        if (selectable is Library.ImportQueueSidebarEntry && last_import_entry.visible) {
 
1459
            switch_to_page(last_import_entry.get_page());
1473
1460
            
1474
1461
            return;
1475
1462
        }
1489
1476
        }
1490
1477
        
1491
1478
        // basic all-around default: jump to the Library page
1492
 
        switch_to_page(library_branch.get_main_page());
 
1479
        switch_to_page(library_branch.photos_entry.get_page());
1493
1480
    }
1494
1481
    
1495
1482
    private void subscribe_for_basic_information(Page page) {