theme: Set object-name on style contexts

The default theme started to use them in GTK+ commit 371f50, so
we need to update the style contexts to keep matching the style
of client-side decorations.

https://bugzilla.gnome.org/show_bug.cgi?id=757101
This commit is contained in:
Florian Müllner 2015-10-27 09:18:32 +01:00
parent 86a913d37a
commit 2750db2a89

View File

@ -929,6 +929,7 @@ static GtkStyleContext *
create_style_context (GType widget_type, create_style_context (GType widget_type,
GtkStyleContext *parent_style, GtkStyleContext *parent_style,
GtkCssProvider *provider, GtkCssProvider *provider,
const char *object_name,
const char *first_class, const char *first_class,
...) ...)
{ {
@ -948,6 +949,9 @@ create_style_context (GType widget_type,
gtk_widget_path_append_type (path, widget_type); gtk_widget_path_append_type (path, widget_type);
if (object_name)
gtk_widget_path_iter_set_object_name (path, -1, object_name);
va_start (ap, first_class); va_start (ap, first_class);
for (name = first_class; name; name = va_arg (ap, const char *)) for (name = first_class; name; name = va_arg (ap, const char *))
gtk_widget_path_iter_add_class (path, -1, name); gtk_widget_path_iter_add_class (path, -1, name);
@ -987,6 +991,7 @@ meta_theme_create_style_info (GdkScreen *screen,
create_style_context (META_TYPE_FRAMES, create_style_context (META_TYPE_FRAMES,
NULL, NULL,
provider, provider,
"decoration",
GTK_STYLE_CLASS_BACKGROUND, GTK_STYLE_CLASS_BACKGROUND,
"window-frame", "window-frame",
"ssd", "ssd",
@ -995,6 +1000,7 @@ meta_theme_create_style_info (GdkScreen *screen,
create_style_context (GTK_TYPE_HEADER_BAR, create_style_context (GTK_TYPE_HEADER_BAR,
style_info->styles[META_STYLE_ELEMENT_FRAME], style_info->styles[META_STYLE_ELEMENT_FRAME],
provider, provider,
NULL,
GTK_STYLE_CLASS_TITLEBAR, GTK_STYLE_CLASS_TITLEBAR,
GTK_STYLE_CLASS_HORIZONTAL, GTK_STYLE_CLASS_HORIZONTAL,
"default-decoration", "default-decoration",
@ -1004,12 +1010,14 @@ meta_theme_create_style_info (GdkScreen *screen,
create_style_context (GTK_TYPE_LABEL, create_style_context (GTK_TYPE_LABEL,
style_info->styles[META_STYLE_ELEMENT_TITLEBAR], style_info->styles[META_STYLE_ELEMENT_TITLEBAR],
provider, provider,
NULL,
GTK_STYLE_CLASS_TITLE, GTK_STYLE_CLASS_TITLE,
NULL); NULL);
style_info->styles[META_STYLE_ELEMENT_BUTTON] = style_info->styles[META_STYLE_ELEMENT_BUTTON] =
create_style_context (GTK_TYPE_BUTTON, create_style_context (GTK_TYPE_BUTTON,
style_info->styles[META_STYLE_ELEMENT_TITLEBAR], style_info->styles[META_STYLE_ELEMENT_TITLEBAR],
provider, provider,
NULL,
GTK_STYLE_CLASS_BUTTON, GTK_STYLE_CLASS_BUTTON,
"titlebutton", "titlebutton",
NULL); NULL);
@ -1017,6 +1025,7 @@ meta_theme_create_style_info (GdkScreen *screen,
create_style_context (GTK_TYPE_IMAGE, create_style_context (GTK_TYPE_IMAGE,
style_info->styles[META_STYLE_ELEMENT_BUTTON], style_info->styles[META_STYLE_ELEMENT_BUTTON],
provider, provider,
NULL,
NULL); NULL);
return style_info; return style_info;
} }