1 Star 0 Fork 18

chen wei/gnome-control-center

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
distro-logo.patch 3.99 KB
一键复制 编辑 原始数据 按行查看 历史
deng weijin 提交于 2022-06-21 20:50 +08:00 . Update to 42.2
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 d56f0cb..e74ce49 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 dbca723..461ae34 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 b348c0f..5ff649d 100644
--- a/panels/info-overview/cc-info-overview-panel.c
+++ b/panels/info-overview/cc-info-overview-panel.c
@@ -937,6 +937,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)
{
@@ -944,10 +945,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;
@@ -975,6 +988,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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chenwei_kernel/gnome-control-center.git
git@gitee.com:chenwei_kernel/gnome-control-center.git
chenwei_kernel
gnome-control-center
gnome-control-center
master

搜索帮助