[gtk+] Don't left align label in check buttons when they have no indicator
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Don't left align label in check buttons when they have no indicator
- Date: Tue, 21 Aug 2012 12:10:11 +0000 (UTC)
commit 515e211d0b823c15f339846953e2c5ab32dc9610
Author: William Jon McCann <jmccann redhat com>
Date: Fri Aug 10 13:41:48 2012 -0400
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
gtk/gtkcheckbutton.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 066a0d5..d7df5a9 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);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]