[totem/wip/cdavis/force-dark: 6/8] main: Use libhandy to force the dark style preference
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/cdavis/force-dark: 6/8] main: Use libhandy to force the dark style preference
- Date: Wed, 26 Jan 2022 12:40:10 +0000 (UTC)
commit 7c294f114c63b529253395486637bf6c01aa858e
Author: Christopher Davis <christopherdavis gnome org>
Date: Wed Jan 5 10:22:32 2022 -0800
main: Use libhandy to force the dark style preference
Also ensures that we use hc-dark when highcontrast mode
is set.
Closes: #492
meson.build | 10 +++++++++-
src/meson.build | 1 +
src/totem-object.c | 7 ++++---
src/totem.c | 2 ++
4 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 2322a68a4..4a08266db 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,12 @@ project(
version: '41.alpha.0',
license: 'GPL2+ with exception',
default_options: 'buildtype=debugoptimized',
- meson_version: '>= 0.50.0'
+ meson_version: '>= 0.50.0',
+ default_options: [
+ 'libhandy:vapi=false',
+ 'libhandy:introspection=disabled',
+ 'libhandy:tests=false',
+ ]
)
totem_version = meson.project_version()
@@ -125,6 +130,7 @@ add_project_arguments(common_flags, language: 'c')
glib_req_version = '>= 2.56.0'
gtk_req_version = '>= 3.22.0'
+hdy_req_version = '>= 1.5.0'
gst_req_version = '>= 1.6.0'
grilo_req_version = '>= 0.3.0'
peas_req_version = '>= 1.1.0'
@@ -134,6 +140,8 @@ glib_dep = dependency('glib-2.0', version: glib_req_version)
gobject_dep = dependency('gobject-2.0', version: glib_req_version)
gio_dep = dependency('gio-2.0', version: '>= 2.43.4')
gtk_dep = dependency('gtk+-3.0', version: gtk_req_version)
+# Keep the version here synchronised with subprojects/libhandy.wrap
+hdy_dep = dependency('libhandy-1', version: hdy_req_version)
gst_dep = dependency('gstreamer-1.0', version: gst_req_version)
gst_tag_dep = dependency('gstreamer-tag-1.0', version: '>= 0.11.93')
gst_video_dep = dependency('gstreamer-video-1.0')
diff --git a/src/meson.build b/src/meson.build
index 0c77d1898..6e3a334bb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -54,6 +54,7 @@ totem_common_deps = libbacon_video_widget_deps + python_deps + [
glib_dep,
gio_dep,
gtk_dep,
+ hdy_dep,
dependency('gmodule-2.0'),
totem_plparser_dep,
gir_dep,
diff --git a/src/totem-object.c b/src/totem-object.c
index 01f05f344..35603fd97 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -43,6 +43,7 @@
#include <gdk/gdkkeysyms.h>
#include <gio/gio.h>
#include <libgd/gd.h>
+#include <libhandy-1/handy.h>
#include <string.h>
@@ -496,13 +497,13 @@ totem_object_class_init (TotemObjectClass *klass)
static void
totem_object_init (TotemObject *totem)
{
- GtkSettings *gtk_settings;
+ HdyStyleManager *style_manager;
if (gtk_clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
g_warning ("gtk-clutter failed to initialise, expect problems from here on.");
- gtk_settings = gtk_settings_get_default ();
- g_object_set (G_OBJECT (gtk_settings), "gtk-application-prefer-dark-theme", TRUE, NULL);
+ style_manager = hdy_style_manager_get_default ();
+ hdy_style_manager_set_color_scheme (style_manager, HDY_COLOR_SCHEME_FORCE_DARK);
totem->settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
diff --git a/src/totem.c b/src/totem.c
index db20ddd79..3ea46b7c3 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -32,6 +32,7 @@
#include <glib-object.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <libhandy-1/handy.h>
#include <locale.h>
#include <string.h>
@@ -62,6 +63,7 @@ main (int argc, char **argv)
if (XInitThreads () == 0)
{
gtk_init (&argc, &argv);
+ hdy_init ();
g_set_application_name (_("Videos"));
totem_object_show_error_and_exit (_("Could not initialize the thread-safe libraries."),
_("Verify your system installation. Totem will now exit."), NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]