[vala/wip/gio-2.0: 2/4] gio-2.0: Fix async constructors of AsyncInitable, DBusConnection, DBusObjectManagerClient and DBusPr



commit ded946f66bdf0c7d04818b80e3d75e9b758c491a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Sep 24 10:03:14 2016 +0200

    gio-2.0: Fix async constructors of AsyncInitable, DBusConnection, DBusObjectManagerClient and DBusProxy

 vapi/gio-2.0.vapi                 |   52 ++++++++++++++++--------------------
 vapi/metadata/Gio-2.0-custom.vala |   29 +--------------------
 vapi/metadata/Gio-2.0.metadata    |   26 ++++--------------
 3 files changed, 30 insertions(+), 77 deletions(-)
---
diff --git a/vapi/gio-2.0.vapi b/vapi/gio-2.0.vapi
index 9a16fd7..78ca442 100644
--- a/vapi/gio-2.0.vapi
+++ b/vapi/gio-2.0.vapi
@@ -613,11 +613,11 @@ namespace GLib {
                public signal bool allow_mechanism (string mechanism);
                public virtual signal bool authorize_authenticated_peer (GLib.IOStream stream, 
GLib.Credentials? credentials);
        }
-       [CCode (cheader_filename = "gio/gio.h")]
+       [CCode (cheader_filename = "gio/gio.h", type_id = "g_dbus_connection_get_type ()")]
        [Version (since = "2.26")]
        public class DBusConnection : GLib.Object, GLib.AsyncInitable, GLib.Initable, GLib.AsyncInitable, 
