diff --git a/randomwallpaper@iflow.space/extension.js b/randomwallpaper@iflow.space/extension.js index 523b78d..d59f39c 100644 --- a/randomwallpaper@iflow.space/extension.js +++ b/randomwallpaper@iflow.space/extension.js @@ -22,35 +22,58 @@ const Timer = Self.imports.timer; const Gio = imports.gi.Gio; // Settings -const Convenience = Self.imports.convenience; +const Prefs = Self.imports.settings; let wallpaperController; let extensionMeta; let panelEntry; +let settings; +let hidePanelIconHandler = null; + function init(metaData) { extensionMeta = metaData; + settings = new Prefs.Settings(); wallpaperController = new WallpaperController.WallpaperController(metaData); } function enable() { // enable Extension + // UI panelEntry = new RandomWallpaperEntry(0, "Random wallpaper"); // add to panel Main.panel.addToStatusArea("random-wallpaper-menu", panelEntry); + + hidePanelIconHandler = settings.observe('hide-panel-icon', updatePanelMenuVisibility); + updatePanelMenuVisibility(); } function disable() { // disable Extension panelEntry.destroy(); + // remove all signal handlers + if (hidePanelIconHandler !== null) { + settings.disconnect(hidePanelIconHandler); + } + // cleanup the timer singleton let timer = new Timer.AFTimer(); timer.cleanup(); } +function updatePanelMenuVisibility(isVisible) { + + if (settings.get('hide-panel-icon', 'boolean')) { + panelEntry.actor.hide(); + } else { + panelEntry.actor.show(); + } + +} + var RandomWallpaperEntry = new Lang.Class({ Extends: PanelMenu.Button, Name: "RandomWallpaperEntry", diff --git a/randomwallpaper@iflow.space/prefs.js b/randomwallpaper@iflow.space/prefs.js index 9a373aa..e03f5b3 100644 --- a/randomwallpaper@iflow.space/prefs.js +++ b/randomwallpaper@iflow.space/prefs.js @@ -136,6 +136,10 @@ var RandomWallpaperSettings = new Lang.Class({ this._settings.bind('disable-hover-preview', this._builder.get_object('disable-hover-preview'), 'active', + Gio.SettingsBindFlags.DEFAULT) + this._settings.bind('hide-panel-icon', + this._builder.get_object('hide-panel-icon'), + 'active', Gio.SettingsBindFlags.DEFAULT); }, diff --git a/randomwallpaper@iflow.space/schemas/gschemas.compiled b/randomwallpaper@iflow.space/schemas/gschemas.compiled index 68e489d..bee5c6b 100644 Binary files a/randomwallpaper@iflow.space/schemas/gschemas.compiled and b/randomwallpaper@iflow.space/schemas/gschemas.compiled differ diff --git a/randomwallpaper@iflow.space/schemas/org.gnome.shell.extensions.space.iflow.randomwallpaper.gschema.xml b/randomwallpaper@iflow.space/schemas/org.gnome.shell.extensions.space.iflow.randomwallpaper.gschema.xml index e365238..0911d56 100644 --- a/randomwallpaper@iflow.space/schemas/org.gnome.shell.extensions.space.iflow.randomwallpaper.gschema.xml +++ b/randomwallpaper@iflow.space/schemas/org.gnome.shell.extensions.space.iflow.randomwallpaper.gschema.xml @@ -69,6 +69,12 @@ Disables the preview of the background while hovering the history list + + false + Hide the panel icon + Removes the panel icon from the gnome shell. + + + + False + True + 0 + + + + + True + False + 0 + in + + + True + False + 15 + 15 + 15 + 15 + + + True + False + 10 + 2 + + + True + False + True + True + + + True + False + start + Hide the panel icon + + + 0 + 0 + + + + + True + False + True + This option hides the panel icon. Therefore, you won't be able to access the history and the settings through the panel menu. Enabling this option currently is only reasonable in conjunction with the Auto-Fetching feature. + True + True + 1 + 0 + + + + 0 + 1 + + + + + True + False + 10 + True + Only enable this option if you know how to open the settings without the panel icon! + True + True + 1 + 0 + + + + + + + + 0 + 2 + + + + + 0 + 0 + + + + + True + False + vertical + + + True + True + end + start + + + False + True + 0 + + + + + 1 + 0 + + + + + + + + + + False True