-
Notifications
You must be signed in to change notification settings - Fork 11
/
prefs.js
111 lines (87 loc) · 2.71 KB
/
prefs.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
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
import Gio from "gi://Gio";
import Adw from "gi://Adw";
import Gtk from "gi://Gtk";
import {
ExtensionPreferences,
gettext as _,
} from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js";
export default class RecentItemsPreferences extends ExtensionPreferences {
fillPreferencesWindow(window) {
window._settings = this.getSettings();
const page = new Adw.PreferencesPage({
title: _("Recent Item Settings"),
icon_name: "dialog-information-symbolic",
});
window.add(page);
const group = new Adw.PreferencesGroup({
title: _("Settings"),
});
page.add(group);
let label = null;
let widget = null;
// Item count
const itemCountBox = new Gtk.Box({
orientation: Gtk.Orientation.HORIZONTAL,
spacing: 10,
margin_start: 10,
margin_end: 10,
margin_top: 10,
margin_bottom: 10,
});
label = new Gtk.Label({
label: _("Item Count"),
hexpand: true,
halign: Gtk.Align.START,
});
widget = new Gtk.SpinButton({ halign: Gtk.Align.END });
widget.set_sensitive(true);
widget.set_range(3, 20);
widget.set_increments(1, 2);
window._settings.bind("item-count", widget, "value", Gio.SettingsBindFlags.DEFAULT);
itemCountBox.append(label);
itemCountBox.append(widget);
group.add(itemCountBox);
// More Item Count
const moreItemCountBox = new Gtk.Box({
orientation: Gtk.Orientation.HORIZONTAL,
spacing: 10,
margin_start: 10,
margin_end: 10,
margin_top: 10,
margin_bottom: 10,
});
label = new Gtk.Label({
label: _("More Item Count"),
hexpand: true,
halign: Gtk.Align.START,
});
widget = new Gtk.SpinButton({ halign: Gtk.Align.END });
widget.set_sensitive(true);
widget.set_range(0, 50);
widget.set_increments(1, 2);
window._settings.bind("more-item-count", widget, "value", Gio.SettingsBindFlags.DEFAULT);
moreItemCountBox.append(label);
moreItemCountBox.append(widget);
group.add(moreItemCountBox);
// Item Blacklist
const itemBlacklistBox = new Gtk.Box({
orientation: Gtk.Orientation.HORIZONTAL,
spacing: 10,
margin_start: 10,
margin_end: 10,
margin_top: 10,
margin_bottom: 10,
});
label = new Gtk.Label({
label: _("Item Blacklist\nSeperate with comma\nExample: image,audio,video"),
hexpand: true,
halign: Gtk.Align.START,
});
widget = new Gtk.Entry({ halign: Gtk.Align.END });
widget.set_sensitive(true);
window._settings.bind("item-blacklist", widget, "text", Gio.SettingsBindFlags.DEFAULT);
itemBlacklistBox.append(label);
itemBlacklistBox.append(widget);
group.add(itemBlacklistBox);
}
}