diff options
author | David Zeuthen <davidz@redhat.com> | 2010-04-24 14:53:51 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2010-04-24 14:53:51 -0400 |
commit | 1179123968b8072b1d3539b346e3c766472621b0 (patch) | |
tree | d2279b15d799fa312d25a251fdbec6a2d00430fb | |
parent | 566f273592a27411ae84de0e3f8af96b9a6e973e (diff) |
Always put user_data as the last argument
Not sure why it was right in the middle in the first place.
-rw-r--r-- | gdbus/example-server.c | 12 | ||||
-rw-r--r-- | gdbus/example-subtree.c | 32 | ||||
-rw-r--r-- | gdbus/gdbusconnection.c | 43 | ||||
-rw-r--r-- | gdbus/gdbusconnection.h | 36 | ||||
-rw-r--r-- | gdbus/tests/export.c | 40 | ||||
-rw-r--r-- | gdbus/tests/peer.c | 8 |
6 files changed, 87 insertions, 84 deletions
diff --git a/gdbus/example-server.c b/gdbus/example-server.c index aa61938..7b4a420 100644 --- a/gdbus/example-server.c +++ b/gdbus/example-server.c @@ -35,13 +35,13 @@ static const gchar introspection_xml[] = static void handle_method_call (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, - GDBusMethodInvocation *invocation) + GDBusMethodInvocation *invocation, + gpointer user_data) { if (g_strcmp0 (method_name, "HelloWorld") == 0) { @@ -110,12 +110,12 @@ static gboolean swap_a_and_b = FALSE; static GVariant * handle_get_property (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, - GError **error) + GError **error, + gpointer user_data) { GVariant *ret; @@ -157,13 +157,13 @@ handle_get_property (GDBusConnection *connection, static gboolean handle_set_property (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, - GError **error) + GError **error, + gpointer user_data) { if (g_strcmp0 (property_name, "Title") == 0) { diff --git a/gdbus/example-subtree.c b/gdbus/example-subtree.c index 68aef44..ba9d8d2 100644 --- a/gdbus/example-subtree.c +++ b/gdbus/example-subtree.c @@ -42,13 +42,13 @@ static const gchar introspection_xml[] = static void manager_method_call (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, - GDBusMethodInvocation *invocation) + GDBusMethodInvocation *invocation, + gpointer user_data) { const gchar *greeting; gchar *response; @@ -80,13 +80,13 @@ const GDBusInterfaceVTable manager_vtable = static void block_method_call (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, - GDBusMethodInvocation *invocation) + GDBusMethodInvocation *invocation, + gpointer user_data) { g_assert_cmpstr (interface_name, ==, "org.gtk.GDBus.Example.Block"); @@ -121,12 +121,12 @@ block_method_call (GDBusConnection *connection, static GVariant * block_get_property (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, - GError **error) + GError **error, + gpointer user_data) { GVariant *ret; const gchar *node; @@ -171,13 +171,13 @@ block_get_property (GDBusConnection *connection, static gboolean block_set_property (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, - GError **error) + GError **error, + gpointer user_data) { /* TODO */ g_assert_not_reached (); @@ -194,13 +194,13 @@ const GDBusInterfaceVTable block_vtable = static void partition_method_call (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, - GDBusMethodInvocation *invocation) + GDBusMethodInvocation *invocation, + gpointer user_data) { const gchar *greeting; gchar *response; @@ -232,9 +232,9 @@ const GDBusInterfaceVTable partition_vtable = static gchar ** subtree_enumerate (GDBusConnection *connection, - gpointer user_data, const gchar *sender, - const gchar *object_path) + const gchar *object_path, + gpointer user_data) { gchar **nodes; GPtrArray *p; @@ -256,10 +256,10 @@ subtree_enumerate (GDBusConnection *connection, static GPtrArray * subtree_introspect (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, - const gchar *node) + const gchar *node, + gpointer user_data) { GPtrArray *p; @@ -280,12 +280,12 @@ subtree_introspect (GDBusConnection *connection, static const GDBusInterfaceVTable * subtree_dispatch (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *node, - gpointer *out_user_data) + gpointer *out_user_data, + gpointer user_data) { const GDBusInterfaceVTable *vtable_to_return; gpointer user_data_to_return; diff --git a/gdbus/gdbusconnection.c b/gdbus/gdbusconnection.c index 2c59a1c..19a49d7 100644 --- a/gdbus/gdbusconnection.c +++ b/gdbus/gdbusconnection.c @@ -2661,12 +2661,13 @@ invoke_get_property_in_idle_cb (gpointer _data) error = NULL; value = data->vtable->get_property (data->connection, - data->user_data, g_dbus_message_get_sender (data->message), g_dbus_message_get_path (data->message), data->interface_info->name, data->property_name, - &error); + &error, + data->user_data); + if (value != NULL) { @@ -2728,13 +2729,13 @@ invoke_set_property_in_idle_cb (gpointer _data) } if (!data->vtable->set_property (data->connection, - data->user_data, g_dbus_message_get_sender (data->message), g_dbus_message_get_path (data->message), data->interface_info->name, data->property_name, value, - &error)) + &error, + data->user_data)) { gchar *dbus_error_name; g_assert (error != NULL); @@ -2967,12 +2968,13 @@ invoke_get_all_properties_in_idle_cb (gpointer _data) continue; value = data->vtable->get_property (data->connection, - data->user_data, g_dbus_message_get_sender (data->message), g_dbus_message_get_path (data->message), data->interface_info->name, property_info->name, - NULL); + NULL, + data->user_data); + if (value == NULL) continue; @@ -3274,13 +3276,14 @@ invoke_method_in_idle_cb (gpointer user_data) g_assert (vtable != NULL && vtable->method_call != NULL); vtable->method_call (g_dbus_method_invocation_get_connection (invocation), - g_dbus_method_invocation_get_user_data (invocation), g_dbus_method_invocation_get_sender (invocation), g_dbus_method_invocation_get_object_path (invocation), g_dbus_method_invocation_get_interface_name (invocation), g_dbus_method_invocation_get_method_name (invocation), g_dbus_method_invocation_get_parameters (invocation), - g_object_ref (invocation)); + g_object_ref (invocation), + g_dbus_method_invocation_get_user_data (invocation)); + return FALSE; } @@ -4000,9 +4003,9 @@ handle_subtree_introspect (GDBusConnection *connection, * conditionals to preserve code clarity */ children = es->vtable->enumerate (es->connection, - es->user_data, sender, - es->object_path); + es->object_path, + es->user_data); if (!is_root) { @@ -4019,10 +4022,10 @@ handle_subtree_introspect (GDBusConnection *connection, } interfaces = es->vtable->introspect (es->connection, - es->user_data, sender, es->object_path, - requested_node); + requested_node, + es->user_data); if (interfaces != NULL) { if (interfaces->len > 0) @@ -4125,9 +4128,9 @@ handle_subtree_method_invocation (GDBusConnection *connection, } children = es->vtable->enumerate (es->connection, - es->user_data, sender, - es->object_path); + es->object_path, + es->user_data); if (!is_root) { @@ -4145,10 +4148,10 @@ handle_subtree_method_invocation (GDBusConnection *connection, /* get introspection data for the node */ interfaces = es->vtable->introspect (es->connection, - es->user_data, sender, requested_object_path, - requested_node); + requested_node, + es->user_data); g_assert (interfaces != NULL); introspection_data = NULL; for (n = 0; n < interfaces->len; n++) @@ -4166,12 +4169,12 @@ handle_subtree_method_invocation (GDBusConnection *connection, /* figure out where to dispatch the method call */ interface_user_data = NULL; interface_vtable = es->vtable->dispatch (es->connection, - es->user_data, sender, es->object_path, interface_name, requested_node, - &interface_user_data); + &interface_user_data, + es->user_data); if (interface_vtable == NULL) goto out; @@ -4224,12 +4227,12 @@ handle_subtree_method_invocation (GDBusConnection *connection, /* figure out where to dispatch the property get/set/getall calls */ interface_user_data = NULL; interface_vtable = es->vtable->dispatch (es->connection, - es->user_data, sender, es->object_path, interface_name, requested_node, - &interface_user_data); + &interface_user_data, + es->user_data); if (interface_vtable == NULL) goto out; diff --git a/gdbus/gdbusconnection.h b/gdbus/gdbusconnection.h index b2450b2..bc6a86b 100644 --- a/gdbus/gdbusconnection.h +++ b/gdbus/gdbusconnection.h @@ -198,70 +198,70 @@ GVariant *g_dbus_connection_invoke_method_sync (GDBusConnection /** * GDBusInterfaceMethodCallFunc: * @connection: A #GDBusConnection. - * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object(). * @sender: The unique bus name of the remote caller. * @object_path: The object path that the method was invoked on. * @interface_name: The D-Bus interface name the method was invoked on. * @method_name: The name of the method that was invoked. * @parameters: A #GVariant tuple with parameters. * @invocation: A #GDBusMethodInvocation object that can be used to return a value or error. + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object(). * * The type of the @method_call function in #GDBusInterfaceVTable. */ typedef void (*GDBusInterfaceMethodCallFunc) (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, - GDBusMethodInvocation *invocation); + GDBusMethodInvocation *invocation, + gpointer user_data); /** * GDBusInterfaceGetPropertyFunc: * @connection: A #GDBusConnection. - * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object(). * @sender: The unique bus name of the remote caller. * @object_path: The object path that the method was invoked on. * @interface_name: The D-Bus interface name for the property. * @property_name: The name of the property to get the value of. * @error: Return location for error. + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object(). * * The type of the @get_property function in #GDBusInterfaceVTable. * * Returns: A newly-allocated #GVariant with the value for @property_name or %NULL if @error is set. */ typedef GVariant *(*GDBusInterfaceGetPropertyFunc) (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, - GError **error); + GError **error, + gpointer user_data); /** * GDBusInterfaceSetPropertyFunc: * @connection: A #GDBusConnection. - * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object(). * @sender: The unique bus name of the remote caller. * @object_path: The object path that the method was invoked on. * @interface_name: The D-Bus interface name for the property. * @property_name: The name of the property to get the value of. * @value: The value to set the property to. * @error: Return location for error. + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object(). * * The type of the @set_property function in #GDBusInterfaceVTable. * * Returns: %TRUE if the property was set to @value, %FALSE if @error is set. */ typedef gboolean (*GDBusInterfaceSetPropertyFunc) (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, - GError **error); + GError **error, + gpointer user_data); /** * GDBusInterfaceVTable: @@ -310,26 +310,26 @@ gboolean g_dbus_connection_unregister_object (GDBusConnection /** * GDBusSubtreeEnumerateFunc: * @connection: A #GDBusConnection. - * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree(). * @sender: The unique bus name of the remote caller. * @object_path: The object path that was registered with g_dbus_connection_register_subtree(). + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree(). * * The type of the @enumerate function in #GDBusSubtreeVTable. * * Returns: A newly allocated array of strings for node names that are children of @object_path. */ typedef gchar** (*GDBusSubtreeEnumerateFunc) (GDBusConnection *connection, - gpointer user_data, const gchar *sender, - const gchar *object_path); + const gchar *object_path, + gpointer user_data); /** * GDBusSubtreeIntrospectFunc: * @connection: A #GDBusConnection. - * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree(). * @sender: The unique bus name of the remote caller. * @object_path: The object path that was registered with g_dbus_connection_register_subtree(). * @node: A node that is a child of @object_path (relative to @object_path) or <quote>/</quote> for the root of the subtree. + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree(). * * The type of the @introspect function in #GDBusSubtreeVTable. * @@ -337,32 +337,32 @@ typedef gchar** (*GDBusSubtreeEnumerateFunc) (GDBusConnection *connection, * the interfaces implemented by @node. */ typedef GPtrArray *(*GDBusSubtreeIntrospectFunc) (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, - const gchar *node); + const gchar *node, + gpointer user_data); /** * GDBusSubtreeDispatchFunc: * @connection: A #GDBusConnection. - * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree(). * @sender: The unique bus name of the remote caller. * @object_path: The object path that was registered with g_dbus_connection_register_subtree(). * @interface_name: The D-Bus interface name that the method call or property access is for. * @node: A node that is a child of @object_path (relative to @object_path) or <quote>/</quote> for the root of the subtree. * @out_user_data: Return location for user data to pass to functions in the returned #GDBusInterfaceVTable (never %NULL). + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree(). * * The type of the @dispatch function in #GDBusSubtreeVtable. * * Returns: A #GDBusInterfaceVTable or %NULL if you don't want to handle the methods. */ typedef const GDBusInterfaceVTable * (*GDBusSubtreeDispatchFunc) (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *node, - gpointer *out_user_data); + gpointer *out_user_data, + gpointer user_data); /** * GDBusSubtreeVTable: diff --git a/gdbus/tests/export.c b/gdbus/tests/export.c index 7cae0c5..a6a0a7f 100644 --- a/gdbus/tests/export.c +++ b/gdbus/tests/export.c @@ -114,13 +114,13 @@ static const GDBusInterfaceInfo foo_interface_info = static void foo_method_call (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, - GDBusMethodInvocation *invocation) + GDBusMethodInvocation *invocation, + gpointer user_data) { if (g_strcmp0 (method_name, "Method1") == 0) { @@ -141,12 +141,12 @@ foo_method_call (GDBusConnection *connection, static GVariant * foo_get_property (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, - GError **error) + GError **error, + gpointer user_data) { GVariant *ret; gchar *s; @@ -158,13 +158,13 @@ foo_get_property (GDBusConnection *connection, static gboolean foo_set_property (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, - GError **error) + GError **error, + gpointer user_data) { gchar *s; s = g_variant_print (value, TRUE); @@ -259,13 +259,13 @@ static const GDBusInterfaceInfo dyna_interface_info = static void dyna_cyber (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, - GDBusMethodInvocation *invocation) + GDBusMethodInvocation *invocation, + gpointer user_data) { GPtrArray *data = user_data; gchar *node_name; @@ -575,9 +575,9 @@ _g_strv_has_string (const gchar* const * haystack, static gchar ** subtree_enumerate (GDBusConnection *connection, - gpointer user_data, const gchar *sender, - const gchar *object_path) + const gchar *object_path, + gpointer user_data) { ObjectRegistrationData *data = user_data; GPtrArray *p; @@ -601,10 +601,10 @@ subtree_enumerate (GDBusConnection *connection, /* Only allows certain objects, and aborts on unknowns */ static GPtrArray * subtree_introspect (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, - const gchar *node) + const gchar *node, + gpointer user_data) { GPtrArray *interfaces; @@ -634,12 +634,12 @@ subtree_introspect (GDBusConnection *connection, static const GDBusInterfaceVTable * subtree_dispatch (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *node, - gpointer *out_user_data) + gpointer *out_user_data, + gpointer user_data) { if (g_strcmp0 (interface_name, "org.example.Foo") == 0) return &foo_vtable; @@ -658,9 +658,9 @@ static const GDBusSubtreeVTable subtree_vtable = static gchar ** dynamic_subtree_enumerate (GDBusConnection *connection, - gpointer user_data, const gchar *sender, - const gchar *object_path) + const gchar *object_path, + gpointer user_data) { GPtrArray *data = user_data; gchar **nodes = g_new (gchar*, data->len + 1); @@ -678,10 +678,10 @@ dynamic_subtree_enumerate (GDBusConnection *connection, /* Allow all objects to be introspected */ static GPtrArray * dynamic_subtree_introspect (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, - const gchar *node) + const gchar *node, + gpointer user_data) { GPtrArray *interfaces; @@ -694,12 +694,12 @@ dynamic_subtree_introspect (GDBusConnection *connection, static const GDBusInterfaceVTable * dynamic_subtree_dispatch (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *node, - gpointer *out_user_data) + gpointer *out_user_data, + gpointer user_data) { *out_user_data = user_data; return &dyna_interface_vtable; diff --git a/gdbus/tests/peer.c b/gdbus/tests/peer.c index 2d10fce..b1fa559 100644 --- a/gdbus/tests/peer.c +++ b/gdbus/tests/peer.c @@ -110,13 +110,13 @@ static const GDBusInterfaceInfo test_interface_introspection_data = static void test_interface_method_call (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, - GDBusMethodInvocation *invocation) + GDBusMethodInvocation *invocation, + gpointer user_data) { PeerData *data = user_data; @@ -161,12 +161,12 @@ test_interface_method_call (GDBusConnection *connection, static GVariant * test_interface_get_property (GDBusConnection *connection, - gpointer user_data, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, - GError **error) + GError **error, + gpointer user_data) { g_assert_cmpstr (object_path, ==, "/org/gtk/GDBus/PeerTestObject"); g_assert_cmpstr (interface_name, ==, "org.gtk.GDBus.PeerTestInterface"); |