From dd65965b20cb31e1095c84c8539b4f6190c11c3c Mon Sep 17 00:00:00 2001 From: Adam Schmalhofer Date: Thu, 16 Sep 2021 13:03:56 +0200 Subject: [PATCH 1/3] Support Gnome 40 --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index ff69594..4e7ff84 100644 --- a/metadata.json +++ b/metadata.json @@ -13,7 +13,8 @@ "3.24", "3.26", "3.28", - "3.30" + "3.30", + "40" ], "url": "https://github.com/simonthechipmunk/turnoffdisplay", "uuid": "turnoffdisplay@simonthechipmunk.noreply.com", From 081a226a024fbc3c0c6882b970ad45901a98fefb Mon Sep 17 00:00:00 2001 From: Adam Schmalhofer Date: Fri, 24 Sep 2021 23:48:56 +0200 Subject: [PATCH 2/3] Ported preferences to Gnome 40 as it now uses gtk+4 --- metadata.json | 11 ----------- prefs.js | 38 +++++++++++++++++++------------------- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/metadata.json b/metadata.json index 4e7ff84..fc923d9 100644 --- a/metadata.json +++ b/metadata.json @@ -3,17 +3,6 @@ "name": "Turn off Display", "settings-schema": "org.gnome.shell.extensions.turnoffdisplay", "shell-version": [ - "3.10", - "3.12", - "3.14", - "3.16", - "3.18", - "3.20", - "3.22", - "3.24", - "3.26", - "3.28", - "3.30", "40" ], "url": "https://github.com/simonthechipmunk/turnoffdisplay", diff --git a/prefs.js b/prefs.js index 76e11c4..6063f00 100644 --- a/prefs.js +++ b/prefs.js @@ -78,10 +78,10 @@ function init() { function buildPrefsWidget() { // build the Gtk preferences widget - let frame = new Gtk.Box({orientation: Gtk.Orientation.VERTICAL, border_width: 10, margin: 20}); + let frame = new Gtk.Box({orientation: Gtk.Orientation.VERTICAL, margin_top: 20, margin_end: 20, margin_bottom: 20, margin_start: 20}); // add items to the widget frame - frame.add( _createSwitchbox( _("Integrate into System Controls (Round Buttons)"), + frame.append( _createSwitchbox( _("Integrate into System Controls (Round Buttons)"), _("Adds a round button instead of a separate entry in the Systemmenu"), _getIntegrate, _setIntegrate )); let box; @@ -104,20 +104,20 @@ function buildPrefsWidget() { box = _createSwitchbox( text, tooltip, _getHandleMouse, _setHandleMouse ); box.set_sensitive(sensitive); - frame.add(box); + frame.append(box); - frame.add( _createComboBox( _("Menu Width adjustment Mode"), _("Select the mode for handling the width of the Main Menu."), + frame.append( _createComboBox( _("Menu Width adjustment Mode"), _("Select the mode for handling the width of the Main Menu."), {'off': _("Off"), 'auto' : _("Automatic"), 'fixed' : _("Fixed")}, _getHandleMenuMode, _setHandleMenuMode )); - frame.add( _createAdjustBox( "", _("Fixed menu size in px."), + frame.append( _createAdjustBox( "", _("Fixed menu size in px."), 360.0, 1200.0, 1.0, _getFixMenuWidth, _setFixMenuWidth )); - frame.add( _createKeybindbox( _("Custom Keybinding"), + frame.append( _createKeybindbox( _("Custom Keybinding"), _("Set a Keybinding to turn off the Display (Examples: F12, space, w)"), "emblem-ok-symbolic", _("Keybinding is enabled"), "window-close-symbolic", _("Keybinding is disabled. Set a valid Shortcut to enable it"), _getKeybinding, _setKeybinding )); - frame.show_all(); + frame.show(); return frame; } @@ -130,7 +130,7 @@ function buildPrefsWidget() { function _createSwitchbox(text, tooltip, getFunction, setFunction) { // create box with toggle switch - let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin: 5}); + let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin_top: 5, margin_end: 5, margin_bottom: 5, margin_start: 5 }); let label = new Gtk.Label({ label: text, xalign: 0, tooltip_text: tooltip }); let toggleswitch = new Gtk.Switch({ active: getFunction(), tooltip_text: tooltip }); @@ -138,8 +138,8 @@ function _createSwitchbox(text, tooltip, getFunction, setFunction) { toggleswitch.connect('notify::active', setFunction); //fill the box with content - box.pack_start(label, true, true, 0); - box.add(toggleswitch); + box.append(label, true, true, 0); + box.append(toggleswitch); return box; } @@ -149,7 +149,7 @@ function _createSwitchbox(text, tooltip, getFunction, setFunction) { function _createComboBox(text, tooltip, values, getFunction, setFunction) { // create box with combo selection field - let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin: 5}); + let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin_top: 5, margin_end: 5, margin_bottom: 5, margin_start: 5 }); let label = new Gtk.Label({ label: text, xalign: 0, tooltip_text: tooltip }); let widget = new Gtk.ComboBoxText({ tooltip_text: tooltip }); for (id in values) { @@ -162,8 +162,8 @@ function _createComboBox(text, tooltip, values, getFunction, setFunction) { setFunction(combo_widget.get_active_id()); }); //fill the box with content - box.pack_start(label, true, true, 0); - box.add(widget); + box.append(label, true, true, 0); + box.append(widget); return box; } @@ -172,7 +172,7 @@ function _createComboBox(text, tooltip, values, getFunction, setFunction) { function _createAdjustBox(text, tooltip, LOWER, UPPER, INCREM, getFunction, setFunction) { // create box with adjust selection field - let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin: 5}); + let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin_top: 5, margin_end: 5, margin_bottom: 5, margin_start: 5}); let label = new Gtk.Label({ label: text, xalign: 0, tooltip_text: tooltip }); let adjustbox = new Gtk.Adjustment({ lower: LOWER, step_increment: INCREM, upper: UPPER, value: 1.0 }); let spinbutton = new Gtk.SpinButton({ adjustment: adjustbox, digits: 0, tooltip_text: tooltip}); @@ -194,8 +194,8 @@ function _createAdjustBox(text, tooltip, LOWER, UPPER, INCREM, getFunction, setF setFunction(spinbutton.value); }); //fill the box with content - box.pack_start(label, true, true, 0); - box.add(spinbutton, true, true, 5); + box.append(label, true, true, 0); + box.append(spinbutton, true, true, 5); return box; } @@ -205,7 +205,7 @@ function _createAdjustBox(text, tooltip, LOWER, UPPER, INCREM, getFunction, setF function _createKeybindbox(text, tooltip, secIconOK, secIcontooltipOK, secIconNOK, secIcontooltipNOK, getFunction, setFunction) { // create box with keybinding entry - let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin: 5}); + let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, margin_top: 5, margin_end: 5, margin_bottom: 5, margin_start: 5}); let label = new Gtk.Label({ label: text, xalign: 0, tooltip_text: tooltip }); let textbox = new Gtk.Entry({ text : getFunction(), tooltip_text: tooltip }); updateTextbox(); @@ -231,8 +231,8 @@ function _createKeybindbox(text, tooltip, secIconOK, secIcontooltipOK, secIconNO //fill the box with content - box.pack_start(label, true, true, 0); - box.add(textbox, true, true, 5); + box.append(label, true, true, 0); + box.append(textbox, true, true, 5); return box; } From fc5e7a5c94854dd1ade0d19be8f5864b9a1b54ed Mon Sep 17 00:00:00 2001 From: Adam Schmalhofer Date: Mon, 25 Oct 2021 08:27:41 +0200 Subject: [PATCH 3/3] Support Gnome 41 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index fc923d9..c736563 100644 --- a/metadata.json +++ b/metadata.json @@ -3,7 +3,7 @@ "name": "Turn off Display", "settings-schema": "org.gnome.shell.extensions.turnoffdisplay", "shell-version": [ - "40" + "40", "41" ], "url": "https://github.com/simonthechipmunk/turnoffdisplay", "uuid": "turnoffdisplay@simonthechipmunk.noreply.com",