update to GNOME Shell 40

This commit is contained in:
Neil Bird 2021-06-26 17:43:29 +01:00
parent 2a03ba3075
commit b3c68cdb53
3 changed files with 44 additions and 32 deletions

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
[ -d pi-hole@fnxweb,.com ] && cd pi-hole@fnxweb.com [ -d pi-hole@fnxweb.com ] && cd pi-hole@fnxweb.com
git archive --format=zip -o /tmp/pihole-extension.zip master git archive --format=zip -o /tmp/pihole-extension.zip master
# .. from inside pi-hole@fnxweb.com # .. from inside pi-hole@fnxweb.com

View file

@ -1,10 +1,10 @@
{ {
"shell-version": ["3.38"], "shell-version": ["40"],
"uuid": "pi-hole@fnxweb.com", "uuid": "pi-hole@fnxweb.com",
"name": "pi-hole", "name": "pi-hole",
"url" : "https://github.com/fnxweb/gnome-shell-pi-hole", "url" : "https://github.com/fnxweb/gnome-shell-pi-hole",
"description": "Status and basic controls of local Pi-Hole", "description": "Status and basic controls of local Pi-Hole",
"settings-schema": "org.gnome.shell.extensions.fnxweb-pi-hole", "settings-schema": "org.gnome.shell.extensions.fnxweb-pi-hole",
"gettext-domain": "gnome-shell-extension-fnxweb-pi-hole", "gettext-domain": "gnome-shell-extension-fnxweb-pi-hole",
"version": 0 "version": 1
} }

View file

@ -26,26 +26,23 @@ function init()
function buildPrefsWidget() function buildPrefsWidget()
{ {
// Create // Create
let prefs = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL, border_width: 8, margin: 8 }); let prefs = new Gtk.Box({
prefs.set_spacing(4); orientation: Gtk.Orientation.VERTICAL,
margin_top: 8,
margin_bottom: 8
});
prefs.set_spacing(8);
// Settings // Settings
{ {
let widget = new Gtk.Entry({ width_chars: 50, tooltip_text: _("URL of pi-hole admin page for API access") }); let widget = new Gtk.SpinButton({ tooltip_text: _("How long to pause Pi-Hole for when it is paused") });
widget.set_text( settings.get_string( Common.URL_SETTING ) ); widget.set_range( 1, 900 );
widget.connect( 'changed', function() { widget.set_increments( 1, 5 );
settings.set_string( Common.URL_SETTING, widget.get_text() ); widget.set_value( settings.get_uint( Common.DISABLE_TIME_SETTING ) );
widget.connect( 'value-changed', function() {
settings.set_uint( Common.DISABLE_TIME_SETTING, widget.get_value() );
}); });
_addSetting( prefs, _("Pi-Hole URL"), widget ); _addSetting( prefs, _("Pause time (seconds)"), widget );
}
{
let widget = new Gtk.Entry({ width_chars: 50, tooltip_text: _("API key of pi-hole from settings/api page") });
widget.set_text( settings.get_string( Common.API_KEY_SETTING ) );
widget.connect( 'changed', function() {
settings.set_string( Common.API_KEY_SETTING, widget.get_text() );
});
_addSetting( prefs, _("API key"), widget );
} }
{ {
@ -60,18 +57,24 @@ function buildPrefsWidget()
} }
{ {
let widget = new Gtk.SpinButton({ tooltip_text: _("How long to pause Pi-Hole for when it is paused") }); let widget = new Gtk.Entry({ width_chars: 50, tooltip_text: _("API key of pi-hole from settings/api page") });
widget.set_range( 1, 900 ); widget.set_text( settings.get_string( Common.API_KEY_SETTING ) );
widget.set_increments( 1, 5 ); widget.connect( 'changed', function() {
widget.set_value( settings.get_uint( Common.DISABLE_TIME_SETTING ) ); settings.set_string( Common.API_KEY_SETTING, widget.get_text() );
widget.connect( 'value-changed', function() {
settings.set_uint( Common.DISABLE_TIME_SETTING, widget.get_value() );
}); });
_addSetting( prefs, _("Pause time (seconds)"), widget ); _addSetting( prefs, _("API key"), widget );
}
{
let widget = new Gtk.Entry({ width_chars: 50, tooltip_text: _("URL of pi-hole admin page for API access") });
widget.set_text( settings.get_string( Common.URL_SETTING ) );
widget.connect( 'changed', function() {
settings.set_string( Common.URL_SETTING, widget.get_text() );
});
_addSetting( prefs, _("Pi-Hole URL"), widget );
} }
// Done // Done
prefs.show_all();
return prefs; return prefs;
} }
@ -79,11 +82,20 @@ function buildPrefsWidget()
// Add a labelled setting // Add a labelled setting
function _addSetting( prefs, labeltext, widget ) function _addSetting( prefs, labeltext, widget )
{ {
let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL }); let box = new Gtk.Box({
let label = new Gtk.Label({ label: labeltext, xalign: 0 }); orientation: Gtk.Orientation.HORIZONTAL,
margin_start: 8,
margin_end: 8
});
let label = new Gtk.Label({
label: labeltext,
xalign: 0,
halign: Gtk.Align.FILL,
hexpand: true
});
box.pack_start( label, true, true, 0 ); box.append( label );
box.add( widget ); box.append( widget );
prefs.pack_start( box, false, false, 0 ); prefs.prepend( box );
} }