check button: Deprecate indicator-size

CSS min-width/min-height can do just the same. We still fall
back to the indicator-size style property if the CSS properties
are not set.
This commit is contained in:
Matthias Clasen 2015-12-16 13:11:24 -05:00
parent bb67a06bd6
commit 0291978acc

View File

@ -37,6 +37,7 @@
#include "gtkcsscustomgadgetprivate.h" #include "gtkcsscustomgadgetprivate.h"
#include "gtkcontainerprivate.h" #include "gtkcontainerprivate.h"
#include "gtkstylecontextprivate.h" #include "gtkstylecontextprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkradiobutton.h" #include "gtkradiobutton.h"
@ -215,6 +216,13 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
widget_class->state_flags_changed = gtk_check_button_state_flags_changed; widget_class->state_flags_changed = gtk_check_button_state_flags_changed;
widget_class->direction_changed = gtk_check_button_direction_changed; widget_class->direction_changed = gtk_check_button_direction_changed;
/**
* GtkCheckButton:indicator-size:
*
* The size of the indicator.
*
* Deprecated: 3.20: Use CSS min-width and min-height on the indicator node.
*/
gtk_widget_class_install_style_property (widget_class, gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("indicator-size", g_param_spec_int ("indicator-size",
P_("Indicator Size"), P_("Indicator Size"),
@ -222,7 +230,7 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
0, 0,
G_MAXINT, G_MAXINT,
INDICATOR_SIZE, INDICATOR_SIZE,
GTK_PARAM_READABLE)); GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
/** /**
* GtkCheckButton:indicator-spacing: * GtkCheckButton:indicator-spacing:
@ -521,15 +529,24 @@ gtk_check_button_measure_check (GtkCssGadget *gadget,
int *natural_baseline, int *natural_baseline,
gpointer unused) gpointer unused)
{ {
GtkWidget *widget; gdouble min_size;
gint indicator_size; guint property;
widget = gtk_css_gadget_get_owner (gadget); if (orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_widget_style_get (widget, property = GTK_CSS_PROPERTY_MIN_WIDTH;
"indicator-size", &indicator_size, else
property = GTK_CSS_PROPERTY_MIN_HEIGHT;
min_size = _gtk_css_number_value_get (gtk_css_style_get_value (gtk_css_gadget_get_style (gadget), property), 100);
if (min_size > 0.0)
*minimum = *natural = 0;
else
{
gtk_widget_style_get (gtk_css_gadget_get_owner (gadget),
"indicator-size", minimum,
NULL); NULL);
*natural = *minimum;
*minimum = *natural = indicator_size; }
} }
static void static void