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/deskchanger/profiles.py b/desk-changer@eric.gach.gmail.com/deskchanger/profiles.py
index 1c5f9d7..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):
@@ -211,7 +214,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/menu.js b/desk-changer@eric.gach.gmail.com/menu.js
index e1eb2c2..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,
@@ -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 () {
@@ -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/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"
}
diff --git a/desk-changer@eric.gach.gmail.com/prefs.js b/desk-changer@eric.gach.gmail.com/prefs.js
index 63f1a10..6b8cdd7 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();
}));
@@ -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 72f1520..5a32254 100644
Binary files a/desk-changer@eric.gach.gmail.com/schemas/gschemas.compiled and b/desk-changer@eric.gach.gmail.com/schemas/gschemas.compiled differ
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 81685a2..3e10841 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 () {
@@ -38,6 +38,16 @@ const 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');
},
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,