pantheon.switchboard-plug-about: fix wallpaper path

This commit is contained in:
Bobby Rong 2021-10-28 23:52:56 +08:00
parent d49d9a24b7
commit 8a7f053f3c
No known key found for this signature in database
GPG Key ID: ED07364437C91161
3 changed files with 19 additions and 39 deletions

View File

@ -15,6 +15,7 @@
, switchboard
, fwupd
, appstream
, nixos-artwork
}:
stdenv.mkDerivation rec {
@ -53,9 +54,11 @@ stdenv.mkDerivation rec {
];
patches = [
# The NixOS logo is not centered in the circular background and path
# to the background is hardcoded, we will drop the background.
./remove-logo-background.patch
# Use NixOS's default wallpaper
(substituteAll {
src = ./fix-background-path.patch;
default_wallpaper = "${nixos-artwork.wallpapers.simple-dark-gray.gnomeFilePath}";
})
];
meta = with lib; {

View File

@ -0,0 +1,13 @@
diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala
index fdb92e7e..4161538e 100644
--- a/src/Views/OperatingSystemView.vala
+++ b/src/Views/OperatingSystemView.vala
@@ -47,7 +47,7 @@ public class About.OperatingSystemView : Gtk.Grid {
};
logo.set_image_load_func ((size) => {
try {
- return new Gdk.Pixbuf.from_file_at_scale ("/usr/share/backgrounds/elementaryos-default", -1, size, true);
+ return new Gdk.Pixbuf.from_file_at_scale ("@default_wallpaper@", -1, size, true);
} catch (Error e) {
critical (e.message);
}

View File

@ -1,36 +0,0 @@
diff --git a/src/Views/OperatingSystemView.vala b/src/Views/OperatingSystemView.vala
index fdb92e7..87bb3a4 100644
--- a/src/Views/OperatingSystemView.vala
+++ b/src/Views/OperatingSystemView.vala
@@ -39,21 +39,6 @@ public class About.OperatingSystemView : Gtk.Grid {
logo_icon_name = "distributor-logo";
}
- var logo = new Hdy.Avatar (128, "", false) {
- // In case the wallpaper can't be loaded, we don't want an icon or text
- icon_name = "invalid-icon-name",
- // We need this for the shadow to not get clipped by Gtk.Overlay
- margin = 6
- };
- logo.set_image_load_func ((size) => {
- try {
- return new Gdk.Pixbuf.from_file_at_scale ("/usr/share/backgrounds/elementaryos-default", -1, size, true);
- } catch (Error e) {
- critical (e.message);
- }
- });
- logo.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
var icon = new Gtk.Image () {
icon_name = logo_icon_name + "-symbolic",
// 128 minus 3px padding on each side
@@ -65,8 +50,7 @@ public class About.OperatingSystemView : Gtk.Grid {
icon_style_context.add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
var logo_overlay = new Gtk.Overlay ();
- logo_overlay.add (logo);
- logo_overlay.add_overlay (icon);
+ logo_overlay.add (icon);
// Intentionally not using GLib.OsInfoKey.PRETTY_NAME here because we
// want more granular control over text formatting