Skip to content

Commit

Permalink
Merge branch 'release/version-35'
Browse files Browse the repository at this point in the history
  • Loading branch information
BigE committed Nov 8, 2022
2 parents d55eae5 + 624b240 commit 6a57d7c
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 34 deletions.
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
/.idea/
/.nbproject/private/
/.settings
/[email protected]
*.pyc
*.pyo
*.gresource
/*.code-workspace
/.vscode

# zip ignore
/*.zip

# build files
*.gresource
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
UUID = [email protected]
VERSION = 32
VERSION = 35

ifeq ($(strip $(DESTDIR)),)
INSTALLBASE = $(HOME)/.local/share/gnome-shell/extensions
Expand Down
7 changes: 5 additions & 2 deletions [email protected]/daemon/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ var Server = GObject.registerClass({
},
class Server extends Gio.Application {
_init() {
this._background = new Gio.Settings({'schema': 'org.gnome.desktop.background'});
this._background_schema = Gio.SettingsSchemaSource.get_default().lookup('org.gnome.desktop.background', true);
this._background = new Gio.Settings({schema: 'org.gnome.desktop.background'});
this._current_profile_changed_id = null;
this._dbus_id = null;
this._interval_changed_id = null;
Expand Down Expand Up @@ -352,7 +353,9 @@ class Server extends Gio.Application {
_set_wallpaper(uri) {
deskchanger.debug(`setting wallpaper to ${uri}`);
this._background.set_string('picture-uri', uri);
this._background.set_string('picture-uri-dark', uri);
if (this._background_schema.has_key('picture-uri-dark')) {
this._background.set_string('picture-uri-dark', uri);
}
this.emit_signal('Changed', new GLib.Variant('(s)', [uri]));
}
}
Expand Down
5 changes: 3 additions & 2 deletions [email protected]/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
"3.38",
"40",
"41",
"42"
"42",
"43"
],
"url": "https://github.com/BigE/desk-changer/",
"uuid": "[email protected]",
"version": "34"
"version": "35"
}
62 changes: 40 additions & 22 deletions [email protected]/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,22 @@ class PrefsWidget extends Gtk.Box {
}

_on_button_add_folders_clicked() {
let dialog = new AddItemsDialog({'title': 'Add Folders', 'action': Gtk.FileChooserAction.SELECT_FOLDER});
let dialog = new AddItemsDialog({
action: Gtk.FileChooserAction.SELECT_FOLDER,
title: 'Add Folders',
transient_for: this.get_root(),
});

dialog.show();
dialog.connect('response', this._on_response_add_items.bind(this));
}

_on_button_add_items_clicked() {
let dialog = new AddItemsDialog({'title': 'Add Images', 'action': Gtk.FileChooserAction.OPEN}),
let dialog = new AddItemsDialog({
action: Gtk.FileChooserAction.OPEN,
title: 'Add Images',
transient_for: this.get_root(),
}),
filter = new Gtk.FileFilter();

deskchanger.settings.allowed_mime_types.forEach(value => {
Expand All @@ -170,7 +178,10 @@ class PrefsWidget extends Gtk.Box {
}

_on_button_add_profile_clicked() {
let dialog = new Gtk.Dialog(),
let dialog = new Gtk.Dialog({
title: 'DeskChanger New Profile',
transient_for: this.get_root(),
}),
mbox = dialog.get_content_area(),
box = new Gtk.Box({orientation: Gtk.Orientation.HORIZONTAL}),
label = new Gtk.Label({label: _('Profile Name')}),
Expand All @@ -187,8 +198,9 @@ class PrefsWidget extends Gtk.Box {
mbox.append(box);
}

dialog.add_button(_('OK'), Gtk.ResponseType.OK);
dialog.add_button(_('Add'), Gtk.ResponseType.OK);
dialog.add_button(_('Cancel'), Gtk.ResponseType.CANCEL);
dialog.set_default_response(Gtk.ResponseType.OK);
dialog.connect('response', (_dialog, result) => {
if (result === Gtk.ResponseType.OK) {
let _profiles = deskchanger.settings.profiles,
Expand All @@ -198,7 +210,7 @@ class PrefsWidget extends Gtk.Box {
this._load_profiles();
this._combo_location_profile.set_active_id(profile);
}
dialog.destroy();
_dialog.destroy();
});
dialog.show();
}
Expand All @@ -212,14 +224,16 @@ class PrefsWidget extends Gtk.Box {

if (this._locations.iter_n_children(iterator) === 1) {
let dialog = new Gtk.MessageDialog({
'buttons': Gtk.ButtonsType.OK,
'message-type': Gtk.MessageType.ERROR,
'text': 'You cannot remove the last item in a profile',
buttons: Gtk.ButtonsType.OK,
message_type: Gtk.MessageType.ERROR,
text: 'You cannot remove the last item in a profile',
title: 'DeskChanger Error',
transient_for: this.get_root(),
});
dialog.show();
dialog.connect('response', () => {
dialog.destroy();
dialog.connect('response', (_dialog, response) => {
_dialog.destroy();
});
dialog.show();
return;
}

Expand All @@ -240,23 +254,26 @@ class PrefsWidget extends Gtk.Box {

if (deskchanger.settings.current_profile === profile) {
dialog = new Gtk.MessageDialog({
'buttons': Gtk.ButtonsType.CLOSE,
'message-type': Gtk.MessageType.ERROR,
'text': 'You cannot remove the current profile',
buttons: Gtk.ButtonsType.CLOSE,
message_type: Gtk.MessageType.ERROR,
text: 'You cannot remove the current profile',
title: 'DeskChanger Error',
transient_for: this.get_root(),
});
dialog.show();
dialog.connect('response', (_dialog, response) => {
dialog.destroy();
})
_dialog.destroy();
});
dialog.show();
return;
}

dialog = new Gtk.MessageDialog({
'buttons': Gtk.ButtonsType.YES_NO,
'message-type': Gtk.MessageType.QUESTION,
'text': `Are you sure you want to remove the profile "${profile}"?`
buttons: Gtk.ButtonsType.YES_NO,
message_type: Gtk.MessageType.QUESTION,
text: `Are you sure you want to remove the profile "${profile}"?`,
title: 'DeskChanger Confirm',
transient_for: this.get_root(),
});
dialog.show();
dialog.connect('response', (_dialog, response) => {
if (response === Gtk.ResponseType.YES) {
profiles = deskchanger.settings.profiles;
Expand All @@ -265,8 +282,9 @@ class PrefsWidget extends Gtk.Box {
this._load_profiles();
}

dialog.destroy();
_dialog.destroy();
});
dialog.show();
}

_on_cell_location_edited(_widget, path, new_text) {
Expand Down
Binary file modified [email protected]/schemas/gschemas.compiled
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<schemalist>
<schema id="org.gnome.Shell.Extensions.DeskChanger" path="/org/gnome/shell/extensions/desk-changer/">
<key name="allowed-mime-types" type="as">
<default><![CDATA[['application/xml', 'image/jpeg', 'image/png']]]></default>
<default><![CDATA[['application/xml', 'image/jpeg', 'image/png', 'image/webp', 'image/svg+xml']]]></default>
<description>
These are the mime types that the daemon will recognise as valid files to load and use for backgrounds.
</description>
Expand Down
4 changes: 2 additions & 2 deletions [email protected]/ui/popupMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class DeskChangerPopupMenuOpenCurrent extends PopupMenu.PopupMenuItem {
this._background = new Gio.Settings({'schema': 'org.gnome.desktop.background'});
this._activate_id = this.connect('activate', () => {
deskchanger.debug(`opening current wallpaper ${this._background.get_string('picture-uri')}`);
Util.spawn(['xdg-open', this._background.get_string('picture-uri')]);
Gio.AppInfo.launch_default_for_uri(this._background.get_string('picture-uri'), global.create_app_launch_context(0, -1));
});
deskchanger.debug(`connect active (${this._activate_id})`);
}
Expand Down Expand Up @@ -185,7 +185,7 @@ class DeskChangerPopupMenuPreviewMenuItem extends PopupMenu.PopupBaseMenuItem {
this._activate_id = this.connect('activate', () => {
if (this._preview.file) {
deskchanger.debug(`opening file ${this._preview.file}`);
Util.spawn(['xdg-open', this._preview.file]);
Gio.AppInfo.launch_default_for_uri(this._preview.file, global.create_app_launch_context(0, -1));
} else {
Utils.error('no preview set');
}
Expand Down

0 comments on commit 6a57d7c

Please sign in to comment.