[glom] Dialog_ExistingOrNew::list_examples(): Use Gio::Resource.



commit df255452e6bc34b362932dde4eb9bcf9d93fdd89
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Nov 16 16:05:35 2014 +0100

    Dialog_ExistingOrNew::list_examples(): Use Gio::Resource.
    
    This has just been added to unstable giomm.

 glom/dialog_existing_or_new.cc |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index 4248204..d924af1 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -26,6 +26,7 @@
 
 #include <glibmm/i18n.h>
 #include <giomm/contenttype.h>
+#include <giomm/resource.h>
 #include <gtkmm/recentmanager.h>
 #include <gtkmm/filechooserdialog.h>
 #include <glibmm/miscutils.h>
@@ -263,18 +264,9 @@ bool Dialog_ExistingOrNew::list_examples()
 
   try
   {
-    //TODO: Add to glibmm? const type_vec_strings examples = Gio::Resource::enumerate_children(examples_dir);
-    GError* gerror = 0;
-    char** cexamples = g_resources_enumerate_children(examples_dir, G_RESOURCE_LOOKUP_FLAGS_NONE, &gerror);
-    if(gerror)
-    {
-      Glib::Error::throw_exception(gerror);
-    }
-
     typedef std::vector<Glib::ustring> type_vec_strings;
-    const type_vec_strings examples = 
-      Glib::ArrayHandler<Glib::ustring>::array_to_vector(cexamples, Glib::OWNERSHIP_DEEP);
-
+    const type_vec_strings examples = Gio::Resource::enumerate_children_global(examples_dir);
+    
     bool example_found = false;
     for(type_vec_strings::const_iterator iter = examples.begin(); iter != examples.end(); ++iter)
     {


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