diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index 4c258a07..6ccce223 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -357,7 +357,7 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){ gtk_box_pack_start( GTK_BOX( vbox ), radio1, FALSE, FALSE, 2 ); gtk_widget_show( radio1 ); - radio2 = gtk_radio_button_new_with_label( ( (GtkRadioButton*)radio1 )->group, "Use Selected Brushes" ); + radio2 = gtk_radio_button_new_with_label_from_widget( GTK_RADIO_BUTTON(radio1), "Use Selected Brushes" ); gtk_box_pack_start( GTK_BOX( vbox ), radio2, FALSE, FALSE, 2 ); gtk_widget_show( radio2 ); diff --git a/contrib/brushexport/support.cpp b/contrib/brushexport/support.cpp index 79c5e145..5aaf6024 100644 --- a/contrib/brushexport/support.cpp +++ b/contrib/brushexport/support.cpp @@ -13,7 +13,7 @@ lookup_widget( GtkWidget *widget, parent = gtk_menu_get_attach_widget( GTK_MENU( widget ) ); } else{ - parent = widget->parent; + parent = gtk_widget_get_parent( widget ); } if ( !parent ) { parent = (GtkWidget*) g_object_get_data( G_OBJECT( widget ), "GladeParentKey" ); diff --git a/contrib/meshtex/GenericDialog.h b/contrib/meshtex/GenericDialog.h index 705a2fcc..aaf47133 100644 --- a/contrib/meshtex/GenericDialog.h +++ b/contrib/meshtex/GenericDialog.h @@ -48,7 +48,7 @@ * @param widgetName Name of the contained widget to enable/disable. */ #define NamedToggleWidgetActive(widgetName) \ - (GTK_TOGGLE_BUTTON(NamedWidget(widgetName))->active) + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(NamedWidget(widgetName))) /** * Macro to read text from a widget inside the dialog, selected by name. diff --git a/contrib/meshtex/GenericPluginUI.cpp b/contrib/meshtex/GenericPluginUI.cpp index 2da58c86..b73e0893 100644 --- a/contrib/meshtex/GenericPluginUI.cpp +++ b/contrib/meshtex/GenericPluginUI.cpp @@ -309,7 +309,7 @@ GenericPluginUI::WidgetControlCallback(GtkWidget *widget, for (; controllerIter != _widgetControlledByMap[controllee].end(); ++controllerIter) { // Dependence found; honor it. - if (!(GTK_TOGGLE_BUTTON(*controllerIter)->active)) + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(*controllerIter))) { sensitive = false; break; @@ -320,7 +320,7 @@ GenericPluginUI::WidgetControlCallback(GtkWidget *widget, for (; controllerIter != _widgetAntiControlledByMap[controllee].end(); ++controllerIter) { // Anti-dependence found; honor it. - if (GTK_TOGGLE_BUTTON(*controllerIter)->active) + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(*controllerIter))) { sensitive = false; break; @@ -371,4 +371,4 @@ GenericPluginUI::InfoReportDialog(const char *title, { // Pass this operation to Radiant. GlobalRadiant().m_pfnMessageBox(UIInstance()._window, message, title, eMB_OK, eMB_ICONDEFAULT); -} \ No newline at end of file +} diff --git a/libs/gtkutil/accelerator.cpp b/libs/gtkutil/accelerator.cpp index 69190301..9bf0c1cd 100644 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@ -243,7 +243,7 @@ bool Buttons_press( ButtonMask& buttons, guint button, guint state ){ { GtkWindow* toplevel = *i; ASSERT_MESSAGE( window_has_accel( toplevel ), "ERROR" ); - ASSERT_MESSAGE( GTK_WIDGET_TOPLEVEL( toplevel ), "disabling accel for non-toplevel window" ); + ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET( toplevel ) ), "disabling accel for non-toplevel window" ); gtk_window_remove_accel_group( toplevel, global_accel ); #if 0 globalOutputStream() << reinterpret_cast( toplevel ) << ": disabled global accelerators\n"; @@ -269,7 +269,7 @@ bool Buttons_release( ButtonMask& buttons, guint button, guint state ){ { GtkWindow* toplevel = *i; ASSERT_MESSAGE( !window_has_accel( toplevel ), "ERROR" ); - ASSERT_MESSAGE( GTK_WIDGET_TOPLEVEL( toplevel ), "enabling accel for non-toplevel window" ); + ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET( toplevel ) ), "enabling accel for non-toplevel window" ); gtk_window_add_accel_group( toplevel, global_accel ); #if 0 globalOutputStream() << reinterpret_cast( toplevel ) << ": enabled global accelerators\n"; diff --git a/libs/gtkutil/menu.cpp b/libs/gtkutil/menu.cpp index cbb07df8..805ea04a 100644 --- a/libs/gtkutil/menu.cpp +++ b/libs/gtkutil/menu.cpp @@ -227,23 +227,13 @@ void accelerator_name( const Accelerator& accelerator, GString* gstring ){ } void menu_item_set_accelerator( GtkMenuItem* item, Accelerator accelerator ){ - GtkAccelLabel* accel_label = GTK_ACCEL_LABEL( gtk_bin_get_child( GTK_BIN( item ) ) ); - - g_free( accel_label->accel_string ); - accel_label->accel_string = 0; - - GString* gstring = g_string_new( accel_label->accel_string ); + GString* gstring = g_string_new( nullptr ); g_string_append( gstring, " " ); - accelerator_name( accelerator, gstring ); + GtkAccelLabel* accel_label = GTK_ACCEL_LABEL( gtk_bin_get_child( GTK_BIN( item ) ) ); g_free( accel_label->accel_string ); - accel_label->accel_string = gstring->str; - g_string_free( gstring, FALSE ); - - if ( !accel_label->accel_string ) { - accel_label->accel_string = g_strdup( "" ); - } + accel_label->accel_string = g_string_free( gstring, FALSE ); gtk_widget_queue_resize( GTK_WIDGET( accel_label ) ); } diff --git a/radiant/console.cpp b/radiant/console.cpp index 54d0e47a..7e70895f 100644 --- a/radiant/console.cpp +++ b/radiant/console.cpp @@ -228,7 +228,7 @@ std::size_t Sys_Print( int level, const char* buf, std::size_t length ){ if ( contains_newline ) { gtk_text_view_scroll_mark_onscreen( GTK_TEXT_VIEW( g_console ), end ); - if ( !ScreenUpdates_Enabled() && GTK_WIDGET_REALIZED( g_console ) ) { + if ( !ScreenUpdates_Enabled() && gtk_widget_get_realized( g_console ) ) { ScreenUpdates_process(); } } diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 2f39e469..ea66c9b2 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -1037,7 +1037,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ for ( int i = 0; i < g_spawnflag_count; ++i ) { GtkWidget* widget = GTK_WIDGET( g_entitySpawnflagsCheck[i] ); - gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), " " ); + gtk_label_set_text( GTK_LABEL( gtk_bin_get_child( GTK_BIN( widget ) ) ), " " ); gtk_widget_hide( widget ); gtk_widget_ref( widget ); gtk_container_remove( GTK_CONTAINER( g_spawnflagsTable ), widget ); @@ -1060,7 +1060,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ (GtkAttachOptions)( GTK_FILL ), 0, 0 ); gtk_widget_unref( widget ); - gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), str.c_str() ); + gtk_label_set_text( GTK_LABEL( gtk_bin_get_child( GTK_BIN( widget ) ) ), str.c_str() ); if( const EntityClassAttribute* attribute = eclass->flagAttributes[spawn_table[i]] ){ EntityAttribute_setTooltip( widget, attribute->m_name.c_str(), attribute->m_description.c_str() ); @@ -1080,7 +1080,7 @@ void EntityClassList_selectEntityClass( EntityClass* eclass ){ GtkTreeView* view = g_entityClassList; GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path ); - if ( GTK_WIDGET_REALIZED( view ) ) { + if ( gtk_widget_get_realized( GTK_WIDGET( view ) ) ) { gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 ); } gtk_tree_path_free( path ); @@ -1404,7 +1404,7 @@ static gint EntityClassList_keypress( GtkWidget* widget, GdkEventKey* event, gpo if ( toupper( text[0] ) == (int)code ) { GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path ); - if ( GTK_WIDGET_REALIZED( view ) ) { + if ( gtk_widget_get_realized( GTK_WIDGET( view ) ) ) { gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 ); } gtk_tree_path_free( path ); diff --git a/radiant/mru.cpp b/radiant/mru.cpp index 54b8eb09..15413815 100644 --- a/radiant/mru.cpp +++ b/radiant/mru.cpp @@ -158,7 +158,7 @@ void MRU_Activate( std::size_t index ){ MRU_SetText( i, MRU_GetText( i + 1 ) ); if ( MRU_used == 0 ) { - gtk_label_set_text( GTK_LABEL( GTK_BIN( MRU_items[0] )->child ), "Recent Files" ); + gtk_label_set_text( GTK_LABEL( gtk_bin_get_child( GTK_BIN( MRU_items[0] ) ) ), "Recent Files" ); gtk_widget_set_sensitive( GTK_WIDGET( MRU_items[0] ), FALSE ); } else diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 65933f52..e912b76a 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -608,7 +608,7 @@ void PreferencesDialog_addSettingsPage( const PreferenceGroupCallback& callback } void Widget_updateDependency( GtkWidget* self, GtkWidget* toggleButton ){ - gtk_widget_set_sensitive( self, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggleButton ) ) && GTK_WIDGET_IS_SENSITIVE( toggleButton ) ); + gtk_widget_set_sensitive( self, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggleButton ) ) && gtk_widget_is_sensitive( toggleButton ) ); } void ToggleButton_toggled_Widget_updateDependency( GtkWidget *toggleButton, GtkWidget* self ){ diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index ff5c181d..3de6128f 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -114,7 +114,7 @@ void queueDraw(){ inline void spin_button_set_step( GtkSpinButton* spin, gfloat step ){ #if 1 - gtk_spin_button_get_adjustment( spin )->step_increment = step; + gtk_adjustment_set_step_increment( gtk_spin_button_get_adjustment( spin ), step ); #else GValue gvalue = GValue_default(); g_value_init( &gvalue, G_TYPE_DOUBLE ); @@ -1294,8 +1294,7 @@ void spin_button_set_value_no_signal( GtkSpinButton* spin, gdouble value ){ } void spin_button_set_step_increment( GtkSpinButton* spin, gdouble value ){ - GtkAdjustment* adjust = gtk_spin_button_get_adjustment( spin ); - adjust->step_increment = value; + gtk_adjustment_set_step_increment( gtk_spin_button_get_adjustment( spin ), value ); } void SurfaceInspector::Update(){ diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 1224375d..f6e1f06f 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -917,7 +917,7 @@ void XYWnd::NewBrushDrag( int x, int y, bool square, bool cube ){ int g_entityCreationOffset = 0; void entitycreate_activated( GtkMenuItem* item, gpointer user_data ){ - const char* entity_name = gtk_label_get_text( GTK_LABEL( GTK_BIN( item )->child ) ); + const char* entity_name = gtk_label_get_text( GTK_LABEL( gtk_bin_get_child( GTK_BIN( item ) ) ) ); if( g_bCamEntityMenu ){ const Vector3 viewvector = -Camera_getViewVector( *g_pParentWnd->GetCamWnd() ); const float offset_for_multiple = std::max( GetSnapGridSize(), 8.f ) * g_entityCreationOffset; @@ -934,7 +934,7 @@ void entitycreate_activated( GtkMenuItem* item, gpointer user_data ){ gboolean entitycreate_rightClicked( GtkWidget* widget, GdkEvent* event, gpointer user_data ) { /* convert entities */ if ( event->button.button == 3 ) { - Scene_EntitySetClassname_Selected( gtk_label_get_text( GTK_LABEL( GTK_BIN( widget )->child ) ) ); + Scene_EntitySetClassname_Selected( gtk_label_get_text( GTK_LABEL( gtk_bin_get_child( GTK_BIN( widget ) ) ) ) ); if( ( event->button.state & GDK_CONTROL_MASK ) == 0 ){ gtk_menu_popdown( XYWnd::m_mnuDrop ); }