forked from MichalW/gnome-bluetooth-battery-indicator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprefs.js
30 lines (23 loc) · 890 Bytes
/
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
'use strict';
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
const GObject = imports.gi.GObject;
const Config = imports.misc.config;
// It's common practice to keep GNOME API and JS imports in separate blocks
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const { SettingsWidget } = Me.imports.settingsWidget;
function init() {
log(`initializing ${Me.metadata.name} Preferences`);
ExtensionUtils.initTranslations();
}
function buildPrefsWidget() {
const prefsWidget = new SettingsWidget();
prefsWidget.show();
// At the time buildPrefsWidget() is called, the window is not yet prepared
// so if you want to access the headerbar you need to use a small trick
GLib.timeout_add(GLib.PRIORITY_DEFAULT, 0, () => {
const window = prefsWidget.get_root();
});
return prefsWidget;
}