~ubuntu-branches/ubuntu/saucy/baobab/saucy

« back to all changes in this revision

Viewing changes to src/baobab-scanner.vala

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2012-11-05 18:19:47 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20121105181947-a5c9utsx2buosfmy
Tags: 3.6.2-0ubuntu1
* New upstream version:
  - Minor tweaks to the UI
* debian/patches/baobab_about_segfault.patch: 
  - don't segfault when opening the about dialog (lp: #1020810)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 
1
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
/* Baobab - disk usage analyzer
3
3
 *
4
4
 * Copyright (C) 2012  Ryan Lortie <desrt@desrt.ca>
46
46
            CANCELLED,
47
47
            NEED_PERCENT,
48
48
            ERROR,
 
49
            CHILD_ERROR,
49
50
            DONE
50
51
        }
51
52
 
148
149
            internal double percent;
149
150
            internal int max_depth;
150
151
            internal Error? error;
 
152
            internal bool child_error;
151
153
 
152
154
            // accessed only by the main thread
153
155
            internal Gtk.TreeIter iter;
172
174
            }
173
175
            results.elements = 1;
174
176
            results.error = null;
 
177
            results.child_error = false;
175
178
 
176
179
            try {
177
180
                var children = directory.enumerate_children (ATTRIBUTES, FileQueryInfoFlags.NOFOLLOW_SYMLINKS, cancellable);
187
190
                                results.alloc_size += child_results.alloc_size;
188
191
                                results.elements += child_results.elements;
189
192
                                results.max_depth = int.max (results.max_depth, child_results.max_depth + 1);
 
193
                                if (child_results.error != null) {
 
194
                                    results.child_error = true;
 
195
                                }
 
196
 
190
197
                                results_array.results += (owned) child_results;
191
198
                            }
192
199
                            break;
282
289
                foreach (unowned Results results in results_array.results) {
283
290
                    ensure_iter_exists (results);
284
291
 
 
292
                    State state;
 
293
                    if (results.child_error) {
 
294
                        state = State.CHILD_ERROR;
 
295
                    } else if (results.error != null) {
 
296
                        state = State.ERROR;
 
297
                    } else {
 
298
                        state = State.DONE;
 
299
                    }
 
300
 
285
301
                    set (results.iter,
286
302
                         Columns.SIZE,       results.size,
287
303
                         Columns.ALLOC_SIZE, results.alloc_size,
288
304
                         Columns.PERCENT,    results.percent,
289
305
                         Columns.ELEMENTS,   results.elements,
290
 
                         Columns.STATE,      results.error == null ? State.DONE : State.ERROR,
 
306
                         Columns.STATE,      state,
291
307
                         Columns.ERROR,      results.error);
292
308
 
293
309
                    if (results.max_depth > max_depth) {