~elementary-apps/pantheon-files/trunk

« back to all changes in this revision

Viewing changes to libcore/gof-directory-async.vala

  • Committer: Jeremy Wootten
  • Date: 2017-01-13 13:36:33 UTC
  • mfrom: (2444 pantheon-files)
  • mto: This revision was merged to the branch mainline in revision 2471.
  • Revision ID: jeremy@elementaryos.org-20170113133633-ajg6izr1e6irmj0g
Merge r2444

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/***
2
2
    Copyright (C) 2011 Marlin Developers
3
 
                  2015-2016 elementary LLC (http://launchpad.net/elementary) 
 
3
                  2015-2017 elementary LLC (http://launchpad.net/elementary) 
4
4
 
5
5
    This program is free software: you can redistribute it and/or modify
6
6
    it under the terms of the GNU General Public License as published by
717
717
            warning ("Add and refresh file which is gone");
718
718
            return;
719
719
        }
720
 
        if (gof.info == null)
 
720
 
 
721
        if (gof.info == null) {
721
722
            critical ("FILE INFO null");
 
723
        }
722
724
 
723
725
        gof.update ();
724
726
 
725
 
        if ((!gof.is_hidden || Preferences.get_default ().pref_show_hidden_files))
 
727
        if ((!gof.is_hidden || Preferences.get_default ().pref_show_hidden_files)) {
726
728
            file_added (gof);
 
729
        }
727
730
 
728
731
        if (!gof.is_hidden && gof.is_folder ()) {
729
732
            /* add to sorted_dirs */
730
 
            if (sorted_dirs.find (gof) == null)
 
733
            if (sorted_dirs.find (gof) == null) {
731
734
                sorted_dirs.insert_sorted (gof,
732
735
                    GOF.File.compare_by_display_name);
 
736
            }
733
737
        }
734
738
 
735
739
        if (track_longest_name && gof.basename.length > longest_file_name.length) {
747
751
    }
748
752
 
749
753
    private void notify_file_removed (GOF.File gof) {
750
 
        if (!gof.is_hidden || Preferences.get_default ().pref_show_hidden_files)
 
754
        if (!gof.is_hidden || Preferences.get_default ().pref_show_hidden_files) {
751
755
            file_deleted (gof);
 
756
        }
752
757
 
753
758
        if (!gof.is_hidden && gof.is_folder ()) {
754
759
            /* remove from sorted_dirs */
873
878
        bool found;
874
879
 
875
880
        foreach (var loc in files) {
876
 
            assert (loc != null);
 
881
            if (loc == null) {
 
882
                continue;
 
883
            }
 
884
 
877
885
            Async? dir = cache_lookup_parent (loc);
878
886
 
879
887
            if (dir != null) {
889
897
                if (!found)
890
898
                    dirs.append (dir);
891
899
            } else {
892
 
                warning ("parent of deleted file not found");
 
900
                dir = cache_lookup (loc);
 
901
                if (dir != null) {
 
902
                    dir.file_deleted (dir.file);
 
903
                }
893
904
            }
894
905
        }
895
906