Merge pull request #140828 from bobby285271/evince

pantheon.evince: init
This commit is contained in:
davidak 2021-10-17 19:33:06 +02:00 committed by GitHub
commit 249d3f306a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 132 additions and 12 deletions

View File

@ -4,7 +4,9 @@
with lib;
{
let cfg = config.programs.evince;
in {
# Added 2019-08-09
imports = [
@ -22,6 +24,13 @@ with lib;
enable = mkEnableOption
"Evince, the GNOME document viewer";
package = mkOption {
type = types.package;
default = pkgs.evince;
defaultText = literalExpression "pkgs.evince";
description = "Evince derivation to use.";
};
};
};
@ -31,11 +40,11 @@ with lib;
config = mkIf config.programs.evince.enable {
environment.systemPackages = [ pkgs.evince ];
environment.systemPackages = [ cfg.package ];
services.dbus.packages = [ pkgs.evince ];
services.dbus.packages = [ cfg.package ];
systemd.packages = [ pkgs.evince ];
systemd.packages = [ cfg.package ];
};

View File

@ -219,6 +219,7 @@ in
] config.environment.pantheon.excludePackages);
programs.evince.enable = mkDefault true;
programs.evince.package = pkgs.pantheon.evince;
programs.file-roller.enable = mkDefault true;
# Settings from elementary-default-settings

View File

@ -47,9 +47,11 @@ stdenv.mkDerivation rec {
};
patches = lib.optionals withPantheon [
# Make this respect dark mode settings from Pantheon
# https://github.com/elementary/browser
./dark-style.patch
./navigation-buttons.patch
# The patch currently differs from upstream (updated for epiphany 40 and 41).
./pantheon-dark-style.patch
./pantheon-navigation-buttons.patch
];
nativeBuildInputs = [
@ -95,7 +97,9 @@ stdenv.mkDerivation rec {
p11-kit
sqlite
webkitgtk
] ++ lib.optional withPantheon pantheon.granite;
] ++ lib.optionals withPantheon [
pantheon.granite
];
# Tests need an X display
mesonFlags = [

View File

@ -30,6 +30,7 @@
, gsettings-desktop-schemas
, gnome-desktop
, dbus
, pantheon
, python3
, texlive
, t1lib
@ -40,6 +41,7 @@
, supportMultimedia ? true # PDF multimedia
, libgxps
, supportXPS ? true # Open XML Paper Specification via libgxps
, withPantheon ? false
}:
stdenv.mkDerivation rec {
@ -53,6 +55,13 @@ stdenv.mkDerivation rec {
sha256 = "lautDW/urJVg2zq4C6fF6rsf3xyg47PJMzmvBUU6JNg=";
};
patches = lib.optionals withPantheon [
# Make this respect dark mode settings from Pantheon
# https://github.com/elementary/evince
# The patch currently differs from upstream (updated for evince 41).
./pantheon-dark-style.patch
];
postPatch = ''
chmod +x meson_post_install.py
patchShebangs meson_post_install.py
@ -96,9 +105,18 @@ stdenv.mkDerivation rec {
poppler
t1lib
texlive.bin.core # kpathsea for DVI support
] ++ lib.optional supportXPS libgxps
++ lib.optionals supportMultimedia (with gst_all_1; [
gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav ]);
] ++ lib.optionals supportXPS [
libgxps
] ++ lib.optionals supportMultimedia (with gst_all_1; [
gstreamer
gst-plugins-base
gst-plugins-good
gst-plugins-bad
gst-plugins-ugly
gst-libav
]) ++ lib.optionals withPantheon [
pantheon.granite
];
mesonFlags = [
"-Dnautilus=false"
@ -128,8 +146,8 @@ stdenv.mkDerivation rec {
on the GNOME Desktop with a single simple application.
'';
license = lib.licenses.gpl2Plus;
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = teams.gnome.members;
maintainers = teams.gnome.members ++ teams.pantheon.members;
};
}

View File

@ -0,0 +1,86 @@
diff --git a/meson.build b/meson.build
index bcb69cf7..4a18c08c 100644
--- a/meson.build
+++ b/meson.build
@@ -162,6 +162,7 @@ gmodule_dep = dependency('gmodule-2.0')
gmodule_no_export_dep = dependency('gmodule-no-export-2.0', version: glib_req_version)
gtk_dep = dependency('gtk+-3.0', version: gtk_req_version)
gthread_dep = dependency('gthread-2.0', version: glib_req_version)
+granite_dep = dependency('granite')
# Keep the version here synchronised with subprojects/libhandy.wrap
hdy_dep = dependency('libhandy-1', version: hdy_req_version, fallback: ['libhandy', 'libhandy_dep'])
diff --git a/shell/ev-application.c b/shell/ev-application.c
index e704bda2..d705328c 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -30,6 +30,7 @@
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
+#include <granite.h>
#include <handy.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
@@ -176,7 +177,7 @@ ev_spawn (const char *uri,
g_string_append_printf (cmd, " %s", path);
g_free (path);
-
+
/* Page label */
if (dest) {
switch (ev_link_dest_get_dest_type (dest)) {
@@ -940,6 +941,20 @@ ev_application_migrate_config_dir (EvApplication *application)
g_free (old_accels);
}
+static void
+ev_application_set_prefers_color_scheme ()
+{
+ GtkSettings* gtk_settings = gtk_settings_get_default ();
+ GraniteSettings* granite_settings = granite_settings_get_default ();
+
+ g_object_set (
+ gtk_settings,
+ "gtk-application-prefer-dark-theme",
+ granite_settings_get_prefers_color_scheme (granite_settings) == GRANITE_SETTINGS_COLOR_SCHEME_DARK,
+ NULL
+ );
+}
+
static void
ev_application_startup (GApplication *gapplication)
{
@@ -992,6 +1007,7 @@ ev_application_startup (GApplication *gapplication)
EvApplication *application = EV_APPLICATION (gapplication);
const gchar **it;
+ GraniteSettings* granite_settings = granite_settings_get_default ();
g_application_set_resource_base_path (gapplication, "/org/gnome/evince");
@@ -999,6 +1015,11 @@ ev_application_startup (GApplication *gapplication)
hdy_init ();
+ ev_application_set_prefers_color_scheme ();
+
+ g_signal_connect (granite_settings, "notify::prefers-color-scheme",
+ G_CALLBACK(ev_application_set_prefers_color_scheme), NULL);
+
for (it = action_accels; it[0]; it += g_strv_length ((gchar **)it) + 1)
gtk_application_set_accels_for_action (GTK_APPLICATION (application), it[0], &it[1]);
}
diff --git a/shell/meson.build b/shell/meson.build
index 7cbc48f2..a3089b13 100644
--- a/shell/meson.build
+++ b/shell/meson.build
@@ -52,6 +52,7 @@ sources += gnome.compile_resources(
deps = [
gdk_pixbuf_dep,
gnome_desktop_dep,
+ granite_dep,
hdy_dep,
libevmisc_dep,
libevproperties_dep,

View File

@ -71,6 +71,8 @@ lib.makeScope pkgs.newScope (self: with self; {
epiphany = pkgs.epiphany.override { withPantheon = true; };
evince = pkgs.evince.override { withPantheon = true; };
sideload = callPackage ./apps/sideload { };
#### DESKTOP