From 060c32e4e04f06d6fcd36d3dece575b96e6cca45 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Fri, 22 Jan 1999 08:12:00 +0000 Subject: [PATCH] take value_spacing into account for GTK_POS_LEFT. Fri Jan 22 07:33:44 1999 Tim Janik * gtk/gtkvscale.c (gtk_vscale_pos_trough): take value_spacing into account for GTK_POS_LEFT. * gtk/gtkradiobutton.c (gtk_radio_button_set_group): use gtk_toggle_button_set_active () to set the new state. (gtk_radio_button_new): only _set_group if group != NULL. (gtk_radio_button_clicked): reference the widget. (gtk_radio_button_init): make radio buttons active upon startup. --- ChangeLog | 12 ++++++++++++ ChangeLog.pre-2-0 | 12 ++++++++++++ ChangeLog.pre-2-10 | 12 ++++++++++++ ChangeLog.pre-2-2 | 12 ++++++++++++ ChangeLog.pre-2-4 | 12 ++++++++++++ ChangeLog.pre-2-6 | 12 ++++++++++++ ChangeLog.pre-2-8 | 12 ++++++++++++ gtk/gtkradiobutton.c | 25 ++++++++++++++++--------- gtk/gtkvscale.c | 2 +- gtk/testgtkrc | 4 ++++ tests/testgtkrc | 4 ++++ 11 files changed, 109 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5efcce6041..1bd91e06ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Fri Jan 22 07:33:44 1999 Tim Janik + + * gtk/gtkvscale.c (gtk_vscale_pos_trough): take value_spacing into + account for GTK_POS_LEFT. + + * gtk/gtkradiobutton.c (gtk_radio_button_set_group): use + gtk_toggle_button_set_active () to set the new state. + (gtk_radio_button_new): only _set_group if group != NULL. + (gtk_radio_button_clicked): reference the widget. + (gtk_radio_button_init): make radio buttons active upon + startup. + Thu Jan 21 17:13:12 1999 Jeff Garzik * gtk/gtkselection.c: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 5efcce6041..1bd91e06ee 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,15 @@ +Fri Jan 22 07:33:44 1999 Tim Janik + + * gtk/gtkvscale.c (gtk_vscale_pos_trough): take value_spacing into + account for GTK_POS_LEFT. + + * gtk/gtkradiobutton.c (gtk_radio_button_set_group): use + gtk_toggle_button_set_active () to set the new state. + (gtk_radio_button_new): only _set_group if group != NULL. + (gtk_radio_button_clicked): reference the widget. + (gtk_radio_button_init): make radio buttons active upon + startup. + Thu Jan 21 17:13:12 1999 Jeff Garzik * gtk/gtkselection.c: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 5efcce6041..1bd91e06ee 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +Fri Jan 22 07:33:44 1999 Tim Janik + + * gtk/gtkvscale.c (gtk_vscale_pos_trough): take value_spacing into + account for GTK_POS_LEFT. + + * gtk/gtkradiobutton.c (gtk_radio_button_set_group): use + gtk_toggle_button_set_active () to set the new state. + (gtk_radio_button_new): only _set_group if group != NULL. + (gtk_radio_button_clicked): reference the widget. + (gtk_radio_button_init): make radio buttons active upon + startup. + Thu Jan 21 17:13:12 1999 Jeff Garzik * gtk/gtkselection.c: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 5efcce6041..1bd91e06ee 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,15 @@ +Fri Jan 22 07:33:44 1999 Tim Janik + + * gtk/gtkvscale.c (gtk_vscale_pos_trough): take value_spacing into + account for GTK_POS_LEFT. + + * gtk/gtkradiobutton.c (gtk_radio_button_set_group): use + gtk_toggle_button_set_active () to set the new state. + (gtk_radio_button_new): only _set_group if group != NULL. + (gtk_radio_button_clicked): reference the widget. + (gtk_radio_button_init): make radio buttons active upon + startup. + Thu Jan 21 17:13:12 1999 Jeff Garzik * gtk/gtkselection.c: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 5efcce6041..1bd91e06ee 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +Fri Jan 22 07:33:44 1999 Tim Janik + + * gtk/gtkvscale.c (gtk_vscale_pos_trough): take value_spacing into + account for GTK_POS_LEFT. + + * gtk/gtkradiobutton.c (gtk_radio_button_set_group): use + gtk_toggle_button_set_active () to set the new state. + (gtk_radio_button_new): only _set_group if group != NULL. + (gtk_radio_button_clicked): reference the widget. + (gtk_radio_button_init): make radio buttons active upon + startup. + Thu Jan 21 17:13:12 1999 Jeff Garzik * gtk/gtkselection.c: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 5efcce6041..1bd91e06ee 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +Fri Jan 22 07:33:44 1999 Tim Janik + + * gtk/gtkvscale.c (gtk_vscale_pos_trough): take value_spacing into + account for GTK_POS_LEFT. + + * gtk/gtkradiobutton.c (gtk_radio_button_set_group): use + gtk_toggle_button_set_active () to set the new state. + (gtk_radio_button_new): only _set_group if group != NULL. + (gtk_radio_button_clicked): reference the widget. + (gtk_radio_button_init): make radio buttons active upon + startup. + Thu Jan 21 17:13:12 1999 Jeff Garzik * gtk/gtkselection.c: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 5efcce6041..1bd91e06ee 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +Fri Jan 22 07:33:44 1999 Tim Janik + + * gtk/gtkvscale.c (gtk_vscale_pos_trough): take value_spacing into + account for GTK_POS_LEFT. + + * gtk/gtkradiobutton.c (gtk_radio_button_set_group): use + gtk_toggle_button_set_active () to set the new state. + (gtk_radio_button_new): only _set_group if group != NULL. + (gtk_radio_button_clicked): reference the widget. + (gtk_radio_button_init): make radio buttons active upon + startup. + Thu Jan 21 17:13:12 1999 Jeff Garzik * gtk/gtkselection.c: diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c index b83814a5dd..b517214d6b 100644 --- a/gtk/gtkradiobutton.c +++ b/gtk/gtkradiobutton.c @@ -99,7 +99,12 @@ static void gtk_radio_button_init (GtkRadioButton *radio_button) { GTK_WIDGET_SET_FLAGS (radio_button, GTK_NO_WINDOW); + + GTK_TOGGLE_BUTTON (radio_button)->active = TRUE; + radio_button->group = g_slist_prepend (NULL, radio_button); + + gtk_widget_set_state (GTK_WIDGET (radio_button), GTK_STATE_ACTIVE); } static void @@ -146,12 +151,12 @@ gtk_radio_button_get_arg (GtkObject *object, void gtk_radio_button_set_group (GtkRadioButton *radio_button, - GSList *group) + GSList *group) { g_return_if_fail (radio_button != NULL); g_return_if_fail (GTK_IS_RADIO_BUTTON (radio_button)); g_return_if_fail (!g_slist_find (group, radio_button)); - + if (radio_button->group) { GSList *slist; @@ -183,11 +188,8 @@ gtk_radio_button_set_group (GtkRadioButton *radio_button, tmp_button->group = radio_button->group; } } - else - { - GTK_TOGGLE_BUTTON (radio_button)->active = TRUE; - gtk_widget_set_state (GTK_WIDGET (radio_button), GTK_STATE_ACTIVE); - } + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button), group == NULL); } GtkWidget* @@ -197,7 +199,8 @@ gtk_radio_button_new (GSList *group) radio_button = gtk_type_new (gtk_radio_button_get_type ()); - gtk_radio_button_set_group (radio_button, group); + if (group) + gtk_radio_button_set_group (radio_button, group); return GTK_WIDGET (radio_button); } @@ -293,6 +296,8 @@ gtk_radio_button_clicked (GtkButton *button) toggle_button = GTK_TOGGLE_BUTTON (button); toggled = FALSE; + gtk_widget_ref (GTK_WIDGET (button)); + if (toggle_button->active) { tmp_button = NULL; @@ -303,7 +308,7 @@ gtk_radio_button_clicked (GtkButton *button) tmp_button = tmp_list->data; tmp_list = tmp_list->next; - if (tmp_button->active && (tmp_button != toggle_button)) + if (tmp_button->active && tmp_button != toggle_button) break; tmp_button = NULL; @@ -348,6 +353,8 @@ gtk_radio_button_clicked (GtkButton *button) gtk_toggle_button_toggled (toggle_button); gtk_widget_queue_draw (GTK_WIDGET (button)); + + gtk_widget_unref (GTK_WIDGET (button)); } static void diff --git a/gtk/gtkvscale.c b/gtk/gtkvscale.c index cb88083f90..438d74796e 100644 --- a/gtk/gtkvscale.c +++ b/gtk/gtkvscale.c @@ -398,7 +398,7 @@ gtk_vscale_pos_trough (GtkVScale *vscale, switch (scale->value_pos) { case GTK_POS_LEFT: - *x = (gtk_scale_get_value_width (scale) + + *x = (gtk_scale_get_value_width (scale) + SCALE_CLASS (scale)->value_spacing + (widget->allocation.width - widget->requisition.width) / 2); break; case GTK_POS_RIGHT: diff --git a/gtk/testgtkrc b/gtk/testgtkrc index 08ca4a3f49..f379c07d62 100644 --- a/gtk/testgtkrc +++ b/gtk/testgtkrc @@ -14,6 +14,10 @@ include "testgtkrc2" #include "/usr/local/share/themes/Pixmap/gtk/gtkrc" +#include "/usr/local/share/themes/Redmond95/gtk/gtkrc" +#include "/usr/local/share/themes/Metal/gtk/gtkrc" +#include "/usr/local/share/themes/Notif/gtk/gtkrc" +#include "/usr/local/share/themes/Default/gtk/gtkrc" pixmap_path "." diff --git a/tests/testgtkrc b/tests/testgtkrc index 08ca4a3f49..f379c07d62 100644 --- a/tests/testgtkrc +++ b/tests/testgtkrc @@ -14,6 +14,10 @@ include "testgtkrc2" #include "/usr/local/share/themes/Pixmap/gtk/gtkrc" +#include "/usr/local/share/themes/Redmond95/gtk/gtkrc" +#include "/usr/local/share/themes/Metal/gtk/gtkrc" +#include "/usr/local/share/themes/Notif/gtk/gtkrc" +#include "/usr/local/share/themes/Default/gtk/gtkrc" pixmap_path "."