* SECTION:hildon-check-button
* @short_description: Button with a check box inside
*
- * This is a standard GtkButton which contains a check box and a
+ * This is a standard #GtkButton which contains a check box and a
* label. Functions are provided to get and set the value of the check
* box. Note that this button does NOT support an image, so don't use
* gtk_button_set_image()
*
* <example>
+ * <title>Using a Hildon check button</title>
* <programlisting>
* void
* button_clicked (GtkButton *button, gpointer user_data)
}
/**
- * hildon_check_button_set_label:
- * @button: A #GtkButton created with hildon_check_button_new()
- * @label: New text for the label.
- *
- * Sets the text of the button label to @label.
- *
- * Deprecated: Use gtk_button_set_label() instead.
- **/
-void
-hildon_check_button_set_label (GtkButton *button,
- const gchar *label)
-{
- gtk_button_set_label (button, label);
-}
-
-/**
- * hildon_check_button_get_label:
- * @button: A #GtkButton created with hildon_check_button_new()
- *
- * Gets the text of the label inside the button.
- *
- * Return value: the text of the label. This string is owned by the
- * button and must not be modified or freed.
- *
- * Deprecated: Use gtk_button_get_label() instead.
- **/
-const gchar *
-hildon_check_button_get_label (GtkButton *button)
-{
- return gtk_button_get_label (button);
-}
-
-/**
* hildon_check_button_set_active:
* @button: A #GtkButton created with hildon_check_button_new()
* @is_active: new state for the check box
gboolean is_active)
{
GtkCellRendererToggle *toggle_renderer;
+ gboolean prev_is_active;
g_return_if_fail (GTK_IS_BUTTON (button));
toggle_renderer = GTK_CELL_RENDERER_TOGGLE (g_object_get_data (G_OBJECT (button), "toggle-renderer"));
g_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle_renderer));
- gtk_cell_renderer_toggle_set_active (toggle_renderer, is_active);
+ prev_is_active = gtk_cell_renderer_toggle_get_active (toggle_renderer);
+
+ if (prev_is_active != is_active) {
+ gtk_cell_renderer_toggle_set_active (toggle_renderer, is_active);
+ gtk_widget_queue_draw (GTK_WIDGET (button));
+ }
}
/**
* This function creates a #GtkButton containing a label and a check
* box.
*
- * This button has specific functions to get and set the value of the
- * check box.
- *
- * Return value: A newly created #GtkButton widget.
+ * Return value: A newly created #GtkButton widget with a check box.
**/
GtkWidget *
hildon_check_button_new (HildonSizeType size)