[glibmm] Fix build with glib from master



commit 2be6461562f696845a60370568dedd7625b6dbf3
Author: Jonathon Jongsma <jonathon quotidian org>
Date:   Thu Jul 9 12:05:40 2009 +0100

    Fix build with glib from master
    
    	* gio/src/socket.hg: fix build breakage caused by the addition of a
    	  bunch of cancellable parameters to GSocket methods.

 ChangeLog                |    7 ++
 gio/src/gio_methods.defs |  229 +++++++++++++++++++++++++++++++++++++++++++++-
 gio/src/socket.ccg       |  111 ++++++++++++++++++++++
 gio/src/socket.hg        |   51 +++++++++-
 4 files changed, 391 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d9e1c90..6f41d66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-09  Jonathon Jongsma  <jonathon quotidian org>
+
+	* gio/src/gio_methods.defs: re-generated defs
+	* gio/src/socket.ccg:
+	* gio/src/socket.hg: fix build breakage caused by the addition of a
+	  bunch of cancellable parameters to GSocket methods.
+
 2009-07-06  Daniel Elstner  <danielk openismus com>
 
 	Treat empty Glib::spawn*() working dir as unset
diff --git a/gio/src/gio_methods.defs b/gio/src/gio_methods.defs
index e49f0d1..d1adc38 100644
--- a/gio/src/gio_methods.defs
+++ b/gio/src/gio_methods.defs
@@ -25,6 +25,13 @@
   (gtype-id "G_TYPE_ASYNC_RESULT")
 )
 
+(define-object e
+  (in-module "GCancellabl")
+  (parent "GObject")
+  (c-name "GCancellable")
+  (gtype-id "G_TYPE_CANCELLABLE")
+)
+
 (define-object AppInfoLookup
   (in-module "GDesktop")
   (c-name "GDesktopAppInfoLookup")
@@ -415,6 +422,7 @@
     '("uint64" "G_FILE_ATTRIBUTE_TYPE_UINT64")
     '("int64" "G_FILE_ATTRIBUTE_TYPE_INT64")
     '("object" "G_FILE_ATTRIBUTE_TYPE_OBJECT")
+    '("stringv" "G_FILE_ATTRIBUTE_TYPE_STRINGV")
   )
 )
 
@@ -1887,13 +1895,19 @@
   (return-type "gboolean")
 )
 
+(define-method can_start_degraded
+  (of-object "GDrive")
+  (c-name "g_drive_can_start_degraded")
+  (return-type "gboolean")
+)
+
 (define-method start
   (of-object "GDrive")
   (c-name "g_drive_start")
   (return-type "none")
   (parameters
     '("GDriveStartFlags" "flags")
-    '("GMountOperation*" "start_operation")
+    '("GMountOperation*" "mount_operation")
     '("GCancellable*" "cancellable")
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
@@ -1922,6 +1936,7 @@
   (return-type "none")
   (parameters
     '("GMountUnmountFlags" "flags")
+    '("GMountOperation*" "mount_operation")
     '("GCancellable*" "cancellable")
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
@@ -1938,6 +1953,29 @@
   )
 )
 
+(define-method eject_with_operation
+  (of-object "GDrive")
+  (c-name "g_drive_eject_with_operation")
+  (return-type "none")
+  (parameters
+    '("GMountUnmountFlags" "flags")
+    '("GMountOperation*" "mount_operation")
+    '("GCancellable*" "cancellable")
+    '("GAsyncReadyCallback" "callback")
+    '("gpointer" "user_data")
+  )
+)
+
+(define-method eject_with_operation_finish
+  (of-object "GDrive")
+  (c-name "g_drive_eject_with_operation_finish")
+  (return-type "gboolean")
+  (parameters
+    '("GAsyncResult*" "result")
+    '("GError**" "error")
+  )
+)
+
 
 
 ;; From gemblemedicon.h
@@ -3087,6 +3125,29 @@
   )
 )
 
+(define-method unmount_mountable_with_operation
+  (of-object "GFile")
+  (c-name "g_file_unmount_mountable_with_operation")
+  (return-type "none")
+  (parameters
+    '("GMountUnmountFlags" "flags")
+    '("GMountOperation*" "mount_operation")
+    '("GCancellable*" "cancellable")
+    '("GAsyncReadyCallback" "callback")
+    '("gpointer" "user_data")
+  )
+)
+
+(define-method unmount_mountable_with_operation_finish
+  (of-object "GFile")
+  (c-name "g_file_unmount_mountable_with_operation_finish")
+  (return-type "gboolean")
+  (parameters
+    '("GAsyncResult*" "result")
+    '("GError**" "error")
+  )
+)
+
 (define-method eject_mountable
   (of-object "GFile")
   (c-name "g_file_eject_mountable")
@@ -3109,6 +3170,29 @@
   )
 )
 
