forked from leonardo-bartoli/gnome-shell-extension-Recents
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fileInfoItem.js
38 lines (32 loc) · 1.13 KB
/
fileInfoItem.js
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
const Lang = imports.lang;
const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
const PopupMenu = imports.ui.popupMenu;
const FileInfoItem = new Lang.Class({
Name: 'FileInfoItem',
Extends: PopupMenu.PopupBaseMenuItem,
_init: function(gicon, label, dirUri, uri, client) {
this.parent('');
this.icon = this.actor.add(new St.Icon({
gicon: gicon,
fallback_icon_name: 'application-x-executable-symbolic',
style_class: 'popup-menu-icon'
}));
this.actor.add(new St.Label({ text: label}), { expand: true });
this._removeBtn = new St.Button();
this._removeBtn.child = new St.Icon({
icon_name: 'edit-delete-symbolic',
style_class: 'popup-menu-icon'
});
this._removeBtn.connect('clicked', Lang.bind(this, function() {
try {
client.removeItem(uri);
this.destroy();
} catch(err) {
log(err);
}
return Clutter.EVENT_STOP;
}));
this.actor.add(this._removeBtn, { x_align: St.Align.END });
}
});