dbus/glib dbus-gproxy.c,1.25,1.26 dbus-gobject.c,1.25,1.26

Colin Walters walters at freedesktop.org
Tue Jun 14 08:49:45 PDT 2005


Update of /cvs/dbus/dbus/glib
In directory gabe:/tmp/cvs-serv6639/glib

Modified Files:
	dbus-gproxy.c dbus-gobject.c 
Log Message:
2005-06-14  Ross Burton <ross at 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.


Index: dbus-gproxy.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gproxy.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- dbus-gproxy.c	13 Jun 2005 03:01:24 -0000	1.25
+++ dbus-gproxy.c	14 Jun 2005 15:49:43 -0000	1.26
@@ -1595,6 +1595,7 @@
  * @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

Index: dbus-gobject.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gobject.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- dbus-gobject.c	14 Jun 2005 14:23:56 -0000	1.25
+++ dbus-gobject.c	14 Jun 2005 15:49:43 -0000	1.26
@@ -724,6 +724,17 @@
   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 @@
   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 @@
   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)



More information about the dbus-commit mailing list