]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/mru.cpp
Implement buffer operations
[xonotic/netradiant.git] / radiant / mru.cpp
index 50d89bf1c0ad29db4760fc5693445b65239a37e5..8e287e814855b2e6a2ec85dafec4db300e41fb0a 100644 (file)
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <gtk/gtk.h>
+#include <util/buffer.h>
 
 #include "os/file.h"
 #include "generic/callback.h"
@@ -142,8 +143,8 @@ void MRU_AddWidget( GtkMenuItem *widget, std::size_t pos ){
 }
 
 void MRU_Activate( std::size_t index ){
-       char text[1024];
-       strcpy( text, MRU_GetText( index ) );
+       auto text = u::buffer<1024>();
+       text.copy( MRU_GetText( index ) );
 
        if ( file_readable( text ) ) { //\todo Test 'map load succeeds' instead of 'file is readable'.
                MRU_AddFile( text );
@@ -159,7 +160,8 @@ 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_get_child(GTK_BIN( MRU_items[0] )) ), "Recent Files" );
+                       auto label = ui::Label(GTK_LABEL(gtk_bin_get_child(GTK_BIN(MRU_items[0] )) ));
+                       label.text("Recent Files");
                        gtk_widget_set_sensitive( GTK_WIDGET( MRU_items[0] ), FALSE );
                }
                else