theme-viewer: use the same GtkStyleContext as mutter usually renders
https://bugzilla.gnome.org/show_bug.cgi?id=690317
This commit is contained in:
@@ -185,38 +185,6 @@ prefs_changed_callback (MetaPreference pref,
|
||||
}
|
||||
}
|
||||
|
||||
static GtkStyleContext *
|
||||
create_style_context (MetaFrames *frames,
|
||||
const gchar *variant)
|
||||
{
|
||||
GtkStyleContext *style;
|
||||
GdkScreen *screen;
|
||||
char *theme_name;
|
||||
|
||||
screen = gtk_widget_get_screen (GTK_WIDGET (frames));
|
||||
g_object_get (gtk_settings_get_for_screen (screen),
|
||||
"gtk-theme-name", &theme_name,
|
||||
NULL);
|
||||
|
||||
style = gtk_style_context_new ();
|
||||
gtk_style_context_set_path (style,
|
||||
gtk_widget_get_path (GTK_WIDGET (frames)));
|
||||
|
||||
if (theme_name && *theme_name)
|
||||
{
|
||||
GtkCssProvider *provider;
|
||||
|
||||
provider = gtk_css_provider_get_named (theme_name, variant);
|
||||
gtk_style_context_add_provider (style,
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
|
||||
}
|
||||
|
||||
g_free (theme_name);
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
static GtkStyleContext *
|
||||
meta_frames_get_theme_variant (MetaFrames *frames,
|
||||
const gchar *variant)
|
||||
@@ -226,7 +194,7 @@ meta_frames_get_theme_variant (MetaFrames *frames,
|
||||
style = g_hash_table_lookup (frames->style_variants, variant);
|
||||
if (style == NULL)
|
||||
{
|
||||
style = create_style_context (frames, variant);
|
||||
style = meta_theme_create_style_context (gtk_widget_get_screen (GTK_WIDGET (frames)), variant);
|
||||
g_hash_table_insert (frames->style_variants, g_strdup (variant), style);
|
||||
}
|
||||
|
||||
@@ -238,15 +206,18 @@ update_style_contexts (MetaFrames *frames)
|
||||
{
|
||||
GtkStyleContext *style;
|
||||
GList *variants, *variant;
|
||||
GdkScreen *screen;
|
||||
|
||||
screen = gtk_widget_get_screen (GTK_WIDGET (frames));
|
||||
|
||||
if (frames->normal_style)
|
||||
g_object_unref (frames->normal_style);
|
||||
frames->normal_style = create_style_context (frames, NULL);
|
||||
frames->normal_style = meta_theme_create_style_context (screen, NULL);
|
||||
|
||||
variants = g_hash_table_get_keys (frames->style_variants);
|
||||
for (variant = variants; variant; variant = variants->next)
|
||||
{
|
||||
style = create_style_context (frames, (char *)variant->data);
|
||||
style = meta_theme_create_style_context (screen, (char *)variant->data);
|
||||
g_hash_table_insert (frames->style_variants,
|
||||
g_strdup (variant->data), style);
|
||||
}
|
||||
|
Reference in New Issue
Block a user