[gtk+] widget: Set .default class when widget is default
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget: Set .default class when widget is default
- Date: Tue, 17 Apr 2012 07:21:59 +0000 (UTC)
commit 1d54e4e86765029266d615d088bd7ae7dcf69940
Author: Benjamin Otte <otte redhat com>
Date: Wed Apr 11 14:56:15 2012 +0200
widget: Set .default class when widget is default
Don't just conditionally set it on buttons.
gtk/gtkbutton.c | 2 --
gtk/gtkwidget.c | 9 +++++++++
2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 6a6d7c3..1ecd6d1 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 5b2aa3f..ff3c552 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);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]