From d63b666e9bee05e5429df1ed067ef32cf4e54298 Mon Sep 17 00:00:00 2001 From: kgshank Date: Sun, 28 Mar 2021 17:24:07 +0200 Subject: [PATCH] V40 compatibility update --- disconnect-wifi@kgshank.net/metadata.json | 5 +- disconnect-wifi@kgshank.net/prefs.js | 18 +- .../ui/dwifi-prefs-dialog.glade | 171 ++++++------------ 3 files changed, 74 insertions(+), 120 deletions(-) diff --git a/disconnect-wifi@kgshank.net/metadata.json b/disconnect-wifi@kgshank.net/metadata.json index 77f6ce1..10520aa 100644 --- a/disconnect-wifi@kgshank.net/metadata.json +++ b/disconnect-wifi@kgshank.net/metadata.json @@ -3,12 +3,13 @@ "3.32", "3.34", "3.36", - "3.38" + "3.38", + "40" ], "uuid": "disconnect-wifi@kgshank.net", "name": "Disconnect Wifi", "description": "Adds a Disconnect option for Wifi in status menu, when a network is connected. Shows a Reconnect option, after network is disconnected.", - "version": "26", + "version": "27", "original-author": "GopI", "url": "https://github.com/kgshank/gse-disconnect-wifi" } diff --git a/disconnect-wifi@kgshank.net/prefs.js b/disconnect-wifi@kgshank.net/prefs.js index cfa1a68..4a6346e 100755 --- a/disconnect-wifi@kgshank.net/prefs.js +++ b/disconnect-wifi@kgshank.net/prefs.js @@ -42,6 +42,16 @@ const DWifiSettingsWidget = new GObject.Class({ _init : function(params) { this.parent(params); + let uiFileSuffix = ""; + if (Gtk.get_major_version() >= "4") { + uiFileSuffix = "40"; + this.__addFn = this.append; + this.__showFn = this.show; + } + else { + this.__addFn = x => this.pack_start(x, true, true, 0); + this.__showFn = this.show_all; + } this.orientation = Gtk.Orientation.VERTICAL; this.spacing = 0; @@ -49,7 +59,7 @@ const DWifiSettingsWidget = new GObject.Class({ this._settings = Lib.getSettings(SETTINGS_SCHEMA); // creates the ui builder and add the main resource file - let uiFilePath = Me.path + "/ui/dwifi-prefs-dialog.glade"; + let uiFilePath = Me.path + "/ui/dwifi-prefs-dialog" +uiFileSuffix +".glade"; let builder = new Gtk.Builder(); if (builder.add_from_file(uiFilePath) == 0) { @@ -59,13 +69,13 @@ const DWifiSettingsWidget = new GObject.Class({ vexpand : true }); - this.pack_start(label, true, true, 0); + this.__addFn(label); } else { _l('JS LOG:_UI file receive and load: ' + uiFilePath); let mainContainer = builder.get_object("main-container"); - this.pack_start(mainContainer, true, true, 0); + this.__addFn(mainContainer); this._signalManager = new SignalManager(); @@ -81,7 +91,7 @@ const DWifiSettingsWidget = new GObject.Class({ function buildPrefsWidget() { let _settingsWidget = new DWifiSettingsWidget(); - _settingsWidget.show_all(); + _settingsWidget.__showFn(); return _settingsWidget; } diff --git a/disconnect-wifi@kgshank.net/ui/dwifi-prefs-dialog.glade b/disconnect-wifi@kgshank.net/ui/dwifi-prefs-dialog.glade index 4ba8368..76689c8 100755 --- a/disconnect-wifi@kgshank.net/ui/dwifi-prefs-dialog.glade +++ b/disconnect-wifi@kgshank.net/ui/dwifi-prefs-dialog.glade @@ -1,146 +1,89 @@ - + - - - - - - - - - - monochrome - Monochrome - - - colored - Colored - - - none - None - - - - False - 6 - 6 - 6 - 6 + False + + + 6 + 6 vertical 2 - + True - False - True - True - True + False + 0 + out - - True - False - 12 - 6 - 12 - 12 - vertical - 12 - - + + True - False - 0 - out + False + none - + + 100 True - False + True - + True - False - none + False + 6 + 6 + + + True + False + start + + + Always show Reconnect option + + + True + True + 0 + + - - 100 + True - True - - - True - False - 6 - 6 - - - True - False - start - 5 - 10 - Always show Reconnect option - - - True - True - 0 - - - - - True - True - end - 10 - 5 - - - False - True - 1 - - - - + True + end + + + + False + True + 1 + - - - True - False - General Settings - - - - - - - False - True - 0 - - + + + + + True + False + General Settings + + + - - False - True - 0 - False True - 1 + 0