Commit ee755b9d authored by Adrien Plazas's avatar Adrien Plazas Committed by Alexander Mikhaylenko
Browse files

style: Add hdy_style_init()

This can be used to initialize the global style.
parent cef384c7
......@@ -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
/*
* 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);
}
......@@ -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',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment