Blame SOURCES/distro-logo.patch

4bc4b9
From 4369e31ec541172e1c0d7c64645c7990e413bbca Mon Sep 17 00:00:00 2001
4bc4b9
From: Michael Catanzaro <mcatanzaro@gnome.org>
4bc4b9
Date: Tue, 9 Mar 2021 14:51:54 -0600
4bc4b9
Subject: [PATCH 1/3] info-overview: add build option to control distributor
4bc4b9
 logo
4bc4b9
4bc4b9
Currently, we display a 256x256 version of the OS icon from
4bc4b9
/etc/os-release. This is too big for my taste, and it's also not
4bc4b9
sufficient for distros that want to display a logo that is not an icon.
4bc4b9
For instance, because we no longer display the operating system name
4bc4b9
immediately beneath the logo, it may be desirable to use a logo variant
4bc4b9
that includes text. This patch adds a meson build option that
4bc4b9
distributions can use to override the logo.
4bc4b9
4bc4b9
Because the logo might include text, distributions may want to vary the
4bc4b9
logo used in dark mode. A subsequent commit will add a second option for
4bc4b9
this.
4bc4b9
---
4bc4b9
 meson.build                                   | 6 ++++++
4bc4b9
 meson_options.txt                             | 1 +
4bc4b9
 panels/info-overview/cc-info-overview-panel.c | 4 ++++
4bc4b9
 3 files changed, 11 insertions(+)
4bc4b9
4bc4b9
diff --git a/meson.build b/meson.build
4bc4b9
index e8333c0da..1661caa4b 100644
4bc4b9
--- a/meson.build
4bc4b9
+++ b/meson.build
4bc4b9
@@ -50,6 +50,12 @@ foreach define: set_defines
4bc4b9
   config_h.set_quoted(define[0], define[1])
4bc4b9
 endforeach
4bc4b9
 
4bc4b9
+distributor_logo = get_option('distributor_logo')
4bc4b9
+if (distributor_logo != '')
4bc4b9
+  config_h.set_quoted('DISTRIBUTOR_LOGO', distributor_logo,
4bc4b9
+                      description: 'Define to absolute path of distributor logo')
4bc4b9
+endif
4bc4b9
+
4bc4b9
 # meson does not support octal values, so it must be handled as a
4bc4b9
 # string. See: https://github.com/mesonbuild/meson/issues/2047
4bc4b9
 config_h.set('USER_DIR_MODE', '0700',
4bc4b9
diff --git a/meson_options.txt b/meson_options.txt
4bc4b9
index 1b7b54810..93e551373 100644
4bc4b9
--- a/meson_options.txt
4bc4b9
+++ b/meson_options.txt
4bc4b9
@@ -8,3 +8,4 @@ option('tracing', type: 'boolean', value: false, description: 'add extra debuggi
4bc4b9
 option('wayland', type: 'boolean', value: true, description: 'build with Wayland support')
4bc4b9
 option('profile', type: 'combo', choices: ['default','development'], value: 'default')
4bc4b9
 option('malcontent', type: 'boolean', value: false, description: 'build with malcontent support')
4bc4b9
+option('distributor_logo', type: 'string', description: 'absolute path to distributor logo for the About panel')
4bc4b9
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
4bc4b9
index bd0e07762..95a5904df 100644
4bc4b9
--- a/panels/info-overview/cc-info-overview-panel.c
4bc4b9
+++ b/panels/info-overview/cc-info-overview-panel.c
4bc4b9
@@ -869,6 +869,9 @@ cc_info_panel_row_activated_cb (CcInfoOverviewPanel *self,
4bc4b9
 static void
4bc4b9
 setup_os_logo (CcInfoOverviewPanel *panel)
4bc4b9
 {
4bc4b9
+#ifdef DISTRIBUTOR_LOGO
4bc4b9
+  gtk_image_set_from_file (panel->os_logo, DISTRIBUTOR_LOGO);
4bc4b9
+#else
4bc4b9
   g_autofree char *logo_name = g_get_os_info ("LOGO");
4bc4b9
   if (logo_name != NULL)
4bc4b9
     {
4bc4b9
@@ -879,6 +882,7 @@ setup_os_logo (CcInfoOverviewPanel *panel)
4bc4b9
     {
4bc4b9
       gtk_image_set_from_resource (panel->os_logo, "/org/gnome/control-center/info-overview/GnomeLogoVerticalMedium.svg");
4bc4b9
     }
4bc4b9
+#endif
4bc4b9
 }
4bc4b9
 
4bc4b9
 static void
4bc4b9
-- 
4bc4b9
GitLab
4bc4b9
4bc4b9
4bc4b9
From f08669767ca87ff99fc08e1a7334c8f2e7f18f0b Mon Sep 17 00:00:00 2001
4bc4b9
From: Michael Catanzaro <mcatanzaro@gnome.org>
4bc4b9
Date: Tue, 9 Mar 2021 16:02:46 -0600
4bc4b9
Subject: [PATCH 2/3] info-overview: add build option to specify a dark mode
4bc4b9
 logo variant
4bc4b9
4bc4b9
Let's allow distributions to specify a different logo to use when using
4bc4b9
a dark GTK theme. This is best-effort only since it relies on the
4bc4b9
convention that dark themes must end with "dark" and therefore will fail
4bc4b9
for a theme named "midnight" or anything that doesn't match convention.
4bc4b9
---
4bc4b9
 meson.build                                   |  5 ++++
4bc4b9
 meson_options.txt                             |  1 +
4bc4b9
 panels/info-overview/cc-info-overview-panel.c | 27 +++++++++++++++++++
4bc4b9
 3 files changed, 33 insertions(+)
4bc4b9
4bc4b9
diff --git a/meson.build b/meson.build
4bc4b9
index 1661caa4b..124171626 100644
4bc4b9
--- a/meson.build
4bc4b9
+++ b/meson.build
4bc4b9
@@ -54,6 +54,11 @@ distributor_logo = get_option('distributor_logo')
4bc4b9
 if (distributor_logo != '')
4bc4b9
   config_h.set_quoted('DISTRIBUTOR_LOGO', distributor_logo,
4bc4b9
                       description: 'Define to absolute path of distributor logo')
4bc4b9
+  dark_mode_distributor_logo = get_option('dark_mode_distributor_logo')
4bc4b9
+  if (dark_mode_distributor_logo != '')
4bc4b9
+    config_h.set_quoted('DARK_MODE_DISTRIBUTOR_LOGO', dark_mode_distributor_logo,
4bc4b9
+                        description: 'Define to absolute path of distributor logo for use in dark mode')
4bc4b9
+  endif
4bc4b9
 endif
4bc4b9
 
4bc4b9
 # meson does not support octal values, so it must be handled as a
4bc4b9
diff --git a/meson_options.txt b/meson_options.txt
4bc4b9
index 93e551373..5305c8606 100644
4bc4b9
--- a/meson_options.txt
4bc4b9
+++ b/meson_options.txt
4bc4b9
@@ -9,3 +9,4 @@ option('wayland', type: 'boolean', value: true, description: 'build with Wayland
4bc4b9
 option('profile', type: 'combo', choices: ['default','development'], value: 'default')
4bc4b9
 option('malcontent', type: 'boolean', value: false, description: 'build with malcontent support')
4bc4b9
 option('distributor_logo', type: 'string', description: 'absolute path to distributor logo for the About panel')
4bc4b9
+option('dark_mode_distributor_logo', type: 'string', description: 'absolute path to distributor logo dark mode variant')
4bc4b9
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
4bc4b9
index 95a5904df..cb20e16b1 100644
4bc4b9
--- a/panels/info-overview/cc-info-overview-panel.c
4bc4b9
+++ b/panels/info-overview/cc-info-overview-panel.c
4bc4b9
@@ -866,10 +866,37 @@ cc_info_panel_row_activated_cb (CcInfoOverviewPanel *self,
4bc4b9
     open_software_update (self);
4bc4b9
 }
4bc4b9
 
4bc4b9
+#ifdef DARK_MODE_DISTRIBUTOR_LOGO
4bc4b9
+static gboolean
4bc4b9
+is_dark_mode (CcInfoOverviewPanel *panel)
4bc4b9
+{
4bc4b9
+  GdkScreen *screen;
4bc4b9
+  GtkSettings *settings;
4bc4b9
+  g_autofree char *theme_name = NULL;
4bc4b9
+
4bc4b9
+  theme_name = g_strdup (g_getenv ("GTK_THEME"));
4bc4b9
+  if (theme_name != NULL)
4bc4b9
+    return g_str_has_suffix (theme_name, "dark");
4bc4b9
+
4bc4b9
+  screen = gtk_widget_get_screen (GTK_WIDGET (panel));
4bc4b9
+  settings = gtk_settings_get_for_screen (screen);
4bc4b9
+
4bc4b9
+  g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
4bc4b9
+  return theme_name != NULL && g_str_has_suffix (theme_name, "dark");
4bc4b9
+}
4bc4b9
+#endif
4bc4b9
+
4bc4b9
 static void
4bc4b9
 setup_os_logo (CcInfoOverviewPanel *panel)
4bc4b9
 {
4bc4b9
 #ifdef DISTRIBUTOR_LOGO
4bc4b9
+#ifdef DARK_MODE_DISTRIBUTOR_LOGO
4bc4b9
+  if (is_dark_mode (panel))
4bc4b9
+    {
4bc4b9
+      gtk_image_set_from_file (panel->os_logo, DARK_MODE_DISTRIBUTOR_LOGO);
4bc4b9
+      return;
4bc4b9
+    }
4bc4b9
+#endif
4bc4b9
   gtk_image_set_from_file (panel->os_logo, DISTRIBUTOR_LOGO);
4bc4b9
 #else
4bc4b9
   g_autofree char *logo_name = g_get_os_info ("LOGO");
4bc4b9
-- 
4bc4b9
GitLab
4bc4b9
4bc4b9
4bc4b9
From c379ccc4e8f0bcdee78361f134ba29d3a25f7528 Mon Sep 17 00:00:00 2001
4bc4b9
From: Michael Catanzaro <mcatanzaro@gnome.org>
4bc4b9
Date: Wed, 10 Mar 2021 11:30:57 -0600
4bc4b9
Subject: [PATCH 3/3] info-overview: reduce size of logo when using icon from
4bc4b9
 /etc/os-release
4bc4b9
4bc4b9
When using the icon from /etc/os-release, display it as 128x128 rather
4bc4b9
than 256x256. In distributions that don't ship a 128x128, such as
4bc4b9
Fedora, this results in the 256x256 icon being scaled down to a
4bc4b9
reasonable size. 256x256 is so large here as to be clearly undesirable.
4bc4b9
128x128 is also the size that Ubuntu uses in its downstream patch. Might
4bc4b9
as well reduce the need for patching as far as possible, even though
4bc4b9
Fedora doesn't plan to use this codepath.
4bc4b9
---
4bc4b9
 panels/info-overview/cc-info-overview-panel.c | 2 +-
4bc4b9
 1 file changed, 1 insertion(+), 1 deletion(-)
4bc4b9
4bc4b9
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
4bc4b9
index cb20e16b1..3575b90c5 100644
4bc4b9
--- a/panels/info-overview/cc-info-overview-panel.c
4bc4b9
+++ b/panels/info-overview/cc-info-overview-panel.c
4bc4b9
@@ -903,7 +903,7 @@ setup_os_logo (CcInfoOverviewPanel *panel)
4bc4b9
   if (logo_name != NULL)
4bc4b9
     {
4bc4b9
       gtk_image_set_from_icon_name (panel->os_logo, logo_name, GTK_ICON_SIZE_INVALID);
4bc4b9
-      gtk_image_set_pixel_size (panel->os_logo, 256);
4bc4b9
+      gtk_image_set_pixel_size (panel->os_logo, 128);
4bc4b9
     }
4bc4b9
   else
4bc4b9
     {
4bc4b9
-- 
4bc4b9
GitLab
4bc4b9