[gtk+/radio-group: 6/9] Replace use of gtk_radio_..._from_widget with GtkRadioGroup use



commit 9631d82de80cf3220e5924c86815d98d6c27e492
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Nov 5 13:28:26 2010 +0100

    Replace use of gtk_radio_..._from_widget with GtkRadioGroup use
    
    The _from_widget stuff is really not needed when we have a proper
    group object.

 docs/tools/widgets.c                 |    8 +++++---
 examples/radiobuttons/radiobuttons.c |    3 +--
 tests/testgtk.c                      |   12 +++++++-----
 3 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 312d064..534e047 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -221,13 +221,15 @@ create_radio (void)
   GtkWidget *widget;
   GtkWidget *radio;
   GtkWidget *align;
+  GtkRadioGroup *group;
 
   widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
-  radio = gtk_radio_button_new_with_mnemonic (NULL, "Radio Button _One");
+  group = gtk_radio_group_new ();
+  radio = gtk_radio_button_new_with_mnemonic (group, "Radio Button _One");
   gtk_box_pack_start (GTK_BOX (widget), radio, FALSE, FALSE, 0);
-  radio = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (radio), "Radio Button _Two");
+  radio = gtk_radio_button_new_with_mnemonic (group, "Radio Button _Two");
   gtk_box_pack_start (GTK_BOX (widget), radio, FALSE, FALSE, 0);
-  radio = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (radio), "Radio Button T_hree");
+  radio = gtk_radio_button_new_with_mnemonic (group, "Radio Button T_hree");
   gtk_box_pack_start (GTK_BOX (widget), radio, FALSE, FALSE, 0);
   align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
   gtk_container_add (GTK_CONTAINER (align), widget);
diff --git a/examples/radiobuttons/radiobuttons.c b/examples/radiobuttons/radiobuttons.c
index aaf50b0..065d461 100644
--- a/examples/radiobuttons/radiobuttons.c
+++ b/examples/radiobuttons/radiobuttons.c
@@ -50,8 +50,7 @@ int main( int   argc,
     gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
     gtk_widget_show (button);
 
-    button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button),
-	                                                  "button3");
+    button = gtk_radio_button_new_with_label (group, "button3");
     gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
     gtk_widget_show (button);
 
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 91977a8..9f4e1d5 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -174,24 +174,26 @@ build_alpha_widgets (void)
   GtkWidget *hbox;
   GtkWidget *label;
   GtkWidget *entry;
+  GtkRadioGroup *group;
 
   table = gtk_table_new (1, 1, FALSE);
 
-  radio_button = gtk_radio_button_new_with_label (NULL, "Red");
+  group = gtk_radio_group_new ();
+  radio_button = gtk_radio_button_new_with_label (group, "Red");
   gtk_table_attach (GTK_TABLE (table),
 		    radio_button,
 		    0, 1,                  0, 1,
 		    GTK_EXPAND | GTK_FILL, 0,
 		    0,                     0);
 
-  radio_button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio_button), "Green");
+  radio_button = gtk_radio_button_new_with_label (group, "Green");
   gtk_table_attach (GTK_TABLE (table),
 		    radio_button,
 		    0, 1,                  1, 2,
 		    GTK_EXPAND | GTK_FILL, 0,
 		    0,                     0);
 
-  radio_button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio_button), "Blue"),
+  radio_button = gtk_radio_button_new_with_label (group, "Blue"),
   gtk_table_attach (GTK_TABLE (table),
 		    radio_button,
 		    0, 1,                  2, 3,
@@ -214,14 +216,14 @@ build_alpha_widgets (void)
 		    GTK_EXPAND | GTK_FILL, 0,
 		    0,                     0);
 
-  radio_button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio_button), "Green");
+  radio_button = gtk_radio_button_new_with_label (group, "Green");
   gtk_table_attach (GTK_TABLE (table),
 		    radio_button,
 		    0, 1,                  1, 2,
 		    GTK_EXPAND | GTK_FILL, 0,
 		    0,                     0);
 
-  radio_button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio_button), "Blue"),
+  radio_button = gtk_radio_button_new_with_label (group, "Blue"),
   gtk_table_attach (GTK_TABLE (table),
 		    radio_button,
 		    0, 1,                  2, 3,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]