gnome-control-center/distro-logo.patch

151 lines
6.2 KiB
Diff
Raw Normal View History

2021-09-08 20:29:33 +00:00
From 763cde56be06ce352f41adcdc1c6756f17043f5d Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@gnome.org>
2021-03-10 20:12:23 +00:00
Date: Tue, 9 Mar 2021 14:51:54 -0600
2021-08-23 14:15:54 +00:00
Subject: [PATCH 1/2] info-overview: add build option to control distributor
2021-03-10 20:12:23 +00:00
logo
2018-04-10 15:29:45 +00:00
2021-03-10 20:12:23 +00:00
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.
2018-04-10 15:29:45 +00:00
2021-03-10 20:12:23 +00:00
Because the logo might include text, distributions may want to vary the
logo used in dark mode. A subsequent commit will add a second option for
this.
2018-04-10 15:29:45 +00:00
---
2021-03-10 20:12:23 +00:00
meson.build | 6 ++++++
meson_options.txt | 1 +
panels/info-overview/cc-info-overview-panel.c | 4 ++++
3 files changed, 11 insertions(+)
2018-04-10 15:29:45 +00:00
2021-03-10 20:12:23 +00:00
diff --git a/meson.build b/meson.build
2021-09-08 20:29:33 +00:00
index 6f08febd9..edaebeea3 100644
2021-03-10 20:12:23 +00:00
--- a/meson.build
+++ b/meson.build
@@ -50,6 +50,12 @@ 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')
+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 1b7b54810..93e551373 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,3 +8,4 @@ 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')
2021-02-21 20:39:46 +00:00
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
2021-09-08 20:29:33 +00:00
index 6e832eb35..3db143d80 100644
2021-02-21 20:39:46 +00:00
--- a/panels/info-overview/cc-info-overview-panel.c
+++ b/panels/info-overview/cc-info-overview-panel.c
2021-09-08 20:29:33 +00:00
@@ -901,6 +901,9 @@ use_dark_theme (CcInfoOverviewPanel *panel)
2021-02-21 20:39:46 +00:00
static void
2021-03-10 20:12:23 +00:00
setup_os_logo (CcInfoOverviewPanel *panel)
2021-02-21 20:39:46 +00:00
{
2021-03-10 20:12:23 +00:00
+#ifdef DISTRIBUTOR_LOGO
+ gtk_image_set_from_file (panel->os_logo, DISTRIBUTOR_LOGO);
+#else
g_autofree char *logo_name = g_get_os_info ("LOGO");
2021-09-08 20:29:33 +00:00
g_autoptr(GPtrArray) array = NULL;
g_autoptr(GIcon) icon = NULL;
@@ -920,6 +923,7 @@ setup_os_logo (CcInfoOverviewPanel *panel)
2021-08-23 14:15:54 +00:00
2021-09-08 20:29:33 +00:00
icon = g_themed_icon_new_from_names ((char **) array->pdata, array->len);
gtk_image_set_from_gicon (panel->os_logo, icon, GTK_ICON_SIZE_INVALID);
2021-03-10 20:12:23 +00:00
+#endif
2021-02-21 20:39:46 +00:00
}
2021-03-10 20:12:23 +00:00
static void
--
2021-08-23 14:15:54 +00:00
2.31.1
2021-03-10 20:12:23 +00:00
2021-09-08 20:29:33 +00:00
From 314ef01084276cd0ca23c404a94087ff268700ba Mon Sep 17 00:00:00 2001
2021-03-10 20:12:23 +00:00
From: Michael Catanzaro <mcatanzaro@gnome.org>
Date: Tue, 9 Mar 2021 16:02:46 -0600
2021-08-23 14:15:54 +00:00
Subject: [PATCH 2/2] info-overview: add build option to specify a dark mode
2021-03-10 20:12:23 +00:00
logo variant
2021-03-10 20:12:23 +00:00
Let's allow distributions to specify a different logo to use when using
a dark GTK theme. This is best-effort only since it relies on the
convention that dark themes must end with "dark" and therefore will fail
for a theme named "midnight" or anything that doesn't match convention.
---
2021-09-08 20:29:33 +00:00
meson.build | 5 +++++
meson_options.txt | 1 +
panels/info-overview/cc-info-overview-panel.c | 9 +++++++++
3 files changed, 15 insertions(+)
2021-03-10 20:12:23 +00:00
diff --git a/meson.build b/meson.build
2021-09-08 20:29:33 +00:00
index edaebeea3..bb0e06d9e 100644
2021-03-10 20:12:23 +00:00
--- a/meson.build
+++ b/meson.build
@@ -54,6 +54,11 @@ 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
2021-03-10 20:12:23 +00:00
# meson does not support octal values, so it must be handled as a
diff --git a/meson_options.txt b/meson_options.txt
index 93e551373..5305c8606 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -9,3 +9,4 @@ option('wayland', type: 'boolean', value: true, description: 'build with Wayland
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
2021-09-08 20:29:33 +00:00
index 3db143d80..434850e7a 100644
2021-03-10 20:12:23 +00:00
--- a/panels/info-overview/cc-info-overview-panel.c
+++ b/panels/info-overview/cc-info-overview-panel.c
2021-09-08 20:29:33 +00:00
@@ -880,6 +880,7 @@ cc_info_panel_row_activated_cb (CcInfoOverviewPanel *self,
2021-03-10 20:12:23 +00:00
open_software_update (self);
}
2021-09-08 20:29:33 +00:00
+#if !defined(DISTRIBUTOR_LOGO) || defined(DARK_MODE_DISTRIBUTOR_LOGO)
static gboolean
use_dark_theme (CcInfoOverviewPanel *panel)
2021-08-23 14:15:54 +00:00
{
2021-09-08 20:29:33 +00:00
@@ -897,11 +898,19 @@ use_dark_theme (CcInfoOverviewPanel *panel)
2021-08-23 14:15:54 +00:00
g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
2021-09-08 20:29:33 +00:00
return (theme_name != NULL && g_str_has_suffix (theme_name, "dark")) ? TRUE : FALSE;
2021-08-23 14:15:54 +00:00
}
2021-03-10 20:12:23 +00:00
+#endif
2021-08-23 14:15:54 +00:00
2021-03-10 20:12:23 +00:00
static void
setup_os_logo (CcInfoOverviewPanel *panel)
{
#ifdef DISTRIBUTOR_LOGO
+#ifdef DARK_MODE_DISTRIBUTOR_LOGO
2021-09-08 20:29:33 +00:00
+ if (use_dark_theme (panel))
2021-03-10 20:12:23 +00:00
+ {
+ gtk_image_set_from_file (panel->os_logo, DARK_MODE_DISTRIBUTOR_LOGO);
+ return;
+ }
+#endif
gtk_image_set_from_file (panel->os_logo, DISTRIBUTOR_LOGO);
#else
g_autofree char *logo_name = g_get_os_info ("LOGO");
--
2021-08-23 14:15:54 +00:00
2.31.1
2021-09-08 20:29:33 +00:00