/usr/share/cinnamon/js/misc/fileDialog.js is in cinnamon-common 3.6.7-8ubuntu1.
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 | const Util = imports.misc.util;
const GLib = imports.gi.GLib;
function open(callback, params) {
_launchDialog(0, callback, params);
}
function openFolder(callback, params) {
_launchDialog(1, callback, params);
}
function save(callback, params) {
_launchDialog(2, callback, params);
}
function _launchDialog(type, callback, params) {
let args = ["cinnamon-file-dialog"];
if (params.selectMultiple) type += 3; //add 3 to use the select-multiple version
args.push(String(type));
if (params.path) args.push("-p", params.path.replace("~", GLib.get_home_dir()));
if (params.name) args.push("-n", params.name);
if (params.directory) args.push("-d", params.directory.replace("~", GLib.get_home_dir()));
if (params.filters) {
let filterList = [];
for (let i = 0; i < params.filters.length; i++) {
filterList.push(params.filters[i].getString());
}
args.push("-f", filterList.join(","));
}
Util.spawn_async(args, callback);
}
function Filter(name) {
this._init(name);
}
Filter.prototype = {
_init: function(name) {
this.name = name;
this.rules = [];
},
addMimeType: function(mime) {
this.rules.push("m="+mime);
},
addPattern: function(pattern) {
this.rules.push("p="+pattern);
},
getString: function() {
return this.name + ";" + this.rules.join(":");
}
}
|