mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
app: Use Adw.StyleManager to enable dark-theme
Latest libadwaita (for reasons unknown to me) totally ignores/breaks dark theme usage with gtk_application_prefer_dark_theme property. Lets just try using the new Adw.StyleManager without asking questions why.
This commit is contained in:
@@ -96,13 +96,6 @@ class ClapperAppBase extends Gtk.Application
|
||||
if(accels)
|
||||
this.set_accels_for_action(`app.${name}`, accels);
|
||||
}
|
||||
|
||||
const gtkSettings = Gtk.Settings.get_default();
|
||||
settings.bind(
|
||||
'dark-theme', gtkSettings,
|
||||
'gtk-application-prefer-dark-theme',
|
||||
Gio.SettingsBindFlags.GET
|
||||
);
|
||||
this.doneFirstActivate = true;
|
||||
}
|
||||
});
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const { Gdk, Gio, GObject, Gst, GstClapper, Gtk } = imports.gi;
|
||||
const { Adw, Gdk, Gio, GObject, Gst, GstClapper, Gtk } = imports.gi;
|
||||
const ByteArray = imports.byteArray;
|
||||
const Debug = imports.src.debug;
|
||||
const Misc = imports.src.misc;
|
||||
@@ -74,6 +74,7 @@ class ClapperPlayer extends GstClapper.Clapper
|
||||
set_and_bind_settings()
|
||||
{
|
||||
const settingsToSet = [
|
||||
'dark-theme',
|
||||
'after-playback',
|
||||
'seeking-mode',
|
||||
'audio-offset',
|
||||
@@ -657,6 +658,19 @@ class ClapperPlayer extends GstClapper.Clapper
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'dark-theme':
|
||||
/* TODO: Remove libadwaita alpha2 compat someday */
|
||||
if (Adw.StyleManager != null) {
|
||||
const styleManager = Adw.StyleManager.get_default();
|
||||
styleManager.color_scheme = (settings.get_boolean(key))
|
||||
? Adw.ColorScheme.FORCE_DARK
|
||||
: Adw.ColorScheme.FORCE_LIGHT;
|
||||
}
|
||||
else {
|
||||
const gtkSettings = Gtk.Settings.get_default();
|
||||
gtkSettings.gtk_application_prefer_dark_theme = settings.get_boolean(key);
|
||||
}
|
||||
break;
|
||||
case 'render-shadows':
|
||||
root = this.widget.get_root();
|
||||
if(!root) break;
|
||||
|
Reference in New Issue
Block a user