This repository has been archived by the owner on Apr 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prefs.js
60 lines (50 loc) · 1.64 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
'use strict';
const Gtk = imports.gi.Gtk;
const ExtensionUtils = imports.misc.extensionUtils;
const GS_SCHEMA = "org.gnome.shell.extensions.thanatophobia";
const GS_KEY_YEAR = "year";
const GS_KEY_MONTH = "month";
const GS_KEY_DAY = "day";
function init() {
}
function buildPrefsWidget() {
this.settings = ExtensionUtils.getSettings(
GS_SCHEMA
);
let prefsWidget = new Gtk.Grid({
"margin-start": 18,
"margin-end": 18,
"margin-top": 18,
"margin-bottom": 18,
column_spacing: 12,
row_spacing: 12,
visible: true
});
let birthdateLabel = new Gtk.Label({
label: "Birthdate:",
halign: Gtk.Align.START,
visible: true
});
let birthdateEntry = new Gtk.Calendar({
year: this.settings.get_int(GS_KEY_YEAR),
month: this.settings.get_int(GS_KEY_MONTH),
day: this.settings.get_int(GS_KEY_DAY),
halign: Gtk.Align.START,
visible: true
});
birthdateEntry.connect('day-selected', function (inputField) {
settings.set_int(GS_KEY_YEAR, inputField.get_date().get_year());
settings.set_int(GS_KEY_MONTH, inputField.get_date().get_month() - 1);
settings.set_int(GS_KEY_DAY, inputField.get_date().get_day_of_month() - 1);
});
prefsWidget.attach(birthdateLabel, 0, 1, 1, 1);
prefsWidget.attach_next_to(birthdateEntry, birthdateLabel, Gtk.PositionType.RIGHT, 1, 1);
prefsWidget.connect('realize', () => {
{
let window = prefsWidget.get_root();
window.default_width = 200;
window.default_height = 200;
}
});
return prefsWidget;
}