[gtk+] scale button: Add a style class
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] scale button: Add a style class
- Date: Fri, 30 Oct 2015 04:57:33 +0000 (UTC)
commit 2c5e25a5c719e9b3375461adf3502e7fc2110b03
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 30 00:51:13 2015 -0400
scale button: Add a style class
Add a .scale style class to differentiate scale buttons from normal
ones.
gtk/gtkscalebutton.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index f797399..010f926 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -65,6 +65,11 @@
* This kind of widget is commonly used for volume controls in multimedia
* applications, and GTK+ provides a #GtkVolumeButton subclass that
* is tailored for this use case.
+ *
+ * # CSS nodes
+ *
+ * GtkScaleButton has a single CSS node with name button. To differentiate
+ * it from a plain #GtkButton, it gets the .scale style class.
*/
@@ -338,12 +343,14 @@ gtk_scale_button_class_init (GtkScaleButtonClass *klass)
gtk_widget_class_bind_template_callback (widget_class, cb_popup_mapped);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCALE_BUTTON_ACCESSIBLE);
+ gtk_widget_class_set_css_name (widget_class, "button");
}
static void
gtk_scale_button_init (GtkScaleButton *button)
{
GtkScaleButtonPrivate *priv;
+ GtkStyleContext *context;
button->priv = priv = gtk_scale_button_get_instance_private (button);
@@ -358,6 +365,9 @@ gtk_scale_button_init (GtkScaleButton *button)
g_object_ref (priv->adjustment);
gtk_widget_add_events (GTK_WIDGET (button), GDK_SMOOTH_SCROLL_MASK);
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (button));
+ gtk_style_context_add_class (context, "scale");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]