[evince/wip/exalm/dark: 4/4] previewer: Support dark style preference




commit 7c2d02170ad5fec9515385edaf5748431837f8c6
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Jan 5 23:24:36 2022 +0500

    previewer: Support dark style preference

 previewer/ev-previewer.c | 11 +++++++++++
 previewer/meson.build    |  5 ++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/previewer/ev-previewer.c b/previewer/ev-previewer.c
index 06ca7ab2f..61f0bbfa0 100644
--- a/previewer/ev-previewer.c
+++ b/previewer/ev-previewer.c
@@ -23,6 +23,7 @@
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
+#include <handy.h>
 #include <evince-document.h>
 #include <evince-view.h>
 
@@ -92,6 +93,15 @@ ev_previewer_load_document (GFile           *file,
        g_free (uri);
 }
 
+static void
+startup_cb (GApplication *application,
+            gpointer      user_data)
+{
+        hdy_init ();
+        hdy_style_manager_set_color_scheme (hdy_style_manager_get_default (),
+                                            HDY_COLOR_SCHEME_PREFER_LIGHT);
+}
+
 static void
 activate_cb (GApplication *application,
              gpointer user_data)
@@ -225,6 +235,7 @@ main (gint argc, gchar **argv)
         application = gtk_application_new (NULL,
                                            G_APPLICATION_NON_UNIQUE |
                                            G_APPLICATION_HANDLES_OPEN);
+        g_signal_connect (application, "startup", G_CALLBACK (startup_cb), NULL);
         g_signal_connect (application, "activate", G_CALLBACK (activate_cb), NULL);
         g_signal_connect (application, "open", G_CALLBACK (open_cb), NULL);
 
diff --git a/previewer/meson.build b/previewer/meson.build
index 38ae6680d..531f30ddd 100644
--- a/previewer/meson.build
+++ b/previewer/meson.build
@@ -19,7 +19,10 @@ sources += gnome.compile_resources(
   export: true,
 )
 
-deps = [libevmisc_dep]
+deps = [
+  libevmisc_dep,
+  hdy_dep
+]
 
 if enable_gtk_unix_print
   deps += gtk_unix_print_dep


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]