[glom/gtkmm4v4] AppWindow: Replace some C code.



commit ced2033307eb8c1bf9c81782cef4d5404b5018aa
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Nov 4 22:15:34 2017 +0100

    AppWindow: Replace some C code.

 glom/appwindow.cc |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index 64d3345..b96f852 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -473,14 +473,12 @@ void AppWindow::on_menu_help_about()
     const auto glom_icon_path = UiUtils::get_icon_path(about_icon_name);
 
     //TODO: Use this, instead of the C API, when we can depend on gtkmm 3.12, with a try/catch:
-    //Glib::RefPtr<Gdk::Pixbuf> logo = Gdk::Pixbuf::create_from_resource(glom_icon_path);
-    GError* gerror = nullptr;
-    auto logo =
-      Glib::wrap(gdk_pixbuf_new_from_resource(glom_icon_path.c_str(), &gerror));
-    if(gerror)
+    Glib::RefPtr<Gdk::Pixbuf> logo;
+    try
     {
+      logo = Gdk::Pixbuf::create_from_resource(glom_icon_path);
+    } catch(const Glib::Exception& ex) {
       std::cerr << G_STRFUNC << ": Could not load icon from resource path=" << glom_icon_path << std::endl;
-      g_clear_error(&gerror);
     }
 
     if(logo)


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