GLib.Initable {
-               [CCode (has_construct_function = false)]
-               protected DBusConnection ();
+               [CCode (cname = "g_dbus_connection_new", has_construct_function = false)]
+               public async DBusConnection (GLib.IOStream stream, string? guid, GLib.DBusConnectionFlags 
flags, GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) throws GLib.Error;
                public uint add_filter (owned GLib.DBusMessageFilterFunction filter_function);
                public async GLib.Variant call (string? bus_name, string object_path, string interface_name, 
string method_name, GLib.Variant? parameters, GLib.VariantType? reply_type, GLib.DBusCallFlags flags, int 
timeout_msec, GLib.Cancellable? cancellable = null) throws GLib.Error;
                public GLib.Variant call_sync (string? bus_name, string object_path, string interface_name, 
string method_name, GLib.Variant? parameters, GLib.VariantType? reply_type, GLib.DBusCallFlags flags, int 
timeout_msec, GLib.Cancellable? cancellable = null) throws GLib.Error;
@@ -634,6 +634,8 @@ namespace GLib {
                public uint export_menu_model (string object_path, GLib.MenuModel menu) throws GLib.Error;
                public async bool flush (GLib.Cancellable? cancellable = null) throws GLib.Error;
                public bool flush_sync (GLib.Cancellable? cancellable = null) throws GLib.Error;
+               [CCode (cname = "g_dbus_connection_new_for_address", has_construct_function = false)]
+               public async DBusConnection.for_address (string address, GLib.DBusConnectionFlags flags, 
GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) throws GLib.Error;
                [CCode (has_construct_function = false)]
                public DBusConnection.for_address_sync (string address, GLib.DBusConnectionFlags flags, 
GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) throws GLib.Error;
                public GLib.DBusCapabilityFlags get_capabilities ();
@@ -647,10 +649,6 @@ namespace GLib {
                public unowned GLib.IOStream get_stream ();
                public unowned string get_unique_name ();
                public bool is_closed ();
-               [CCode (cname = "g_dbus_connection_new", finish_function = "g_dbus_connection_new_finish")]
-               public static async GLib.DBusConnection @new (GLib.IOStream stream, string guid, 
GLib.DBusConnectionFlags flags, GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) 
throws GLib.Error;
-               [CCode (cname = "g_dbus_connection_new_for_address", finish_function = 
"g_dbus_connection_new_for_address_finish")]
-               public static async GLib.DBusConnection new_for_address (string address, 
GLib.DBusConnectionFlags flags, GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) 
throws GLib.Error;
                public uint register_object<T> (string object_path, T object) throws GLib.IOError;
                [Version (since = "2.46")]
                public uint register_object_with_closures (string object_path, GLib.DBusInterfaceInfo 
interface_info, GLib.Closure? method_call_closure, GLib.Closure? get_property_closure, GLib.Closure? 
set_property_closure) throws GLib.Error;
@@ -867,19 +865,17 @@ namespace GLib {
        }
        [CCode (cheader_filename = "gio/gio.h", type_id = "g_dbus_object_manager_client_get_type ()")]
        [Version (since = "2.30")]
-       public class DBusObjectManagerClient : GLib.Object, GLib.AsyncInitable, GLib.DBusObjectManager, 
GLib.Initable, GLib.AsyncInitable, GLib.DBusObjectManager, GLib.Initable {
-               [CCode (has_construct_function = false)]
-               protected DBusObjectManagerClient ();
+       public class DBusObjectManagerClient : GLib.Object, GLib.AsyncInitable, GLib.DBusObjectManager, 
GLib.Initable {
+               [CCode (cname = "g_dbus_object_manager_client_new", has_construct_function = false)]
+               public async DBusObjectManagerClient (GLib.DBusConnection connection, 
GLib.DBusObjectManagerClientFlags flags, string name, string object_path, [CCode (delegate_target_pos = 
5.33333, destroy_notify_pos = 5.66667)] owned GLib.DBusProxyTypeFunc? get_proxy_type_func, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
+               [CCode (cname = "g_dbus_object_manager_client_new_for_bus", has_construct_function = false)]
+               public async DBusObjectManagerClient.for_bus (GLib.BusType bus_type, 
GLib.DBusObjectManagerClientFlags flags, string name, string object_path, [CCode (delegate_target_pos = 
5.33333, destroy_notify_pos = 5.66667)] owned GLib.DBusProxyTypeFunc? get_proxy_type_func, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
                [CCode (has_construct_function = false, type = "GDBusObjectManager*")]
                public DBusObjectManagerClient.for_bus_sync (GLib.BusType bus_type, 
GLib.DBusObjectManagerClientFlags flags, string name, string object_path, [CCode (delegate_target_pos = 
5.33333, destroy_notify_pos = 5.66667)] owned GLib.DBusProxyTypeFunc? get_proxy_type_func, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
                public unowned GLib.DBusConnection get_connection ();
                public GLib.DBusObjectManagerClientFlags get_flags ();
                public unowned string get_name ();
                public string? get_name_owner ();
-               [CCode (cname = "g_dbus_object_manager_client_new", finish_function = 
"g_dbus_object_manager_client_new_finish")]
-               public static async GLib.DBusObjectManagerClient @new (GLib.DBusConnection connection, 
GLib.DBusObjectManagerClientFlags flags, string name, string object_path, [CCode (delegate_target_pos = 
5.33333, destroy_notify_pos = 5.66667)] owned GLib.DBusProxyTypeFunc get_proxy_type_func, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
-               [CCode (cname = "g_dbus_object_manager_client_new_for_bus", finish_function = 
"g_dbus_object_manager_client_new_for_bus_finish")]
-               public static async GLib.DBusObjectManagerClient new_for_bus (GLib.BusType bus_type, 
GLib.DBusObjectManagerClientFlags flags, string name, string object_path, [CCode (delegate_target_pos = 
5.33333, destroy_notify_pos = 5.66667)] owned GLib.DBusProxyTypeFunc get_proxy_type_func, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
                [CCode (has_construct_function = false, type = "GDBusObjectManager*")]
                public DBusObjectManagerClient.sync (GLib.DBusConnection connection, 
GLib.DBusObjectManagerClientFlags flags, string? name, string object_path, [CCode (delegate_target_pos = 
5.33333, destroy_notify_pos = 5.66667)] owned GLib.DBusProxyTypeFunc? get_proxy_type_func, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
                public GLib.BusType bus_type { construct; }
@@ -952,19 +948,19 @@ namespace GLib {
                public GLib.DBusPropertyInfo @ref ();
                public void unref ();
        }
-       [CCode (cheader_filename = "gio/gio.h")]
+       [CCode (cheader_filename = "gio/gio.h", type_id = "g_dbus_proxy_get_type ()")]
        [Version (since = "2.26")]
-       public class DBusProxy : GLib.Object, GLib.AsyncInitable, GLib.DBusInterface, GLib.Initable, 
GLib.AsyncInitable, GLib.DBusInterface, GLib.Initable {
-               [CCode (has_construct_function = false)]
-               protected DBusProxy ();
+       public class DBusProxy : GLib.Object, GLib.AsyncInitable, GLib.DBusInterface, GLib.Initable {
+               [CCode (cname = "g_dbus_proxy_new", has_construct_function = false)]
+               public async DBusProxy (GLib.DBusConnection connection, GLib.DBusProxyFlags flags, 
GLib.DBusInterfaceInfo? info, string? name, string object_path, string interface_name, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
                public async GLib.Variant call (string method_name, GLib.Variant? parameters, 
GLib.DBusCallFlags flags, int timeout_msec, GLib.Cancellable? cancellable = null) throws GLib.Error;
                public GLib.Variant call_sync (string method_name, GLib.Variant? parameters, 
GLib.DBusCallFlags flags, int timeout_msec, GLib.Cancellable? cancellable = null) throws GLib.Error;
                [Version (since = "2.30")]
                public async GLib.Variant call_with_unix_fd_list (string method_name, GLib.Variant? 
parameters, GLib.DBusCallFlags flags, int timeout_msec, GLib.UnixFDList? fd_list = null, GLib.Cancellable? 
cancellable = null, out GLib.UnixFDList? out_fd_list = null) throws GLib.Error;
                [Version (since = "2.30")]
                public GLib.Variant call_with_unix_fd_list_sync (string method_name, GLib.Variant? 
parameters, GLib.DBusCallFlags flags, int timeout_msec, GLib.UnixFDList? fd_list = null, out GLib.UnixFDList? 
out_fd_list = null, GLib.Cancellable? cancellable = null) throws GLib.Error;
-               [CCode (cname = "g_dbus_proxy_new_for_bus", finish_function = 
"g_dbus_proxy_new_for_bus_finish")]
-               public static async GLib.DBusProxy create_for_bus (GLib.BusType bus_type, GLib.DBusProxyFlags 
flags, GLib.DBusInterfaceInfo? info, string name, string object_path, string interface_name, 
GLib.Cancellable? cancellable = null) throws GLib.IOError;
+               [CCode (cname = "g_dbus_proxy_new_for_bus", has_construct_function = false)]
+               public async DBusProxy.for_bus (GLib.BusType bus_type, GLib.DBusProxyFlags flags, 
GLib.DBusInterfaceInfo? info, string name, string object_path, string interface_name, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
                [CCode (has_construct_function = false)]
                public DBusProxy.for_bus_sync (GLib.BusType bus_type, GLib.DBusProxyFlags flags, 
GLib.DBusInterfaceInfo? info, string name, string object_path, string interface_name, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
                public GLib.Variant get_cached_property (string property_name);
@@ -978,8 +974,6 @@ namespace GLib {
                public unowned string get_name ();
                public string get_name_owner ();
                public unowned string get_object_path ();
-               [CCode (cname = "g_dbus_proxy_new", finish_function = "g_dbus_proxy_new_finish")]
-               public static async GLib.DBusProxy @new (GLib.DBusConnection connection, GLib.DBusProxyFlags 
flags, GLib.DBusInterfaceInfo? info, string? name, string object_path, string interface_name, 
GLib.Cancellable? cancellable = null) throws GLib.IOError;
                public void set_cached_property (string property_name, GLib.Variant? value);
                public void set_default_timeout (int timeout_msec);
                public void set_interface_info (GLib.DBusInterfaceInfo? info);
@@ -3140,16 +3134,16 @@ namespace GLib {
                public abstract bool supports_files ();
                public abstract bool supports_uris ();
        }
-       [CCode (cheader_filename = "gio/gio.h")]
+       [CCode (cheader_filename = "gio/gio.h", type_id = "g_async_initable_get_type ()")]
        [Version (since = "2.22")]
        public interface AsyncInitable : GLib.Object {
                public virtual async bool init_async (int io_priority = GLib.Priority.DEFAULT, 
GLib.Cancellable? cancellable = null) throws GLib.Error;
-               [CCode (finish_function = "g_async_initable_new_finish")]
-               public static async GLib.Object new_async (GLib.Type object_type, int io_priority = 
GLib.Priority.DEFAULT, GLib.Cancellable? cancellable, ...) throws GLib.Error;
-               [CCode (finish_function = "g_async_initable_new_finish")]
-               public static async GLib.Object new_valist_async (GLib.Type object_type, string 
first_property_name, va_list var_args, int io_priority = GLib.Priority.DEFAULT, GLib.Cancellable? cancellable 
= null);
-               [CCode (finish_function = "g_async_initable_new_finish")]
-               public static async GLib.Object newv_async (GLib.Type object_type, [CCode (array_length_pos = 
1.1)] GLib.Parameter[] parameters, int io_priority = GLib.Priority.DEFAULT, GLib.Cancellable? cancellable = 
null);
+               [CCode (finish_name = "g_async_initable_new_finish")]
+               public async GLib.Object new_async (GLib.Type object_type, int io_priority = 
GLib.Priority.DEFAULT, GLib.Cancellable? cancellable = null, ...) throws GLib.Error;
+               [CCode (finish_name = "g_async_initable_new_finish")]
+               public async GLib.Object new_valist_async (GLib.Type object_type, string first_property_name, 
va_list var_args, int io_priority = GLib.Priority.DEFAULT, GLib.Cancellable? cancellable = null) throws 
GLib.Error;
+               [CCode (finish_name = "g_async_initable_new_finish")]
+               public async GLib.Object newv_async (GLib.Type object_type, uint n_parameters, GLib.Parameter 
parameters, int io_priority = GLib.Priority.DEFAULT, GLib.Cancellable? cancellable = null) throws GLib.Error;
        }
        [CCode (cheader_filename = "gio/gio.h", type_id = "g_async_result_get_type ()")]
        public interface AsyncResult : GLib.Object {
diff --git a/vapi/metadata/Gio-2.0-custom.vala b/vapi/metadata/Gio-2.0-custom.vala
index 32beefd..1b12f6b 100644
--- a/vapi/metadata/Gio-2.0-custom.vala
+++ b/vapi/metadata/Gio-2.0-custom.vala
@@ -31,11 +31,8 @@ namespace GLib {
                public void set_callback ([CCode (type = "GSourceFunc")] owned CancellableSourceFunc func);
        }
 
+       [CCode (cheader_filename = "gio/gio.h", type_id = "g_dbus_connection_get_type ()")]
        public class DBusConnection : GLib.Object, GLib.AsyncInitable, GLib.Initable {
-               [CCode (cname = "g_dbus_connection_new", finish_function = "g_dbus_connection_new_finish")]
-               public static async GLib.DBusConnection @new (GLib.IOStream stream, string guid, 
GLib.DBusConnectionFlags flags, GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) 
throws GLib.Error;
-               [CCode (cname = "g_dbus_connection_new_for_address", finish_function = 
"g_dbus_connection_new_for_address_finish")]
-               public static async GLib.DBusConnection @new_for_address (string address, 
GLib.DBusConnectionFlags flags, GLib.DBusAuthObserver? observer = null, GLib.Cancellable? cancellable = null) 
throws GLib.Error;
                public async T get_proxy<T> (string? name, string object_path, GLib.DBusProxyFlags flags = 0, 
GLib.Cancellable? cancellable = null) throws GLib.IOError; 
                public T get_proxy_sync<T> (string? name, string object_path, GLib.DBusProxyFlags flags = 0, 
GLib.Cancellable? cancellable = null) throws GLib.IOError;
                public uint register_object<T> (string object_path, T object) throws GLib.IOError;
@@ -55,21 +52,6 @@ namespace GLib {
                public DBusMessage.method_reply (GLib.DBusMessage method_call_message);
        }
 
-       [CCode (cheader_filename = "gio/gio.h", type_id = "g_dbus_object_manager_client_get_type ()")]
-       public class DBusObjectManagerClient : GLib.Object, GLib.AsyncInitable, GLib.DBusObjectManager, 
GLib.Initable {
-               [CCode (cname = "g_dbus_object_manager_client_new", finish_function = 
"g_dbus_object_manager_client_new_finish")]
-               public static async GLib.DBusObjectManagerClient @new (GLib.DBusConnection connection, 
GLib.DBusObjectManagerClientFlags flags, string name, string object_path, [CCode (delegate_target_pos = 
5.33333, destroy_notify_pos = 5.66667)] owned GLib.DBusProxyTypeFunc get_proxy_type_func, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
-               [CCode (cname = "g_dbus_object_manager_client_new_for_bus", finish_function = 
"g_dbus_object_manager_client_new_for_bus_finish")]
-               public static async GLib.DBusObjectManagerClient @new_for_bus (GLib.BusType bus_type, 
GLib.DBusObjectManagerClientFlags flags, string name, string object_path, [CCode (delegate_target_pos = 
5.33333, destroy_notify_pos = 5.66667)] owned GLib.DBusProxyTypeFunc get_proxy_type_func, GLib.Cancellable? 
cancellable = null) throws GLib.Error;
-       }
-
-       public class DBusProxy : GLib.Object, GLib.AsyncInitable, GLib.DBusInterface, GLib.Initable {
-               [CCode (cname = "g_dbus_proxy_new", finish_function = "g_dbus_proxy_new_finish")]
-               public static async GLib.DBusProxy @new (GLib.DBusConnection connection, GLib.DBusProxyFlags 
flags, GLib.DBusInterfaceInfo? info, string? name, string object_path, string interface_name, 
GLib.Cancellable? cancellable = null) throws GLib.IOError;
-               [CCode (cname = "g_dbus_proxy_new_for_bus", finish_function = 
"g_dbus_proxy_new_for_bus_finish")]
-               public static async GLib.DBusProxy create_for_bus (GLib.BusType bus_type, GLib.DBusProxyFlags 
flags, GLib.DBusInterfaceInfo? info, string name, string object_path, string interface_name, 
GLib.Cancellable? cancellable = null) throws GLib.IOError;
-       }
-
        public class DataInputStream : GLib.BufferedInputStream {
                [CCode (cname = "g_data_input_stream_read_line_async", finish_function = 
"g_data_input_stream_read_line_finish_utf8")]
                public async string? read_line_utf8_async (int io_priority = GLib.Priority.DEFAULT, 
GLib.Cancellable? cancellable = null, out size_t length) throws GLib.IOError, GLib.IOError;
@@ -179,15 +161,6 @@ namespace GLib {
                public virtual bool is_supported ();
        }
 
-       public interface AsyncInitable : GLib.Object {
-               [CCode (finish_function = "g_async_initable_new_finish")]
-               public static async GLib.Object new_async (GLib.Type object_type, int io_priority = 
GLib.Priority.DEFAULT, GLib.Cancellable? cancellable, ...) throws GLib.Error;
-               [CCode (finish_function = "g_async_initable_new_finish")]
-               public static async GLib.Object new_valist_async (GLib.Type object_type, string 
first_property_name, va_list var_args, int io_priority = GLib.Priority.DEFAULT, GLib.Cancellable? cancellable 
= null);
-               [CCode (finish_function = "g_async_initable_new_finish")]
-               public static async GLib.Object newv_async (GLib.Type object_type, [CCode (array_length_pos = 
1.1)] GLib.Parameter[] parameters, int io_priority = GLib.Priority.DEFAULT, GLib.Cancellable? cancellable = 
null);
-       }
-
        public interface File : GLib.Object {
                [NoWrapper, Version (deprecated_since = "vala-0.16", replacement = "has_prefix")]
                public abstract bool prefix_matches (GLib.File file);
diff --git a/vapi/metadata/Gio-2.0.metadata b/vapi/metadata/Gio-2.0.metadata
index 1257ce3..595e77a 100644
--- a/vapi/metadata/Gio-2.0.metadata
+++ b/vapi/metadata/Gio-2.0.metadata
@@ -70,6 +70,12 @@ ApplicationCommandLine
   .get_platform_data nullable
   .print skip=false printf_format
   .printerr skip=false printf_format
+AsyncInitable
+  .* skip=false
+  .init_async#virtual_method virtual
+  .new_async symbol_type="construtor" finish_name="g_async_initable_new_finish"
+  .new_valist_async symbol_type="construtor" finish_name="g_async_initable_new_finish"
+  .newv_async symbol_type="construtor" finish_name="g_async_initable_new_finish"
 BufferedInputStream
   .peek.offset default=0
 Cancellable
@@ -290,26 +296,6 @@ proxy_resolver_get_default skip
 simple_async_report_gerror_in_idle parent="GLib.SimpleAsyncResult" name="report_gerror_in_idle"
 tls_* skip
 
-// Bug #659886: Async constuctors don't work
-DBusConnection
-  .new skip
-  .new_finish skip
-  .new_for_address skip
-  .new_for_address_finish skip
-DBusObjectManagerClient
-  .new skip
-  .new_finish skip
-  .new_for_bus skip
-  .new_for_bus_finish skip
-DBusProxy
-  .new skip
-  .new_finish skip
-  .new_for_bus skip
-  .new_for_bus_finish skip
-AsyncInitable
-  .new* skip
-  .init_async#virtual_method virtual
-
 // Bug #666797: No support for generic methods in GIR parser
 DBusConnection
   .register_object skip


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