From e8998ab4a8ea8e4bf5d60659f612aa55c26ca2ab Mon Sep 17 00:00:00 2001 From: Garux Date: Thu, 21 May 2020 12:17:57 +0300 Subject: [PATCH] replace gtk_radio_button_group() --- contrib/bobtoolz/dialogs/dialogs-gtk.cpp | 34 ++++++--------------- contrib/brushexport/interface.cpp | 13 ++------ contrib/camera/dialogs.cpp | 37 ++++++++--------------- contrib/gtkgensurf/gendlgs.cpp | 16 ++++------ contrib/meshtex/GeneralFunctionDialog.cpp | 22 +++++++------- contrib/meshtex/SetScaleDialog.cpp | 28 ++++++++--------- libs/gtkutil/button.cpp | 6 ++-- libs/gtkutil/dialog.cpp | 5 +-- libs/gtkutil/nonmodal.h | 2 +- radiant/csg.cpp | 2 +- radiant/dialog.cpp | 5 +-- radiant/gtktheme.cpp | 9 ++---- radiant/patchmanip.cpp | 25 +++++---------- 13 files changed, 73 insertions(+), 131 deletions(-) diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index 540e00eb..1f40edfd 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -353,7 +353,7 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){ // ---- vbox ---- - radio1 = gtk_radio_button_new_with_label( NULL, "Use Whole Map" ); + radio1 = gtk_radio_button_new_with_label_from_widget( NULL, "Use Whole Map" ); gtk_box_pack_start( GTK_BOX( vbox ), radio1, FALSE, FALSE, 2 ); gtk_widget_show( radio1 ); @@ -605,7 +605,6 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ GtkWidget *radioNorth, *radioSouth, *radioEast, *radioWest; // i'm guessing we can't just abuse 'w' for these if we're getting a value GtkWidget *radioOldStyle, *radioBobStyle, *radioCornerStyle; GtkWidget *checkUseDetail; - GSList *radioDirection, *radioStyle; EMessageBoxReturn ret; int loop = 1; @@ -680,25 +679,19 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ // djbob: actually it looks very nice :), slightly better than the way i did it // edit: actually it doesn't work :P, you must pass the last radio item each time, ugh - radioNorth = gtk_radio_button_new_with_label( NULL, "North" ); + radioNorth = gtk_radio_button_new_with_label_from_widget( NULL, "North" ); gtk_box_pack_start( GTK_BOX( hbox ), radioNorth, FALSE, FALSE, 3 ); gtk_widget_show( radioNorth ); - radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioNorth ) ); - - radioSouth = gtk_radio_button_new_with_label( radioDirection, "South" ); + radioSouth = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radioNorth ), "South" ); gtk_box_pack_start( GTK_BOX( hbox ), radioSouth, FALSE, FALSE, 2 ); gtk_widget_show( radioSouth ); - radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioSouth ) ); - - radioEast = gtk_radio_button_new_with_label( radioDirection, "East" ); + radioEast = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radioNorth ), "East" ); gtk_box_pack_start( GTK_BOX( hbox ), radioEast, FALSE, FALSE, 1 ); gtk_widget_show( radioEast ); - radioDirection = gtk_radio_button_group( GTK_RADIO_BUTTON( radioEast ) ); - - radioWest = gtk_radio_button_new_with_label( radioDirection, "West" ); + radioWest = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radioNorth ), "West" ); gtk_box_pack_start( GTK_BOX( hbox ), radioWest, FALSE, FALSE, 0 ); gtk_widget_show( radioWest ); @@ -718,19 +711,15 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); gtk_widget_show( hbox ); - radioOldStyle = gtk_radio_button_new_with_label( NULL, "Original" ); + radioOldStyle = gtk_radio_button_new_with_label_from_widget( NULL, "Original" ); gtk_box_pack_start( GTK_BOX( hbox ), radioOldStyle, FALSE, FALSE, 0 ); gtk_widget_show( radioOldStyle ); - radioStyle = gtk_radio_button_group( GTK_RADIO_BUTTON( radioOldStyle ) ); - - radioBobStyle = gtk_radio_button_new_with_label( radioStyle, "Bob's Style" ); + radioBobStyle = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radioOldStyle ), "Bob's Style" ); gtk_box_pack_start( GTK_BOX( hbox ), radioBobStyle, FALSE, FALSE, 0 ); gtk_widget_show( radioBobStyle ); - radioStyle = gtk_radio_button_group( GTK_RADIO_BUTTON( radioBobStyle ) ); - - radioCornerStyle = gtk_radio_button_new_with_label( radioStyle, "Corner Style" ); + radioCornerStyle = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radioOldStyle ), "Corner Style" ); gtk_box_pack_start( GTK_BOX( hbox ), radioCornerStyle, FALSE, FALSE, 0 ); gtk_widget_show( radioCornerStyle ); @@ -862,7 +851,6 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ GtkWidget *comboMain, *comboTrim; GtkWidget *buttonSetMain, *buttonSetTrim; GtkWidget *radioNS, *radioEW; - GSList *radioOrientation; TwinWidget tw1, tw2; EMessageBoxReturn ret; int loop = 1; @@ -1004,13 +992,11 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ gtk_widget_show( w ); // argh more radio buttons! - radioNS = gtk_radio_button_new_with_label( NULL, "North - South" ); + radioNS = gtk_radio_button_new_with_label_from_widget( NULL, "North - South" ); gtk_box_pack_start( GTK_BOX( hbox ), radioNS, FALSE, FALSE, 0 ); gtk_widget_show( radioNS ); - radioOrientation = gtk_radio_button_group( GTK_RADIO_BUTTON( radioNS ) ); - - radioEW = gtk_radio_button_new_with_label( radioOrientation, "East - West" ); + radioEW = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radioNS ), "East - West" ); gtk_box_pack_start( GTK_BOX( hbox ), radioEW, FALSE, FALSE, 0 ); gtk_widget_show( radioEW ); diff --git a/contrib/brushexport/interface.cpp b/contrib/brushexport/interface.cpp index 40800954..f2288c9c 100644 --- a/contrib/brushexport/interface.cpp +++ b/contrib/brushexport/interface.cpp @@ -21,7 +21,6 @@ create_w_plugplug2( void ){ GtkWidget *hbox2; GtkWidget *vbox4; GtkWidget *r_collapse; - GSList *r_collapse_group = NULL; GtkWidget *r_collapsebymaterial; GtkWidget *r_nocollapse; GtkWidget *vbox3; @@ -58,23 +57,17 @@ create_w_plugplug2( void ){ vbox4 = gtk_vbox_new( TRUE, 0 ); gtk_box_pack_start( GTK_BOX( hbox2 ), vbox4, TRUE, FALSE, 0 ); - r_collapse = gtk_radio_button_new_with_mnemonic( NULL, "Collapse mesh" ); + r_collapse = gtk_radio_button_new_with_label_from_widget( NULL, "Collapse mesh" ); gtk_widget_set_tooltip_text( r_collapse, "Collapse all brushes into a single group" ); gtk_box_pack_start( GTK_BOX( vbox4 ), r_collapse, FALSE, FALSE, 0 ); - gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_collapse ), r_collapse_group ); - r_collapse_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( r_collapse ) ); - r_collapsebymaterial = gtk_radio_button_new_with_mnemonic( NULL, "Collapse by material" ); + r_collapsebymaterial = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( r_collapse ), "Collapse by material" ); gtk_widget_set_tooltip_text( r_collapsebymaterial, "Collapse into groups by material" ); gtk_box_pack_start( GTK_BOX( vbox4 ), r_collapsebymaterial, FALSE, FALSE, 0 ); - gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_collapsebymaterial ), r_collapse_group ); - r_collapse_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( r_collapsebymaterial ) ); - r_nocollapse = gtk_radio_button_new_with_mnemonic( NULL, "Don't collapse" ); + r_nocollapse = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( r_collapse ), "Don't collapse" ); gtk_widget_set_tooltip_text( r_nocollapse, "Every brush is stored in its own group" ); gtk_box_pack_start( GTK_BOX( vbox4 ), r_nocollapse, FALSE, FALSE, 0 ); - gtk_radio_button_set_group( GTK_RADIO_BUTTON( r_nocollapse ), r_collapse_group ); - r_collapse_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( r_nocollapse ) ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( r_nocollapse ), TRUE ); vbox3 = gtk_vbox_new( FALSE, 0 ); diff --git a/contrib/camera/dialogs.cpp b/contrib/camera/dialogs.cpp index 9bb72364..f8160eb3 100644 --- a/contrib/camera/dialogs.cpp +++ b/contrib/camera/dialogs.cpp @@ -26,8 +26,6 @@ #include "camera.h" -static GSList *g_pEditTypeRadio = NULL; -static GtkWidget *g_pEditModeEditRadioButton = NULL; GtkWidget *g_pEditModeAddRadioButton = NULL; static GtkWidget *g_pSecondsEntry = NULL; static GtkWidget *g_pEventsList = NULL; @@ -65,8 +63,6 @@ static gint ci_new( GtkWidget *widget, gpointer data ){ GtkWidget *fixed, *interpolated, *spline; EMessageBoxReturn ret; int loop = 1; - GSList *targetTypeRadio = NULL; -// char buf[128]; // create the window window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); @@ -102,20 +98,17 @@ static gint ci_new( GtkWidget *widget, gpointer data ){ // -------------------------- // - fixed = gtk_radio_button_new_with_label( targetTypeRadio, "Fixed" ); + fixed = gtk_radio_button_new_with_label_from_widget( NULL, "Fixed" ); gtk_box_pack_start( GTK_BOX( vbox2 ), fixed, FALSE, FALSE, 3 ); gtk_widget_show( fixed ); - targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( fixed ) ); - interpolated = gtk_radio_button_new_with_label( targetTypeRadio, "Interpolated" ); + interpolated = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( fixed ), "Interpolated" ); gtk_box_pack_start( GTK_BOX( vbox2 ), interpolated, FALSE, FALSE, 3 ); gtk_widget_show( interpolated ); - targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( interpolated ) ); - spline = gtk_radio_button_new_with_label( targetTypeRadio, "Spline" ); + spline = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( fixed ), "Spline" ); gtk_box_pack_start( GTK_BOX( vbox2 ), spline, FALSE, FALSE, 3 ); gtk_widget_show( spline ); - targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( spline ) ); // -------------------------- // @@ -473,7 +466,6 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){ GtkWidget *fixed, *interpolated, *spline; EMessageBoxReturn ret; int loop = 1; - GSList *targetTypeRadio = NULL; char buf[128]; if ( !GetCurrentCam() ) { @@ -531,20 +523,17 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){ // -------------------------- // - fixed = gtk_radio_button_new_with_label( targetTypeRadio, "Fixed" ); + fixed = gtk_radio_button_new_with_label_from_widget( NULL, "Fixed" ); gtk_box_pack_start( GTK_BOX( vbox2 ), fixed, FALSE, FALSE, 3 ); gtk_widget_show( fixed ); - targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( fixed ) ); - interpolated = gtk_radio_button_new_with_label( targetTypeRadio, "Interpolated" ); + interpolated = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( fixed ), "Interpolated" ); gtk_box_pack_start( GTK_BOX( vbox2 ), interpolated, FALSE, FALSE, 3 ); gtk_widget_show( interpolated ); - targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( interpolated ) ); - spline = gtk_radio_button_new_with_label( targetTypeRadio, "Spline" ); + spline = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( fixed ), "Spline" ); gtk_box_pack_start( GTK_BOX( vbox2 ), spline, FALSE, FALSE, 3 ); gtk_widget_show( spline ); - targetTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( spline ) ); // -------------------------- // @@ -869,7 +858,7 @@ static gint ci_add( GtkWidget *widget, gpointer data ){ eventWidget[i] = gtk_radio_button_new_with_label( eventTypeRadio, camEventStr[i] ); gtk_box_pack_start( GTK_BOX( vbox2 ), eventWidget[i], FALSE, FALSE, 3 ); gtk_widget_show( eventWidget[i] ); - eventTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( eventWidget[i] ) ); + eventTypeRadio = gtk_radio_button_get_group( GTK_RADIO_BUTTON( eventWidget[i] ) ); if ( camEventFlags[i][1] == false ) { gtk_widget_set_sensitive( eventWidget[i], FALSE ); } @@ -1109,17 +1098,15 @@ GtkWidget *CreateCameraInspectorDialog( void ){ gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); gtk_widget_show( hbox ); - g_pEditModeEditRadioButton = gtk_radio_button_new_with_label( g_pEditTypeRadio, "Edit Points" ); - gtk_box_pack_start( GTK_BOX( hbox ), g_pEditModeEditRadioButton, FALSE, FALSE, 3 ); - gtk_widget_show( g_pEditModeEditRadioButton ); - g_pEditTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( g_pEditModeEditRadioButton ) ); + GtkWidget *EditModeEditRadioButton = gtk_radio_button_new_with_label_from_widget( NULL, "Edit Points" ); + gtk_box_pack_start( GTK_BOX( hbox ), EditModeEditRadioButton, FALSE, FALSE, 3 ); + gtk_widget_show( EditModeEditRadioButton ); - g_signal_connect( G_OBJECT( g_pEditModeEditRadioButton ), "clicked", G_CALLBACK( ci_editmode_edit ), NULL ); + g_signal_connect( G_OBJECT( EditModeEditRadioButton ), "clicked", G_CALLBACK( ci_editmode_edit ), NULL ); - g_pEditModeAddRadioButton = gtk_radio_button_new_with_label( g_pEditTypeRadio, "Add Points" ); + g_pEditModeAddRadioButton = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( EditModeEditRadioButton ), "Add Points" ); gtk_box_pack_start( GTK_BOX( hbox ), g_pEditModeAddRadioButton, FALSE, FALSE, 3 ); gtk_widget_show( g_pEditModeAddRadioButton ); - g_pEditTypeRadio = gtk_radio_button_group( GTK_RADIO_BUTTON( g_pEditModeAddRadioButton ) ); g_signal_connect( G_OBJECT( g_pEditModeAddRadioButton ), "clicked", G_CALLBACK( ci_editmode_add ), NULL ); diff --git a/contrib/gtkgensurf/gendlgs.cpp b/contrib/gtkgensurf/gendlgs.cpp index e6f95812..b3a357ec 100644 --- a/contrib/gtkgensurf/gendlgs.cpp +++ b/contrib/gtkgensurf/gendlgs.cpp @@ -1347,7 +1347,6 @@ GtkWidget* create_main_dialog(){ GtkWidget *dlg, *vbox, *hbox, *hbox2, *button, *notebook, *frame, *table, *table2; GtkWidget *check, *spin, *radio, *label, *entry, *scale; GtkObject *adj; - GSList *group; int i; const char *games[] = { "Quake 2", "Half-Life", "SiN", "Heretic 2", "Kingpin", "Genesis3D", "Quake 3 Arena" }; const char *waveforms[] = { "Alternating hill/valley", "Cylindrical left-to-right", "Cylindrical top-to-bottom", @@ -1395,12 +1394,11 @@ GtkWidget* create_main_dialog(){ gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); - for ( i = 0, group = NULL; i < NUMGAMES; i++ ) + for ( i = 0, radio = NULL; i < NUMGAMES; i++ ) { - radio = gtk_radio_button_new_with_label( group, games[i] ); + radio = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radio ), games[i] ); gtk_widget_show( radio ); gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 ); - group = gtk_radio_button_group( GTK_RADIO_BUTTON( radio ) ); game_radios[i] = radio; g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_game ), GINT_TO_POINTER( i ) ); } @@ -1416,12 +1414,11 @@ GtkWidget* create_main_dialog(){ gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); - for ( i = 0, group = NULL; i < 5; i++ ) + for ( i = 0, radio = NULL; i < 5; i++ ) { - radio = gtk_radio_button_new_with_label( group, waveforms[i] ); + radio = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radio ), waveforms[i] ); gtk_widget_show( radio ); gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 ); - group = gtk_radio_button_group( GTK_RADIO_BUTTON( radio ) ); wave_radios[i] = radio; g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_wave ), GINT_TO_POINTER( i ) ); } @@ -1437,12 +1434,11 @@ GtkWidget* create_main_dialog(){ gtk_container_add( GTK_CONTAINER( frame ), vbox ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); - for ( i = 0, group = NULL; i < 6; i++ ) + for ( i = 0, radio = NULL; i < 6; i++ ) { - radio = gtk_radio_button_new_with_label( group, orientations[i] ); + radio = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( radio ), orientations[i] ); gtk_widget_show( radio ); gtk_box_pack_start( GTK_BOX( vbox ), radio, TRUE, TRUE, 0 ); - group = gtk_radio_button_group( GTK_RADIO_BUTTON( radio ) ); plane_radios[i] = radio; g_signal_connect( G_OBJECT( radio ), "toggled", G_CALLBACK( general_plane ), GINT_TO_POINTER( i ) ); } diff --git a/contrib/meshtex/GeneralFunctionDialog.cpp b/contrib/meshtex/GeneralFunctionDialog.cpp index d06642d4..6ac6df05 100644 --- a/contrib/meshtex/GeneralFunctionDialog.cpp +++ b/contrib/meshtex/GeneralFunctionDialog.cpp @@ -127,15 +127,15 @@ GeneralFunctionDialog::GeneralFunctionDialog(const std::string& key) : // Mutually exclusive "Surface values" and "Control values" radio buttons. - button = gtk_radio_button_new_with_label(NULL, + button = gtk_radio_button_new_with_label_from_widget(NULL, DIALOG_GEN_FUNC_SURFACE_VALUES); g_object_set_data(G_OBJECT(_dialog), "surface", button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_GEN_FUNC_CONTROL_VALUES); g_object_set_data(G_OBJECT(_dialog), "control", button); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); @@ -385,8 +385,8 @@ GeneralFunctionDialog::GeneralFunctionDialog(const std::string& key) : UIInstance().RegisterWidgetDependence(button, entry); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_GEN_FUNC_MAX_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "col_max_align", button); gtk_box_pack_end(GTK_BOX(hbox), button, TRUE, FALSE, 5); @@ -434,8 +434,8 @@ GeneralFunctionDialog::GeneralFunctionDialog(const std::string& key) : UIInstance().RegisterWidgetDependence(refbutton, entry); UIInstance().RegisterWidgetDependence(button, entry); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_GEN_FUNC_MAX_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "row_max_ref", button); gtk_box_pack_end(GTK_BOX(hbox), button, TRUE, FALSE, 5); @@ -493,8 +493,8 @@ GeneralFunctionDialog::GeneralFunctionDialog(const std::string& key) : UIInstance().RegisterWidgetDependence(button, entry); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_GEN_FUNC_MAX_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "row_max_align", button); gtk_box_pack_end(GTK_BOX(hbox), button, TRUE, FALSE, 5); @@ -542,8 +542,8 @@ GeneralFunctionDialog::GeneralFunctionDialog(const std::string& key) : UIInstance().RegisterWidgetDependence(refbutton, entry); UIInstance().RegisterWidgetDependence(button, entry); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_GEN_FUNC_MAX_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "col_max_ref", button); gtk_box_pack_end(GTK_BOX(hbox), button, TRUE, FALSE, 5); diff --git a/contrib/meshtex/SetScaleDialog.cpp b/contrib/meshtex/SetScaleDialog.cpp index eefca271..6d218617 100644 --- a/contrib/meshtex/SetScaleDialog.cpp +++ b/contrib/meshtex/SetScaleDialog.cpp @@ -153,7 +153,7 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : gtk_box_pack_end(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); gtk_widget_show(hbox); - button = gtk_radio_button_new_with_label(NULL, DIALOG_SET_SCALE_TILES_OPT_LABEL); + button = gtk_radio_button_new_with_label_from_widget(NULL, DIALOG_SET_SCALE_TILES_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "s_tiling", button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5); gtk_widget_show(button); @@ -175,8 +175,8 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : gtk_box_pack_end(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); gtk_widget_show(hbox); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_SET_SCALE_NATURAL_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "s_natural", button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5); @@ -237,8 +237,8 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : UIInstance().RegisterWidgetDependence(applybutton, entry); UIInstance().RegisterWidgetDependence(button, entry); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_SET_SCALE_MAX_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "col_max_align", button); gtk_box_pack_end(GTK_BOX(hbox), button, TRUE, FALSE, 5); @@ -291,8 +291,8 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : UIInstance().RegisterWidgetDependence(refbutton, entry); UIInstance().RegisterWidgetDependence(button, entry); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_SET_SCALE_MAX_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "row_max_ref", button); gtk_box_pack_end(GTK_BOX(hbox), button, TRUE, FALSE, 5); @@ -356,7 +356,7 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : gtk_box_pack_end(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); gtk_widget_show(hbox); - button = gtk_radio_button_new_with_label(NULL, DIALOG_SET_SCALE_TILES_OPT_LABEL); + button = gtk_radio_button_new_with_label_from_widget(NULL, DIALOG_SET_SCALE_TILES_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "t_tiling", button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5); gtk_widget_show(button); @@ -378,8 +378,8 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : gtk_box_pack_end(GTK_BOX(vbox), hbox, TRUE, TRUE, 5); gtk_widget_show(hbox); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_SET_SCALE_NATURAL_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "t_natural", button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 5); @@ -440,8 +440,8 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : UIInstance().RegisterWidgetDependence(applybutton, entry); UIInstance().RegisterWidgetDependence(button, entry); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_SET_SCALE_MAX_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "row_max_align", button); gtk_box_pack_end(GTK_BOX(hbox), button, TRUE, FALSE, 5); @@ -494,8 +494,8 @@ SetScaleDialog::SetScaleDialog(const std::string& key) : UIInstance().RegisterWidgetDependence(refbutton, entry); UIInstance().RegisterWidgetDependence(button, entry); - button = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(button)), + button = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(button), DIALOG_SET_SCALE_MAX_OPT_LABEL); g_object_set_data(G_OBJECT(_dialog), "col_max_ref", button); gtk_box_pack_end(GTK_BOX(hbox), button, TRUE, FALSE, 5); diff --git a/libs/gtkutil/button.cpp b/libs/gtkutil/button.cpp index d565c974..a1e2a8c8 100644 --- a/libs/gtkutil/button.cpp +++ b/libs/gtkutil/button.cpp @@ -73,7 +73,7 @@ void toggle_button_set_active_no_signal( GtkToggleButton* button, gboolean activ void radio_button_print_state( GtkRadioButton* button ){ globalOutputStream() << "toggle button: "; - for ( GSList* radio = gtk_radio_button_group( button ); radio != 0; radio = g_slist_next( radio ) ) + for ( GSList* radio = gtk_radio_button_get_group( button ); radio != 0; radio = g_slist_next( radio ) ) { globalOutputStream() << gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio->data ) ); } @@ -81,7 +81,7 @@ void radio_button_print_state( GtkRadioButton* button ){ } GtkToggleButton* radio_button_get_nth( GtkRadioButton* radio, int index ){ - GSList *group = gtk_radio_button_group( radio ); + GSList *group = gtk_radio_button_get_group( radio ); return GTK_TOGGLE_BUTTON( g_slist_nth_data( group, g_slist_length( group ) - index - 1 ) ); } @@ -109,7 +109,7 @@ void radio_button_set_active_no_signal( GtkRadioButton* radio, int index ){ int radio_button_get_active( GtkRadioButton* radio ){ //radio_button_print_state(radio); - GSList *group = gtk_radio_button_group( radio ); + GSList *group = gtk_radio_button_get_group( radio ); int index = g_slist_length( group ) - 1; for (; group != 0; group = g_slist_next( group ) ) { diff --git a/libs/gtkutil/dialog.cpp b/libs/gtkutil/dialog.cpp index a9420452..8a5fde01 100644 --- a/libs/gtkutil/dialog.cpp +++ b/libs/gtkutil/dialog.cpp @@ -186,15 +186,12 @@ RadioHBox RadioHBox_new( StringArrayRange names ){ GtkHBox* hbox = GTK_HBOX( gtk_hbox_new( TRUE, 4 ) ); gtk_widget_show( GTK_WIDGET( hbox ) ); - GSList* group = 0; GtkRadioButton* radio = 0; for ( StringArrayRange::Iterator i = names.first; i != names.last; ++i ) { - radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( group, *i ) ); + radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label_from_widget( radio, *i ) ); gtk_widget_show( GTK_WIDGET( radio ) ); gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( radio ), FALSE, FALSE, 0 ); - - group = gtk_radio_button_get_group( radio ); } return RadioHBox( hbox, radio ); diff --git a/libs/gtkutil/nonmodal.h b/libs/gtkutil/nonmodal.h index 72f56bee..eb79fb60 100644 --- a/libs/gtkutil/nonmodal.h +++ b/libs/gtkutil/nonmodal.h @@ -148,7 +148,7 @@ public: NonModalRadio( const Callback& changed ) : m_changed( changed ){ } void connect( GtkRadioButton* radio ){ - GSList* group = gtk_radio_button_group( radio ); + GSList* group = gtk_radio_button_get_group( radio ); for (; group != 0; group = g_slist_next( group ) ) { toggle_button_connect_callback( GTK_TOGGLE_BUTTON( group->data ), m_changed ); diff --git a/radiant/csg.cpp b/radiant/csg.cpp index 33a8ac8a..b397b3eb 100644 --- a/radiant/csg.cpp +++ b/radiant/csg.cpp @@ -1505,7 +1505,7 @@ void CSG_Tool(){ } { //radio button group for choosing the exclude axis - GtkWidget* radFaces = gtk_radio_button_new_with_label( NULL, "-faces" ); + GtkWidget* radFaces = gtk_radio_button_new_with_label_from_widget( NULL, "-faces" ); gtk_widget_set_tooltip_text( radFaces, "Exclude selected faces" ); GtkWidget* radPlusFaces = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(radFaces), "+faces" ); gtk_widget_set_tooltip_text( radPlusFaces, "Only process selected faces" ); diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index 7a1b9c38..8d1700ca 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -581,7 +581,6 @@ void Dialog::addRadioIcons( GtkWidget* vbox, const char* name, StringArrayRange gtk_table_set_row_spacings( GTK_TABLE( table ), 5 ); gtk_table_set_col_spacings( GTK_TABLE( table ), 5 ); - GSList* group = 0; GtkWidget* radio = 0; for ( StringArrayRange::Iterator icon = icons.first; icon != icons.last; ++icon ) { @@ -592,13 +591,11 @@ void Dialog::addRadioIcons( GtkWidget* vbox, const char* name, StringArrayRange (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); - radio = gtk_radio_button_new( group ); + radio = gtk_radio_button_new_from_widget( GTK_RADIO_BUTTON( radio ) ); gtk_widget_show( radio ); gtk_table_attach( GTK_TABLE( table ), radio, pos, pos + 1, 1, 2, (GtkAttachOptions) ( 0 ), (GtkAttachOptions) ( 0 ), 0, 0 ); - - group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( radio ) ); } AddIntRadioData( *GTK_RADIO_BUTTON( radio ), importViewer, exportViewer ); diff --git a/radiant/gtktheme.cpp b/radiant/gtktheme.cpp index 1c5c9b80..226ce45f 100644 --- a/radiant/gtktheme.cpp +++ b/radiant/gtktheme.cpp @@ -128,7 +128,6 @@ GtkWidget* create_rc_window() { GtkWidget* hbox8; GtkWidget* vbox9; GtkWidget* main_use_default_font_radio; - GSList* main_use_default_font_radio_group = NULL; GtkWidget* main_use_custom_font_radio; GtkWidget* alignment5; GtkWidget* vbox10; @@ -240,19 +239,15 @@ GtkWidget* create_rc_window() { gtk_widget_show( vbox9 ); gtk_box_pack_start( GTK_BOX( hbox8 ), vbox9, TRUE, TRUE, 0 ); - main_use_default_font_radio = gtk_radio_button_new_with_mnemonic( NULL, "Use theme default font" ); + main_use_default_font_radio = gtk_radio_button_new_with_label_from_widget( NULL, "Use theme default font" ); gtk_widget_set_name( main_use_default_font_radio, "main_use_default_font_radio" ); gtk_widget_show( main_use_default_font_radio ); gtk_box_pack_start( GTK_BOX( vbox9 ), main_use_default_font_radio, FALSE, FALSE, 0 ); - gtk_radio_button_set_group( GTK_RADIO_BUTTON( main_use_default_font_radio ), main_use_default_font_radio_group ); - main_use_default_font_radio_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( main_use_default_font_radio ) ); - main_use_custom_font_radio = gtk_radio_button_new_with_mnemonic( NULL, "Use custom font:" ); + main_use_custom_font_radio = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON( main_use_default_font_radio ), "Use custom font:" ); gtk_widget_set_name( main_use_custom_font_radio, "main_use_custom_font_radio" ); gtk_widget_show( main_use_custom_font_radio ); gtk_box_pack_start( GTK_BOX( vbox9 ), main_use_custom_font_radio, FALSE, FALSE, 0 ); - gtk_radio_button_set_group( GTK_RADIO_BUTTON( main_use_custom_font_radio ), main_use_default_font_radio_group ); - main_use_default_font_radio_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON( main_use_custom_font_radio ) ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( main_use_custom_font_radio ), TRUE ); //gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( main_use_custom_font_radio ), FALSE ); diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index 13b34483..62c71100 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -1285,55 +1285,46 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ (GtkAttachOptions) ( 0 ), 0, 0 ); } - GSList* group = 0; + GtkRadioButton* group = 0; { - GtkWidget* button = gtk_radio_button_new_with_label( group, "Bevel" ); + GtkWidget* button = gtk_radio_button_new_with_label_from_widget( group, "Bevel" ); gtk_widget_show( button ); gtk_table_attach( table, button, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); - group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) ); - + group = GTK_RADIO_BUTTON( button ); bevel = button; } { - GtkWidget* button = gtk_radio_button_new_with_label( group, "Endcap" ); + GtkWidget* button = gtk_radio_button_new_with_label_from_widget( group, "Endcap" ); gtk_widget_show( button ); gtk_table_attach( table, button, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); - group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) ); - endcap = button; } { - GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Bevel" ); + GtkWidget* button = gtk_radio_button_new_with_label_from_widget( group, "Inverted Bevel" ); gtk_widget_show( button ); gtk_table_attach( table, button, 1, 2, 2, 3, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); - group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) ); - ibevel = button; } { - GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Endcap" ); + GtkWidget* button = gtk_radio_button_new_with_label_from_widget( group, "Inverted Endcap" ); gtk_widget_show( button ); gtk_table_attach( table, button, 1, 2, 3, 4, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); - group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) ); - iendcap = button; } { - GtkWidget* button = gtk_radio_button_new_with_label( group, "Cylinder" ); + GtkWidget* button = gtk_radio_button_new_with_label_from_widget( group, "Cylinder" ); gtk_widget_show( button ); gtk_table_attach( table, button, 1, 2, 4, 5, (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ), (GtkAttachOptions) ( 0 ), 0, 0 ); - group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) ); - cylinder = button; } } @@ -1447,7 +1438,7 @@ void DoPatchThickenDlg(){ } { // Create the radio button group for choosing the extrude axis - GtkWidget* _radNormals = gtk_radio_button_new_with_label( NULL, "Normal" ); + GtkWidget* _radNormals = gtk_radio_button_new_with_label_from_widget( NULL, "Normal" ); GtkWidget* _radX = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(_radNormals), "X" ); GtkWidget* _radY = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(_radNormals), "Y" ); GtkWidget* _radZ = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(_radNormals), "Z" );