]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/map.cpp
Wrap more GTK
[xonotic/netradiant.git] / radiant / map.cpp
index 518886f690e9bf7f6cdb05dfb5cc6df95d29fa16..fff85c1f2ebe397ba7cfc91ad0d6b17885c856fe 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "map.h"
 
+#include <gtk/gtk.h>
+
 #include "debugging/debugging.h"
 
 #include "imap.h"
@@ -761,9 +763,9 @@ WindowPosition g_posMapInfoWnd( c_default_window_pos );
 
 void DoMapInfo(){
        ModalDialog dialog;
-       GtkEntry* brushes_entry;
-       GtkEntry* entities_entry;
-       ui::ListStore EntityBreakdownWalker{nullptr};
+       ui::Entry brushes_entry{ui::null};
+       ui::Entry entities_entry{ui::null};
+       ui::ListStore EntityBreakdownWalker{ui::null};
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Map Info", G_CALLBACK(dialog_delete_callback ), &dialog );
 
@@ -782,7 +784,7 @@ void DoMapInfo(){
                                gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
 
                                {
-                                       auto entry = ui::Entry();
+                                       auto entry = ui::Entry(ui::New);
                                        entry.show();
                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -792,7 +794,7 @@ void DoMapInfo(){
                                        brushes_entry = entry;
                                }
                                {
-                                       auto entry = ui::Entry();
+                                       auto entry = ui::Entry(ui::New);
                                        entry.show();
                                        gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -845,14 +847,14 @@ void DoMapInfo(){
                                gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE );
 
                                {
-                                       auto renderer = ui::CellRendererText();
+                                       auto renderer = ui::CellRendererText(ui::New);
                                        GtkTreeViewColumn* column = ui::TreeViewColumn( "Entity", renderer, {{"text", 0}} );
                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                        gtk_tree_view_column_set_sort_column_id( column, 0 );
                                }
 
                                {
-                                       auto renderer = ui::CellRendererText();
+                                       auto renderer = ui::CellRendererText(ui::New);
                                        GtkTreeViewColumn* column = ui::TreeViewColumn( "Count", renderer, {{"text", 1}} );
                                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
                                        gtk_tree_view_column_set_sort_column_id( column, 1 );
@@ -877,26 +879,24 @@ void DoMapInfo(){
                {
                        char tmp[16];
                        sprintf( tmp, "%u", Unsigned( ( *i ).second ) );
-                       GtkTreeIter iter;
-                       gtk_list_store_append( GTK_LIST_STORE( EntityBreakdownWalker ), &iter );
-                       gtk_list_store_set( GTK_LIST_STORE( EntityBreakdownWalker ), &iter, 0, ( *i ).first.c_str(), 1, tmp, -1 );
+                       EntityBreakdownWalker.append(0, (*i).first.c_str(), 1, tmp);
                }
        }
 
-       g_object_unref( G_OBJECT( EntityBreakdownWalker ) );
+       EntityBreakdownWalker.unref();
 
        char tmp[16];
        sprintf( tmp, "%u", Unsigned( g_brushCount.get() ) );
-       gtk_entry_set_text( GTK_ENTRY( brushes_entry ), tmp );
+       brushes_entry.text(tmp);
        sprintf( tmp, "%u", Unsigned( g_entityCount.get() ) );
-       gtk_entry_set_text( GTK_ENTRY( entities_entry ), tmp );
+       entities_entry.text(tmp);
 
        modal_dialog_show( window, dialog );
 
        // save before exit
        window_get_position( window, g_posMapInfoWnd );
 
-       gtk_widget_destroy( GTK_WIDGET( window ) );
+    window.destroy();
 }
 
 
@@ -2034,12 +2034,12 @@ static void GetSelectionIndex( int *ent, int *brush ){
 
 void DoFind(){
        ModalDialog dialog;
-       GtkEntry* entity;
-       GtkEntry* brush;
+       ui::Entry entity{ui::null};
+       ui::Entry brush{ui::null};
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Find Brush", G_CALLBACK(dialog_delete_callback ), &dialog );
 
-       auto accel = ui::AccelGroup();
+       auto accel = ui::AccelGroup(ui::New);
        window.add_accel_group( accel );
 
        {
@@ -2063,7 +2063,7 @@ void DoFind(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               auto entry = ui::Entry();
+                               auto entry = ui::Entry(ui::New);
                                entry.show();
                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -2072,7 +2072,7 @@ void DoFind(){
                                entity = entry;
                        }
                        {
-                               auto entry = ui::Entry();
+                               auto entry = ui::Entry(ui::New);
                                entry.show();
                                gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -2104,9 +2104,9 @@ void DoFind(){
 
        GetSelectionIndex( &ent, &br );
        sprintf( buf, "%i", ent );
-       gtk_entry_set_text( entity, buf );
+       entity.text(buf);
        sprintf( buf, "%i", br );
-       gtk_entry_set_text( brush, buf );
+       brush.text(buf);
 
        if ( modal_dialog_show( window, dialog ) == eIDOK ) {
                const char *entstr = gtk_entry_get_text( entity );
@@ -2114,7 +2114,7 @@ void DoFind(){
                SelectBrush( atoi( entstr ), atoi( brushstr ) );
        }
 
-       gtk_widget_destroy( GTK_WIDGET( window ) );
+    window.destroy();
 }
 
 void Map_constructPreferences( PreferencesPage& page ){