[gtk+] button: Use an element name instead of a style class
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] button: Use an element name instead of a style class
- Date: Fri, 30 Oct 2015 04:40:58 +0000 (UTC)
commit a953e377359d001160e2c9700c8fdd163a14c2b4
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Oct 29 22:55:29 2015 -0400
button: Use an element name instead of a style class
gtk/gtkbutton.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 8abbceb..f976194 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -34,6 +34,15 @@
* The #GtkButton widget can hold any valid child widget. That is, it can hold
* almost any other standard #GtkWidget. The most commonly used child is the
* #GtkLabel.
+ *
+ * # CSS nodes
+ *
+ * GtkButton has a single CSS node with name button. The node will get the
+ * style classes .image-button or .text-button, if the content is just an
+ * image or label, respectively. It may also receive the .flat style class.
+ *
+ * Other style classes that are commonly used with GtkButton include
+ * .suggested-action and .destructive-action.
*/
#include "config.h"
@@ -579,6 +588,7 @@ gtk_button_class_init (GtkButtonClass *klass)
GTK_PARAM_READABLE));
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_BUTTON_ACCESSIBLE);
+ gtk_widget_class_set_css_name (widget_class, "button");
}
static void
@@ -658,7 +668,6 @@ static void
gtk_button_init (GtkButton *button)
{
GtkButtonPrivate *priv;
- GtkStyleContext *context;
button->priv = gtk_button_get_instance_private (button);
priv = button->priv;
@@ -683,9 +692,6 @@ gtk_button_init (GtkButton *button)
priv->image_position = GTK_POS_LEFT;
priv->use_action_appearance = TRUE;
- context = gtk_widget_get_style_context (GTK_WIDGET (button));
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
-
priv->gesture = gtk_gesture_multi_press_new (GTK_WIDGET (button));
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->gesture), FALSE);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->gesture), TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]