From d5e54d4df5f431ce57ae3aa7025fa5ae1b846956 Mon Sep 17 00:00:00 2001 From: Eric Gach Date: Sat, 14 Apr 2018 20:02:51 -0500 Subject: [PATCH 1/6] Fixes #40 with lockscreen label --- desk-changer@eric.gach.gmail.com/menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desk-changer@eric.gach.gmail.com/menu.js b/desk-changer@eric.gach.gmail.com/menu.js index e1eb2c2..f8d639f 100644 --- a/desk-changer@eric.gach.gmail.com/menu.js +++ b/desk-changer@eric.gach.gmail.com/menu.js @@ -341,7 +341,7 @@ const DeskChangerProfileLockscreen = new Lang.Class({ value = _('(inherited)'); } - this.label.text = _('Lock Screen Profile') + value; + this.label.text = _('Lock Screen Profile') + ': ' + value; }, _populate_profiles: function () { From 3dc98d4c3694d4290f7ccc212708feef03b2a615 Mon Sep 17 00:00:00 2001 From: Eric Gach Date: Sun, 15 Apr 2018 01:26:21 -0500 Subject: [PATCH 2/6] Updating to fix ES6 warning --- desk-changer@eric.gach.gmail.com/daemon.js | 2 +- desk-changer@eric.gach.gmail.com/menu.js | 24 ++++++++++---------- desk-changer@eric.gach.gmail.com/settings.js | 2 +- desk-changer@eric.gach.gmail.com/ui.js | 8 +++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/desk-changer@eric.gach.gmail.com/daemon.js b/desk-changer@eric.gach.gmail.com/daemon.js index 7790fcd..59f7f0c 100644 --- a/desk-changer@eric.gach.gmail.com/daemon.js +++ b/desk-changer@eric.gach.gmail.com/daemon.js @@ -69,7 +69,7 @@ const DBusInterface = '\ '; const DBusProxy = Gio.DBusProxy.makeProxyWrapper(DBusInterface); -const DeskChangerDaemon = new Lang.Class({ +var DeskChangerDaemon = new Lang.Class({ Name: 'DeskChangerDaemon', _init: function (settings) { diff --git a/desk-changer@eric.gach.gmail.com/menu.js b/desk-changer@eric.gach.gmail.com/menu.js index f8d639f..75f9098 100644 --- a/desk-changer@eric.gach.gmail.com/menu.js +++ b/desk-changer@eric.gach.gmail.com/menu.js @@ -37,7 +37,7 @@ const debug = Me.imports.utils.debug; const error = Me.imports.utils.error; const Ui = Me.imports.ui; -const DeskChangerControls = new Lang.Class({ +var DeskChangerControls = new Lang.Class({ Name: 'DeskChangerControls', Extends: PopupMenu.PopupBaseMenuItem, @@ -152,7 +152,7 @@ const DeskChangerControls = new Lang.Class({ }, }); -const DeskChangerDaemonControls = new Lang.Class({ +var DeskChangerDaemonControls = new Lang.Class({ Name: 'DeskChangerDaemonControls', Extends: PopupMenu.PopupSwitchMenuItem, @@ -179,7 +179,7 @@ const DeskChangerDaemonControls = new Lang.Class({ } }); -const DeskChangerOpenCurrent = new Lang.Class({ +var DeskChangerOpenCurrent = new Lang.Class({ Name: 'DeskChangerOpenCurrent', Extends: PopupMenu.PopupMenuItem, @@ -202,7 +202,7 @@ const DeskChangerOpenCurrent = new Lang.Class({ } }); -const DeskChangerPreviewMenuItem = new Lang.Class({ +var DeskChangerPreviewMenuItem = new Lang.Class({ Name: 'DeskChangerPreviewMenuItem', Extends: PopupMenu.PopupBaseMenuItem, @@ -212,7 +212,7 @@ const DeskChangerPreviewMenuItem = new Lang.Class({ try { this.addActor(this._box, {align: St.Align.MIDDLE, span: -1}); } catch (e) { - this.actor.add_actor(this._box, {align: St.Align.MIDDLE, span: -1}); + this.actor.add_actor(this._box); } this._prefix = new St.Label({text: _('Open Next Wallpaper')}); this._box.add(this._prefix); @@ -241,7 +241,7 @@ const DeskChangerPreviewMenuItem = new Lang.Class({ } }); -const DeskChangerPopupSubMenuMenuItem = new Lang.Class({ +var DeskChangerPopupSubMenuMenuItem = new Lang.Class({ Abstract: true, Name: 'DeskChangerPopupSubMenuItem', Extends: PopupMenu.PopupSubMenuMenuItem, @@ -262,7 +262,7 @@ const DeskChangerPopupSubMenuMenuItem = new Lang.Class({ } }); -const DeskChangerPopupMenuItem = new Lang.Class({ +var DeskChangerPopupMenuItem = new Lang.Class({ Name: 'DeskChangerPopupMenuItem', Extends: PopupMenu.PopupMenuItem, @@ -296,7 +296,7 @@ const DeskChangerPopupMenuItem = new Lang.Class({ } }); -const DeskChangerProfileBase = new Lang.Class({ +var DeskChangerProfileBase = new Lang.Class({ Abstract: true, Name: 'DeskChangerProfileBase', Extends: DeskChangerPopupSubMenuMenuItem, @@ -317,7 +317,7 @@ const DeskChangerProfileBase = new Lang.Class({ } }); -const DeskChangerProfileDesktop = new Lang.Class({ +var DeskChangerProfileDesktop = new Lang.Class({ Name: 'DeskChangerProfileDesktop', Extends: DeskChangerProfileBase, @@ -326,7 +326,7 @@ const DeskChangerProfileDesktop = new Lang.Class({ }, }); -const DeskChangerProfileLockscreen = new Lang.Class({ +var DeskChangerProfileLockscreen = new Lang.Class({ Name: 'DeskChangerProfileLockscreen', Extends: DeskChangerProfileBase, @@ -351,7 +351,7 @@ const DeskChangerProfileLockscreen = new Lang.Class({ } }); -const DeskChangerRotation = new Lang.Class({ +var DeskChangerRotation = new Lang.Class({ Name: 'DeskChangerRotation', Extends: DeskChangerPopupSubMenuMenuItem, @@ -363,7 +363,7 @@ const DeskChangerRotation = new Lang.Class({ } }); -const DeskChangerSwitch = new Lang.Class({ +var DeskChangerSwitch = new Lang.Class({ Name: 'DeskChangerSwitch', Extends: PopupMenu.PopupSwitchMenuItem, diff --git a/desk-changer@eric.gach.gmail.com/settings.js b/desk-changer@eric.gach.gmail.com/settings.js index 81685a2..d454dda 100644 --- a/desk-changer@eric.gach.gmail.com/settings.js +++ b/desk-changer@eric.gach.gmail.com/settings.js @@ -24,7 +24,7 @@ const GLib = imports.gi.GLib; const Lang = imports.lang; const Me = imports.misc.extensionUtils.getCurrentExtension(); -const DeskChangerSettings = new Lang.Class({ +var DeskChangerSettings = new Lang.Class({ Name: 'DeskChangerSettings', _init: function () { diff --git a/desk-changer@eric.gach.gmail.com/ui.js b/desk-changer@eric.gach.gmail.com/ui.js index c588fd0..0da2d11 100644 --- a/desk-changer@eric.gach.gmail.com/ui.js +++ b/desk-changer@eric.gach.gmail.com/ui.js @@ -34,7 +34,7 @@ const _ = Gettext.gettext; const debug = Me.imports.utils.debug; const error = Me.imports.utils.error; -const DeskChangerButton = new Lang.Class({ +var DeskChangerButton = new Lang.Class({ Name: 'DeskChangerButton', Extends: St.Button, @@ -59,7 +59,7 @@ const DeskChangerButton = new Lang.Class({ } }); -const DeskChangerIcon = new Lang.Class({ +var DeskChangerIcon = new Lang.Class({ Name: 'DeskChangerIcon', Extends: St.Bin, @@ -137,7 +137,7 @@ const DeskChangerIcon = new Lang.Class({ } }); -const DeskChangerPreview = new Lang.Class({ +var DeskChangerPreview = new Lang.Class({ Name: 'DeskChangerPreview', Extends: St.Bin, @@ -222,7 +222,7 @@ const DeskChangerPreview = new Lang.Class({ } }); -const DeskChangerStateButton = new Lang.Class({ +var DeskChangerStateButton = new Lang.Class({ Name: 'DeskChangerStateButton', Extends: DeskChangerButton, From 24be42501acde9620b16625d6f135637a8a16961 Mon Sep 17 00:00:00 2001 From: Eric Gach Date: Sun, 15 Apr 2018 01:27:17 -0500 Subject: [PATCH 3/6] Moving update to not trigger signal --- desk-changer@eric.gach.gmail.com/prefs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desk-changer@eric.gach.gmail.com/prefs.js b/desk-changer@eric.gach.gmail.com/prefs.js index 63f1a10..691c733 100644 --- a/desk-changer@eric.gach.gmail.com/prefs.js +++ b/desk-changer@eric.gach.gmail.com/prefs.js @@ -55,7 +55,6 @@ const DeskChangerPrefs = new Lang.Class({ this._initExtension(); this._initDaemon(); this._load_profiles(); - this._update_rotation(); this.box.pack_start(this.notebook, true, true, 0); this.box.show_all(); this._is_init = false; @@ -83,6 +82,7 @@ const DeskChangerPrefs = new Lang.Class({ this._rotation_combo_box.insert_text(0, 'interval'); this._rotation_combo_box.insert_text(1, 'hourly'); this._rotation_combo_box.insert_text(2, 'disabled'); + this._update_rotation(); this._rotation_combo_box.connect('changed', Lang.bind(this, function (object) { this._settings.rotation = object.get_active_text(); })); From faaa7aa8d55c1923bd13fd6eeedfe7e5d0264acb Mon Sep 17 00:00:00 2001 From: Eric Gach Date: Sun, 15 Apr 2018 01:06:15 -0500 Subject: [PATCH 4/6] Updating daemon and extension to allow custom mime types --- .../deskchanger/profiles.py | 2 +- desk-changer@eric.gach.gmail.com/prefs.js | 20 ++++++++++++++++++ .../schemas/gschemas.compiled | Bin 1255 -> 1368 bytes ....shell.extensions.desk-changer.gschema.xml | 7 ++++++ desk-changer@eric.gach.gmail.com/settings.js | 10 +++++++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/desk-changer@eric.gach.gmail.com/deskchanger/profiles.py b/desk-changer@eric.gach.gmail.com/deskchanger/profiles.py index 1c5f9d7..514cf48 100644 --- a/desk-changer@eric.gach.gmail.com/deskchanger/profiles.py +++ b/desk-changer@eric.gach.gmail.com/deskchanger/profiles.py @@ -211,7 +211,7 @@ def _load_uri(self, uri, recursive, top_level=False): self._monitors.append(monitor) logger.debug('descending into %s to find wallpapers', location.get_uri()) self._load_children(location, recursive) - elif info.get_file_type() == Gio.FileType.REGULAR and info.get_content_type() in ACCEPTED: + elif info.get_file_type() == Gio.FileType.REGULAR and info.get_content_type() in self._settings.get_value('allowed-mime-types'): logger.debug('adding wallpaper %s', location.get_uri()) if location.get_uri() in self._wallpapers: logger.warning('%s already loaded, skipping duplicate', location.get_uri()) diff --git a/desk-changer@eric.gach.gmail.com/prefs.js b/desk-changer@eric.gach.gmail.com/prefs.js index 691c733..6b8cdd7 100644 --- a/desk-changer@eric.gach.gmail.com/prefs.js +++ b/desk-changer@eric.gach.gmail.com/prefs.js @@ -159,6 +159,26 @@ const DeskChangerPrefs = new Lang.Class({ })); box.pack_end(button, false, false, 5); daemon_box.pack_start(box, false, false, 5); + // Allowed Mime Types + box = new Gtk.Box({orientation: Gtk.Orientation.HORIZONTAL}); + label = new Gtk.Label({label: _('Allowed Mime Types')}); + box.pack_start(label, false, true, 5); + label = new Gtk.Label({label: ' '}); + box.pack_start(label, true, true, 5); + this._allowed_mime_types = new Gtk.TextBuffer({text: this._settings.allowed_mime_types.join("\n")}); + let textview = new Gtk.TextView({ + buffer: this._allowed_mime_types, + justification: Gtk.Justification.RIGHT, + }); + box.pack_end(textview, false, true, 5); + daemon_box.pack_start(box, false, false, 5); + box = new Gtk.Box({orientation: Gtk.Orientation.HORIZONTAL}); + button = new Gtk.Button({label: 'Save'}); + button.connect('clicked', Lang.bind(this, function () { + this._settings.allowed_mime_types = this._allowed_mime_types.text.split("\n"); + })); + box.pack_end(button, false, true, 5); + daemon_box.pack_start(box, false, false, 5); this.notebook.append_page(daemon_box, new Gtk.Label({label: _('Daemon')})); }, diff --git a/desk-changer@eric.gach.gmail.com/schemas/gschemas.compiled b/desk-changer@eric.gach.gmail.com/schemas/gschemas.compiled index 72f1520dc28118ee6904f62b117cb0fc23f7bd03..5a322541c7d31c35e2ae3eabe905824c921ef02b 100644 GIT binary patch literal 1368 zcmZuwJ!lj`7@eqzi5E>wP$Ur}h-NoYQO1^`ICL=fO8Iu>~CIYN;AVfhw6P<@+UdI#HqV zqR^Bo%1jr_Q!=b7jYwhj@|zFNT>-QLD|57ii4I^D(3ztP+`R-n&|K@;=*u^p&s=)M zjCcV41YH08sFyxRCtrPeMW1>- z{4wxRpjjtsAy6mqHDIo9?g!(k*C75b_&)Id$?ymI)T`jX0KW#dMISfNr*4D)4m=NZ z4sGnCPt9|E1Ahmeo;_FK{ZO~UX92eZeLqJB7*Ab*zXv=FJU?>$Bz@{G_+#J+pnl@< z9DQomAqJ7GteuJT;3w8pCq!SVxnduZkv-iE7&NjIoTd&)R8RfnD^Y^0X;y zrNY1Svw*eI^91Q844; zEGiJoxbaM2wqz%gX%aDQ-F&#PU0chr5(Nm#!d!bX^=78{V;Q>?%Va7G6Am7!lRZ)= zd!)|dBXyQOQb!1rZK|WJSlNE%RBII`OBNRuH7QdcSz((nO1#PZlJaX~`mP;flYbA^ zI9Fa!^LHKI&tAuIQlpWe)XH&XdAh2jG^`lWvT1Ys5DId}NXxjmGcQb3RrA_R%_J%) z1}aP&CuMz@J30mi1NDsb`LEmv5cP^@r0c5+o&l};RFrDJmdWh1IH}%&16nni+S!)P MmGI7Z(Uxcb0TN0nQ~&?~ literal 1255 zcmY*ZJ!lj`7@erm{F)z)gdj!`%f-A(S6?Cl;iyB9-@fY(beRFJF>TQE5a9r*Sl>SzPE??MN3=Pn$E?gF}jzk{2n$jqZp zRK+v!BJlCbjS2eHUGU$4mx0xR)!+1~55r#re+8ayJbz7}x(EJG@GoFu<;Mzr>SOS` zk#HaIWb54#`qUlp9k9o~`{#z}Q@6k$2Hyn+{)`XOr*4P80Dc5?WR4Her|yOS0{jwK zZojZdpSlzN68ICa{$b<`ed;#&Yv2uFY3_DA_l&w3{ucP?0qo<=_p6Mj<~$DA15U@A z{q(61!XE~Y0GCEDXXsNi|55NAATxgU0ex!v_rME4(H;nUBCa;x>Fd*k@RaWJk(v1l{lOW1|&GrZRI6|MQ25P$Q*2cw% z!}*2BoOM-(?9SI?whMugxlk4Gi)n3_;#7w-R@%qTpzT&9?##&4b!D2wp61NV0BPsk zopc)+qQ@@Ou77X3a@IJ;xO26MuoBH;w)12wGAZ%PLii{~-xi~9i_zaHMt^rP`a+l} zPJ+oGZV?Ve*=Y8K#jmC$hR(?+Ar;0jGqk<7lCr-9x zuraenIwpsl|NoIQyfB==WzDnJ`N}(hjdjg?pa)>xqwGX0z?$bBfFp$STDvzQtZUC% JK%zJY{{X;Z4!-~Z diff --git a/desk-changer@eric.gach.gmail.com/schemas/org.gnome.shell.extensions.desk-changer.gschema.xml b/desk-changer@eric.gach.gmail.com/schemas/org.gnome.shell.extensions.desk-changer.gschema.xml index e58d316..a010e56 100644 --- a/desk-changer@eric.gach.gmail.com/schemas/org.gnome.shell.extensions.desk-changer.gschema.xml +++ b/desk-changer@eric.gach.gmail.com/schemas/org.gnome.shell.extensions.desk-changer.gschema.xml @@ -1,5 +1,12 @@ + + + + These are the mime types that the daemon will recognise as valid files to load and use for backgrounds. + + Allowed mime types for loading backgrounds + true diff --git a/desk-changer@eric.gach.gmail.com/settings.js b/desk-changer@eric.gach.gmail.com/settings.js index d454dda..3e10841 100644 --- a/desk-changer@eric.gach.gmail.com/settings.js +++ b/desk-changer@eric.gach.gmail.com/settings.js @@ -38,6 +38,16 @@ var DeskChangerSettings = new Lang.Class({ this._handlers = []; }, + get allowed_mime_types() + { + return this.schema.get_value('allowed-mime-types').deep_unpack(); + }, + + set allowed_mime_types(value) + { + this.schema.set_value('allowed-mime-types', new GLib.Variant('as', value)); + }, + get auto_rotate() { return this.schema.get_boolean('auto-rotate'); }, From 733ecaf9632a05e7307961ac7fabd92bc67db91f Mon Sep 17 00:00:00 2001 From: Eric Gach Date: Sun, 15 Apr 2018 01:39:46 -0500 Subject: [PATCH 5/6] Updating dameno to detect changes --- desk-changer@eric.gach.gmail.com/deskchanger/profiles.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/desk-changer@eric.gach.gmail.com/deskchanger/profiles.py b/desk-changer@eric.gach.gmail.com/deskchanger/profiles.py index 514cf48..c08d254 100644 --- a/desk-changer@eric.gach.gmail.com/deskchanger/profiles.py +++ b/desk-changer@eric.gach.gmail.com/deskchanger/profiles.py @@ -4,7 +4,6 @@ import random from . import logger -ACCEPTED = ['application/xml', 'image/jpeg', 'image/png'] MAX_QUEUE_LENGTH = 100 @@ -35,6 +34,7 @@ def __init__(self, name): self._wallpapers = [] self._settings = Gio.Settings.new('org.gnome.shell.extensions.desk-changer') self._handler_profiles = self._settings.connect('changed::profiles', self._changed_profile) + self._handler_mime_types = self._settings.connect('changed::allowed-mime-types', self._changed_profile) self._handler_random = self._settings.connect('changed::random', self._changed_random) logger.debug('successfully created %s', self) @@ -47,6 +47,7 @@ def destroy(self): """ self._remove_monitors() self._settings.disconnect(self._handler_profiles) + self._settings.disconnect(self._handler_mime_types) self._settings.disconnect(self._handler_random) del self._settings @@ -120,9 +121,11 @@ def save_state(self): logger.info('saving state of %s is disabled while type %s', self.name, self) def _changed_profile(self, obj, key): - if self._hash == sha256(str(self._settings.get_value(key).unpack().get(self.name)).encode('utf-8')): + if key == 'current-profile' and self._hash == sha256(str(self._settings.get_value('current-profile').unpack().get(self.name)).encode('utf-8')): logger.info('not reloading profile, hashes match') return + elif key == 'allowed-mime-types': + logger.info('reloading profile since mime types changed') self.load() def _changed_random(self, obj, key): From 7b085a2dbd3067300c42ac1ed4d7d18137e2abf4 Mon Sep 17 00:00:00 2001 From: Eric Gach Date: Sun, 15 Apr 2018 01:41:57 -0500 Subject: [PATCH 6/6] Bumping version for release --- desk-changer@eric.gach.gmail.com/metadata.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/desk-changer@eric.gach.gmail.com/metadata.json b/desk-changer@eric.gach.gmail.com/metadata.json index 5421a86..6f1be3d 100644 --- a/desk-changer@eric.gach.gmail.com/metadata.json +++ b/desk-changer@eric.gach.gmail.com/metadata.json @@ -8,9 +8,10 @@ "3.21.91", "3.22", "3.24", - "3.26" + "3.26", + "3.28" ], "url": "https://github.com/BigE/desk-changer/", "uuid": "desk-changer@eric.gach.gmail.com", - "version": "26" + "version": "27" }