]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkradiobutton.c
replace g_scanner_add/remove_symbol by g_scanner_scope_add/remove_symbol.
[~andy/gtk] / gtk / gtkradiobutton.c
index fb9e6297d63537ee11038d3cc00b3da424a5ae8a..245bec87e9f39e714e812f650022337014026f8b 100644 (file)
@@ -160,7 +160,6 @@ void
 gtk_radio_button_set_group (GtkRadioButton *radio_button,
                            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));
 
@@ -217,14 +216,11 @@ gtk_radio_button_new_with_label (GSList      *group,
                                 const gchar *label)
 {
   GtkWidget *radio_button;
-  GtkWidget *label_widget;
 
-  radio_button = gtk_radio_button_new (group);
-  label_widget = gtk_label_new (label);
-  gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
+  radio_button = g_object_new (GTK_TYPE_RADIO_BUTTON, "label", label, NULL) ;
 
-  gtk_container_add (GTK_CONTAINER (radio_button), label_widget);
-  gtk_widget_show (label_widget);
+  if (group)
+    gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_button), group);
 
   return radio_button;
 }
@@ -246,14 +242,11 @@ gtk_radio_button_new_with_mnemonic (GSList      *group,
                                    const gchar *label)
 {
   GtkWidget *radio_button;
-  GtkWidget *label_widget;
 
-  radio_button = gtk_radio_button_new (group);
-  label_widget = gtk_label_new_with_mnemonic (label);
-  gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
+  radio_button = g_object_new (GTK_TYPE_RADIO_BUTTON, "label", label, "use_underline", TRUE, NULL);
 
-  gtk_container_add (GTK_CONTAINER (radio_button), label_widget);
-  gtk_widget_show (label_widget);
+  if (group)
+    gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_button), group);
 
   return radio_button;
 }
@@ -302,7 +295,6 @@ gtk_radio_button_new_with_mnemonic_from_widget (GtkRadioButton *group,
 GSList*
 gtk_radio_button_get_group (GtkRadioButton *radio_button)
 {
-  g_return_val_if_fail (radio_button != NULL, NULL);
   g_return_val_if_fail (GTK_IS_RADIO_BUTTON (radio_button), NULL);
 
   return radio_button->group;
@@ -316,7 +308,6 @@ gtk_radio_button_destroy (GtkObject *object)
   GtkRadioButton *tmp_button;
   GSList *tmp_list;
 
-  g_return_if_fail (object != NULL);
   g_return_if_fail (GTK_IS_RADIO_BUTTON (object));
 
   radio_button = GTK_RADIO_BUTTON (object);
@@ -332,6 +323,9 @@ gtk_radio_button_destroy (GtkObject *object)
       tmp_button->group = radio_button->group;
     }
 
+  /* this button is no longer in the group */
+  radio_button->group = NULL;
+  
   if (GTK_OBJECT_CLASS (parent_class)->destroy)
     (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
 }
@@ -346,7 +340,6 @@ gtk_radio_button_clicked (GtkButton *button)
   GSList *tmp_list;
   gint toggled;
 
-  g_return_if_fail (button != NULL);
   g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
 
   radio_button = GTK_RADIO_BUTTON (button);
@@ -428,7 +421,6 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
   gint x, y;
   gint indicator_size, indicator_spacing;
 
-  g_return_if_fail (check_button != NULL);
   g_return_if_fail (GTK_IS_RADIO_BUTTON (check_button));
 
   if (GTK_WIDGET_VISIBLE (check_button) && GTK_WIDGET_MAPPED (check_button))
@@ -474,7 +466,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
        x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
 
       gtk_paint_option (widget->style, widget->window,
-                       GTK_WIDGET_STATE (widget), shadow_type,
+                       state_type, shadow_type,
                        area, widget, "radiobutton",
                        x, y, indicator_size, indicator_size);
     }