summaryrefslogtreecommitdiff
path: root/gtk/gtkcheckbutton.c
diff options
context:
space:
mode:
authorWilliam Jon McCann <jmccann@redhat.com>2012-08-10 13:41:48 -0400
committerWilliam Jon McCann <jmccann@redhat.com>2012-08-21 07:09:14 -0400
commit515e211d0b823c15f339846953e2c5ab32dc9610 (patch)
tree363cd3056906434a3d5c6c250e141b6b82d1929f /gtk/gtkcheckbutton.c
parentde3cfa6034780cc9e7a0f203dbb7e3a09413da94 (diff)
downloadgtk+-515e211d0b823c15f339846953e2c5ab32dc9610.tar.gz
Don't left align label in check buttons when they have no indicator
Because they should be normal buttons in that case. https://bugzilla.gnome.org/show_bug.cgi?id=681617
Diffstat (limited to 'gtk/gtkcheckbutton.c')
-rw-r--r--gtk/gtkcheckbutton.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 066a0d540d..d7df5a914e 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -106,11 +106,24 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
}
static void
+draw_indicator_changed (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ GtkButton *button = GTK_BUTTON (object);
+
+ if (gtk_toggle_button_get_mode (GTK_TOGGLE_BUTTON (button)))
+ gtk_button_set_alignment (button, 0.0, 0.5);
+ else
+ gtk_button_set_alignment (button, 0.5, 0.5);
+}
+
+static void
gtk_check_button_init (GtkCheckButton *check_button)
{
gtk_widget_set_receives_default (GTK_WIDGET (check_button), FALSE);
+ g_signal_connect (check_button, "notify::draw-indicator", G_CALLBACK (draw_indicator_changed), NULL);
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (check_button), TRUE);
- gtk_button_set_alignment (GTK_BUTTON (check_button), 0.0, 0.5);
}
/**