~xapantu/beat-box/animations

« back to all changes in this revision

Viewing changes to src/LibraryWindow.vala

  • Committer: sgringwe at gmail
  • Date: 2012-01-11 18:23:20 UTC
  • Revision ID: sgringwe@gmail.com-20120111182320-i117rvcsea2hsqry
getting closer to async imports. a few bugs to work out, mem leak to find, and testing remain

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
                this.lm.music_imported.connect(musicImported);
123
123
                this.lm.music_rescanned.connect(musicRescanned);
124
124
                this.lm.progress_notification.connect(progressNotification);
 
125
                this.lm.medias_added.connect(medias_added);
 
126
                this.lm.medias_updated.connect(medias_updated);
125
127
                this.lm.medias_removed.connect(medias_removed);
126
128
                this.lm.media_played.connect(media_played);
127
129
                this.lm.playback_stopped.connect(playback_stopped);
128
 
                this.lm.medias_updated.connect(medias_updated);
129
130
                this.lm.dm.device_added.connect(device_added);
130
131
                this.lm.dm.device_removed.connect(device_removed);
131
132
                this.similarMedias.similar_retrieved.connect(similarRetrieved);
623
624
                        topDisplay.set_label_markup(message);
624
625
                
625
626
                topDisplay.set_progress_value(progress);
626
 
                
627
 
                // if we are adding medias, refresh periodically
628
 
                ViewWrapper vw = (ViewWrapper)sideTree.getWidget(sideTree.library_music_iter);
629
 
                if(lm.media().size - vw.media_count >= 500) {
630
 
                        stdout.printf("doing update!\n");
631
 
                        vw.doUpdate(vw.currentView, lm.media_ids(), true, true);
632
 
                        stdout.printf("doing update!\n");
633
 
                        miller.populateColumns("", lm.media_ids());
634
 
                        stdout.printf("doing update!\n");
635
 
                        updateSensitivities();
636
 
                        stdout.printf("doing update!\n");
637
 
                }
638
627
        }
639
628
        
640
629
        public bool updateCurrentMedia() {
794
783
                }
795
784
        }
796
785
        
 
786
        void medias_added(LinkedList<int> ids) {
 
787
                var new_songs = new LinkedList<int>();
 
788
                var new_podcasts = new LinkedList<int>();
 
789
                
 
790
                foreach(int i in ids) {
 
791
                        if(lm.media_from_id(i).mediatype == 0)
 
792
                                new_songs.add(i);
 
793
                        else if(lm.media_from_id(i).mediatype == 1)
 
794
                                new_podcasts.add(i);
 
795
                }
 
796
                
 
797
                stdout.printf("appending...\n");
 
798
                ViewWrapper vw = (ViewWrapper)sideTree.getWidget(sideTree.library_music_iter);
 
799
                vw.add_medias(new_songs);
 
800
                
 
801
                vw = (ViewWrapper)sideTree.getWidget(sideTree.library_podcasts_iter);
 
802
                vw.add_medias(new_podcasts);
 
803
                stdout.printf("appended\n");
 
804
                
 
805
                miller.populateColumns("", lm.media_ids());
 
806
                updateSensitivities();
 
807
        }
 
808
        
797
809
        public void* lastfm_track_thread_function () {
798
810
                LastFM.TrackInfo track = new LastFM.TrackInfo.basic();
799
811