/usr/share/sushi/js/ui/fallbackRenderer.js is in gnome-sushi 3.18.0-2.
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, see <http://www.gnu.org/licenses/>.
*
* 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>
*
*/
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const GtkClutter = imports.gi.GtkClutter;
const Sushi = imports.gi.Sushi;
const Gettext = imports.gettext.domain('sushi');
const _ = Gettext.gettext;
const Lang = imports.lang;
const Constants = imports.util.constants;
const Utils = imports.ui.utils;
const FallbackRenderer = new Lang.Class({
Name: 'FallbackRenderer',
_init : function() {
this._fileLoader = null;
this._fileLoaderId = 0;
this.moveOnClick = true;
this.canFullScreen = false;
},
prepare : function(file, mainWindow, callback) {
this._mainWindow = mainWindow;
this.lastWidth = 0;
this.lastHeight = 0;
this._fileLoader = new Sushi.FileLoader();
this._fileLoader.file = file;
this._fileLoaderId =
this._fileLoader.connect('notify',
Lang.bind(this, this._onFileInfoChanged));
this._box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
spacing: 6 });
this._image = new Gtk.Image({ icon_name: 'document',
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_start: 12,
margin_end: 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._typeLabel = new Gtk.Label();
this._typeLabel.set_halign(Gtk.Align.START);
vbox.pack_start(this._typeLabel, false, false, 0);
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 });
Utils.alphaGtkWidget(this._actor.get_widget());
callback();
},
render : function() {
return this._actor;
},
_applyLabels : function() {
let titleStr =
'<b><big>' +
((this._fileLoader.name) ? (this._fileLoader.name) : (this._fileLoader.file.get_basename()))
+ '</big></b>';
this._titleLabel.set_markup(titleStr);
if (this._fileLoader.get_file_type() != Gio.FileType.DIRECTORY) {
let typeStr =
'<small><b>' + _("Type") + ' </b>' +
((this._fileLoader.contentType) ? (this._fileLoader.contentType) : (_("Loading...")))
+ '</small>';
this._typeLabel.set_markup(typeStr);
} else {
this._typeLabel.hide();
}
let sizeStr =
'<small><b>' + _("Size") + ' </b>' +
((this._fileLoader.size) ? (this._fileLoader.size) : (_("Loading...")))
+ '</small>';
this._sizeLabel.set_markup(sizeStr);
let dateStr =
'<small><b>' + _("Modified") + ' </b>' +
((this._fileLoader.time) ? (this._fileLoader.time) : (_("Loading...")))
+ '</small>';
this._dateLabel.set_markup(dateStr);
},
_onFileInfoChanged : function() {
if (!this._fileLoader.get_loading()) {
this._spinner.stop();
this._spinner.hide();
}
if (this._fileLoader.icon)
this._image.set_from_pixbuf(this._fileLoader.icon);
this._applyLabels();
this._mainWindow.refreshSize();
},
clear : function() {
if (this._fileLoader) {
this._fileLoader.disconnect(this._fileLoaderId);
this._fileLoaderId = 0;
this._fileLoader.stop();
this._fileLoader = null;
}
},
getSizeForAllocation : function(allocation) {
return Utils.getStaticSize(this, this._box);
}
});
|