[glom] ImageGlom: Use AppInfo instead of gtk_show_uri() for Open.



commit ebdf9b090fb6e1b443a48e52d1215c9ae06d3fd9
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Jul 12 13:09:06 2011 +0200

    ImageGlom: Use AppInfo instead of gtk_show_uri() for Open.
    
    * glom/utility_widgets/imageglom.cc: For the case that we have no AppInfo
    (not Open With), use the static AppInfo method, for consistency.
    This might work on Win32 too.

 ChangeLog                         |    8 ++++++++
 glom/utility_widgets/imageglom.cc |   14 ++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 46be0ef..aafa4a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-07-12  Murray Cumming  <murrayc murrayc com>
 
+	ImageGlom: Use AppInfo instead of gtk_show_uri() for Open.
+
+	* glom/utility_widgets/imageglom.cc: For the case that we have no AppInfo
+	(not Open With), use the static AppInfo method, for consistency.
+	This might work on Win32 too.
+
+2011-07-12  Murray Cumming  <murrayc murrayc com>
+
 	Image fields: Add Open, Open With, and Save context menu items.
 
 	* glom/utility_widgets/dialog_image_save_progress.[h|cc]:
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index 717eb4d..fa66ef9 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -359,8 +359,10 @@ void ImageGlom::open_with(const Glib::RefPtr<Gio::AppInfo>& app_info)
   {
     std::vector<std::string> vec_uris;
     vec_uris.push_back(uri);
-    std::cout << "app_info: " << app_info->get_name() << ", uri=" << uri << std::endl;
     app_info->launch_uris(vec_uris, 0); //TODO: Get a GdkAppLaunchContext?
+    
+    //TODO Use this instead when we can use glibmm 3.2:
+    //app_info->launch_uri(uri);
   }
   else
   {
@@ -369,15 +371,11 @@ void ImageGlom::open_with(const Glib::RefPtr<Gio::AppInfo>& app_info)
     // gtk_show_uri doesn't seem to work on Win32, at least not for local files
     // We use Windows API instead.
     // TODO: Check it again and file a bug if necessary.
+    // TODO: and this might not be necessary with Gio::AppInfo::launch_default_for_uri().
+    //   Previously we used gtk_show_uri().
     ShellExecute(0, "open", uri.c_str(), 0, 0, SW_SHOW);
 #else
-    //Use the GNOME browser:
-    GError* gerror = 0;
-    if(!gtk_show_uri(0 /* screen */, uri.c_str(), GDK_CURRENT_TIME, &gerror))
-    {
-      std::cerr << G_STRFUNC << ": " << gerror->message << std::endl;
-      g_error_free(gerror);
-    }
+    Gio::AppInfo::launch_default_for_uri(uri);
 #endif //G_OS_WIN32
   }
 }



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