[gtk+] color button: Add a style class



commit 7d18398eebe52da382a2d3255e6de8f49c5b9798
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Oct 30 01:15:57 2015 -0400

    color button: Add a style class
    
    Add a .color style class to differentiate this button from the
    normal ones.

 gtk/gtkcolorbutton.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index 9b3e7bb..0a61e74 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -51,6 +51,11 @@
  * The #GtkColorButton is a button which displays the currently selected
  * color and allows to open a color selection dialog to change the color.
  * It is suitable widget for selecting a color in a preference dialog.
+ *
+ * # CSS nodes
+ *
+ * GtkColorButton has a single CSS node with name button. To differentiate
+ * it from a plain #GtkButton, it gets the .color style class.
  */
 
 
@@ -366,6 +371,7 @@ gtk_color_button_init (GtkColorButton *button)
   GtkColorButtonPrivate *priv;
   PangoLayout *layout;
   PangoRectangle rect;
+  GtkStyleContext *context;
 
   /* Create the widgets */
   priv = button->priv = gtk_color_button_get_instance_private (button);
@@ -404,6 +410,9 @@ gtk_color_button_init (GtkColorButton *button)
                     G_CALLBACK (gtk_color_button_drag_data_received), button);
   g_signal_connect (button, "drag-data-get",
                     G_CALLBACK (gtk_color_button_drag_data_get), button);
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (button));
+  gtk_style_context_add_class (context, "color");
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]