[gtkmm] demowindow: Use std::cerr instead of g_warning().



commit c10b2bbed57fcee0894210c0b2ea556d9ca8952b
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 1 12:52:56 2015 +0200

    demowindow: Use std::cerr instead of g_warning().
    
    Avoiding the need to use std::string::c_str(), which seems to be
    far less necessary with C++11 now that we have functions such
    as std::sto*(). This makes it easier to find c_str() in the source
    code.

 demos/gtk-demo/demowindow.cc |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/demos/gtk-demo/demowindow.cc b/demos/gtk-demo/demowindow.cc
index cda5188..b88a159 100644
--- a/demos/gtk-demo/demowindow.cc
+++ b/demos/gtk-demo/demowindow.cc
@@ -27,6 +27,7 @@
 #include "demowindow.h"
 #include "textwidget.h"
 #include "demos.h"
+#include <iostream>
 #include <cstring>
 
 using std::isspace;
@@ -245,7 +246,7 @@ void DemoWindow::load_file(const std::string& filename)
     }
     catch (const Gio::ResourceError& ex)
     {
-      g_warning ("Cannot open source for %s: %s\n", filename.c_str(), ex.what().c_str());
+      std::cerr << "Cannot open source for " << filename << ": " << ex.what() << std::endl;
       return;
     }
 
@@ -405,8 +406,7 @@ void DemoWindow::add_data_tabs(const std::string& filename)
       }
       catch (const Gio::ResourceError& ex)
       {
-        g_warning("Can't get data from resource '%s': %s\n",
-          resource_name.c_str(), ex.what().c_str());
+        std::cerr << "Can't get data from resource '" << resource_name << "': " << ex.what() << std::endl;
         continue;
       }
       gsize data_size = 0;
@@ -421,7 +421,7 @@ void DemoWindow::add_data_tabs(const std::string& filename)
       }
       else
       {
-        g_warning ("Don't know how to display resource '%s'\n", resource_name.c_str());
+        std::cerr << "Don't know how to display resource '" << resource_name << "'" << std::endl;
         continue;
       }
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]