+(define-method eject_mountable_with_operation
+  (of-object "GFile")
+  (c-name "g_file_eject_mountable_with_operation")
+  (return-type "none")
+  (parameters
+    '("GMountUnmountFlags" "flags")
+    '("GMountOperation*" "mount_operation")
+    '("GCancellable*" "cancellable")
+    '("GAsyncReadyCallback" "callback")
+    '("gpointer" "user_data")
+  )
+)
+
+(define-method eject_mountable_with_operation_finish
+  (of-object "GFile")
+  (c-name "g_file_eject_mountable_with_operation_finish")
+  (return-type "gboolean")
+  (parameters
+    '("GAsyncResult*" "result")
+    '("GError**" "error")
+  )
+)
+
 (define-method copy_attributes
   (of-object "GFile")
   (c-name "g_file_copy_attributes")
@@ -3183,6 +3267,7 @@
   (return-type "none")
   (parameters
     '("GMountUnmountFlags" "flags")
+    '("GMountOperation*" "mount_operation")
     '("GCancellable*" "cancellable")
     '("GAsyncReadyCallback" "callback")
     '("gpointer" "user_data")
@@ -3199,6 +3284,27 @@
   )
 )
 
+(define-method poll_mountable
+  (of-object "GFile")
+  (c-name "g_file_poll_mountable")
+  (return-type "none")
+  (parameters
+    '("GCancellable*" "cancellable")
+    '("GAsyncReadyCallback" "callback")
+    '("gpointer" "user_data")
+  )
+)
+
+(define-method poll_mountable_finish
+  (of-object "GFile")
+  (c-name "g_file_poll_mountable_finish")
+  (return-type "gboolean")
+  (parameters
+    '("GAsyncResult*" "result")
+    '("GError**" "error")
+  )
+)
+
 (define-method query_default_handler
   (of-object "GFile")
   (c-name "g_file_query_default_handler")
@@ -3314,6 +3420,12 @@
   )
 )
 
+(define-method supports_thread_contexts
+  (of-object "GFile")
+  (c-name "g_file_supports_thread_contexts")
+  (return-type "gboolean")
+)
+
 
 
 ;; From gfileicon.h
@@ -3374,6 +3486,15 @@
   )
 )
 
+(define-method has_namespace
+  (of-object "GFileInfo")
+  (c-name "g_file_info_has_namespace")
+  (return-type "gboolean")
+  (parameters
+    '("const-char*" "name_space")
+  )
+)
+
 (define-method list_attributes
   (of-object "GFileInfo")
   (c-name "g_file_info_list_attributes")
@@ -3422,6 +3543,16 @@
   )
 )
 
+(define-method set_attribute_status
+  (of-object "GFileInfo")
+  (c-name "g_file_info_set_attribute_status")
+  (return-type "gboolean")
+  (parameters
+    '("const-char*" "attribute")
+    '("GFileAttributeStatus" "status")
+  )
+)
+
 (define-method get_attribute_as_string
   (of-object "GFileInfo")
   (c-name "g_file_info_get_attribute_as_string")
@@ -3503,6 +3634,15 @@
   )
 )
 
+(define-method get_attribute_stringv
+  (of-object "GFileInfo")
+  (c-name "g_file_info_get_attribute_stringv")
+  (return-type "char**")
+  (parameters
+    '("const-char*" "attribute")
+  )
+)
+
 (define-method set_attribute
   (of-object "GFileInfo")
   (c-name "g_file_info_set_attribute")
@@ -3594,6 +3734,16 @@
   )
 )
 
+(define-method set_attribute_stringv
+  (of-object "GFileInfo")
+  (c-name "g_file_info_set_attribute_stringv")
+  (return-type "none")
+  (parameters
+    '("const-char*" "attribute")
+    '("char**" "attr_value")
+  )
+)
+
 (define-method clear_status
   (of-object "GFileInfo")
   (c-name "g_file_info_clear_status")
@@ -5261,6 +5411,52 @@
   (return-type "none")
 )
 
+(define-method unmount_with_operation
+  (of-object "GMount")
+  (c-name "g_mount_unmount_with_operation")
+  (return-type "none")
+  (parameters
+    '("GMountUnmountFlags" "flags")
+    '("GMountOperation*" "mount_operation")
+    '("GCancellable*" "cancellable")
+    '("GAsyncReadyCallback" "callback")
+    '("gpointer" "user_data")
+  )
+)
+
+(define-method unmount_with_operation_finish
+  (of-object "GMount")
+  (c-name "g_mount_unmount_with_operation_finish")
+  (return-type "gboolean")
+  (parameters
+    '("GAsyncResult*" "result")
+    '("GError**" "error")
+  )
+)
+
+(define-method eject_with_operation
+  (of-object "GMount")
+  (c-name "g_mount_eject_with_operation")
+  (return-type "none")
+  (parameters
+    '("GMountUnmountFlags" "flags")
+    '("GMountOperation*" "mount_operation")
+    '("GCancellable*" "cancellable")
+    '("GAsyncReadyCallback" "callback")
+    '("gpointer" "user_data")
+  )
+)
+
+(define-method eject_with_operation_finish
+  (of-object "GMount")
+  (c-name "g_mount_eject_with_operation_finish")
+  (return-type "gboolean")
+  (parameters
+    '("GAsyncResult*" "result")
+    '("GError**" "error")
+  )
+)
+
 
 
 ;; From gmountoperation.h
@@ -6570,6 +6766,7 @@
   (return-type "gboolean")
   (parameters
     '("GSocketAddress*" "address")
+    '("GCancellable*" "cancellable")
     '("GError**" "error")
   )
 )
@@ -6608,6 +6805,7 @@
   (c-name "g_socket_accept")
   (return-type "GSocket*")
   (parameters
+    '("GCancellable*" "cancellable")
     '("GError**" "error")
   )
 )
@@ -6628,6 +6826,7 @@
   (parameters
     '("gchar*" "buffer")
     '("gsize" "size")
+    '("GCancellable*" "cancellable")
     '("GError**" "error")
   )
 )
@@ -6640,6 +6839,7 @@
     '("GSocketAddress**" "address")
     '("gchar*" "buffer")
     '("gsize" "size")
+    '("GCancellable*" "cancellable")
     '("GError**" "error")
   )
 )
@@ -6651,6 +6851,7 @@
   (parameters
     '("const-gchar*" "buffer")
     '("gsize" "size")
+    '("GCancellable*" "cancellable")
     '("GError**" "error")
   )
 )
@@ -6663,6 +6864,7 @@
     '("GSocketAddress*" "address")
     '("const-gchar*" "buffer")
     '("gsize" "size")
+    '("GCancellable*" "cancellable")
     '("GError**" "error")
   )
 )
@@ -6678,6 +6880,7 @@
     '("GSocketControlMessage***" "messages")
     '("gint*" "num_messages")
     '("gint*" "flags")
+    '("GCancellable*" "cancellable")
     '("GError**" "error")
   )
 )
@@ -6693,6 +6896,7 @@
     '("GSocketControlMessage**" "messages")
     '("gint" "num_messages")
     '("gint" "flags")
+    '("GCancellable*" "cancellable")
     '("GError**" "error")
   )
 )
@@ -7239,6 +7443,29 @@
   (return-type "GFile*")
 )
 
+(define-method eject_with_operation
+  (of-object "GVolume")
+  (c-name "g_volume_eject_with_operation")
+  (return-type "none")
+  (parameters
+    '("GMountUnmountFlags" "flags")
+    '("GMountOperation*" "mount_operation")
+    '("GCancellable*" "cancellable")
+    '("GAsyncReadyCallback" "callback")
+    '("gpointer" "user_data")
+  )
+)
+
+(define-method eject_with_operation_finish
+  (of-object "GVolume")
+  (c-name "g_volume_eject_with_operation_finish")
+  (return-type "gboolean")
+  (parameters
+    '("GAsyncResult*" "result")
+    '("GError**" "error")
+  )
+)
+
 
 
 ;; From gvolumemonitor.h
