diff options
author | José Alburquerque <jaalburqu@svn.gnome.org> | 2012-11-06 15:41:59 -0500 |
---|---|---|
committer | José Alburquerque <jaalburqu@svn.gnome.org> | 2012-11-06 15:41:59 -0500 |
commit | 0dfeefb3cb604bdc6465155be7f5e333b435468e (patch) | |
tree | 45f27cc956b10101ad7b386201ca349aa29c995b | |
parent | 5222ee56a371eabe123afe208641ae76355d3588 (diff) | |
download | glibmm-0dfeefb3cb604bdc6465155be7f5e333b435468e.tar.gz |
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.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gio/src/appinfo.ccg | 10 | ||||
-rw-r--r-- | gio/src/appinfo.hg | 13 |
3 files changed, 15 insertions, 14 deletions
@@ -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 84d96b7a..8fab8a37 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 e4a35e6d..f5b5b536 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 - |