Commit ce5e74e1 authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld
Browse files

initialize the inconsistent field in the private structure,

2006-01-13  Kristian Rietveld  <kris@imendio.com>

	* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_init):
	initialize the inconsistent field in the private structure,
	(gtk_cell_renderer_toggle_class_init),
	(gtk_cell_renderer_toggle_{set,get}_property),
	(gtk_cell_renderer_toggle_get_size): introduce a indicator-size
	property.
parent eb8f23f9
2006-01-13 Kristian Rietveld <kris@imendio.com>
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_init):
initialize the inconsistent field in the private structure,
(gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_{set,get}_property),
(gtk_cell_renderer_toggle_get_size): introduce a indicator-size
property.
2006-01-13 Michael Natterer <mitch@imendio.com>
* gtk/gtktreeview.c (gtk_tree_view_real_expand_row)
......
2006-01-13 Kristian Rietveld <kris@imendio.com>
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_init):
initialize the inconsistent field in the private structure,
(gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_{set,get}_property),
(gtk_cell_renderer_toggle_get_size): introduce a indicator-size
property.
2006-01-13 Michael Natterer <mitch@imendio.com>
* gtk/gtktreeview.c (gtk_tree_view_real_expand_row)
......
......@@ -69,7 +69,8 @@ enum {
PROP_ACTIVATABLE,
PROP_ACTIVE,
PROP_RADIO,
PROP_INCONSISTENT
PROP_INCONSISTENT,
PROP_INDICATOR_SIZE
};
#define TOGGLE_WIDTH 12
......@@ -81,6 +82,8 @@ static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
typedef struct _GtkCellRendererTogglePrivate GtkCellRendererTogglePrivate;
struct _GtkCellRendererTogglePrivate
{
gint indicator_size;
guint inconsistent : 1;
};
......@@ -116,12 +119,20 @@ gtk_cell_renderer_toggle_get_type (void)
static void
gtk_cell_renderer_toggle_init (GtkCellRendererToggle *celltoggle)
{
GtkCellRendererTogglePrivate *priv;
priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (celltoggle);
celltoggle->activatable = TRUE;
celltoggle->active = FALSE;
celltoggle->radio = FALSE;
GTK_CELL_RENDERER (celltoggle)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
GTK_CELL_RENDERER (celltoggle)->xpad = 2;
GTK_CELL_RENDERER (celltoggle)->ypad = 2;
priv->indicator_size = 12;
priv->inconsistent = FALSE;
}
static void
......@@ -169,6 +180,16 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class)
FALSE,
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_INDICATOR_SIZE,
g_param_spec_int ("indicator-size",
P_("Indicator size"),
P_("Size of check or radio indicator"),
0,
G_MAXINT,
TOGGLE_WIDTH,
GTK_PARAM_READWRITE));
/**
* GtkCellRendererToggle::toggled:
......@@ -216,6 +237,9 @@ gtk_cell_renderer_toggle_get_property (GObject *object,
case PROP_RADIO:
g_value_set_boolean (value, celltoggle->radio);
break;
case PROP_INDICATOR_SIZE:
g_value_set_int (value, priv->indicator_size);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
......@@ -248,6 +272,9 @@ gtk_cell_renderer_toggle_set_property (GObject *object,
case PROP_RADIO:
celltoggle->radio = g_value_get_boolean (value);
break;
case PROP_INDICATOR_SIZE:
priv->indicator_size = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
......@@ -284,9 +311,12 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
{
gint calc_width;
gint calc_height;
GtkCellRendererTogglePrivate *priv;
priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (cell);
calc_width = (gint) cell->xpad * 2 + TOGGLE_WIDTH;
calc_height = (gint) cell->ypad * 2 + TOGGLE_WIDTH;
calc_width = (gint) cell->xpad * 2 + priv->indicator_size;
calc_height = (gint) cell->ypad * 2 + priv->indicator_size;
if (width)
*width = calc_width;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment