2005-06-14 Ross Burton <ross@burtonini.com>.
authorColin Walters <walters@verbum.org>
Tue, 14 Jun 2005 15:52:41 +0000 (15:52 +0000)
committerColin Walters <walters@verbum.org>
Tue, 14 Jun 2005 15:52:41 +0000 (15:52 +0000)
* glib/dbus-glib.h: Make DBusGMethodInvocation
a private structure.  Rearrange prototypes a bit.

* glib/dbus-gproxy.c (dbus_g_proxy_invoke): Add
documentation for first_arg_type.

* glib/dbus-gobject.c: Move DBusGMethodInvocation
here, add documentation.  Move dbus_g_method_return
and dbus_g_method_return_error into public API
section.

ChangeLog
dbus/dbus-glib.h
glib/dbus-gobject.c
glib/dbus-gproxy.c

index 7e0794e..9aa3264 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-06-14  Ross Burton <ross@burtonini.com>.
+
+       * glib/dbus-glib.h: Make DBusGMethodInvocation
+       a private structure.  Rearrange prototypes a bit.
+       
+       * glib/dbus-gproxy.c (dbus_g_proxy_invoke): Add
+       documentation for first_arg_type.
+       
+       * glib/dbus-gobject.c: Move DBusGMethodInvocation
+       here, add documentation.  Move dbus_g_method_return
+       and dbus_g_method_return_error into public API
+       section.
+
 2005-06-14  Colin Walters  <walters@verbum.org>
 
        * glib/dbus-gobject.c (_dbus_gobject_lookup_marshaller):
index 7921c91..80ed7f4 100644 (file)
@@ -267,22 +267,18 @@ gboolean          dbus_g_proxy_invoke                (DBusGProxy        *proxy,
                                                      GType              first_arg_type,
                                                      ...);
 
+typedef struct DBusGMethodInvocation DBusGMethodInvocation;
+
+void dbus_g_method_return (DBusGMethodInvocation *context, ...);
+
+void dbus_g_method_return_error (DBusGMethodInvocation *context, GError *error);
+
 typedef struct {
   DBusGProxy *proxy;
   gpointer cb;
   gpointer userdata;
 } DBusGAsyncData;
 
-typedef struct {
-  DBusGConnection *connection;
-  DBusGMessage *message;
-  const DBusGObjectInfo *object;
-  const DBusGMethodInfo *method;
-} DBusGMethodInvocation;
-
-void dbus_g_method_return (DBusGMethodInvocation *context, ...);
-void dbus_g_method_return_error (DBusGMethodInvocation *context, GError *error);
-
 #undef DBUS_INSIDE_DBUS_GLIB_H
 
 G_END_DECLS
index 4495c6c..5928e26 100644 (file)
@@ -724,6 +724,17 @@ gerror_to_dbus_error_message (const DBusGObjectInfo *object_info,
   return reply;
 }
 
+/**
+ * The context of an asynchronous method call.  See dbus_g_method_return() and
+ * dbus_g_method_return_error().
+ */
+struct DBusGMethodInvocation {
+  DBusGConnection *connection; /**< The connection */
+  DBusGMessage *message; /**< The message which generated the method call */
+  const DBusGObjectInfo *object; /**< The object the method was called on */
+  const DBusGMethodInfo *method; /**< The method called */
+};
+
 static DBusHandlerResult
 invoke_object_method (GObject         *object,
                      const DBusGObjectInfo *object_info,
@@ -946,55 +957,6 @@ invoke_object_method (GObject         *object,
   goto done;
 }
 
-void
-dbus_g_method_return (DBusGMethodInvocation *context, ...)
-{
-  DBusMessage *reply;
-  DBusMessageIter iter;
-  va_list args;
-  char *out_sig;
-  GArray *argsig;
-  guint i;
-
-  reply = dbus_message_new_method_return (dbus_g_message_get_message (context->message));
-  out_sig = method_output_signature_from_object_info (context->object, context->method);
-  argsig = dbus_gtypes_from_arg_signature (out_sig, FALSE);
-
-  dbus_message_iter_init_append (reply, &iter);
-
-  va_start (args, context);
-  for (i = 0; i < argsig->len; i++) {
-    GValue value = {0,};
-    char *error;
-    g_value_init (&value, g_array_index (argsig, GType, i));
-    error = NULL;
-    G_VALUE_COLLECT (&value, args, 0, &error);
-    if (error) {
-      g_warning(error);
-      g_free (error);
-    }
-    dbus_gvalue_marshal (&iter, &value);
-  }
-  va_end (args);
-
-  dbus_connection_send (dbus_g_connection_get_connection (context->connection), reply, NULL);
-  dbus_message_unref (reply);
-
-  dbus_g_connection_unref (context->connection);
-  dbus_g_message_unref (context->message);
-  g_free (context);
-}
-
-void
-dbus_g_method_return_error (DBusGMethodInvocation *context, GError *error)
-{
-  DBusMessage *reply;
-  reply = gerror_to_dbus_error_message (context->object, dbus_g_message_get_message (context->message), error);
-  dbus_connection_send (dbus_g_connection_get_connection (context->connection), reply, NULL);
-  dbus_message_unref (reply);
-}
-
-
 static DBusHandlerResult
 gobject_message_function (DBusConnection  *connection,
                           DBusMessage     *message,
@@ -1486,6 +1448,65 @@ dbus_g_object_register_marshaller (GType            rettype,
   g_static_rw_lock_writer_unlock (&globals_lock);
 }
 
+/**
+ * Send a return message for a given method invocation, with arguments.
+ *
+ * @param context the method context
+ */
+void
+dbus_g_method_return (DBusGMethodInvocation *context, ...)
+{
+  DBusMessage *reply;
+  DBusMessageIter iter;
+  va_list args;
+  char *out_sig;
+  GArray *argsig;
+  guint i;
+
+  reply = dbus_message_new_method_return (dbus_g_message_get_message (context->message));
+  out_sig = method_output_signature_from_object_info (context->object, context->method);
+  argsig = dbus_gtypes_from_arg_signature (out_sig, FALSE);
+
+  dbus_message_iter_init_append (reply, &iter);
+
+  va_start (args, context);
+  for (i = 0; i < argsig->len; i++) {
+    GValue value = {0,};
+    char *error;
+    g_value_init (&value, g_array_index (argsig, GType, i));
+    error = NULL;
+    G_VALUE_COLLECT (&value, args, 0, &error);
+    if (error) {
+      g_warning(error);
+      g_free (error);
+    }
+    dbus_gvalue_marshal (&iter, &value);
+  }
+  va_end (args);
+
+  dbus_connection_send (dbus_g_connection_get_connection (context->connection), reply, NULL);
+  dbus_message_unref (reply);
+
+  dbus_g_connection_unref (context->connection);
+  dbus_g_message_unref (context->message);
+  g_free (context);
+}
+
+/**
+ * Send a error message for a given method invocation.
+ *
+ * @param context the method context
+ * @param error the error to send.
+ */
+void
+dbus_g_method_return_error (DBusGMethodInvocation *context, GError *error)
+{
+  DBusMessage *reply;
+  reply = gerror_to_dbus_error_message (context->object, dbus_g_message_get_message (context->message), error);
+  dbus_connection_send (dbus_g_connection_get_connection (context->connection), reply, NULL);
+  dbus_message_unref (reply);
+}
+
 /** @} */ /* end of public API */
 
 const char * _dbus_gobject_get_path (GObject *obj)
index 42bfca8..efb8292 100644 (file)
@@ -1595,6 +1595,7 @@ dbus_g_proxy_end_call (DBusGProxy          *proxy,
  * @param proxy a proxy for a remote interface
  * @param method method to invoke
  * @param error return location for an error
+ * @param first_arg_type type of first "in" argument
  * @returns #FALSE if an error is set, TRUE otherwise
  */
 gboolean