mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
theme: add development highlight to headerbar
This commit is contained in:
@ -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
|
||||
|
||||
@ -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>
|
||||
|
||||
13
src/resources/theme/Adwaita-shared.css
Normal file
13
src/resources/theme/Adwaita-shared.css
Normal file
@ -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;
|
||||
}
|
||||
@ -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,
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user