Refresh distro-logo.patch

This commit is contained in:
Michael Catanzaro 2022-02-23 16:44:01 -06:00
parent a5747e3d37
commit ca3dd8dbcd

View File

@ -1,8 +1,7 @@
From 763cde56be06ce352f41adcdc1c6756f17043f5d Mon Sep 17 00:00:00 2001
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 1/2] info-overview: add build option to control distributor
logo
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
@ -10,22 +9,19 @@ 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.
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.
distributions can use to override the logo, and a second build option to
specify a different logo for use in dark mode.
---
meson.build | 6 ++++++
meson_options.txt | 1 +
panels/info-overview/cc-info-overview-panel.c | 4 ++++
3 files changed, 11 insertions(+)
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 6f08febd9..edaebeea3 100644
index b8b450046..b234810cb 100644
--- a/meson.build
+++ b/meson.build
@@ -50,6 +50,12 @@ foreach define: set_defines
@@ -50,6 +50,17 @@ foreach define: set_defines
config_h.set_quoted(define[0], define[1])
endforeach
@ -33,91 +29,31 @@ index 6f08febd9..edaebeea3 100644
+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 1b7b54810..93e551373 100644
index dbca72387..461ae34e7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,3 +8,4 @@ option('tracing', type: 'boolean', value: false, description: 'add extra debuggi
@@ -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')
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
index 6e832eb35..3db143d80 100644
--- a/panels/info-overview/cc-info-overview-panel.c
+++ b/panels/info-overview/cc-info-overview-panel.c
@@ -901,6 +901,9 @@ use_dark_theme (CcInfoOverviewPanel *panel)
static void
setup_os_logo (CcInfoOverviewPanel *panel)
{
+#ifdef DISTRIBUTOR_LOGO
+ gtk_image_set_from_file (panel->os_logo, DISTRIBUTOR_LOGO);
+#else
GtkIconTheme *icon_theme;
g_autofree char *logo_name = g_get_os_info ("LOGO");
g_autoptr(GtkIconPaintable) icon_paintable = NULL;
@@ -920,6 +923,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
--
2.31.1
From 314ef01084276cd0ca23c404a94087ff268700ba Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@gnome.org>
Date: Tue, 9 Mar 2021 16:02:46 -0600
Subject: [PATCH 2/2] info-overview: add build option to specify a dark mode
logo variant
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.
---
meson.build | 5 +++++
meson_options.txt | 1 +
panels/info-overview/cc-info-overview-panel.c | 9 +++++++++
3 files changed, 15 insertions(+)
diff --git a/meson.build b/meson.build
index edaebeea3..bb0e06d9e 100644
--- 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
# 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
index 3db143d80..434850e7a 100644
index 274a3c644..f0d0f4636 100644
--- a/panels/info-overview/cc-info-overview-panel.c
+++ b/panels/info-overview/cc-info-overview-panel.c
@@ -880,6 +880,7 @@ cc_info_panel_row_activated_cb (CcInfoOverviewPanel *self,
@@ -924,6 +924,7 @@ cc_info_panel_row_activated_cb (CcInfoOverviewPanel *self,
open_software_update (self);
}
@ -125,7 +61,7 @@ index 3db143d80..434850e7a 100644
static gboolean
use_dark_theme (CcInfoOverviewPanel *panel)
{
@@ -897,11 +898,19 @@ use_dark_theme (CcInfoOverviewPanel *panel)
@@ -931,10 +932,22 @@ use_dark_theme (CcInfoOverviewPanel *panel)
return adw_style_manager_get_dark (style_manager);
}
@ -134,17 +70,27 @@ index 3db143d80..434850e7a 100644
static void
setup_os_logo (CcInfoOverviewPanel *panel)
{
#ifdef DISTRIBUTOR_LOGO
+#ifdef DISTRIBUTOR_LOGO
+#ifdef DARK_MODE_DISTRIBUTOR_LOGO
+ if (use_dark_theme (panel))
+ {
+ gtk_image_set_from_file (panel->os_logo, DARK_MODE_DISTRIBUTOR_LOGO);
+ gtk_picture_set_filename (panel->os_logo, DARK_MODE_DISTRIBUTOR_LOGO);
+ return;
+ }
+#endif
gtk_image_set_from_file (panel->os_logo, DISTRIBUTOR_LOGO);
#else
+ 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
--
2.31.1
GitLab