Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adrien Plazas
libhandy
Commits
ee755b9d
Commit
ee755b9d
authored
Jan 29, 2020
by
Adrien Plazas
Committed by
Alexander Mikhaylenko
Feb 14, 2020
Browse files
style: Add hdy_style_init()
This can be used to initialize the global style.
parent
cef384c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/hdy-style-private.h
View file @
ee755b9d
...
...
@@ -19,4 +19,6 @@ G_BEGIN_DECLS
* can nonetheless apply custom styling on top of it. */
#define HDY_STYLE_PROVIDER_PRIORITY (GTK_STYLE_PROVIDER_PRIORITY_SETTINGS + 1)
void
hdy_style_init
(
void
);
G_END_DECLS
src/hdy-style.c
0 → 100644
View file @
ee755b9d
/*
* Copyright (C) 2020 Purism SPC
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include <glib/gi18n-lib.h>
#include "hdy-style-private.h"
#include <gtk/gtk.h>
/**
* PRIVATE:hdy-style
* @short_description: Style helpers
* @title: Style
* @stability: Private
*
* Helpers for styles.
*
* Since: 1.0
*/
/**
* hdy_style_init:
*
* Initializes the style classes. This must be called once GTK has been
* initialized.
*
* Since: 1.0
*/
void
hdy_style_init
(
void
)
{
static
volatile
gsize
guard
=
0
;
g_autoptr
(
GtkCssProvider
)
css_override_provider
=
NULL
;
g_autoptr
(
GtkCssProvider
)
css_fallback_provider
=
NULL
;
if
(
!
g_once_init_enter
(
&
guard
))
return
;
css_fallback_provider
=
gtk_css_provider_new
();
gtk_css_provider_load_from_resource
(
css_fallback_provider
,
"/sm/puri/handy/style/handy-fallback.css"
);
gtk_style_context_add_provider_for_screen
(
gdk_screen_get_default
(),
GTK_STYLE_PROVIDER
(
css_fallback_provider
),
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK
);
css_override_provider
=
gtk_css_provider_new
();
gtk_css_provider_load_from_resource
(
css_override_provider
,
"/sm/puri/handy/style/handy-override.css"
);
gtk_style_context_add_provider_for_screen
(
gdk_screen_get_default
(),
GTK_STYLE_PROVIDER
(
css_override_provider
),
HDY_STYLE_PROVIDER_PRIORITY
);
g_once_init_leave
(
&
guard
,
1
);
}
src/meson.build
View file @
ee755b9d
...
...
@@ -119,6 +119,7 @@ src_sources = [
'hdy-shadow-helper.c',
'hdy-squeezer.c',
'hdy-string-utf8.c',
'hdy-style.c',
'hdy-swipe-group.c',
'hdy-swipe-tracker.c',
'hdy-swipeable.c',
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment