[glibmm] Gio::SocketAddress: Hand-code create() because the C func does lots.



commit 1bd61e69afed88b1ffc9e46370b415397d530c0e
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon May 9 12:33:12 2016 +0200

    Gio::SocketAddress: Hand-code create() because the C func does lots.
    
    We can only genereate constructors (that are then called by generated
    create() methods) when the C function just sets its properties, as per
    the convention with GObject APIs. This C function does far more.
    
    Bug #766150 (Vladimir)

 gio/src/socketaddress.hg |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gio/src/socketaddress.hg b/gio/src/socketaddress.hg
index 2739673..ed7cf8f 100644
--- a/gio/src/socketaddress.hg
+++ b/gio/src/socketaddress.hg
@@ -41,10 +41,13 @@ class SocketAddress : public Glib::Object,
   _CLASS_GOBJECT(SocketAddress, GSocketAddress, G_SOCKET_ADDRESS, Glib::Object, GObject)
   _IMPLEMENTS_INTERFACE(SocketConnectable)
 
-  _WRAP_CTOR(SocketAddress(gpointer native, gsize len), g_socket_address_new_from_native)
-
 public:
-  _WRAP_CREATE(gpointer native, gsize len)
+
+  // Note that we can't use _WRAP_CTOR() and _WRAP_CREATE() because the C
+  // function does more than just call g_object_new():
+  // See https://bugzilla.gnome.org/show_bug.cgi?id=766150
+  _WRAP_METHOD(static Glib::RefPtr<SocketAddress> create(gpointer native, gsize len), 
g_socket_address_new_from_native)
+
   _WRAP_METHOD(SocketFamily get_family() const, g_socket_address_get_family)
   _WRAP_METHOD(bool to_native(gpointer dest, gsize destlen), g_socket_address_to_native, errthrow)
   _WRAP_METHOD(gssize get_native_size() const, g_socket_address_get_native_size)


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