[gtk+/key-themes: 8/8] Parse the gtk-keys.css file in the GtkSettings::gtk-key-theme-name theme path
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/key-themes: 8/8] Parse the gtk-keys.css file in the GtkSettings::gtk-key-theme-name theme path
- Date: Fri, 28 Jan 2011 18:42:34 +0000 (UTC)
commit f8b932a12ebe04b4bb6e49cf1dc2e45b3522e52f
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jan 28 19:34:36 2011 +0100
Parse the gtk-keys.css file in the GtkSettings::gtk-key-theme-name theme path
gtk/gtksettings.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 50c00be..2a9fa49 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -225,6 +225,7 @@ static gboolean settings_update_fontconfig (GtkSettings *setting
#endif
static void settings_update_color_scheme (GtkSettings *settings);
static void settings_update_theme (GtkSettings *settings);
+static void settings_update_key_theme (GtkSettings *settings);
static void merge_color_scheme (GtkSettings *settings,
const GValue *value,
@@ -1426,6 +1427,7 @@ settings_init_style (GtkSettings *settings)
GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
settings_update_theme (settings);
+ settings_update_key_theme (settings);
}
/**
@@ -1608,6 +1610,9 @@ gtk_settings_notify (GObject *object,
settings_update_color_scheme (settings);
gtk_style_context_reset_widgets (priv->screen);
break;
+ case PROP_KEY_THEME_NAME:
+ settings_update_key_theme (settings);
+ break;
case PROP_THEME_NAME:
settings_update_theme (settings);
break;
@@ -2732,6 +2737,47 @@ settings_update_theme (GtkSettings *settings)
g_free (theme_name);
}
+static void
+settings_update_key_theme (GtkSettings *settings)
+{
+ static GQuark quark_key_theme_name = 0;
+ GtkSettingsPrivate *priv = settings->priv;
+ GtkCssProvider *provider, *new_provider = NULL;
+ gchar *key_theme_name;
+
+ if (G_UNLIKELY (!quark_key_theme_name))
+ quark_key_theme_name = g_quark_from_static_string ("gtk-settings-key-theme-name");
+
+ provider = g_object_get_qdata (G_OBJECT (settings), quark_key_theme_name);
+
+ g_object_get (settings,
+ "gtk-key-theme-name", &key_theme_name,
+ NULL);
+
+ if (key_theme_name && *key_theme_name)
+ new_provider = gtk_css_provider_get_named (key_theme_name, "keys");
+
+ if (new_provider != provider)
+ {
+ if (provider)
+ gtk_style_context_remove_provider_for_screen (priv->screen,
+ GTK_STYLE_PROVIDER (provider));
+
+ if (new_provider)
+ {
+ gtk_style_context_add_provider_for_screen (priv->screen,
+ GTK_STYLE_PROVIDER (new_provider),
+ GTK_STYLE_PROVIDER_PRIORITY_THEME);
+ g_object_ref (new_provider);
+ }
+
+ g_object_set_qdata_full (G_OBJECT (settings), quark_key_theme_name,
+ new_provider, (GDestroyNotify) g_object_unref);
+ }
+
+ g_free (key_theme_name);
+}
+
static gboolean
add_color_to_hash (gchar *name,
GdkColor *color,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]