gnome-control-center/distro-logo.patch
2022-02-23 16:44:01 -06:00

97 lines
4.0 KiB
Diff

From c8d7a25d5c8d216e78f4148ad041532ead5ec458 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@gnome.org>
Date: Tue, 9 Mar 2021 14:51:54 -0600
Subject: [PATCH] info-overview: add build option to control distributor logo
Currently, we display a 256x256 version of the OS icon from
/etc/os-release. This is too big for my taste, and it's also not
sufficient for distros that want to display a logo that is not an icon.
For instance, because we no longer display the operating system name
immediately beneath the logo, it may be desirable to use a logo variant
that includes text. This patch adds a meson build option that
distributions can use to override the logo, and a second build option to
specify a different logo for use in dark mode.
---
meson.build | 11 +++++++++++
meson_options.txt | 2 ++
panels/info-overview/cc-info-overview-panel.c | 14 ++++++++++++++
3 files changed, 27 insertions(+)
diff --git a/meson.build b/meson.build
index b8b450046..b234810cb 100644
--- a/meson.build
+++ b/meson.build
@@ -50,6 +50,17 @@ foreach define: set_defines
config_h.set_quoted(define[0], define[1])
endforeach
+distributor_logo = get_option('distributor_logo')
+if (distributor_logo != '')
+ config_h.set_quoted('DISTRIBUTOR_LOGO', distributor_logo,
+ description: 'Define to absolute path of distributor logo')
+ dark_mode_distributor_logo = get_option('dark_mode_distributor_logo')
+ if (dark_mode_distributor_logo != '')
+ config_h.set_quoted('DARK_MODE_DISTRIBUTOR_LOGO', dark_mode_distributor_logo,
+ description: 'Define to absolute path of distributor logo for use in dark mode')
+ endif
+endif
+
# meson does not support octal values, so it must be handled as a
# string. See: https://github.com/mesonbuild/meson/issues/2047
config_h.set('USER_DIR_MODE', '0700',
diff --git a/meson_options.txt b/meson_options.txt
index dbca72387..461ae34e7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,3 +7,5 @@ option('tracing', type: 'boolean', value: false, description: 'add extra debuggi
option('wayland', type: 'boolean', value: true, description: 'build with Wayland support')
option('profile', type: 'combo', choices: ['default','development'], value: 'default')
option('malcontent', type: 'boolean', value: false, description: 'build with malcontent support')
+option('distributor_logo', type: 'string', description: 'absolute path to distributor logo for the About panel')
+option('dark_mode_distributor_logo', type: 'string', description: 'absolute path to distributor logo dark mode variant')
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
index 274a3c644..f0d0f4636 100644
--- a/panels/info-overview/cc-info-overview-panel.c
+++ b/panels/info-overview/cc-info-overview-panel.c
@@ -924,6 +924,7 @@ cc_info_panel_row_activated_cb (CcInfoOverviewPanel *self,
open_software_update (self);
}
+#if !defined(DISTRIBUTOR_LOGO) || defined(DARK_MODE_DISTRIBUTOR_LOGO)
static gboolean
use_dark_theme (CcInfoOverviewPanel *panel)
{
@@ -931,10 +932,22 @@ use_dark_theme (CcInfoOverviewPanel *panel)
return adw_style_manager_get_dark (style_manager);
}
+#endif
static void
setup_os_logo (CcInfoOverviewPanel *panel)
{
+#ifdef DISTRIBUTOR_LOGO
+#ifdef DARK_MODE_DISTRIBUTOR_LOGO
+ if (use_dark_theme (panel))
+ {
+ gtk_picture_set_filename (panel->os_logo, DARK_MODE_DISTRIBUTOR_LOGO);
+ return;
+ }
+#endif
+ gtk_picture_set_filename (panel->os_logo, DISTRIBUTOR_LOGO);
+ return;
+#else
GtkIconTheme *icon_theme;
g_autofree char *logo_name = g_get_os_info ("LOGO");
g_autoptr(GtkIconPaintable) icon_paintable = NULL;
@@ -962,6 +975,7 @@ setup_os_logo (CcInfoOverviewPanel *panel)
gtk_widget_get_direction (GTK_WIDGET (panel)),
0);
gtk_picture_set_paintable (panel->os_logo, GDK_PAINTABLE (icon_paintable));
+#endif
}
static void
--
GitLab