From 4b0dcb35e9f8035e5a90c0696a91ec7aaa3e1c78 Mon Sep 17 00:00:00 2001 From: Wolfgang Rumpler Date: Sun, 29 Jul 2018 16:02:38 +0200 Subject: [PATCH] implement hidable panel icon closes #25 --- randomwallpaper@iflow.space/extension.js | 25 +++- randomwallpaper@iflow.space/prefs.js | 4 + .../schemas/gschemas.compiled | Bin 2916 -> 2980 bytes ...ns.space.iflow.randomwallpaper.gschema.xml | 6 + randomwallpaper@iflow.space/settings.js | 11 +- randomwallpaper@iflow.space/settings.ui | 125 ++++++++++++++++++ 6 files changed, 164 insertions(+), 7 deletions(-) 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 68e489dffaaf8f976ac6d5b14c04cdec57cbf82a..bee5c6b230062634e2370d0dea3bbe7e736ba906 100644 GIT binary patch delta 633 zcmYjOJ1+!L7`>j$tgwhzqEIng+)^Y8iAFp&XqB_G*UrS)k(t>+gl#pFO@?R`BuWjH zM57T32_X^+i9#vj56C)a5WeKhIdi`6&OLYTYv*BC`Kb4(QHZ(@Au6b?q(Egv8GHyt zpEX0rmAOQzi9V_ds0M0&Pz$aHxQ;Xb(U3YgVV@hciBOz_uYuzBKe+zy9!pd+j{RgeYQ-ztMOV+JE!z)VZ&f;~ zkPl)L0fgW>UP~^z(55HiTSC;hl>lR_xQ!ng-&O;dm9u>#>nLftA#yBvDzw$|cMDHF z8|^g?^jUUJ$t9zp9BG?w;kS)2zFYK66-{ZIY11+ac_kg!T#&x$DfK<~mpERg8-A2Y Gc7FjR7JdN$ delta 529 zcmYk3y-UMT6veOB^dkWkYpp^BCvAsp6~RFip-55e>Smfgn__7sNuwgRtAj%!1zj8j z2Zti))KPG7ROq6Jn}eVh{{gAzmI^-j<(!HwMrRi z4tPJlx$DkGpxVu`)dze)`bPksK^>BNL=T#&0eCJRAeT;|XCVE!bk8|^&M%>NU?RM* z&N=%C@+askDA&`^$gABO85{2izrf##+4G6Np`++N{V?0+LhJ|ed>pzA+|GQAbM}7Z z8R!+~t&<_n*-OZq&=$BotSCGY_7bIVBA7775F9?g;TPDCa06%(v_C7|LhLzTf$}(w zg6){rK2cn=y}CTJnJd^@wkTA?bcLnvSi&ucU2JC)TG=txE#c?}>f;_)o;4a%Kj6i4 z=UMZA@B{w(UI(=(N_od1?;|u7w9T@m3;e(r`N&h`MXwQ>j8S|qp&ME$FVv!`Z>zR$ N2~k1?H1m#?@n89lY`p*g 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