[glibmm] Gio: Add some API (AppInfo::launch_uris_async() etc.)



commit 78101fa72ce8822e359823ea7e9bc92ea51b4904
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Fri Mar 15 15:33:04 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/datainputstream.hg: _IGNORE deprecated methods.
    * gio/src/dbusconnection.hg: Add get/property_flags().
    * tools/m4/convert_gio.m4: Add conversions for GDBusConnectionFlags.

 gio/src/appinfo.hg         | 20 ++++++++++++++++----
 gio/src/asyncresult.hg     |  2 +-
 gio/src/datainputstream.hg |  3 +++
 gio/src/dbusconnection.hg  |  5 +++--
 tools/m4/convert_gio.m4    |  1 +
 5 files changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/gio/src/appinfo.hg b/gio/src/appinfo.hg
index 7833cc0a..b05e13ad 100644
--- a/gio/src/appinfo.hg
+++ b/gio/src/appinfo.hg
@@ -157,6 +157,10 @@ public:
    #m4 _CONVERSION(`const 
std::vector<std::string>&',`GList*',`Glib::ListHandler<std::string>::vector_to_list($3).data()')
 
   //TODO: I think we use Glib::ustring elsewhere for URIs:
+  // 2019-03-14 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.
   _WRAP_METHOD(bool launch_uris(const std::vector<std::string>& uris,
                                 const Glib::RefPtr<AppLaunchContext>& context{?}),
                g_app_info_launch_uris,
@@ -170,13 +174,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.
    *
@@ -184,6 +188,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)
@@ -218,8 +230,8 @@ public:
   _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)
 
   _WRAP_METHOD(static void launch_default_for_uri_async(const std::string& uri, const 
Glib::RefPtr<AppLaunchContext>& context{.?},
-    const SlotAsyncReady& slot{callback?}, const Glib::RefPtr<Cancellable>& cancellable{.?}), 
g_app_info_launch_default_for_uri_async, slot_name slot, slot_callback SignalProxy_async_callback)
-  _IGNORE(g_app_info_launch_default_for_uri_async)
+    const SlotAsyncReady& slot{callback?}, const Glib::RefPtr<Cancellable>& cancellable{.?}),
+    g_app_info_launch_default_for_uri_async, slot_name slot, slot_callback SignalProxy_async_callback)
   _WRAP_METHOD(static bool launch_default_for_uri_finish(const Glib::RefPtr<AsyncResult>& result), 
g_app_info_launch_default_for_uri_finish, errthrow)
 
 protected:
diff --git a/gio/src/asyncresult.hg b/gio/src/asyncresult.hg
index 295a271f..3076a0a3 100644
--- a/gio/src/asyncresult.hg
+++ b/gio/src/asyncresult.hg
@@ -109,7 +109,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/datainputstream.hg b/gio/src/datainputstream.hg
index da158498..157f8947 100644
--- a/gio/src/datainputstream.hg
+++ b/gio/src/datainputstream.hg
@@ -138,6 +138,9 @@ public:
    */
   _WRAP_METHOD(void read_line_finish_utf8(const Glib::RefPtr<AsyncResult>& result{.}, std::string& 
data{OUT}, gsize& length{.?}), g_data_input_stream_read_line_finish_utf8, errthrow)
 
+  _IGNORE(g_data_input_stream_read_until, g_data_input_stream_read_until_async,
+    g_data_input_stream_read_until_finish)dnl// deprecated
+
  /** Reads a string from the data input stream, up to the first
    * occurrence of any of the stop characters.
    *
diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg
index d17d5a80..306f8705 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, NO_GTYPE)
-_WRAP_ENUM(ConnectionFlags, GDBusConnectionFlags, NO_GTYPE)
+_WRAP_ENUM(ConnectionFlags, GDBusConnectionFlags, gtype_func g_dbus_connection_flags_get_type)
 _WRAP_ENUM(SendMessageFlags, GDBusSendMessageFlags, NO_GTYPE)
 _WRAP_ENUM(SignalFlags, GDBusSignalFlags, NO_GTYPE)
 _WRAP_ENUM(SubtreeFlags, GDBusSubtreeFlags, NO_GTYPE)
@@ -578,6 +578,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)
@@ -1010,7 +1011,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 a6254b66..b42dea09 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -42,6 +42,7 @@ _CONV_GIO_DBUS_ENUM(MessageFlags)
 _CONV_GIO_DBUS_ENUM(MessageHeaderField)
 _CONV_GIO_DBUS_ENUM(MessageType)
 _CONV_GIO_DBUS_ENUM(ProxyFlags)
+_CONV_GIO_DBUS_ENUM(ConnectionFlags)
 _CONV_GIO_DBUS_ENUM(SendMessageFlags)
 _CONV_GIO_DBUS_INCLASS_ENUM(Server,Flags)
 _CONV_GIO_INCLASS_ENUM(Drive,StartFlags)


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