~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/browser/listing.js

  • Committer: mattgiuca
  • Date: 2008-01-16 22:37:07 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:237
listing: bugfix, update_selection no longer dependent on dictionary ordering
    (which would cause the wrong files to be selected if any sorting was
    made). Now processes the listing in the order of the TRs in the DOM.
    Apply an initial sort by filename.

Show diffs side-by-side

added added

removed removed

Lines of Context:
309
309
    var row_toggle = 1;
310
310
    selected_files = [];  /* Clear global selected_files */
311
311
 
312
 
    var total_files = 0;
313
312
    var total_file_size = 0;    /* In bytes */
314
313
    var total_file_size_sel = 0;
315
314
 
316
315
    /* Children are trs */
317
 
    var i = 0;
 
316
    var filename;
318
317
    var file;
319
318
    if (file_listing == null) return;
320
 
    for (var filename in file_listing)
 
319
    for (var i=0; i<files_children.length; i++)
321
320
    {
322
 
        /* Count total files and size so we can write to the status bar later
 
321
        filename = files_children[i].filename;
 
322
        file = files_children[i].fileinfo;
 
323
        /* Count total file size so we can write to the status bar later
323
324
         */
324
 
        file = file_listing[filename];
325
 
        total_files++;
326
325
        if ("size" in file)
327
326
            total_file_size += file.size;
328
327
 
340
339
            if ("size" in file)
341
340
                total_file_size_sel += file.size;
342
341
        }
343
 
        i++;
344
342
    }
345
343
 
346
344
    /* Write to the side-panel */
358
356
    }
359
357
    else
360
358
    {
361
 
        statusmsg = total_files.toString() + " file"
362
 
            + (total_files == 1 ? "" : "s") + ", "
 
359
        statusmsg = files_children.length.toString() + " file"
 
360
            + (files_children.length == 1 ? "" : "s") + ", "
363
361
            + nice_filesize(total_file_size);
364
362
    }
365
363
    dom_removechildren(statusbar);
627
625
        files.appendChild(row);
628
626
    }
629
627
 
 
628
    /* Apply an initial sort by filename */
 
629
    sort_listing("filename");
 
630
 
630
631
    /* Do a selection update (create initial elements for side panel and
631
632
     * status bar). */
632
 
    update_selection();
 
633
    /* Commented out; already called by sort_listing */
 
634
    /*update_selection();*/
633
635
}
634
636