use NULL as sentinel instead of 0
[xonotic/netradiant.git] / radiant / entitylist.cpp
index a9b9a66..dad00e4 100644 (file)
@@ -23,8 +23,8 @@
 
 #include "iselection.h"
 
-#include <gtk/gtk.h>
 #include <uilib/uilib.h>
+#include <gtk/gtk.h>
 
 #include "string/string.h"
 #include "scenelib.h"
@@ -43,7 +43,6 @@
 void RedrawEntityList();
 typedef FreeCaller<RedrawEntityList> RedrawEntityListCaller;
 
-typedef struct _GtkTreeView GtkTreeView;
 
 class EntityList
 {
@@ -116,22 +115,22 @@ void entitylist_treeviewcolumn_celldatafunc( GtkTreeViewColumn* column, GtkCellR
        if ( node != 0 ) {
                gtk_cell_renderer_set_fixed_size( renderer, -1, -1 );
                char* name = const_cast<char*>( node_get_name( *node ) );
-               g_object_set( G_OBJECT( renderer ), "text", name, "visible", TRUE, 0 );
+               g_object_set( G_OBJECT( renderer ), "text", name, "visible", TRUE, NULL );
 
                //globalOutputStream() << "rendering cell " << makeQuoted(name) << "\n";
                GtkStyle* style = gtk_widget_get_style( GTK_WIDGET( getEntityList().m_tree_view ) );
                if ( instance->childSelected() ) {
-                       g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_ACTIVE], 0 );
+                       g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_ACTIVE], NULL );
                }
                else
                {
-                       g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_NORMAL], 0 );
+                       g_object_set( G_OBJECT( renderer ), "cell-background-gdk", &style->base[GTK_STATE_NORMAL], NULL );
                }
        }
        else
        {
                gtk_cell_renderer_set_fixed_size( renderer, -1, 0 );
-               g_object_set( G_OBJECT( renderer ), "text", "", "visible", FALSE, 0 );
+               g_object_set( G_OBJECT( renderer ), "text", "", "visible", FALSE, NULL );
        }
 }
 
@@ -245,7 +244,7 @@ void entitylist_treeview_row_expanded( GtkTreeView* view, GtkTreeIter* iter, Gtk
 
 
 void EntityList_SetShown( bool shown ){
-       widget_set_visible( GTK_WIDGET( getEntityList().m_window ), shown );
+       widget_set_visible( getEntityList().m_window, shown );
 }
 
 void EntityList_toggleShown(){
@@ -283,9 +282,9 @@ void DetachEntityTreeModel(){
 void EntityList_constructWindow( ui::Window main_window ){
        ASSERT_TRUE( !getEntityList().m_window );
 
-       ui::Window window = ui::Window(create_persistent_floating_window( "Entity List", main_window ));
+       auto window = ui::Window(create_persistent_floating_window( "Entity List", main_window ));
 
-       gtk_window_add_accel_group( window, global_accel );
+       window.add_accel_group(global_accel);
 
        getEntityList().m_positionTracker.connect( window );
 
@@ -293,8 +292,8 @@ void EntityList_constructWindow( ui::Window main_window ){
        getEntityList().m_window = window;
 
        {
-               GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
-               gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( scr ) );
+               auto scr = create_scrolled_window( ui::Policy::AUTOMATIC, ui::Policy::AUTOMATIC );
+               window.add(scr);
 
                {
                        ui::Widget view = ui::TreeView();
@@ -308,13 +307,13 @@ void EntityList_constructWindow( ui::Window main_window ){
                        GtkTreeSelection* select = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
                        gtk_tree_selection_set_mode( select, GTK_SELECTION_MULTIPLE );
 
-                       g_signal_connect( G_OBJECT( view ), "row_expanded", G_CALLBACK( entitylist_treeview_row_expanded ), 0 );
-                       g_signal_connect( G_OBJECT( view ), "row_collapsed", G_CALLBACK( entitylist_treeview_rowcollapsed ), 0 );
+                       view.connect( "row_expanded", G_CALLBACK( entitylist_treeview_row_expanded ), 0 );
+                       view.connect( "row_collapsed", G_CALLBACK( entitylist_treeview_rowcollapsed ), 0 );
 
                        gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
 
-                       gtk_widget_show( view );
-                       gtk_container_add( GTK_CONTAINER( scr ), view );
+                       view.show();
+                       scr.add(view);
                        getEntityList().m_tree_view = GTK_TREE_VIEW( view );
                }
        }