[sysprof] theme: add development highlight to headerbar
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] theme: add development highlight to headerbar
- Date: Tue, 16 Oct 2018 01:57:35 +0000 (UTC)
commit be185c2fbc7da088a950009e4af08f9412371fb5
Author: Christian Hergert <chergert redhat com>
Date: Mon Oct 15 18:57:13 2018 -0700
theme: add development highlight to headerbar
meson.build | 5 +++++
src/resources/sysprof.gresource.xml | 1 +
src/resources/theme/Adwaita-shared.css | 13 +++++++++++++
src/sp-application.c | 11 +++++++++++
src/sp-window.c | 8 ++++++++
5 files changed, 38 insertions(+)
---
diff --git a/meson.build b/meson.build
index 2f0f1da..8150709 100644
--- a/meson.build
+++ b/meson.build
@@ -9,6 +9,8 @@ project('sysprof', ['c', 'cpp'],
]
)
+version_split = meson.project_version().split('.')
+
cc = meson.get_compiler('c')
config_h = configuration_data()
@@ -32,6 +34,9 @@ config_h.set10('ENABLE_NLS', true)
config_h.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
config_h.set('LOCALEDIR', 'PACKAGE_LOCALE_DIR')
+# Development build setup
+config_h.set('DEVELOPMENT_BUILD', version_split[1].to_int().is_odd())
+
has_use_clockid = cc.has_member('struct perf_event_attr', 'use_clockid', prefix: '#include
<linux/perf_event.h>')
has_clockid = cc.has_member('struct perf_event_attr', 'clockid', prefix: '#include <linux/perf_event.h>')
if has_use_clockid and has_clockid
diff --git a/src/resources/sysprof.gresource.xml b/src/resources/sysprof.gresource.xml
index 8fed68d..2d45c46 100644
--- a/src/resources/sysprof.gresource.xml
+++ b/src/resources/sysprof.gresource.xml
@@ -6,6 +6,7 @@
<!-- Theme overrides -->
<file compressed="true">theme/shared.css</file>
+ <file compressed="true">theme/Adwaita-shared.css</file>
<!-- UI Files -->
<file compressed="true">ui/sp-window.ui</file>
diff --git a/src/resources/theme/Adwaita-shared.css b/src/resources/theme/Adwaita-shared.css
new file mode 100644
index 0000000..244172f
--- /dev/null
+++ b/src/resources/theme/Adwaita-shared.css
@@ -0,0 +1,13 @@
+
+/* development styles */
+window.development-version headerbar {
+ background: transparent -gtk-icontheme("system-run-symbolic") 80% 0/128px 128px no-repeat,
+ linear-gradient(to left,
+ mix(@theme_fg_color, @theme_bg_color, 0.5) 0%,
+ @theme_bg_color 25%);
+ color: alpha(@theme_fg_color, 0.2);
+}
+
+window.development-version headerbar label {
+ color: @theme_fg_color;
+}
diff --git a/src/sp-application.c b/src/sp-application.c
index b7f39e0..21bee63 100644
--- a/src/sp-application.c
+++ b/src/sp-application.c
@@ -100,6 +100,9 @@ static void
sp_application_startup (GApplication *application)
{
g_autoptr(GtkCssProvider) provider = NULL;
+#ifdef DEVELOPMENT_BUILD
+ g_autoptr(GtkCssProvider) adwaita = NULL;
+#endif
g_assert (SP_IS_APPLICATION (application));
@@ -111,6 +114,14 @@ sp_application_startup (GApplication *application)
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+#ifdef DEVELOPMENT_BUILD
+ adwaita = gtk_css_provider_new ();
+ gtk_css_provider_load_from_resource (adwaita, "/org/gnome/sysprof/theme/Adwaita-shared.css");
+ gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+ GTK_STYLE_PROVIDER (adwaita),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+#endif
+
for (guint i = 0; default_accels[i].action_name; i++)
gtk_application_set_accels_for_action (GTK_APPLICATION (application),
default_accels[i].action_name,
diff --git a/src/sp-window.c b/src/sp-window.c
index 5d0485e..4643057 100644
--- a/src/sp-window.c
+++ b/src/sp-window.c
@@ -16,6 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
+#define G_LOG_DOMAIN "sp-window"
+
#include <errno.h>
#include <glib/gi18n.h>
#include <math.h>
@@ -859,6 +863,10 @@ sp_window_init (SpWindow *self)
gtk_widget_init_template (GTK_WIDGET (self));
+#ifdef DEVELOPMENT_BUILD
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "development-version");
+#endif
+
/*
* Hookup widget signals.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]