[glibmm/glibmm-2-60] Gio: Add some API (AppInfo::launch_uris_async() etc.)



commit 251384c253748ca630b209ddb60279ca29aa6df4
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Mon Mar 18 19:14:19 2019 +0100

    Gio: Add some API (AppInfo::launch_uris_async() etc.)
    
    * gio/src/appinfo.hg: Add launch_uris_async() and launch_uris_async().
    * gio/src/asyncresult.hg: _IGNORE g_async_result_legacy_propagate_error().
    * gio/src/dbusconnection.hg: Add get/property_flags().
    * tools/m4/convert_gio.m4: Add conversions for GDBusConnectionFlags.

 gio/src/appinfo.hg        | 17 +++++++++++++++--
 gio/src/asyncresult.hg    |  2 +-
 gio/src/dbusconnection.hg |  5 +++--
 tools/m4/convert_gio.m4   |  1 +
 4 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/gio/src/appinfo.hg b/gio/src/appinfo.hg
index 27dd2487..4dd48fa7 100644
--- a/gio/src/appinfo.hg
+++ b/gio/src/appinfo.hg
@@ -162,6 +162,11 @@ public:
                errthrow, deprecated "Use the method that takes an AppLaunchContext")
 
   //TODO: I think we use Glib::ustring elsewhere for URIs:
+  // 2019-03-18 kjellahl: Glibmm is inconsistent; Glib::ustring in convert.hg,
+  // std::string in uriutils.hg.
+  // The reporter of libxml++ bug https://bugzilla.gnome.org/show_bug.cgi?id=790034
+  // proposes std::string.
+#m4 _CONVERSION(`const 
std::vector<std::string>&',`GList*',`Glib::ListHandler<std::string>::vector_to_list($3).data()')
   _WRAP_METHOD(bool launch_uris(const Glib::ListHandle<std::string>& uris,
                                 const Glib::RefPtr<AppLaunchContext>& context{?}),
                g_app_info_launch_uris,
@@ -175,13 +180,13 @@ public:
    * Note that even if the launch is successful the application launched
    * can fail to start if it runs into problems during startup. There is
    * no way to detect this.
-   * @param uris A URIs to launch.
+   * @param uri A URI to launch.
    * @param context An AppLaunchContext.
    * @return <tt>true</tt> on successful launch, <tt>false</tt> otherwise.
    *
    * @newin{2,30}
    */
-  bool launch_uri(const std::string& uris, const Glib::RefPtr<AppLaunchContext>& context);
+  bool launch_uri(const std::string& uri, const Glib::RefPtr<AppLaunchContext>& context);
 
   /** A launch_uri() convenience overload.
    *
@@ -189,6 +194,14 @@ public:
    */
   bool launch_uri(const std::string& uris);
 
+  _WRAP_METHOD(void launch_uris_async(const std::vector<std::string>& uris,
+    const Glib::RefPtr<AppLaunchContext>& context{.},
+    const SlotAsyncReady& slot{callback?},
+    const Glib::RefPtr<Cancellable>& cancellable{.} = {}),
+    g_app_info_launch_uris_async, slot_name slot, slot_callback SignalProxy_async_callback, newin "2,60")
+  _WRAP_METHOD(bool launch_uris_finish(const Glib::RefPtr<AsyncResult>& result),
+    g_app_info_launch_uris_finish, errthrow, newin "2,60")
+
   _WRAP_METHOD(bool should_show() const, g_app_info_should_show)
   // FIXME: use better terminology than delete/do_delete
   _WRAP_METHOD(bool can_delete() const, g_app_info_can_delete)
diff --git a/gio/src/asyncresult.hg b/gio/src/asyncresult.hg
index 5e5facc8..4c4da93c 100644
--- a/gio/src/asyncresult.hg
+++ b/gio/src/asyncresult.hg
@@ -115,7 +115,7 @@ public:
   Glib::RefPtr<Glib::ObjectBase> get_source_object_base();
   Glib::RefPtr<const Glib::ObjectBase> get_source_object_base() const;
 
-  //TODO?: gboolean g_async_result_legacy_propagate_error (GAsyncResult  *res, GError **error);
+  _IGNORE(g_async_result_legacy_propagate_error)dnl// Shall not be used in new code
 
   _WRAP_METHOD(bool is_tagged(gpointer source_tag) const, g_async_result_is_tagged)
 
diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg
index 363e3545..9233e8d9 100644
--- a/gio/src/dbusconnection.hg
+++ b/gio/src/dbusconnection.hg
@@ -43,7 +43,7 @@ namespace DBus
 
 _WRAP_ENUM(BusType, GBusType)
 _WRAP_ENUM(CallFlags, GDBusCallFlags, s#^DBUS_##, NO_GTYPE)
-_WRAP_ENUM(ConnectionFlags, GDBusConnectionFlags, s#^DBUS_##, NO_GTYPE)
+_WRAP_ENUM(ConnectionFlags, GDBusConnectionFlags, s#^DBUS_##, gtype_func g_dbus_connection_flags_get_type)
 _WRAP_ENUM(SendMessageFlags, GDBusSendMessageFlags, s#^DBUS_##, NO_GTYPE)
 _WRAP_ENUM(SignalFlags, GDBusSignalFlags, s#^DBUS_##, NO_GTYPE)
 _WRAP_ENUM(SubtreeFlags, GDBusSubtreeFlags, s#^DBUS_##, NO_GTYPE)
@@ -590,6 +590,7 @@ public:
   _WRAP_METHOD(Glib::ustring get_unique_name() const, g_dbus_connection_get_unique_name)
 
   _WRAP_METHOD(CapabilityFlags get_capabilities() const, g_dbus_connection_get_capabilities)
+  _WRAP_METHOD(ConnectionFlags get_flags() const, g_dbus_connection_get_flags, newin "2,60")
 
   _WRAP_METHOD(Glib::RefPtr<Credentials> get_peer_credentials(), g_dbus_connection_get_peer_credentials, 
refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Credentials> get_peer_credentials() const, 
g_dbus_connection_get_peer_credentials, refreturn, constversion)
@@ -1022,7 +1023,7 @@ public:
   _WRAP_PROPERTY("capabilities", CapabilityFlags)
   _WRAP_PROPERTY("closed", bool)
   _WRAP_PROPERTY("exit-on-close", bool)
-  //_WRAP_PROPERTY("flags", ConnectionFlags) // write-only construct-only
+  _WRAP_PROPERTY("flags", ConnectionFlags, newin "2,60")
   _WRAP_PROPERTY("guid", std::string)
   _WRAP_PROPERTY("stream", Glib::RefPtr<IOStream>)
   _WRAP_PROPERTY("unique-name", Glib::ustring)
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index e6f7cb46..d40cac60 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -14,6 +14,7 @@ _CONV_ENUM(GDBus,MessageFlags)
 _CONV_ENUM(GDBus,MessageHeaderField)
 _CONV_ENUM(GDBus,MessageType)
 _CONV_ENUM(GDBus,ProxyFlags)
+_CONV_ENUM(GDBus,ConnectionFlags)
 _CONV_ENUM(GDBus,SendMessageFlags)
 _CONV_ENUM(GDBus,ServerFlags)
 _CONV_ENUM(G,DriveStartFlags)


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