forked from RaphaelRochet/arch-update
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
prefs.js
71 lines (59 loc) · 4.61 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
/*
This file is part of Fedora Linux Update Indicator
Fedora Linux Update Indicator is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Fedora Linux Update Indicator is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fedora Linux Update Indicator. If not, see <http://www.gnu.org/licenses/>.
Copyright 2023 Ralph Plawetzki
*/
import Gio from "gi://Gio";
import Gtk from 'gi://Gtk';
import {ExtensionPreferences} from "resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js"
export default class FedoraUpdatePreferences extends ExtensionPreferences {
fillPreferencesWindow(window) {
// Prepare labels and controls
let buildable = new Gtk.Builder();
buildable.add_from_file( this.dir.get_path() + '/prefs.xml' );
// Fill in about page from metadata
buildable.get_object('about_logo').set_from_file( this.dir.get_child('icons').get_path() + "/fedora-updates-logo.svg" );
buildable.get_object('about_name').set_text(this.metadata.name.toString());
buildable.get_object('about_version').set_text(this.metadata.version.toString());
buildable.get_object('about_description').set_text(this.metadata.description.toString());
buildable.get_object('about_url').set_markup("<a href=\"" + this.metadata.url.toString() + "\">" + this.metadata.url.toString() + "</a>");
// Bind fields to settings
let settings = this.getSettings();
settings.bind('boot-wait' , buildable.get_object('field_wait') , 'value' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('check-interval' , buildable.get_object('field_interval') , 'value' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('always-visible' , buildable.get_object('field_visible') , 'active' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('use-buildin-icons' , buildable.get_object('field_buildinicons') , 'active' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('show-count' , buildable.get_object('field_count') , 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('notify' , buildable.get_object('field_notify') , 'active' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('howmuch', buildable.get_object('field_howmuch'), 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('strip-versions' , buildable.get_object('field_stripversions') , 'active' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('strip-versions-in-notification' , buildable.get_object('field_stripversionsnotifications') , 'active' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('check-cmd-dnf4' , buildable.get_object('field_checkcmd_dnf4') , 'text' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('check-cmd-dnf5' , buildable.get_object('field_checkcmd_dnf5') , 'text' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('disable-parsing', buildable.get_object('field_disableparsing'), 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('update-cmd' , buildable.get_object('field_updatecmd') , 'text' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('packages-dir' , buildable.get_object('field_packagesdir') , 'text' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('auto-expand-list', buildable.get_object('field_autoexpandlist'), 'value', Gio.SettingsBindFlags.DEFAULT);
settings.bind('package-manager' , buildable.get_object('field_packagemanager') , 'text' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('enable-positioning' , buildable.get_object('field_enablepositioning') , 'active' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('enable-positioning' , buildable.get_object('box_position') , 'sensitive' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('position' , buildable.get_object('field_position') , 'active' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('position-number' , buildable.get_object('field_positionnumber') , 'value' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('package-info-cmd' , buildable.get_object('field_packageinfocmd') , 'text' , Gio.SettingsBindFlags.DEFAULT);
settings.bind('show-timechecked' , buildable.get_object('field_showtimechecked') , 'active' , Gio.SettingsBindFlags.DEFAULT);
// Pref window layout
window.search_enabled = true;
window.add( buildable.get_object('page_basic') );
window.add( buildable.get_object('page_advanced') );
window.add( buildable.get_object('page_about') );
}
}