]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/console.cpp
Suppress GTK warnings and errors
[xonotic/netradiant.git] / radiant / console.cpp
index 112957793a06da5eea27328a7ea4077aa30f57d3..82b08e3c2ab5468ca1919e0a094dd0a99af7a9e7 100644 (file)
@@ -67,7 +67,7 @@ void Sys_LogFile( bool enable ){
                                                                 << "This is NetRadiant '" RADIANT_VERSION "' compiled " __DATE__ "\n" RADIANT_ABOUTMSG "\n";
                }
                else{
-                       ui::root.alert( "Failed to create log file, check write permissions in Radiant directory.\n",
+                       ui::alert( ui::root, "Failed to create log file, check write permissions in Radiant directory.\n",
                                                        "Console logging", ui::alert_type::OK, ui::alert_icon::Error );
                }
        }
@@ -111,9 +111,9 @@ ui::Widget Console_constructWindow( ui::Window toplevel ){
 
        {
                auto text = ui::TextView(ui::New);
-               gtk_widget_set_size_request( text, 0, -1 ); // allow shrinking
-               gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text ), GTK_WRAP_WORD );
-               gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE );
+               text.dimensions(0, -1); // allow shrinking
+               gtk_text_view_set_wrap_mode( text, GTK_WRAP_WORD );
+               gtk_text_view_set_editable( text, FALSE );
                scr.add(text);
                text.show();
                g_console = text;
@@ -163,19 +163,19 @@ std::size_t Sys_Print( int level, const char* buf, std::size_t length ){
 
        if ( level != SYS_NOCON ) {
                if ( g_console ) {
-                       GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( g_console ) );
+                       auto buffer = gtk_text_view_get_buffer( g_console );
 
                        GtkTextIter iter;
                        gtk_text_buffer_get_end_iter( buffer, &iter );
 
-                       static GtkTextMark* end = gtk_text_buffer_create_mark( buffer, "end", &iter, FALSE );
+                       static auto end = gtk_text_buffer_create_mark( buffer, "end", &iter, FALSE );
 
                        const GdkColor yellow = { 0, 0xb0ff, 0xb0ff, 0x0000 };
                        const GdkColor red = { 0, 0xffff, 0x0000, 0x0000 };
 
-                       static GtkTextTag* error_tag = gtk_text_buffer_create_tag( buffer, "red_foreground", "foreground-gdk", &red, NULL );
-                       static GtkTextTag* warning_tag = gtk_text_buffer_create_tag( buffer, "yellow_foreground", "foreground-gdk", &yellow, NULL );
-                       static GtkTextTag* standard_tag = gtk_text_buffer_create_tag( buffer, "black_foreground", NULL );
+                       static auto error_tag = gtk_text_buffer_create_tag( buffer, "red_foreground", "foreground-gdk", &red, NULL );
+                       static auto warning_tag = gtk_text_buffer_create_tag( buffer, "yellow_foreground", "foreground-gdk", &yellow, NULL );
+                       static auto standard_tag = gtk_text_buffer_create_tag( buffer, "black_foreground", NULL );
                        GtkTextTag* tag;
                        switch ( level )
                        {
@@ -207,7 +207,7 @@ std::size_t Sys_Print( int level, const char* buf, std::size_t length ){
 
                        // update console widget immediatly if we're doing something time-consuming
                        if ( contains_newline ) {
-                               gtk_text_view_scroll_mark_onscreen( GTK_TEXT_VIEW( g_console ), end );
+                               gtk_text_view_scroll_mark_onscreen( g_console, end );
 
                                if ( !ScreenUpdates_Enabled() && gtk_widget_get_realized( g_console ) ) {
                                        ScreenUpdates_process();