diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-10-30 22:16:18 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-10-30 22:19:07 -0400 |
commit | dfedda3deefc16a5ef8c45218dd600f81fd16d71 (patch) | |
tree | d24732d92dbc5bc6bf11eeb37aae626e00631701 /gtk/gtkcolorswatch.c | |
parent | 42a231a61c609f095a58f82a620a147890261435 (diff) | |
download | gtk+-dfedda3deefc16a5ef8c45218dd600f81fd16d71.tar.gz |
color editor: Redo the non-activatable color swatch
Use a .activatable style class on the color swatch and tie the
hover effect to it. The color editor simply removes this class
now to get an inert color swatch.
This is more flexible and lets us avoid referring to the
GtkColorEditor type in the theme.
Diffstat (limited to 'gtk/gtkcolorswatch.c')
-rw-r--r-- | gtk/gtkcolorswatch.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c index 9296320e11..05d8734da9 100644 --- a/gtk/gtkcolorswatch.c +++ b/gtk/gtkcolorswatch.c @@ -31,6 +31,7 @@ #include "gtkrenderprivate.h" #include "gtkcssnodeprivate.h" #include "gtkwidgetprivate.h" +#include "gtkstylecontextprivate.h" #include "a11y/gtkcolorswatchaccessibleprivate.h" @@ -39,6 +40,9 @@ * and a subnode named overlay. The main node gets the .light or .dark * style classes added depending on the brightness of the color that * the swatch is showing. + * + * The color swatch has the .activatable style class by default. It can + * be removed for non-activatable swatches. */ struct _GtkColorSwatchPrivate @@ -93,6 +97,7 @@ static void gtk_color_swatch_init (GtkColorSwatch *swatch) { GtkCssNode *widget_node; + GtkStyleContext *context; swatch->priv = gtk_color_swatch_get_instance_private (swatch); swatch->priv->use_alpha = TRUE; @@ -119,6 +124,9 @@ gtk_color_swatch_init (GtkColorSwatch *swatch) gtk_css_node_set_parent (swatch->priv->overlay_node, widget_node); gtk_css_node_set_state (swatch->priv->overlay_node, gtk_css_node_get_state (widget_node)); g_object_unref (swatch->priv->overlay_node); + + context = gtk_widget_get_style_context (GTK_WIDGET (swatch)); + gtk_style_context_add_class (context, "activatable"); } #define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11) |