diff --git a/po/rounded-window-corners@yilozt.pot b/po/rounded-window-corners@yilozt.pot index 12a1190..b846568 100644 --- a/po/rounded-window-corners@yilozt.pot +++ b/po/rounded-window-corners@yilozt.pot @@ -2,7 +2,7 @@ msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Report-Msgid-Bugs-To: yilozt@outlook.com\n" -"Project-Id-Version: 11\n" +"Project-Id-Version: 12\n" #: src/preferences/pages/general.ui:284 msgid "Add Settings Entry in right-click menu of Background" @@ -183,7 +183,7 @@ msgid "Right" msgstr "" #: src/utils/ui.ts:103 -#: src/utils/ui.ts:131 +#: src/utils/ui.ts:132 msgid "Rounded Corners Settings..." msgstr "" diff --git a/src/preferences/pages/general.ts b/src/preferences/pages/general.ts index a7b8531..c3ae795 100644 --- a/src/preferences/pages/general.ts +++ b/src/preferences/pages/general.ts @@ -8,7 +8,6 @@ import { settings } from '../../utils/settings.js' import { SchemasKeys } from '../../utils/settings.js' import { connections } from '../../utils/connections.js' import { list_children } from '../../utils/prefs.js' -import { _log } from '../../utils/log.js' import { RoundedCornersItem } from '../widgets/rounded_corners_item.js' import { EditShadowWindow } from '../widgets/edit_shadow_window.js' import { ResetDialog } from '../widgets/reset_dialog.js' @@ -157,18 +156,6 @@ export const General = GObject.registerClass ( }) } - vfunc_root (): void { - super.vfunc_root () - const win = this.root as Gtk.Window - - // Disconnect all signal when close prefs - win.connect ('close-request', () => { - _log ('Disconnect Signals') - connections.get ().disconnect_all () - connections.del () - }) - } - private build_ui () { list_children (this.config_items).forEach ((i) => { this.config_items.remove (i) diff --git a/src/prefs.ts b/src/prefs.ts index c5bcb4b..7934482 100644 --- a/src/prefs.ts +++ b/src/prefs.ts @@ -2,8 +2,10 @@ import * as Gtk from 'gi://Gtk' import * as Gdk from 'gi://Gdk' import * as Adw from 'gi://Adw' -import { init_settings } from './utils/settings.js' +import { connections } from './utils/connections.js' +import { init_settings, uninit_settings } from './utils/settings.js' import { pages } from './preferences/index.js' +import { _log } from './utils/log.js' import * as Utils from './utils/io.js' import { ExtensionPreferences } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js' @@ -40,6 +42,14 @@ export default class RoundedWindowCornresPrefs extends ExtensionPreferences { win.add (pref_page) } + // Disconnect all signal when close prefs + win.connect ('close-request', () => { + _log ('Disconnect Signals') + connections.get ().disconnect_all () + connections.del () + uninit_settings () + }) + this._load_css () } } diff --git a/src/utils/settings.ts b/src/utils/settings.ts index 5ef5902..15924b2 100644 --- a/src/utils/settings.ts +++ b/src/utils/settings.ts @@ -203,6 +203,10 @@ export class Settings { log (`[RoundedWindowCorners] Update Settings to v${VERSION}`) } + + _disable () { + (this.g_settings as Gio.Settings | null) = null + } } /** A singleton instance of Settings */ @@ -212,6 +216,11 @@ export const init_settings = (g_settings: Gio.Settings) => { _settings = new Settings (g_settings) } +export const uninit_settings = () => { + _settings?._disable () + ;(_settings as Settings | null) = null +} + /** Access _settings by this method */ export const settings = () => { return _settings