[gtk+] settings: Use _gtk_css_provider_load_named()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] settings: Use _gtk_css_provider_load_named()
- Date: Wed, 31 Oct 2012 10:57:17 +0000 (UTC)
commit b1ad5c8abc2ca054bbf19ffddfb0a0af7195e50c
Author: Benjamin Otte <otte redhat com>
Date: Wed Sep 19 16:41:19 2012 +0200
settings: Use _gtk_css_provider_load_named()
This way we create one provider per settings object instead of stuffing
it into a global unchanging never-deleting hash table.
Also, we now reload the theme when instructed instead of keeping the old
loaded (and possibly stale) data forever.
https://bugzilla.gnome.org/show_bug.cgi?id=683896
gtk/gtksettings.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 9a25317..47328f1 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -293,6 +293,8 @@ gtk_settings_init (GtkSettings *settings)
g_datalist_init (&priv->queued_settings);
object_list = g_slist_prepend (object_list, settings);
+ priv->theme_provider = gtk_css_provider_new ();
+
/* build up property array for all yet existing properties and queue
* notification for them (at least notification for internal properties
* will instantly be caught)
@@ -1612,6 +1614,10 @@ settings_init_style (GtkSettings *settings)
GTK_STYLE_PROVIDER (settings),
GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
+ gtk_style_context_add_provider_for_screen (screen,
+ GTK_STYLE_PROVIDER (settings->priv->theme_provider),
+ GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
+
settings_update_theme (settings);
settings_update_key_theme (settings);
}
@@ -2915,7 +2921,6 @@ static void
settings_update_theme (GtkSettings *settings)
{
GtkSettingsPrivate *priv = settings->priv;
- GtkCssProvider *provider = NULL;
gboolean prefer_dark_theme;
gchar *theme_name;
@@ -2930,9 +2935,9 @@ settings_update_theme (GtkSettings *settings)
theme_name = g_strdup ("Raleigh");
}
- provider = gtk_css_provider_get_named (theme_name, prefer_dark_theme ? "dark" : NULL);
-
- settings_update_provider (priv->screen, &priv->theme_provider, provider);
+ _gtk_css_provider_load_named (priv->theme_provider,
+ theme_name,
+ prefer_dark_theme ? "dark" : NULL);
if (theme_name && *theme_name)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]