summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-04-11 14:56:15 +0200
committerBenjamin Otte <otte@redhat.com>2012-04-17 08:59:22 +0200
commit1d54e4e86765029266d615d088bd7ae7dcf69940 (patch)
tree9b2eaf4fc1caaeabb34f8c26f6d36af78998ca42 /gtk
parent60eff87d0884cf5ae7dc0a5de81ab8283d50abc0 (diff)
downloadgtk+-1d54e4e86765029266d615d088bd7ae7dcf69940.tar.gz
widget: Set .default class when widget is default
Don't just conditionally set it on buttons.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkbutton.c2
-rw-r--r--gtk/gtkwidget.c9
2 files changed, 9 insertions, 2 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 6a6d7c3147..1ecd6d1468 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1720,8 +1720,6 @@ _gtk_button_paint (GtkButton *button,
y += default_border.top;
width -= default_border.left + default_border.right;
height -= default_border.top + default_border.bottom;
-
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_DEFAULT);
}
else if (gtk_widget_get_can_default (widget))
{
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 5b2aa3f719..ff3c552650 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6994,7 +6994,16 @@ void
_gtk_widget_set_has_default (GtkWidget *widget,
gboolean has_default)
{
+ GtkStyleContext *context;
+
widget->priv->has_default = has_default;
+
+ context = gtk_widget_get_style_context (widget);
+
+ if (has_default)
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_DEFAULT);
+ else
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_DEFAULT);
}
/**