diff --git a/gio/src/socket.ccg b/gio/src/socket.ccg
index 251999b..1850a92 100644
--- a/gio/src/socket.ccg
+++ b/gio/src/socket.ccg
@@ -23,4 +23,115 @@
 
 namespace Gio
 {
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+void Socket::connect(const Glib::RefPtr<SocketAddress>& address)
+#else
+void Socket::connect(const Glib::RefPtr<SocketAddress>& address, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  g_socket_connect(gobj(), const_cast<GSocketAddress*>(Glib::unwrap(address)), 0, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<Socket> Socket::accept()
+#else
+Glib::RefPtr<Socket> Socket::accept(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  Glib::RefPtr<Socket> retvalue = Glib::wrap(g_socket_accept(gobj(), 0, &(gerror)));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+gssize Socket::receive(char* buffer, gsize size)
+#else
+gssize Socket::receive(char* buffer, gsize size, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  gssize retvalue = g_socket_receive(gobj(), buffer, size, 0, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+gssize Socket::send(const gchar* buffer, gsize size)
+#else
+gssize Socket::send(const gchar* buffer, gsize size, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  gssize retvalue = g_socket_send(gobj(), buffer, size, 0, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+gssize Socket::send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size)
+#else
+gssize Socket::send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  gssize retvalue = g_socket_send_to(gobj(), const_cast<GSocketAddress*>(Glib::unwrap(address)), buffer, size, 0, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+void Socket::condition_wait(Glib::IOCondition condition)
+#else
+void Socket::condition_wait(Glib::IOCondition condition, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  g_socket_condition_wait(gobj(), ((GIOCondition)(condition)), 0, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+}
+
 } // namespace Gio
diff --git a/gio/src/socket.hg b/gio/src/socket.hg
index d6055ba..cbf02f1 100644
--- a/gio/src/socket.hg
+++ b/gio/src/socket.hg
@@ -95,33 +95,72 @@ public:
 
   _WRAP_METHOD(void bind(const Glib::RefPtr<SocketAddress>& address, bool allow_reuse), g_socket_bind, errthrow)
   _WRAP_METHOD(void listen(), g_socket_listen, errthrow)
-  _WRAP_METHOD(Glib::RefPtr<Socket> accept(), g_socket_accept, errthrow)
-  _WRAP_METHOD(void connect(const Glib::RefPtr<SocketAddress>& address), g_socket_connect, errthrow)
+  _WRAP_METHOD(Glib::RefPtr<Socket> accept(const Glib::RefPtr<Cancellable>& cancellable), g_socket_accept, errthrow)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  Glib::RefPtr<Socket> accept();
+#else
+  Glib::RefPtr<Socket> accept(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  _WRAP_METHOD(void connect(const Glib::RefPtr<SocketAddress>& address, const Glib::RefPtr<Cancellable>& cancellable), g_socket_connect, errthrow)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  void connect(const Glib::RefPtr<SocketAddress>& address);
+#else
+  void connect(const Glib::RefPtr<SocketAddress>& address, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
   // FIXME: it doesn't really seem like this is a proper use of exceptions...
   _WRAP_METHOD(void check_connect_result(), g_socket_check_connect_result, errthrow)
+
   // TODO: std::string overload?
-  _WRAP_METHOD(gssize receive(char* buffer, gsize size), g_socket_receive, errthrow)
+  _WRAP_METHOD(gssize receive(char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable), g_socket_receive, errthrow)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  gssize receive(char* buffer, gsize size);
+#else
+  gssize receive(char* buffer, gsize size, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
   // TODO: std::string overload?
   // TODO: need to do manually?
   //_WRAP_METHOD(gssize receive_from(Glib::RefPtr<SocketAddress>& address, char* buffer, gsize size), g_socket_receive_from, errthrow)
   // TODO: wrap receive_message -- figure out this GInputVector thing
   // TODO: std::string overload?
-  _WRAP_METHOD(gssize send(const gchar* buffer, gsize size), g_socket_send, errthrow)
+
+  _WRAP_METHOD(gssize send(const gchar* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable), g_socket_send, errthrow)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  gssize send(const gchar* buffer, gsize size);
+#else
+  gssize send(const gchar* buffer, gsize size, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
   // TODO: std::string overload?
-  _WRAP_METHOD(gssize send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size), g_socket_send_to, errthrow)
+  _WRAP_METHOD(gssize send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size, const Glib::RefPtr<Cancellable>& cancellable), g_socket_send_to, errthrow)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  gssize send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size);
+#else
+  gssize send_to(const Glib::RefPtr<SocketAddress>& address, const char* buffer, gsize size, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
   // TODO: wrap send_message -- figure out this GOutputVector thing
   _WRAP_METHOD(void close(), g_socket_close, errthrow)
   _WRAP_METHOD(bool is_closed(), g_socket_is_closed)
   _WRAP_METHOD(void shutdown(bool shutdown_read, bool shutdown_write), g_socket_shutdown, errthrow)
   _WRAP_METHOD(bool is_connected(), g_socket_is_connected)
+
   // TODO: non-cancellable version
   // This won't work because Glib::Source is abstract, and Glib::IOSource has no
   // constructor that takes a GSource*
 //#m4 _CONVERSION(`GSource*',`Glib::RefPtr<Glib::Source>',`Glib::RefPtr<Glib::Source>(new ::Glib::Source($3))')
   //_WRAP_METHOD(Glib::RefPtr<Glib::Source> create_source(Glib::IOCondition condition, const Glib::RefPtr<Cancellable>& cancellable), g_socket_create_source)
   _WRAP_METHOD(Glib::IOCondition condition_check(Glib::IOCondition condition), g_socket_condition_check)
-  // TODO: non-cancellable version
+
   _WRAP_METHOD(void condition_wait(Glib::IOCondition condition, const Glib::RefPtr<Cancellable>& cancellable), g_socket_condition_wait, errthrow)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  void condition_wait(Glib::IOCondition condition);
+#else
+  void condition_wait(Glib::IOCondition condition, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
   _WRAP_METHOD(void set_listen_backlog(int backlog), g_socket_set_listen_backlog)
   _WRAP_METHOD(int get_listen_backlog() const, g_socket_get_listen_backlog)
   _WRAP_METHOD(void set_blocking(bool blocking), g_socket_set_blocking)



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