| |
@@ -25,12 +25,19 @@
|
| |
|
| |
this._settings = settings;
|
| |
this._settings.connect('changed', (s, key) => {
|
| |
- if (key === 'logo-file' ||
|
| |
+ if (key === this._logoKey ||
|
| |
key === 'logo-size')
|
| |
this._logo = null;
|
| |
this._preview.queue_draw();
|
| |
});
|
| |
|
| |
+ this._styleManager = Adw.StyleManager.get_default();
|
| |
+ this._styleManager.connect('notify::dark', () => {
|
| |
+ this._background = null;
|
| |
+ this._logo = null;
|
| |
+ this._preview.queue_draw();
|
| |
+ });
|
| |
+
|
| |
this._preview = new Gtk.DrawingArea({
|
| |
halign: Gtk.Align.CENTER,
|
| |
margin_bottom: 12,
|
| |
@@ -77,7 +84,10 @@
|
| |
|
| |
_createBackgroundThumbnail(width, height) {
|
| |
let settings = new Gio.Settings({ schema_id: BACKGROUND_SCHEMA });
|
| |
- let uri = settings.get_default_value('picture-uri').deep_unpack();
|
| |
+ const bgKey = this._styleManager.dark
|
| |
+ ? 'picture-uri-dark'
|
| |
+ : 'picture-uri';
|
| |
+ let uri = settings.get_default_value(bgKey).deep_unpack();
|
| |
let file = Gio.File.new_for_commandline_arg(uri);
|
| |
|
| |
if (uri.endsWith('.xml'))
|
| |
@@ -88,7 +98,10 @@
|
| |
}
|
| |
|
| |
_createLogoThumbnail(width) {
|
| |
- let filename = this._settings.get_string('logo-file');
|
| |
+ this._logoKey = this._styleManager.dark
|
| |
+ ? 'logo-file-dark'
|
| |
+ : 'logo-file';
|
| |
+ let filename = this._settings.get_string(this._logoKey);
|
| |
let file = Gio.File.new_for_commandline_arg(filename);
|
| |
let pixbuf = GdkPixbuf.Pixbuf.new_from_file(file.get_path());
|
| |
let size = this._settings.get_double('logo-size') / 100;
|
| |
@@ -146,6 +159,7 @@
|
| |
super._init({ title: 'Logo' });
|
| |
|
| |
this._settings = settings;
|
| |
+ this._fileChooserKey = '';
|
| |
|
| |
const filter = new Gtk.FileFilter();
|
| |
filter.add_pixbuf_formats();
|
| |
@@ -158,25 +172,42 @@
|
| |
this._fileChooser.connect('response', (dlg, response) => {
|
| |
if (response !== Gtk.ResponseType.ACCEPT)
|
| |
return;
|
| |
- this._settings.set_string('logo-file', dlg.get_file().get_path());
|
| |
+ this._settings.set_string(this._fileChooserKey,
|
| |
+ dlg.get_file().get_path());
|
| |
});
|
| |
|
| |
this._filenameLabel = new Gtk.Label();
|
| |
+ this._filenameDarkLabel = new Gtk.Label();
|
| |
this._settings.connect('changed::logo-file',
|
| |
- () => this._updateFilenameLabel());
|
| |
- this._updateFilenameLabel();
|
| |
+ () => this._updateFilenameLabels());
|
| |
+ this._settings.connect('changed::logo-file-dark',
|
| |
+ () => this._updateFilenameLabels());
|
| |
+ this._updateFilenameLabels();
|
| |
|
| |
const filenameRow = new Adw.ActionRow({
|
| |
title: 'Filename',
|
| |
activatable: true,
|
| |
});
|
| |
filenameRow.connect('activated', () => {
|
| |
+ this._fileChooserKey = 'logo-file';
|
| |
this._fileChooser.transient_for = this.get_root();
|
| |
this._fileChooser.show();
|
| |
});
|
| |
filenameRow.add_suffix(this._filenameLabel);
|
| |
this.add(filenameRow);
|
| |
|
| |
+ const filenameDarkRow = new Adw.ActionRow({
|
| |
+ title: 'Filename (dark)',
|
| |
+ activatable: true,
|
| |
+ });
|
| |
+ filenameDarkRow.connect('activated', () => {
|
| |
+ this._fileChooserKey = 'logo-file-dark';
|
| |
+ this._fileChooser.transient_for = this.get_root();
|
| |
+ this._fileChooser.show();
|
| |
+ });
|
| |
+ filenameDarkRow.add_suffix(this._filenameDarkLabel);
|
| |
+ this.add(filenameDarkRow);
|
| |
+
|
| |
const positionModel = new Gio.ListStore({ item_type: LogoPosition });
|
| |
positionModel.append(new LogoPosition('Center', 'center'));
|
| |
positionModel.append(new LogoPosition('Bottom left', 'bottom-left'));
|
| |
@@ -248,9 +279,12 @@
|
| |
return adj;
|
| |
}
|
| |
|
| |
- _updateFilenameLabel() {
|
| |
+ _updateFilenameLabels() {
|
| |
const filename = this._settings.get_string('logo-file');
|
| |
this._filenameLabel.label = GLib.basename(filename);
|
| |
+
|
| |
+ const filenameDark = this._settings.get_string('logo-file-dark');
|
| |
+ this._filenameDarkLabel.label = GLib.basename(filenameDark);
|
| |
}
|
| |
|
| |
on_destroy() {
|
| |
gnome-shell uses a different setting when dark mode is active.
Account for that when checking whether the current background
corresponds to the setting's default value.