/usr/share/sushi/js/viewers/folder.js is in gnome-sushi 0.4.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /*
* Copyright (C) 2011 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* The Sushi project hereby grant permission for non-gpl compatible GStreamer
* plugins to be used and distributed together with GStreamer and Sushi. This
* permission is above and beyond the permissions granted by the GPL license
* Sushi is covered by.
*
* Authors: Cosimo Cecchi <cosimoc@redhat.com>
*
*/
let MimeHandler = imports.ui.mimeHandler;
let Gtk = imports.gi.Gtk;
let Sushi = imports.gi.Sushi;
let Gettext = imports.gettext.domain("sushi");
let _ = Gettext.gettext;
let Constants = imports.util.constants;
let Utils = imports.ui.utils;
function FolderRenderer(args) {
this._init(args);
}
FolderRenderer.prototype = {
_init : function() {
this._folderLoader = null;
this._folderLoaderId = 0;
this.moveOnClick = true;
this.canFullScreen = false;
},
prepare : function(file, mainWindow, callback) {
this._mainWindow = mainWindow;
this._file = file;
this._callback = callback;
this.lastWidth = 0;
this.lastHeight = 0;
this._folderLoader = new Sushi.FileLoader();
this._folderLoader.file = file;
this._folderLoaderId =
this._folderLoader.connect("notify",
Lang.bind(this, this._onFolderInfoChanged));
this._box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
spacing: 6 });
this._image = new Gtk.Image({ "icon-name": "folder",
"pixel-size": 256 });
this._box.pack_start(this._image, false, false, 0);
let vbox = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL,
spacing: 1,
"margin-top": 48,
"margin-left": 12,
"margin-right": 12 });
this._box.pack_start(vbox, false, false, 0);
let hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
spacing: 6 });
vbox.pack_start(hbox, false, false, 0);
this._titleLabel = new Gtk.Label();
this._titleLabel.set_halign(Gtk.Align.START);
hbox.pack_start(this._titleLabel, false, false, 0);
this._spinner = new Gtk.Spinner();
hbox.pack_start(this._spinner, false, false, 0);
this._spinner.start();
this._sizeLabel = new Gtk.Label();
this._sizeLabel.set_halign(Gtk.Align.START);
vbox.pack_start(this._sizeLabel, false, false, 0);
this._dateLabel = new Gtk.Label();
this._dateLabel.set_halign(Gtk.Align.START);
vbox.pack_start(this._dateLabel, false, false, 0);
this._applyLabels();
this._box.show_all();
this._actor = new GtkClutter.Actor({ contents: this._box });
this._callback();
},
render : function() {
return this._actor;
},
_applyLabels : function() {
let name = this._folderLoader.name;
if (!name) {
try {
name = this._folderLoader.file.get_basename();
} catch (e) {
name = "";
}
}
let titleStr =
"<b><big>" + name + "</big></b>";
let sizeStr =
"<small><b>" + _("Size") + " </b>" +
((this._folderLoader.size) ? (this._folderLoader.size) : (_("Loading...")))
+ "</small>";
let dateStr =
"<small><b>" + _("Modified") + " </b>" +
((this._folderLoader.time) ? (this._folderLoader.time) : (_("Loading...")))
+ "</small>";
this._titleLabel.set_markup(titleStr);
this._sizeLabel.set_markup(sizeStr);
this._dateLabel.set_markup(dateStr);
},
_onFolderInfoChanged : function() {
if (!this._folderLoader.get_loading()) {
this._spinner.stop();
this._spinner.hide();
}
this._applyLabels();
this._image.set_from_pixbuf(this._folderLoader.icon);
this._mainWindow.refreshSize();
},
clear : function() {
if (this._folderLoader) {
this._folderLoader.disconnect(this._folderLoaderId);
this._folderLoaderId = 0;
this._folderLoader.stop();
this._folderLoader = null;
}
},
getSizeForAllocation : function(allocation) {
return Utils.getStaticSize(this, this._box);
}
}
let handler = new MimeHandler.MimeHandler();
let renderer = new FolderRenderer();
handler.registerMime("inode/directory", renderer);
|