[glibmm] AppInfo: Add create_duplicate().



commit 0dfeefb3cb604bdc6465155be7f5e333b435468e
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Tue Nov 6 15:41:59 2012 -0500

    AppInfo: Add create_duplicate().
    
    	* gio/src/appinfo.{hg,ccg}: Add the new method (which creates a
    	duplicate of the AppInfo).  Also, use gmmproc's optional parameter
    	functionality to wrap the launch_default_for_uri() method without the
    	optional AppLaunchContext parameter.

 ChangeLog           |    6 ++++++
 gio/src/appinfo.ccg |   10 ++--------
 gio/src/appinfo.hg  |   13 +++++++------
 3 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 613ae5c..6c74817 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2012-11-06  Josà Alburquerque  <jaalburquerque gmail com>
 
+	AppInfo: Add create_duplicate().
+
+	* gio/src/appinfo.{hg,ccg}: Add the new method (which creates a
+	duplicate of the AppInfo).  Also, use gmmproc's optional parameter
+	functionality to wrap the launch_default_for_uri() method without the
+	optional AppLaunchContext parameter.
 
 2012-11-06  Josà Alburquerque  <jaalburquerque gmail com>
 
diff --git a/gio/src/appinfo.ccg b/gio/src/appinfo.ccg
index 84d96b7..8fab8a3 100644
--- a/gio/src/appinfo.ccg
+++ b/gio/src/appinfo.ccg
@@ -44,15 +44,9 @@ AppInfo::create_from_commandline(const std::string& commandline,
   return Glib::wrap(capp_info);
 }
 
-bool AppInfo::launch_default_for_uri(const std::string& uri)
+Glib::RefPtr<AppInfo> AppInfo::create_duplicate() const
 {
-  GError* gerror = 0;
-  const bool retvalue = g_app_info_launch_default_for_uri(uri.c_str(), 0, &(gerror));
-
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
-
-  return retvalue;
+   return Glib::wrap(g_app_info_dup(const_cast<GAppInfo*>(gobj())));
 }
 
 bool AppInfo::launch(const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<AppLaunchContext>& launch_context)
diff --git a/gio/src/appinfo.hg b/gio/src/appinfo.hg
index e4a35e6..f5b5b53 100644
--- a/gio/src/appinfo.hg
+++ b/gio/src/appinfo.hg
@@ -60,8 +60,12 @@ public:
                                                        const std::string& application_name,
                                                        AppInfoCreateFlags flags);
 
-  //_IGNORE(g_app_info_dup)
-  _IGNORE(g_app_info_equal)
+  /**  Creates a duplicate of a this AppInfo.
+   * @return A duplicate of this AppInfo.
+   * @newin{2,36}
+   */
+  Glib::RefPtr<AppInfo> create_duplicate() const;
+  _IGNORE(g_app_info_dup)
 
   // Note that the implementation of equal() is virtual via equal_vfunc().
   _WRAP_METHOD(bool equal(const Glib::RefPtr<AppInfo>& other) const, g_app_info_equal)
@@ -211,9 +215,7 @@ public:
   _WRAP_METHOD(static Glib::RefPtr<AppInfo> get_default_for_type(const std::string& content_type, bool must_support_uris = true), g_app_info_get_default_for_type)
   _WRAP_METHOD(static Glib::RefPtr<AppInfo> get_default_for_uri_scheme(const std::string& uri_scheme), g_app_info_get_default_for_uri_scheme)
   _WRAP_METHOD(static void reset_type_associations(const std::string& content_type), g_app_info_reset_type_associations)
-  _WRAP_METHOD(static bool launch_default_for_uri(const std::string& uri, const Glib::RefPtr<AppLaunchContext>& context), g_app_info_launch_default_for_uri, errthrow)
-  // same as above but without optional AppLaunchContext
-  static bool launch_default_for_uri(const std::string& uri);
+  _WRAP_METHOD(static bool launch_default_for_uri(const std::string& uri, const Glib::RefPtr<AppLaunchContext>& context{?}), g_app_info_launch_default_for_uri, errthrow)
 
 protected:
   //_WRAP_VFUNC(Glib::RefPtr<AppInfo> dup(), "dup")
@@ -238,4 +240,3 @@ protected:
 };
 
 } // namespace Gio
-



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