summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2008-12-08 01:29:48 -0500
committerDavid Zeuthen <davidz@redhat.com>2008-12-08 01:29:48 -0500
commit27afdc7a49ee49290e048364500d5c549f8ac614 (patch)
tree1c29cce703ae99c0e9fe2eff34e8eb5aeb355104
parent4b33ff1d6b5bc6cd22fe52cbb5fc71d32f0090ff (diff)
remove _async() and add _sync(); to discourage use of synchronous calls
-rw-r--r--docs/TODO4
-rw-r--r--docs/eggdbus/eggdbus-sections.txt58
-rw-r--r--src/eggdbus/eggdbusbusnametracker.c36
-rw-r--r--src/eggdbus/eggdbusconnection.c110
-rw-r--r--src/eggdbus/eggdbusconnection.h15
-rw-r--r--src/eggdbus/eggdbusproxy.c26
-rw-r--r--src/eggdbus/interface.c142
-rw-r--r--src/tests/testclient.c994
-rw-r--r--src/tests/testserver.c14
9 files changed, 697 insertions, 702 deletions
diff --git a/docs/TODO b/docs/TODO
index ae21f18..fbf481f 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -94,10 +94,6 @@ Can happen before 1.0 (before API/ABI freeze):
make it possible to get the proxy async from the connection (ie.
so when you get it then it has all properties).
- o Maybe rename generated client methods to invoke_foo_sync(), invoke_foo()
- and foo_finish(); the intent is to discourage the use of synchronous
- method invocations.
-
o Make it possible to specify the destination when emitting signals.
The API already provides for this, just need to actually JFDI
along with test cases.
diff --git a/docs/eggdbus/eggdbus-sections.txt b/docs/eggdbus/eggdbus-sections.txt
index 5e64cb8..c1b6aaa 100644
--- a/docs/eggdbus/eggdbus-sections.txt
+++ b/docs/eggdbus/eggdbus-sections.txt
@@ -3,8 +3,8 @@
EggDBusIntrospectable
EggDBusIntrospectableIface
egg_dbus_introspectable_invoke_introspect
-egg_dbus_introspectable_invoke_introspect_async
egg_dbus_introspectable_invoke_introspect_finish
+egg_dbus_introspectable_invoke_introspect_sync
egg_dbus_introspectable_handle_introspect_finish
<SUBSECTION Standard>
EGG_DBUS_INTROSPECTABLE
@@ -22,59 +22,59 @@ EggDBusRequestNameFlags
EggDBusRequestNameReply
EggDBusReleaseNameReply
egg_dbus_bus_invoke_hello
-egg_dbus_bus_invoke_hello_async
egg_dbus_bus_invoke_hello_finish
+egg_dbus_bus_invoke_hello_sync
egg_dbus_bus_invoke_request_name
-egg_dbus_bus_invoke_request_name_async
egg_dbus_bus_invoke_request_name_finish
+egg_dbus_bus_invoke_request_name_sync
egg_dbus_bus_invoke_release_name
-egg_dbus_bus_invoke_release_name_async
egg_dbus_bus_invoke_release_name_finish
+egg_dbus_bus_invoke_release_name_sync
egg_dbus_bus_invoke_start_service_by_name
-egg_dbus_bus_invoke_start_service_by_name_async
egg_dbus_bus_invoke_start_service_by_name_finish
+egg_dbus_bus_invoke_start_service_by_name_sync
egg_dbus_bus_invoke_update_activation_environment
-egg_dbus_bus_invoke_update_activation_environment_async
egg_dbus_bus_invoke_update_activation_environment_finish
+egg_dbus_bus_invoke_update_activation_environment_sync
egg_dbus_bus_invoke_name_has_owner
-egg_dbus_bus_invoke_name_has_owner_async
egg_dbus_bus_invoke_name_has_owner_finish
+egg_dbus_bus_invoke_name_has_owner_sync
egg_dbus_bus_invoke_list_names
-egg_dbus_bus_invoke_list_names_async
egg_dbus_bus_invoke_list_names_finish
+egg_dbus_bus_invoke_list_names_sync
egg_dbus_bus_invoke_list_activatable_names
-egg_dbus_bus_invoke_list_activatable_names_async
egg_dbus_bus_invoke_list_activatable_names_finish
+egg_dbus_bus_invoke_list_activatable_names_sync
egg_dbus_bus_invoke_add_match
-egg_dbus_bus_invoke_add_match_async
egg_dbus_bus_invoke_add_match_finish
+egg_dbus_bus_invoke_add_match_sync
egg_dbus_bus_invoke_remove_match
-egg_dbus_bus_invoke_remove_match_async
egg_dbus_bus_invoke_remove_match_finish
+egg_dbus_bus_invoke_remove_match_sync
egg_dbus_bus_invoke_get_name_owner
-egg_dbus_bus_invoke_get_name_owner_async
egg_dbus_bus_invoke_get_name_owner_finish
+egg_dbus_bus_invoke_get_name_owner_sync
egg_dbus_bus_invoke_list_queued_owners
-egg_dbus_bus_invoke_list_queued_owners_async
egg_dbus_bus_invoke_list_queued_owners_finish
+egg_dbus_bus_invoke_list_queued_owners_sync
egg_dbus_bus_invoke_get_connection_unix_user
-egg_dbus_bus_invoke_get_connection_unix_user_async
egg_dbus_bus_invoke_get_connection_unix_user_finish
+egg_dbus_bus_invoke_get_connection_unix_user_sync
egg_dbus_bus_invoke_get_connection_unix_process_id
-egg_dbus_bus_invoke_get_connection_unix_process_id_async
egg_dbus_bus_invoke_get_connection_unix_process_id_finish
+egg_dbus_bus_invoke_get_connection_unix_process_id_sync
egg_dbus_bus_invoke_get_adt_audit_session_data
-egg_dbus_bus_invoke_get_adt_audit_session_data_async
egg_dbus_bus_invoke_get_adt_audit_session_data_finish
+egg_dbus_bus_invoke_get_adt_audit_session_data_sync
egg_dbus_bus_invoke_get_connection_se_linux_security_context
-egg_dbus_bus_invoke_get_connection_se_linux_security_context_async
egg_dbus_bus_invoke_get_connection_se_linux_security_context_finish
+egg_dbus_bus_invoke_get_connection_se_linux_security_context_sync
egg_dbus_bus_invoke_reload_config
-egg_dbus_bus_invoke_reload_config_async
egg_dbus_bus_invoke_reload_config_finish
+egg_dbus_bus_invoke_reload_config_sync
egg_dbus_bus_invoke_get_id
-egg_dbus_bus_invoke_get_id_async
egg_dbus_bus_invoke_get_id_finish
+egg_dbus_bus_invoke_get_id_sync
egg_dbus_bus_handle_hello_finish
egg_dbus_bus_handle_request_name_finish
egg_dbus_bus_handle_release_name_finish
@@ -157,11 +157,11 @@ EGG_DBUS_INTERFACE_GET_IFACE
EggDBusPeer
EggDBusPeerIface
egg_dbus_peer_invoke_ping
-egg_dbus_peer_invoke_ping_async
egg_dbus_peer_invoke_ping_finish
+egg_dbus_peer_invoke_ping_sync
egg_dbus_peer_invoke_get_machine_id
-egg_dbus_peer_invoke_get_machine_id_async
egg_dbus_peer_invoke_get_machine_id_finish
+egg_dbus_peer_invoke_get_machine_id_sync
egg_dbus_peer_handle_ping_finish
egg_dbus_peer_handle_get_machine_id_finish
<SUBSECTION Standard>
@@ -417,8 +417,8 @@ egg_dbus_connection_new_message_for_signal
egg_dbus_connection_new_message_for_method_call
egg_dbus_connection_send_message
egg_dbus_connection_send_message_with_reply
-egg_dbus_connection_send_message_with_reply_async
egg_dbus_connection_send_message_with_reply_finish
+egg_dbus_connection_send_message_with_reply_sync
egg_dbus_connection_pending_call_cancel
egg_dbus_connection_pending_call_block
<SUBSECTION Standard>
@@ -436,14 +436,14 @@ EGG_DBUS_CONNECTION_GET_CLASS
EggDBusProperties
EggDBusPropertiesIface
egg_dbus_properties_invoke_get
-egg_dbus_properties_invoke_get_async
egg_dbus_properties_invoke_get_finish
+egg_dbus_properties_invoke_get_sync
egg_dbus_properties_invoke_get_all
-egg_dbus_properties_invoke_get_all_async
egg_dbus_properties_invoke_get_all_finish
+egg_dbus_properties_invoke_get_all_sync
egg_dbus_properties_invoke_set
-egg_dbus_properties_invoke_set_async
egg_dbus_properties_invoke_set_finish
+egg_dbus_properties_invoke_set_sync
egg_dbus_properties_handle_get_finish
egg_dbus_properties_handle_get_all_finish
egg_dbus_properties_handle_set_finish
@@ -458,16 +458,16 @@ EGG_DBUS_PROPERTIES_GET_IFACE
<SECTION>
<FILE>eggdbusenumtypes</FILE>
-egg_dbus_error_get_type
-EGG_TYPE_DBUS_ERROR
-egg_dbus_message_type_get_type
-EGG_TYPE_DBUS_MESSAGE_TYPE
egg_dbus_interface_property_info_flags_get_type
EGG_TYPE_DBUS_INTERFACE_PROPERTY_INFO_FLAGS
egg_dbus_call_flags_get_type
EGG_TYPE_DBUS_CALL_FLAGS
egg_dbus_bus_type_get_type
EGG_TYPE_DBUS_BUS_TYPE
+egg_dbus_error_get_type
+EGG_TYPE_DBUS_ERROR
+egg_dbus_message_type_get_type
+EGG_TYPE_DBUS_MESSAGE_TYPE
</SECTION>
<SECTION>
diff --git a/src/eggdbus/eggdbusbusnametracker.c b/src/eggdbus/eggdbusbusnametracker.c
index e69c485..74ab8b9 100644
--- a/src/eggdbus/eggdbusbusnametracker.c
+++ b/src/eggdbus/eggdbusbusnametracker.c
@@ -124,12 +124,12 @@ name_data_unref (NameData *data)
{
if (g_atomic_int_dec_and_test (&data->ref_count))
{
- egg_dbus_bus_invoke_remove_match_async (data->bus,
- 0,
- data->match_rule,
- NULL,
- (GAsyncReadyCallback) remove_match_rule_cb,
- data->match_rule); /* steal, remove_match_rule_cb() will free it */
+ egg_dbus_bus_invoke_remove_match (data->bus,
+ 0,
+ data->match_rule,
+ NULL,
+ (GAsyncReadyCallback) remove_match_rule_cb,
+ data->match_rule); /* steal, remove_match_rule_cb() will free it */
g_object_unref (data->bus);
g_free (data->name);
g_free (data->owner);
@@ -536,22 +536,22 @@ egg_dbus_bus_name_tracker_watch_bus_name (EggDBusBusNameTracker *bus_name_tracke
"member='NameOwnerChanged',arg0='%s'",
bus_name);
/* Watch for changes */
- egg_dbus_bus_invoke_add_match_async (priv->bus,
- 0,
- data->match_rule,
- NULL,
- (GAsyncReadyCallback) add_match_rule_cb,
- name_data_ref (data));
+ egg_dbus_bus_invoke_add_match (priv->bus,
+ 0,
+ data->match_rule,
+ NULL,
+ (GAsyncReadyCallback) add_match_rule_cb,
+ name_data_ref (data));
data->get_name_owner_is_pending = TRUE;
/* Get the name */
- egg_dbus_bus_invoke_get_name_owner_async (priv->bus,
- 0,
- data->name,
- NULL,
- (GAsyncReadyCallback) get_name_owner_cb,
- name_data_ref (data));
+ egg_dbus_bus_invoke_get_name_owner (priv->bus,
+ 0,
+ data->name,
+ NULL,
+ (GAsyncReadyCallback) get_name_owner_cb,
+ name_data_ref (data));
/*g_debug ("started watching bus name %s", bus_name);*/
}
diff --git a/src/eggdbus/eggdbusconnection.c b/src/eggdbus/eggdbusconnection.c
index 18a3044..fc3c712 100644
--- a/src/eggdbus/eggdbusconnection.c
+++ b/src/eggdbus/eggdbusconnection.c
@@ -775,12 +775,12 @@ egg_dbus_connection_get_proxy (EggDBusConnection *connection,
/*g_debug ("adding match rule \"%s\"", rule);*/
- egg_dbus_bus_invoke_add_match_async (EGG_DBUS_BUS (priv->bus_proxy),
- 0,
- rule,
- NULL,
- (GAsyncReadyCallback) add_match_rule_cb,
- match_rule_data_new (rule, connection));
+ egg_dbus_bus_invoke_add_match (EGG_DBUS_BUS (priv->bus_proxy),
+ 0,
+ rule,
+ NULL,
+ (GAsyncReadyCallback) add_match_rule_cb,
+ match_rule_data_new (rule, connection));
g_free (rule);
@@ -840,12 +840,12 @@ _egg_dbus_connection_unregister_proxy (EggDBusConnection *connection,
/*g_debug ("removing match rule \"%s\"", rule);*/
- egg_dbus_bus_invoke_remove_match_async (EGG_DBUS_BUS (priv->bus_proxy != NULL ? priv->bus_proxy : proxy),
- 0,
- rule,
- NULL,
- (GAsyncReadyCallback) remove_match_rule_cb,
- match_rule_data_new (rule, connection));
+ egg_dbus_bus_invoke_remove_match (EGG_DBUS_BUS (priv->bus_proxy != NULL ? priv->bus_proxy : proxy),
+ 0,
+ rule,
+ NULL,
+ (GAsyncReadyCallback) remove_match_rule_cb,
+ match_rule_data_new (rule, connection));
g_free (rule);
@@ -1895,7 +1895,7 @@ filter_function_handle_method_call (DBusConnection *dconnection,
void
egg_dbus_connection_send_message (EggDBusConnection *connection,
- EggDBusMessage *message)
+ EggDBusMessage *message)
{
DBusMessage *dmessage;
EggDBusConnectionPrivate *priv;
@@ -1913,15 +1913,15 @@ egg_dbus_connection_send_message (EggDBusConnection *connection,
}
static void
-egg_dbus_connection_send_message_with_reply_cb (EggDBusConnection *proxy,
- GAsyncResult *res,
- GAsyncResult **data)
+egg_dbus_connection_send_message_with_reply_sync_cb (EggDBusConnection *proxy,
+ GAsyncResult *res,
+ GAsyncResult **data)
{
*data = g_object_ref (res);
}
/**
- * egg_dbus_connection_send_message_with_reply:
+ * egg_dbus_connection_send_message_with_reply_sync:
* @connection:
* @call_flags:
* @message:
@@ -1934,12 +1934,12 @@ egg_dbus_connection_send_message_with_reply_cb (EggDBusConnection *proxy,
* Returns:
**/
EggDBusMessage *
-egg_dbus_connection_send_message_with_reply (EggDBusConnection *connection,
- EggDBusCallFlags call_flags,
- EggDBusMessage *message,
- GType *error_types,
- GCancellable *cancellable,
- GError **error)
+egg_dbus_connection_send_message_with_reply_sync (EggDBusConnection *connection,
+ EggDBusCallFlags call_flags,
+ EggDBusMessage *message,
+ GType *error_types,
+ GCancellable *cancellable,
+ GError **error)
{
EggDBusMessage *reply;
GAsyncResult *res;
@@ -1950,13 +1950,13 @@ egg_dbus_connection_send_message_with_reply (EggDBusConnection *connection
res = NULL;
- pending_call_id = egg_dbus_connection_send_message_with_reply_async (connection,
- call_flags,
- message,
- error_types,
- cancellable,
- (GAsyncReadyCallback) egg_dbus_connection_send_message_with_reply_cb,
- &res);
+ pending_call_id = egg_dbus_connection_send_message_with_reply (connection,
+ call_flags,
+ message,
+ error_types,
+ cancellable,
+ (GAsyncReadyCallback) egg_dbus_connection_send_message_with_reply_sync_cb,
+ &res);
egg_dbus_connection_pending_call_block (connection, pending_call_id);
@@ -1971,8 +1971,8 @@ egg_dbus_connection_send_message_with_reply (EggDBusConnection *connection
}
static void
-egg_dbus_connection_send_message_with_reply_async_cancelled_cb (GCancellable *cancellable,
- GSimpleAsyncResult *simple)
+egg_dbus_connection_send_message_with_reply_cancelled_cb (GCancellable *cancellable,
+ GSimpleAsyncResult *simple)
{
EggDBusConnection *connection;
guint pending_call_id;
@@ -1984,8 +1984,8 @@ egg_dbus_connection_send_message_with_reply_async_cancelled_cb (GCancellable *ca
}
static void
-egg_dbus_connection_send_message_with_reply_async_cb (DBusPendingCall *pending_call,
- GSimpleAsyncResult *simple)
+egg_dbus_connection_send_message_with_reply_cb (DBusPendingCall *pending_call,
+ GSimpleAsyncResult *simple)
{
DBusMessage *dreply;
DBusError derror;
@@ -2071,7 +2071,7 @@ egg_dbus_connection_send_message_with_reply_async_cb (DBusPendingCall *pendin
cancellable = g_object_get_data (G_OBJECT (simple), "egg-dbus-cancellable");
if (cancellable != NULL)
g_signal_handlers_disconnect_by_func (cancellable,
- egg_dbus_connection_send_message_with_reply_async_cancelled_cb,
+ egg_dbus_connection_send_message_with_reply_cancelled_cb,
simple);
if (pending_call != NULL)
@@ -2082,12 +2082,12 @@ egg_dbus_connection_send_message_with_reply_async_cb (DBusPendingCall *pendin
/**
* egg_dbus_connection_pending_call_cancel:
* @connection: A #EggDBusConnection.
- * @pending_call_id: A valid pending call id obtained from egg_dbus_connection_send_message_with_reply_async()
+ * @pending_call_id: A valid pending call id obtained from egg_dbus_connection_send_message_with_reply()
* or similar wrapper functions (such as egg_dbus_bus_invoke_request_name_async()).
*
* Cancels an asynchronous method invocation expecting a reply. The
* #GAsyncReadyCallback callback given to
- * egg_dbus_connection_send_message_with_reply_async() will be invoked
+ * egg_dbus_connection_send_message_with_reply() will be invoked
* before this function returns.
**/
void
@@ -2117,19 +2117,19 @@ egg_dbus_connection_pending_call_cancel (EggDBusConnection *connection,
dbus_pending_call_cancel (pending_call);
/* generate a callback with a EGG_DBUS_ERROR_CANCELLED error, then do away with the pending call */
- egg_dbus_connection_send_message_with_reply_async_cb (NULL, simple);
+ egg_dbus_connection_send_message_with_reply_cb (NULL, simple);
dbus_pending_call_unref (pending_call);
}
/**
* egg_dbus_connection_pending_call_block:
* @connection: A #EggDBusConnection.
- * @pending_call_id: A valid pending call id obtained from egg_dbus_connection_send_message_with_reply_async()
- * or similar wrapper functions (such as egg_dbus_bus_invoke_request_name_async()).
+ * @pending_call_id: A valid pending call id obtained from egg_dbus_connection_send_message_with_reply()
+ * or similar wrapper functions (such as egg_dbus_bus_invoke_request_name()).
*
* Blocks until the asynchronous method invocation with
* @pending_call_id completes. The #GAsyncReadyCallback callback given to
- * egg_dbus_connection_send_message_with_reply_async() will be invoked
+ * egg_dbus_connection_send_message_with_reply() will be invoked
* before this function returns.
*
* Depending on how the call was issued (e.g. what set of #EggDBusCallFlags was
@@ -2165,7 +2165,7 @@ egg_dbus_connection_pending_call_block (EggDBusConnection *connection,
if (call_flags & EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP)
{
/* creates a new main loop;
- * egg_dbus_connection_send_message_with_reply_async_cb() will
+ * egg_dbus_connection_send_message_with_reply_cb() will
* quit it *after* it has completed the operation.
*/
loop = g_main_loop_new (NULL, FALSE);
@@ -2182,7 +2182,7 @@ egg_dbus_connection_pending_call_block (EggDBusConnection *connection,
}
/**
- * egg_dbus_connection_send_message_with_reply_async:
+ * egg_dbus_connection_send_message_with_reply:
* @connection: A #EggDBusConnection.
* @call_flags: Flags from #EggDBusCallFlags detailing how the message should be sent.
* @message: The message to send.
@@ -2201,13 +2201,13 @@ egg_dbus_connection_pending_call_block (EggDBusConnection *connection,
* egg_dbus_connection_pending_call_block().
**/
guint
-egg_dbus_connection_send_message_with_reply_async (EggDBusConnection *connection,
- EggDBusCallFlags call_flags,
- EggDBusMessage *message,
- GType *error_types,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+egg_dbus_connection_send_message_with_reply (EggDBusConnection *connection,
+ EggDBusCallFlags call_flags,
+ EggDBusMessage *message,
+ GType *error_types,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
guint pending_call_id;
DBusPendingCall *pending_call;
@@ -2225,7 +2225,7 @@ egg_dbus_connection_send_message_with_reply_async (EggDBusConnection *conn
simple = g_simple_async_result_new (G_OBJECT (connection),
callback,
user_data,
- egg_dbus_connection_send_message_with_reply_async);
+ egg_dbus_connection_send_message_with_reply);
dmessage = g_object_get_data (G_OBJECT (message), "dbus-1-message");
@@ -2250,7 +2250,7 @@ egg_dbus_connection_send_message_with_reply_async (EggDBusConnection *conn
timeout);
dbus_pending_call_set_notify (pending_call,
- (DBusPendingCallNotifyFunction) egg_dbus_connection_send_message_with_reply_async_cb,
+ (DBusPendingCallNotifyFunction) egg_dbus_connection_send_message_with_reply_cb,
(void *) simple,
(DBusFreeFunction) g_object_unref);
@@ -2285,7 +2285,7 @@ egg_dbus_connection_send_message_with_reply_async (EggDBusConnection *conn
{
g_signal_connect_data (cancellable,
"cancelled",
- G_CALLBACK (egg_dbus_connection_send_message_with_reply_async_cancelled_cb),
+ G_CALLBACK (egg_dbus_connection_send_message_with_reply_cancelled_cb),
g_object_ref (simple),
(GClosureNotify) g_object_unref,
0);
@@ -2299,7 +2299,7 @@ egg_dbus_connection_send_message_with_reply_async (EggDBusConnection *conn
* egg_dbus_connection_send_message_with_reply_finish:
* @connection: A #EggDBusConnection.
* @res: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed
- * to egg_dbus_connection_send_message_with_reply_async().
+ * to egg_dbus_connection_send_message_with_reply().
* @error: Return location for error.
*
* Finishes sending a message where a reply is requested.
@@ -2316,7 +2316,7 @@ egg_dbus_connection_send_message_with_reply_finish (EggDBusConnection *conne
g_return_val_if_fail (EGG_DBUS_IS_CONNECTION (connection), NULL);
- g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == egg_dbus_connection_send_message_with_reply_async);
+ g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == egg_dbus_connection_send_message_with_reply);
reply = NULL;
diff --git a/src/eggdbus/eggdbusconnection.h b/src/eggdbus/eggdbusconnection.h
index 975d73a..375763d 100644
--- a/src/eggdbus/eggdbusconnection.h
+++ b/src/eggdbus/eggdbusconnection.h
@@ -123,14 +123,7 @@ EggDBusMessage *egg_dbus_connection_new_message_for_method_call (EggDBusCo
void egg_dbus_connection_send_message (EggDBusConnection *connection,
EggDBusMessage *message);
-EggDBusMessage *egg_dbus_connection_send_message_with_reply (EggDBusConnection *connection,
- EggDBusCallFlags call_flags,
- EggDBusMessage *message,
- GType *error_types,
- GCancellable *cancellable,
- GError **error);
-
-guint egg_dbus_connection_send_message_with_reply_async (EggDBusConnection *connection,
+guint egg_dbus_connection_send_message_with_reply (EggDBusConnection *connection,
EggDBusCallFlags call_flags,
EggDBusMessage *message,
GType *error_types,
@@ -142,6 +135,12 @@ EggDBusMessage *egg_dbus_connection_send_message_with_reply_finish (EggDBusCo
GAsyncResult *res,
GError **error);
+EggDBusMessage *egg_dbus_connection_send_message_with_reply_sync (EggDBusConnection *connection,
+ EggDBusCallFlags call_flags,
+ EggDBusMessage *message,
+ GType *error_types,
+ GCancellable *cancellable,
+ GError **error);
void egg_dbus_connection_pending_call_cancel (EggDBusConnection *connection,
guint pending_call_id);
diff --git a/src/eggdbus/eggdbusproxy.c b/src/eggdbus/eggdbusproxy.c
index b3007fc..3e39ccc 100644
--- a/src/eggdbus/eggdbusproxy.c
+++ b/src/eggdbus/eggdbusproxy.c
@@ -225,12 +225,12 @@ ensure_properties (EggDBusProxy *proxy,
/* don't block in mainloop... */
error = NULL;
- if (!egg_dbus_properties_invoke_get_all (EGG_DBUS_PROPERTIES (proxy),
- EGG_DBUS_CALL_FLAGS_NONE,
- interface_name,
- &property_bag,
- NULL,
- &error))
+ if (!egg_dbus_properties_invoke_get_all_sync (EGG_DBUS_PROPERTIES (proxy),
+ EGG_DBUS_CALL_FLAGS_NONE,
+ interface_name,
+ &property_bag,
+ NULL,
+ &error))
{
g_warning ("Error getting properties on interface %s: %s",
interface_name,
@@ -373,13 +373,13 @@ egg_dbus_proxy_set_property (GObject *object,
*
* TODO: Right now we block in the mainloop. This is *probably* wrong.
*/
- if (!egg_dbus_properties_invoke_set (EGG_DBUS_PROPERTIES (proxy),
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- interface_name,
- property_info->name,
- variant,
- NULL,
- &error))
+ if (!egg_dbus_properties_invoke_set_sync (EGG_DBUS_PROPERTIES (proxy),
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ interface_name,
+ property_info->name,
+ variant,
+ NULL,
+ &error))
{
g_warning ("Error setting property %s (%s) on %s via D-Bus: %s",
property_info->g_name,
diff --git a/src/eggdbus/interface.c b/src/eggdbus/interface.c
index 6c0a950..fa6fd48 100644
--- a/src/eggdbus/interface.c
+++ b/src/eggdbus/interface.c
@@ -102,13 +102,13 @@ print_method_prototype (const EggDBusInterfaceMethodInfo *method,
switch (method_type)
{
case METHOD_TYPE_SYNC:
- name_suffix = "";
+ name_suffix = "_sync";
return_ctype = "gboolean";
method_name_qualifier = "invoke";
break;
case METHOD_TYPE_ASYNC:
- name_suffix = "_async";
+ name_suffix = "";
return_ctype = "guint";
method_name_qualifier = "invoke";
break;
@@ -610,7 +610,7 @@ interface_generate_iface_h_file (const EggDBusInterfaceInfo *interface,
for (n = 0; n < interface->num_methods; n++)
{
const EggDBusInterfaceMethodInfo *method = interface->methods + n;
- MethodType method_types[3] = {METHOD_TYPE_SYNC, METHOD_TYPE_ASYNC, METHOD_TYPE_ASYNC_FINISH};
+ MethodType method_types[3] = {METHOD_TYPE_ASYNC, METHOD_TYPE_ASYNC_FINISH, METHOD_TYPE_SYNC};
for (m = 0; m < 3; m++)
{
@@ -1809,71 +1809,6 @@ interface_generate_iface_c_file (const EggDBusInterfaceInfo *interface,
method_name_uscore = egg_dbus_utils_camel_case_to_uscore (method->name);
- /* sync */
- if (!print_method_prototype (method,
- name_space_uscore,
- iface_name_uscore,
- full_instance_name,
- METHOD_TYPE_SYNC,
- 0,
- "_",
- TRUE,
- TRUE,
- FALSE,
- FALSE,
- error))
- goto out;
-
- g_print ("{\n"
- " EggDBusProxy *proxy;\n"
- " EggDBusMessage *message;\n"
- " EggDBusMessage *reply;\n"
- " gboolean ret;\n"
- "\n"
- " g_return_val_if_fail (%s_IS_%s (instance) && EGG_DBUS_IS_PROXY (instance), FALSE);\n"
- "\n"
- " ret = FALSE;"
- " reply = NULL;"
- "\n"
- " proxy = EGG_DBUS_PROXY (instance);\n"
- "\n"
- " message = egg_dbus_connection_new_message_for_method_call (egg_dbus_proxy_get_connection (proxy),\n"
- " NULL,\n"
- " egg_dbus_proxy_get_name (proxy),\n"
- " egg_dbus_proxy_get_object_path (proxy),\n"
- " \"%s\",\n"
- " \"%s\");\n"
- "\n",
- name_space_uscore_upper,
- iface_name_uscore_upper,
- interface->name,
- method->name);
-
- if (!append_args (method->in_args, method->in_num_args, FALSE, 2, "_", "error", "message", name_space, "out", error))
- goto out;
-
- g_print ("\n"
- " reply = egg_dbus_connection_send_message_with_reply (egg_dbus_proxy_get_connection (proxy), call_flags, message, %s_bindings_get_error_domain_types (), cancellable, error);\n"
- " if (reply == NULL)\n"
- " goto out;\n"
- "\n",
- name_space_uscore);
-
- if (!append_args (method->out_args, method->out_num_args, TRUE, 2, "_out_", "error", "reply", name_space, "out", error))
- goto out;
-
- g_print ("\n"
- " ret = TRUE;\n"
- "\n"
- "out:\n"
- " if (message != NULL)\n"
- " g_object_unref (message);\n"
- " if (reply != NULL)\n"
- " g_object_unref (reply);\n"
- " return ret;\n"
- "}\n"
- "\n");
-
/* async */
if (!print_method_prototype (method,
name_space_uscore,
@@ -1901,7 +1836,7 @@ interface_generate_iface_c_file (const EggDBusInterfaceInfo *interface,
" simple = g_simple_async_result_new (G_OBJECT (instance),\n"
" callback,\n"
" user_data,\n"
- " %s_%s_invoke_%s_async);\n"
+ " %s_%s_invoke_%s);\n"
"\n"
"\n"
" proxy = EGG_DBUS_PROXY (instance);\n"
@@ -1928,7 +1863,7 @@ interface_generate_iface_c_file (const EggDBusInterfaceInfo *interface,
goto out;
g_print ("\n"
- " pending_call_id = egg_dbus_connection_send_message_with_reply_async (egg_dbus_proxy_get_connection (proxy), call_flags, message, %s_bindings_get_error_domain_types (), cancellable, generic_async_callback, simple);\n"
+ " pending_call_id = egg_dbus_connection_send_message_with_reply (egg_dbus_proxy_get_connection (proxy), call_flags, message, %s_bindings_get_error_domain_types (), cancellable, generic_async_callback, simple);\n"
"\n",
name_space_uscore);
@@ -1975,7 +1910,7 @@ interface_generate_iface_c_file (const EggDBusInterfaceInfo *interface,
"\n"
" g_return_val_if_fail (%s_IS_%s (instance) && EGG_DBUS_IS_PROXY (instance), FALSE);\n"
"\n"
- " g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == %s_%s_invoke_%s_async);\n"
+ " g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == %s_%s_invoke_%s);\n"
"\n"
" ret = FALSE;\n"
" reply = NULL;\n"
@@ -2012,6 +1947,71 @@ interface_generate_iface_c_file (const EggDBusInterfaceInfo *interface,
"}\n"
"\n");
+ /* sync */
+ if (!print_method_prototype (method,
+ name_space_uscore,
+ iface_name_uscore,
+ full_instance_name,
+ METHOD_TYPE_SYNC,
+ 0,
+ "_",
+ TRUE,
+ TRUE,
+ FALSE,
+ FALSE,
+ error))
+ goto out;
+
+ g_print ("{\n"
+ " EggDBusProxy *proxy;\n"
+ " EggDBusMessage *message;\n"
+ " EggDBusMessage *reply;\n"
+ " gboolean ret;\n"
+ "\n"
+ " g_return_val_if_fail (%s_IS_%s (instance) && EGG_DBUS_IS_PROXY (instance), FALSE);\n"
+ "\n"
+ " ret = FALSE;"
+ " reply = NULL;"
+ "\n"
+ " proxy = EGG_DBUS_PROXY (instance);\n"
+ "\n"
+ " message = egg_dbus_connection_new_message_for_method_call (egg_dbus_proxy_get_connection (proxy),\n"
+ " NULL,\n"
+ " egg_dbus_proxy_get_name (proxy),\n"
+ " egg_dbus_proxy_get_object_path (proxy),\n"
+ " \"%s\",\n"
+ " \"%s\");\n"
+ "\n",
+ name_space_uscore_upper,
+ iface_name_uscore_upper,
+ interface->name,
+ method->name);
+
+ if (!append_args (method->in_args, method->in_num_args, FALSE, 2, "_", "error", "message", name_space, "out", error))
+ goto out;
+
+ g_print ("\n"
+ " reply = egg_dbus_connection_send_message_with_reply_sync (egg_dbus_proxy_get_connection (proxy), call_flags, message, %s_bindings_get_error_domain_types (), cancellable, error);\n"
+ " if (reply == NULL)\n"
+ " goto out;\n"
+ "\n",
+ name_space_uscore);
+
+ if (!append_args (method->out_args, method->out_num_args, TRUE, 2, "_out_", "error", "reply", name_space, "out", error))
+ goto out;
+
+ g_print ("\n"
+ " ret = TRUE;\n"
+ "\n"
+ "out:\n"
+ " if (message != NULL)\n"
+ " g_object_unref (message);\n"
+ " if (reply != NULL)\n"
+ " g_object_unref (reply);\n"
+ " return ret;\n"
+ "}\n"
+ "\n");
+
g_free (method_name_uscore);
}
diff --git a/src/tests/testclient.c b/src/tests/testclient.c
index 2520fd9..1fafc0b 100644
--- a/src/tests/testclient.c
+++ b/src/tests/testclient.c
@@ -189,12 +189,12 @@ test_low_level (void)
"HelloWorld");
egg_dbus_message_append_string (message, "Yupski", &error);
g_assert_no_error (error);
- reply = egg_dbus_connection_send_message_with_reply (connection,
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- message,
- NULL,
- NULL,
- &error);
+ reply = egg_dbus_connection_send_message_with_reply_sync (connection,
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ message,
+ NULL,
+ NULL,
+ &error);
g_assert_no_error (error);
egg_dbus_message_extract_string (reply, &ret_string, &error);
g_assert_no_error (error);
@@ -212,12 +212,12 @@ test_low_level (void)
"HelloWorld");
egg_dbus_message_append_string (message, "Yo", &error);
g_assert_no_error (error);
- reply = egg_dbus_connection_send_message_with_reply (connection,
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- message,
- NULL,
- NULL,
- &error);
+ reply = egg_dbus_connection_send_message_with_reply_sync (connection,
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ message,
+ NULL,
+ NULL,
+ &error);
g_assert (reply == NULL);
g_assert_error (error, EGG_DBUS_ERROR, EGG_DBUS_ERROR_REMOTE_EXCEPTION);
g_object_unref (message);
@@ -240,12 +240,12 @@ test_low_level (void)
"HelloWorld");
egg_dbus_message_append_string (message, "Yo", &error);
g_assert_no_error (error);
- reply = egg_dbus_connection_send_message_with_reply (connection,
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- message,
- test_bindings_get_error_domain_types (),
- NULL,
- &error);
+ reply = egg_dbus_connection_send_message_with_reply_sync (connection,
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ message,
+ test_bindings_get_error_domain_types (),
+ NULL,
+ &error);
g_object_unref (message);
g_assert (reply == NULL);
g_assert_error (error, TEST_ERROR, TEST_ERROR_FLUX_CAPACITOR_FAILURE);
@@ -262,12 +262,12 @@ test_low_level (void)
"HelloWorld");
egg_dbus_message_append_string (message, "Yupski", &error);
g_assert_no_error (error);
- reply = egg_dbus_connection_send_message_with_reply (connection,
- 0, /* flags */
- message,
- NULL,
- NULL,
- &error);
+ reply = egg_dbus_connection_send_message_with_reply_sync (connection,
+ 0, /* flags */
+ message,
+ NULL,
+ NULL,
+ &error);
g_assert_no_error (error);
egg_dbus_message_extract_string (reply, &ret_string, &error);
g_assert_no_error (error);
@@ -285,12 +285,12 @@ test_low_level (void)
"HelloWorld");
egg_dbus_message_append_string (message, "Yo", &error);
g_assert_no_error (error);
- reply = egg_dbus_connection_send_message_with_reply (connection,
- 0, /* flags */
- message,
- NULL,
- NULL,
- &error);
+ reply = egg_dbus_connection_send_message_with_reply_sync (connection,
+ 0, /* flags */
+ message,
+ NULL,
+ NULL,
+ &error);
g_assert (reply == NULL);
g_assert_error (error, EGG_DBUS_ERROR, EGG_DBUS_ERROR_REMOTE_EXCEPTION);
g_object_unref (message);
@@ -313,13 +313,13 @@ test_low_level (void)
"HelloWorld");
egg_dbus_message_append_string (message, "Yupski", &error);
g_assert_no_error (error);
- egg_dbus_connection_send_message_with_reply_async (connection,
- 0, /* flags */
- message,
- NULL,
- NULL,
- (GAsyncReadyCallback) low_level_hello_world_cb,
- GUINT_TO_POINTER ((guint) FALSE));
+ egg_dbus_connection_send_message_with_reply (connection,
+ 0, /* flags */
+ message,
+ NULL,
+ NULL,
+ (GAsyncReadyCallback) low_level_hello_world_cb,
+ GUINT_TO_POINTER ((guint) FALSE));
g_main_loop_run (loop);
g_object_unref (message);
@@ -332,13 +332,13 @@ test_low_level (void)
"HelloWorld");
egg_dbus_message_append_string (message, "Yo", &error);
g_assert_no_error (error);
- egg_dbus_connection_send_message_with_reply_async (connection,
- 0, /* flags */
- message,
- NULL,
- NULL,
- (GAsyncReadyCallback) low_level_hello_world_cb,
- GUINT_TO_POINTER ((guint) TRUE));
+ egg_dbus_connection_send_message_with_reply (connection,
+ 0, /* flags */
+ message,
+ NULL,
+ NULL,
+ (GAsyncReadyCallback) low_level_hello_world_cb,
+ GUINT_TO_POINTER ((guint) TRUE));
g_main_loop_run (loop);
g_object_unref (message);
}
@@ -381,42 +381,42 @@ test_hello_world (void)
error = NULL;
/* test sync method invocation */
- g_assert (test_frob_invoke_hello_world (TEST_FROB (proxy), 0, /* flags */
- "Hi!",
- &s,
- NULL,
- &error));
+ g_assert (test_frob_invoke_hello_world_sync (TEST_FROB (proxy), 0, /* flags */
+ "Hi!",
+ &s,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmpstr (s, ==, "You greeted me with 'Hi!'. Thanks!");
g_free (s);
/* test sync method invocation with exception */
- g_assert (!test_frob_invoke_hello_world (TEST_FROB (proxy), 0, /* flags */
- "Yo",
- &s,
- NULL,
- &error));
+ g_assert (!test_frob_invoke_hello_world_sync (TEST_FROB (proxy), 0, /* flags */
+ "Yo",
+ &s,
+ NULL,
+ &error));
g_assert_error (error, TEST_ERROR, TEST_ERROR_FLUX_CAPACITOR_FAILURE);
g_assert_cmpstr (error->message, ==, "Remote Exception invoking com.example.Frob.HelloWorld() on /com/example/TestObject at name com.example.TestService: com.example.Error.FluxCapacitorFailure: Yo is not a proper greeting");
g_error_free (error);
error = NULL;
/* test async method invocation */
- test_frob_invoke_hello_world_async (TEST_FROB (proxy), 0, /* flags */
- "Hi Async!",
- NULL,
- (GAsyncReadyCallback) hello_world_cb,
- &s);
+ test_frob_invoke_hello_world (TEST_FROB (proxy), 0, /* flags */
+ "Hi Async!",
+ NULL,
+ (GAsyncReadyCallback) hello_world_cb,
+ &s);
g_main_loop_run (loop);
g_assert_cmpstr (s, ==, "You greeted me with 'Hi Async!'. Thanks!");
g_free (s);
/* test async method invocation with exception */
- test_frob_invoke_hello_world_async (TEST_FROB (proxy), 0, /* flags */
- "Yo",
- NULL,
- (GAsyncReadyCallback) hello_world_cb,
- &s);
+ test_frob_invoke_hello_world (TEST_FROB (proxy), 0, /* flags */
+ "Yo",
+ NULL,
+ (GAsyncReadyCallback) hello_world_cb,
+ &s);
g_main_loop_run (loop);
g_assert (s == NULL);
}
@@ -441,31 +441,31 @@ test_primitive_types (void)
error = NULL;
- g_assert (test_frob_invoke_test_primitive_types (TEST_FROB (proxy), 0, /* flags */
- 1,
- FALSE,
- 160,
- 161,
- 320,
- 321,
- 640,
- 641,
- 4.5,
- "somestring",
- "/some/objpath",
- &ret_byte,
- &ret_boolean,
- &ret_int16,
- &ret_uint16,
- &ret_int32,
- &ret_uint32,
- &ret_int64,
- &ret_uint64,
- &ret_double,
- &ret_string,
- &ret_objpath,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_primitive_types_sync (TEST_FROB (proxy), 0, /* flags */
+ 1,
+ FALSE,
+ 160,
+ 161,
+ 320,
+ 321,
+ 640,
+ 641,
+ 4.5,
+ "somestring",
+ "/some/objpath",
+ &ret_byte,
+ &ret_boolean,
+ &ret_int16,
+ &ret_uint16,
+ &ret_int32,
+ &ret_uint32,
+ &ret_int64,
+ &ret_uint64,
+ &ret_double,
+ &ret_string,
+ &ret_objpath,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmphex (ret_byte, ==, 1 + 1);
g_assert_cmpint (ret_boolean, ==, TRUE);
@@ -549,31 +549,31 @@ test_array_of_primitive_types (void)
ret_uint64 = 651; g_array_append_val (array_uint64, ret_uint64);
ret_double = 4.5; g_array_append_val (array_double, ret_double);
ret_double = 5.5; g_array_append_val (array_double, ret_double);
- g_assert (test_frob_invoke_test_array_of_primitive_types (TEST_FROB (proxy), 0, /* flags */
- array_byte,
- array_boolean,
- array_int16,
- array_uint16,
- array_int32,
- array_uint32,
- array_int64,
- array_uint64,
- array_double,
- array_string,
- array_objpath,
- &ret_array_byte,
- &ret_array_boolean,
- &ret_array_int16,
- &ret_array_uint16,
- &ret_array_int32,
- &ret_array_uint32,
- &ret_array_int64,
- &ret_array_uint64,
- &ret_array_double,
- &ret_array_string,
- &ret_array_objpath,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_array_of_primitive_types_sync (TEST_FROB (proxy), 0, /* flags */
+ array_byte,
+ array_boolean,
+ array_int16,
+ array_uint16,
+ array_int32,
+ array_uint32,
+ array_int64,
+ array_uint64,
+ array_double,
+ array_string,
+ array_objpath,
+ &ret_array_byte,
+ &ret_array_boolean,
+ &ret_array_int16,
+ &ret_array_uint16,
+ &ret_array_int32,
+ &ret_array_uint32,
+ &ret_array_int64,
+ &ret_array_uint64,
+ &ret_array_double,
+ &ret_array_string,
+ &ret_array_objpath,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmpuint (ret_array_byte->len, ==, 4);
@@ -681,13 +681,13 @@ test_structure_types (void)
point2 = test_point_new (100, 101);
dpoint = test_described_point_new ("described point", point2);
- g_assert (test_frob_invoke_test_structure_types (TEST_FROB (proxy), 0, /* flags */
- point,
- dpoint,
- &res_point,
- &res_dpoint,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_structure_types_sync (TEST_FROB (proxy), 0, /* flags */
+ point,
+ dpoint,
+ &res_point,
+ &res_dpoint,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmpint (test_point_get_x (point) + 1, ==, test_point_get_x (res_point));
g_assert_cmpint (test_point_get_y (point) + 1, ==, test_point_get_y (res_point));
@@ -733,11 +733,11 @@ test_array_of_structure_types (void)
list = g_list_append (list, test_extended_described_point_new ("foo4", point, "ext2"));
g_object_unref (point);
- g_assert (test_frob_invoke_test_array_of_structure_types (TEST_FROB (proxy), 0, /* flags */
- list,
- &res_list,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_array_of_structure_types_sync (TEST_FROB (proxy), 0, /* flags */
+ list,
+ &res_list,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmpint (g_list_length (res_list), == , 3);
@@ -872,31 +872,31 @@ test_hash_tables (void)
pd2 = g_new0 (gdouble, 1); *pd2 = 2.6;
g_hash_table_insert (hdd, pd1, pd2);
- g_assert (test_frob_invoke_test_hash_tables (TEST_FROB (proxy), 0, /* flags */
- hss,
- hoo,
- hii,
- hyy,
- hnn,
- hqq,
- huu,
- hbb,
- hxx,
- htt,
- hdd,
- &res_hss,
- &res_hoo,
- &res_hii,
- &res_hyy,
- &res_hnn,
- &res_hqq,
- &res_huu,
- &res_hbb,
- &res_hxx,
- &res_htt,
- &res_hdd,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_hash_tables_sync (TEST_FROB (proxy), 0, /* flags */
+ hss,
+ hoo,
+ hii,
+ hyy,
+ hnn,
+ hqq,
+ huu,
+ hbb,
+ hxx,
+ htt,
+ hdd,
+ &res_hss,
+ &res_hoo,
+ &res_hii,
+ &res_hyy,
+ &res_hnn,
+ &res_hqq,
+ &res_huu,
+ &res_hbb,
+ &res_hxx,
+ &res_htt,
+ &res_hdd,
+ NULL,
+ &error));
g_assert_no_error (error);
egg_dbus_hash_table_unref (hss);
@@ -1127,33 +1127,33 @@ test_hash_tables_of_arrays (void)
site2_points = g_list_append (site2_points, test_point_new (2020, 2021));
g_hash_table_insert (hash_of_point_arrays, "site2", site2_points);
- g_assert (test_frob_invoke_test_hash_tables_of_arrays (TEST_FROB (proxy), 0, /* flags */
- hsas,
- hsao,
- hsai,
- hsay,
- hsan,
- hsaq,
- hsau,
- hsab,
- hsax,
- hsat,
- hsad,
- hash_of_point_arrays,
- &res_hsas,
- &res_hsao,
- &res_hsai,
- &res_hsay,
- &res_hsan,
- &res_hsaq,
- &res_hsau,
- &res_hsab,
- &res_hsax,
- &res_hsat,
- &res_hsad,
- &res_hash_of_point_arrays,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_hash_tables_of_arrays_sync (TEST_FROB (proxy), 0, /* flags */
+ hsas,
+ hsao,
+ hsai,
+ hsay,
+ hsan,
+ hsaq,
+ hsau,
+ hsab,
+ hsax,
+ hsat,
+ hsad,
+ hash_of_point_arrays,
+ &res_hsas,
+ &res_hsao,
+ &res_hsai,
+ &res_hsay,
+ &res_hsan,
+ &res_hsaq,
+ &res_hsau,
+ &res_hsab,
+ &res_hsax,
+ &res_hsat,
+ &res_hsad,
+ &res_hash_of_point_arrays,
+ NULL,
+ &error));
g_assert_no_error (error);
g_array_free (array_byte, TRUE);
g_array_free (array_boolean, TRUE);
@@ -1317,11 +1317,11 @@ test_hash_table_of_structures (void)
g_hash_table_insert (hash_of_points, "beta", test_point_new (12, 12));
g_hash_table_insert (hash_of_points, "gamma", test_point_new (14, 14));
- g_assert (test_frob_invoke_test_hash_table_of_structures (TEST_FROB (proxy), 0, /* flags */
- hash_of_points,
- &hash_of_described_points,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_hash_table_of_structures_sync (TEST_FROB (proxy), 0, /* flags */
+ hash_of_points,
+ &hash_of_described_points,
+ NULL,
+ &error));
g_assert_no_error (error);
dpoint = g_hash_table_lookup (hash_of_described_points, "alpha_new");
@@ -1373,11 +1373,11 @@ test_hash_table_of_hash_table_of_structures (void)
g_hash_table_insert (hash_of_points, "rap", test_point_new (2, 2));
g_hash_table_insert (hash_of_points, "rup", test_point_new (3, 3));
g_hash_table_insert (hash_of_hash_of_points, "org2", hash_of_points);
- g_assert (test_frob_invoke_test_hash_table_of_hash_tables_of_structures (TEST_FROB (proxy), 0, /* flags */
- hash_of_hash_of_points,
- &res_hash_of_hash_of_points,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_hash_table_of_hash_tables_of_structures_sync (TEST_FROB (proxy), 0, /* flags */
+ hash_of_hash_of_points,
+ &res_hash_of_hash_of_points,
+ NULL,
+ &error));
g_assert_no_error (error);
g_hash_table_unref (hash_of_hash_of_points);
@@ -1430,11 +1430,11 @@ test_array_of_hash_table_of_structures (void)
g_hash_table_insert (hash_of_points, "rup", test_point_new (3, 3));
list_of_hashes = g_list_append (list_of_hashes, hash_of_points);
- g_assert (test_frob_invoke_test_array_of_hash_tables_of_structures (TEST_FROB (proxy), 0, /* flags */
- list_of_hashes,
- &res_list_of_hashes,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_array_of_hash_tables_of_structures_sync (TEST_FROB (proxy), 0, /* flags */
+ list_of_hashes,
+ &res_list_of_hashes,
+ NULL,
+ &error));
g_assert_no_error (error);
g_list_foreach (list_of_hashes, (GFunc) g_hash_table_unref, NULL);
g_list_free (list_of_hashes);
@@ -1580,35 +1580,35 @@ test_array_of_arrays (void)
list_of_list_of_list_of_string = g_list_append (list_of_list_of_list_of_string, list_of_list_string);
list_of_list_of_list_of_string = g_list_append (list_of_list_of_list_of_string, list_of_list_string);
- g_assert (test_frob_invoke_test_array_of_arrays (TEST_FROB (proxy), 0, /* flags */
- list_of_list_string,
- list_of_list_point,
- list_of_list_objpath,
- list_of_list_int32,
- list_of_list_byte,
- list_of_list_int16,
- list_of_list_uint16,
- list_of_list_uint32,
- list_of_list_boolean,
- list_of_list_int64,
- list_of_list_uint64,
- list_of_list_double,
- list_of_list_of_list_of_string,
- &res_list_of_list_string,
- &res_list_of_list_point,
- &res_list_of_list_objpath,
- &res_list_of_list_int32,
- &res_list_of_list_byte,
- &res_list_of_list_int16,
- &res_list_of_list_uint16,
- &res_list_of_list_uint32,
- &res_list_of_list_boolean,
- &res_list_of_list_int64,
- &res_list_of_list_uint64,
- &res_list_of_list_double,
- &res_list_of_list_of_list_of_string,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_array_of_arrays_sync (TEST_FROB (proxy), 0, /* flags */
+ list_of_list_string,
+ list_of_list_point,
+ list_of_list_objpath,
+ list_of_list_int32,
+ list_of_list_byte,
+ list_of_list_int16,
+ list_of_list_uint16,
+ list_of_list_uint32,
+ list_of_list_boolean,
+ list_of_list_int64,
+ list_of_list_uint64,
+ list_of_list_double,
+ list_of_list_of_list_of_string,
+ &res_list_of_list_string,
+ &res_list_of_list_point,
+ &res_list_of_list_objpath,
+ &res_list_of_list_int32,
+ &res_list_of_list_byte,
+ &res_list_of_list_int16,
+ &res_list_of_list_uint16,
+ &res_list_of_list_uint32,
+ &res_list_of_list_boolean,
+ &res_list_of_list_int64,
+ &res_list_of_list_uint64,
+ &res_list_of_list_double,
+ &res_list_of_list_of_list_of_string,
+ NULL,
+ &error));
g_assert_no_error (error);
g_array_free (array_byte, TRUE);
@@ -1685,133 +1685,133 @@ test_variant_return (void)
error = NULL;
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "y",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "y",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_byte (variant));
g_assert_cmpint (egg_dbus_variant_get_byte (variant), ==, 1);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "b",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "b",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_boolean (variant));
g_assert_cmpint (egg_dbus_variant_get_boolean (variant), ==, TRUE);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "n",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "n",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_int16 (variant));
g_assert_cmpint (egg_dbus_variant_get_int16 (variant), ==, 2);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "q",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "q",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_uint16 (variant));
g_assert_cmpuint (egg_dbus_variant_get_uint16 (variant), ==, 3);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "i",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "i",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_int32 (variant));
g_assert_cmpint (egg_dbus_variant_get_int32 (variant), ==, 4);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "u",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "u",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_uint32 (variant));
g_assert_cmpuint (egg_dbus_variant_get_uint32 (variant), ==, 5);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "x",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "x",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_int64 (variant));
g_assert_cmpint (egg_dbus_variant_get_int64 (variant), ==, 6);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "t",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "t",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_uint64 (variant));
g_assert_cmpuint (egg_dbus_variant_get_uint64 (variant), ==, 7);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "d",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "d",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_double (variant));
g_assert_cmpfloat (egg_dbus_variant_get_double (variant), ==, 7.5);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "s",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "s",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_string (variant));
g_assert_cmpstr (egg_dbus_variant_get_string (variant), ==, "a string");
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "o",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "o",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_objpath (variant));
g_assert_cmpstr (egg_dbus_variant_get_objpath (variant), ==, "/some/object/path");
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "ai",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "ai",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_array (variant));
array = egg_dbus_variant_get_array (variant);
@@ -1820,12 +1820,12 @@ test_variant_return (void)
g_assert_cmpint (g_array_index (array, gint32, 1), ==, 5);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "as",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "as",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_string_array (variant));
strv = egg_dbus_variant_get_string_array (variant);
@@ -1834,12 +1834,12 @@ test_variant_return (void)
g_assert_cmpstr (strv[1], ==, "another string");
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "point",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "point",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_structure (variant));
point = TEST_POINT (egg_dbus_variant_get_structure (variant));
@@ -1847,12 +1847,12 @@ test_variant_return (void)
g_assert_cmpint (test_point_get_y (point), ==, 2);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "dpoint",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "dpoint",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_structure (variant));
dpoint = TEST_DESCRIBED_POINT (egg_dbus_variant_get_structure (variant));
@@ -1862,12 +1862,12 @@ test_variant_return (void)
g_assert_cmpint (test_point_get_x (point), ==, 3);
g_assert_cmpint (test_point_get_y (point), ==, 4);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "hash_of_points",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "hash_of_points",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (egg_dbus_variant_is_hash_table (variant));
hash_of_points = egg_dbus_variant_get_hash_table (variant);
@@ -1886,12 +1886,12 @@ test_variant_return (void)
g_assert_cmpint (test_point_get_y (point), ==, 8);
g_object_unref (variant);
- g_assert (test_frob_invoke_test_variant_return (TEST_FROB (proxy),
- 0, /* flags */
- "unregistered_struct",
- &variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return_sync (TEST_FROB (proxy),
+ 0, /* flags */
+ "unregistered_struct",
+ &variant,
+ NULL,
+ &error));
g_assert_no_error (error);
structure = egg_dbus_variant_get_structure (variant);
@@ -1922,26 +1922,26 @@ test_variant_return2 (void)
error = NULL;
- g_assert (test_frob_invoke_test_variant_return2 (TEST_FROB (proxy), 0, /* flags */
- "one",
- &res_list_of_variants,
- &res_hash_of_variants,
- &res_struct_with_variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return2_sync (TEST_FROB (proxy), 0, /* flags */
+ "one",
+ &res_list_of_variants,
+ &res_hash_of_variants,
+ &res_struct_with_variant,
+ NULL,
+ &error));
g_assert_no_error (error);
/* TODO: check data */
egg_dbus_list_free (res_list_of_variants);
egg_dbus_hash_table_unref (res_hash_of_variants);
g_object_unref (res_struct_with_variant);
- g_assert (test_frob_invoke_test_variant_return2 (TEST_FROB (proxy), 0, /* flags */
- "two",
- &res_list_of_variants,
- &res_hash_of_variants,
- &res_struct_with_variant,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_variant_return2_sync (TEST_FROB (proxy), 0, /* flags */
+ "two",
+ &res_list_of_variants,
+ &res_hash_of_variants,
+ &res_struct_with_variant,
+ NULL,
+ &error));
g_assert_no_error (error);
/* TODO: check data */
egg_dbus_list_free (res_list_of_variants);
@@ -1964,22 +1964,22 @@ test_pass_variant (void)
error = NULL;
variant_to_pass = egg_dbus_variant_new_for_string ("dbus-rocks");
- g_assert (test_frob_invoke_test_pass_variant (TEST_FROB (proxy), 0, /* flags */
- variant_to_pass,
- &as_string,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_pass_variant_sync (TEST_FROB (proxy), 0, /* flags */
+ variant_to_pass,
+ &as_string,
+ NULL,
+ &error));
g_assert_no_error (error);
g_object_unref (variant_to_pass);
g_assert_cmpstr (as_string, ==, "dbus-rocks-and-a-bag-of-chips");
g_free (as_string);
variant_to_pass = egg_dbus_variant_new_for_byte (0x5a);
- g_assert (test_frob_invoke_test_pass_variant (TEST_FROB (proxy), 0, /* flags */
- variant_to_pass,
- &as_string,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_pass_variant_sync (TEST_FROB (proxy), 0, /* flags */
+ variant_to_pass,
+ &as_string,
+ NULL,
+ &error));
g_assert_no_error (error);
g_object_unref (variant_to_pass);
g_assert_cmpstr (as_string, ==, "Z-and-a-bag-of-chips");
@@ -1989,11 +1989,11 @@ test_pass_variant (void)
ret_byte = 1; g_array_append_val (array_byte, ret_byte);
ret_byte = 2; g_array_append_val (array_byte, ret_byte);
variant_to_pass = egg_dbus_variant_new_for_array_with_signature (array_byte, "y");
- g_assert (test_frob_invoke_test_pass_variant (TEST_FROB (proxy), 0, /* flags */
- variant_to_pass,
- &as_string,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_pass_variant_sync (TEST_FROB (proxy), 0, /* flags */
+ variant_to_pass,
+ &as_string,
+ NULL,
+ &error));
g_assert_no_error (error);
g_object_unref (variant_to_pass);
g_array_free (array_byte, TRUE);
@@ -2060,14 +2060,14 @@ test_pass_variant2 (void)
variant_to_pass = egg_dbus_variant_new_for_array_with_signature (array_byte, "y");
- g_assert (test_frob_invoke_test_pass_variant2 (TEST_FROB (proxy), 0, /* flags */
- array_of_variants,
- dict_of_string_to_variants,
- dict_of_string_to_array_of_variants,
- struct_with_variant,
- &as_string,
- NULL,
- &error));
+ g_assert (test_frob_invoke_test_pass_variant2_sync (TEST_FROB (proxy), 0, /* flags */
+ array_of_variants,
+ dict_of_string_to_variants,
+ dict_of_string_to_array_of_variants,
+ struct_with_variant,
+ &as_string,
+ NULL,
+ &error));
g_assert_no_error (error);
g_list_foreach (array_of_variants, (GFunc) g_object_unref, NULL);
g_list_free (array_of_variants);
@@ -2122,12 +2122,12 @@ test_another_interface (void)
error = NULL;
- g_assert (test_tweak_invoke_i_can_haz_greetingz (TEST_TWEAK (proxy),
- 0, /* flags */
- "Sup?",
- &s,
- NULL,
- &error));
+ g_assert (test_tweak_invoke_i_can_haz_greetingz_sync (TEST_TWEAK (proxy),
+ 0, /* flags */
+ "Sup?",
+ &s,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmpstr (s, ==, "Word. You haz greetz 'Sup?'. KTHXBYE!");
g_free (s);
@@ -2267,11 +2267,11 @@ test_properties (void)
* this.
*/
received_async_reply = FALSE;
- test_tweak_invoke_block_until_rw_property_changes_async (TEST_TWEAK (proxy),
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- NULL,
- (GAsyncReadyCallback) rw_property_changes_cb,
- &received_async_reply);
+ test_tweak_invoke_block_until_rw_property_changes (TEST_TWEAK (proxy),
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ NULL,
+ (GAsyncReadyCallback) rw_property_changes_cb,
+ &received_async_reply);
g_object_set (proxy, "test-tweak-some-read-write-property", "A new property value", NULL);
g_assert (received_async_reply == TRUE);
@@ -2287,24 +2287,24 @@ test_properties (void)
"notify::test-tweak-foo",
(GCallback) foo_notify_cb,
&got_foo_notify_event);
- g_assert (test_tweak_invoke_change_readable_property (TEST_TWEAK (proxy),
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- "bar is the new foo",
- NULL,
- &error));
+ g_assert (test_tweak_invoke_change_readable_property_sync (TEST_TWEAK (proxy),
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ "bar is the new foo",
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (got_foo_notify_event == TRUE);
g_signal_handlers_disconnect_by_func (proxy, foo_notify_cb, &got_foo_notify_event);
/* Check that we return the right error on unknown properties on known interfaces */
variant = NULL;
- g_assert(!egg_dbus_properties_invoke_get (EGG_DBUS_PROPERTIES (proxy),
- 0, /* flags */
- "com.example.Tweak",
- "NonexistantProperty",
- &variant,
- NULL,
- &error));
+ g_assert(!egg_dbus_properties_invoke_get_sync (EGG_DBUS_PROPERTIES (proxy),
+ 0, /* flags */
+ "com.example.Tweak",
+ "NonexistantProperty",
+ &variant,
+ NULL,
+ &error));
g_assert_error (error, EGG_DBUS_ERROR, EGG_DBUS_ERROR_FAILED);
g_assert_cmpstr (error->message, ==, "Remote Exception invoking org.freedesktop.DBus.Properties.Get() on /com/example/TestObject at name com.example.TestService: org.gtk.EggDBus.Error.Failed: Given property does not exist on the given interface");
g_assert (variant == NULL);
@@ -2313,13 +2313,13 @@ test_properties (void)
/* Check that we return the right error on unknown properties on unknown interfaces */
variant = NULL;
- g_assert(!egg_dbus_properties_invoke_get (EGG_DBUS_PROPERTIES (proxy),
- 0, /* flags */
- "com.example.NonexistantInterface",
- "NonexistantProperty",
- &variant,
- NULL,
- &error));
+ g_assert(!egg_dbus_properties_invoke_get_sync (EGG_DBUS_PROPERTIES (proxy),
+ 0, /* flags */
+ "com.example.NonexistantInterface",
+ "NonexistantProperty",
+ &variant,
+ NULL,
+ &error));
g_assert_error (error, EGG_DBUS_ERROR, EGG_DBUS_ERROR_FAILED);
g_assert_cmpstr (error->message, ==, "Remote Exception invoking org.freedesktop.DBus.Properties.Get() on /com/example/TestObject at name com.example.TestService: org.gtk.EggDBus.Error.Failed: Object does not implement given interface");
g_assert (variant == NULL);
@@ -2328,12 +2328,12 @@ test_properties (void)
/* ditto for GetAll() */
property_bag = NULL;
- g_assert(!egg_dbus_properties_invoke_get_all (EGG_DBUS_PROPERTIES (proxy),
- 0, /* flags */
- "com.example.NonexistantInterface",
- &property_bag,
- NULL,
- &error));
+ g_assert(!egg_dbus_properties_invoke_get_all_sync (EGG_DBUS_PROPERTIES (proxy),
+ 0, /* flags */
+ "com.example.NonexistantInterface",
+ &property_bag,
+ NULL,
+ &error));
g_assert_error (error, EGG_DBUS_ERROR, EGG_DBUS_ERROR_FAILED);
g_assert_cmpstr (error->message, ==, "Remote Exception invoking org.freedesktop.DBus.Properties.GetAll() on /com/example/TestObject at name com.example.TestService: org.gtk.EggDBus.Error.Failed: Object does not implement given interface");
g_assert (property_bag == NULL);
@@ -2342,13 +2342,13 @@ test_properties (void)
/* Check that we return the right error on setting an unknown property on a known interfaces */
variant = egg_dbus_variant_new_for_byte (42);
- g_assert(!egg_dbus_properties_invoke_set (EGG_DBUS_PROPERTIES (proxy),
- 0, /* flags */
- "com.example.Tweak",
- "NonexistantProperty",
- variant,
- NULL,
- &error));
+ g_assert(!egg_dbus_properties_invoke_set_sync (EGG_DBUS_PROPERTIES (proxy),
+ 0, /* flags */
+ "com.example.Tweak",
+ "NonexistantProperty",
+ variant,
+ NULL,
+ &error));
g_assert_error (error, EGG_DBUS_ERROR, EGG_DBUS_ERROR_FAILED);
g_assert_cmpstr (error->message, ==, "Remote Exception invoking org.freedesktop.DBus.Properties.Set() on /com/example/TestObject at name com.example.TestService: org.gtk.EggDBus.Error.Failed: Given property does not exist on the given interface");
g_error_free (error);
@@ -2357,13 +2357,13 @@ test_properties (void)
/* Check that we return the right error on setting an unknown property on a unknown interfaces */
variant = egg_dbus_variant_new_for_byte (42);
- g_assert(!egg_dbus_properties_invoke_set (EGG_DBUS_PROPERTIES (proxy),
- 0, /* flags */
- "com.example.NonexistantInterface",
- "NonexistantProperty",
- variant,
- NULL,
- &error));
+ g_assert(!egg_dbus_properties_invoke_set_sync (EGG_DBUS_PROPERTIES (proxy),
+ 0, /* flags */
+ "com.example.NonexistantInterface",
+ "NonexistantProperty",
+ variant,
+ NULL,
+ &error));
g_assert_error (error, EGG_DBUS_ERROR, EGG_DBUS_ERROR_FAILED);
g_assert_cmpstr (error->message, ==, "Remote Exception invoking org.freedesktop.DBus.Properties.Set() on /com/example/TestObject at name com.example.TestService: org.gtk.EggDBus.Error.Failed: Object does not implement given interface");
g_error_free (error);
@@ -2498,12 +2498,12 @@ newz_notifz_signal_handler_deadlock_test (TestTweak *tweak,
/* test sync method invocation in signal handler */
error = NULL;
- g_assert (test_frob_invoke_hello_world (TEST_FROB (tweak),
- 0, /* flags */
- "Hi!",
- &s,
- NULL,
- &error));
+ g_assert (test_frob_invoke_hello_world_sync (TEST_FROB (tweak),
+ 0, /* flags */
+ "Hi!",
+ &s,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmpstr (s, ==, "You greeted me with 'Hi!'. Thanks!");
g_free (s);
@@ -2537,22 +2537,22 @@ test_signals (void)
g_signal_connect (proxy, "test-tweak-newz-notifz", (GCallback) newz_notifz_signal_handler, &tweak_signal_ret);
g_signal_connect (proxy, "test-twiddle-newz-notifz", (GCallback) newz_notifz_signal_handler, &twiddle_signal_ret);
- g_assert (test_tweak_invoke_broadcastz_newz (TEST_TWEAK (proxy),
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- "Quick, there's a C compiler fire sale",
- NULL,
- &error));
+ g_assert (test_tweak_invoke_broadcastz_newz_sync (TEST_TWEAK (proxy),
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ "Quick, there's a C compiler fire sale",
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (twiddle_signal_ret == NULL);
g_assert_cmpstr (tweak_signal_ret, ==, "Word. Broadcastz 'Quick, there's a C compiler fire sale'. KTHXBYE!");
g_free (tweak_signal_ret);
tweak_signal_ret = NULL;
- g_assert (test_twiddle_invoke_broadcastz_newz (TEST_TWIDDLE (proxy),
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- "Diamonds in the mine",
- NULL,
- &error));
+ g_assert (test_twiddle_invoke_broadcastz_newz_sync (TEST_TWIDDLE (proxy),
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ "Diamonds in the mine",
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (tweak_signal_ret == NULL);
g_assert_cmpstr (twiddle_signal_ret, ==, "Sez 'Diamonds in the mine'. KTHXBYE!");
@@ -2571,11 +2571,11 @@ test_signals (void)
"test-twiddle-newz-notifz",
(GCallback) newz_notifz_signal_handler_deadlock_test,
&twiddle_signal_ret);
- g_assert (test_twiddle_invoke_broadcastz_newz (TEST_TWIDDLE (proxy),
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- "Deadlock test",
- NULL,
- &error));
+ g_assert (test_twiddle_invoke_broadcastz_newz_sync (TEST_TWIDDLE (proxy),
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ "Deadlock test",
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmpstr (twiddle_signal_ret, ==, "Sez 'Deadlock test'. KTHXBYE!");
g_free (twiddle_signal_ret);
@@ -2600,10 +2600,10 @@ test_signals (void)
(GCallback) frob_signal_with_struct_and_hash_cb,
&struct_and_hash_signal_received);
- g_assert (test_frob_invoke_emit_test_signals (TEST_FROB (proxy),
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- NULL,
- &error));
+ g_assert (test_frob_invoke_emit_test_signals_sync (TEST_FROB (proxy),
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (primitive_types_signal_received == TRUE);
@@ -2659,11 +2659,11 @@ test_name_owner_changed (void)
g_assert (owner != NULL);
/* check that the server agrees */
- g_assert (test_tweak_invoke_get_server_unique_name (TEST_TWEAK (proxy),
- 0, /* flags */
- &owner_from_server,
- NULL,
- &error));
+ g_assert (test_tweak_invoke_get_server_unique_name_sync (TEST_TWEAK (proxy),
+ 0, /* flags */
+ &owner_from_server,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmpstr (owner, ==, owner_from_server);
g_free (owner);
@@ -2933,12 +2933,12 @@ test_cancellation (void)
/* check cancellation works through returned pending_call_id's */
got_callback = FALSE;
- pending_call_id = test_tweak_invoke_long_running_method_async (TEST_TWEAK (proxy),
- 0, /* flags */
- 1500,
- NULL,
- (GAsyncReadyCallback) long_running_method_expect_cancelled_cb,
- &got_callback);
+ pending_call_id = test_tweak_invoke_long_running_method (TEST_TWEAK (proxy),
+ 0, /* flags */
+ 1500,
+ NULL,
+ (GAsyncReadyCallback) long_running_method_expect_cancelled_cb,
+ &got_callback);
g_timeout_add (500,
cancel_through_pending_call_id_timer_cb,
GUINT_TO_POINTER (pending_call_id));
@@ -2948,12 +2948,12 @@ test_cancellation (void)
/* check cancellation works through GCancellable */
got_callback = FALSE;
cancellable = g_cancellable_new ();
- test_tweak_invoke_long_running_method_async (TEST_TWEAK (proxy),
- 0, /* flags */
- 1500,
- cancellable,
- (GAsyncReadyCallback) long_running_method_expect_cancelled_cb,
- &got_callback);
+ test_tweak_invoke_long_running_method (TEST_TWEAK (proxy),
+ 0, /* flags */
+ 1500,
+ cancellable,
+ (GAsyncReadyCallback) long_running_method_expect_cancelled_cb,
+ &got_callback);
g_timeout_add (500,
cancel_through_g_cancellable_timer_cb,
cancellable);
@@ -2977,11 +2977,11 @@ test_timeouts (void)
* and the default time out is 25 seconds.
*/
error = NULL;
- g_assert (!test_tweak_invoke_long_running_method (TEST_TWEAK (proxy),
- 0, /* flags */
- 30 * 1000,
- NULL,
- &error));
+ g_assert (!test_tweak_invoke_long_running_method_sync (TEST_TWEAK (proxy),
+ 0, /* flags */
+ 30 * 1000,
+ NULL,
+ &error));
g_assert_error (error, EGG_DBUS_ERROR, EGG_DBUS_ERROR_NO_REPLY);
g_error_free (error);
@@ -2989,11 +2989,11 @@ test_timeouts (void)
* so the default timeout should be ignored.
*/
error = NULL;
- g_assert (test_tweak_invoke_long_running_method (TEST_TWEAK (proxy),
- EGG_DBUS_CALL_FLAGS_TIMEOUT_NONE,
- 30 * 1000,
- NULL,
- &error));
+ g_assert (test_tweak_invoke_long_running_method_sync (TEST_TWEAK (proxy),
+ EGG_DBUS_CALL_FLAGS_TIMEOUT_NONE,
+ 30 * 1000,
+ NULL,
+ &error));
g_assert_no_error (error);
}
@@ -3023,34 +3023,34 @@ test_error_reporting (void)
* proper D-Bus error names as specified by the nick-name.
*/
error = NULL;
- g_assert (!test_tweak_invoke_return_gerror (TEST_TWEAK (proxy),
- 0, /* flags */
- g_quark_to_string (EGG_DBUS_ERROR),
- EGG_DBUS_ERROR_TIMED_OUT,
- NULL,
- &error));
+ g_assert (!test_tweak_invoke_return_gerror_sync (TEST_TWEAK (proxy),
+ 0, /* flags */
+ g_quark_to_string (EGG_DBUS_ERROR),
+ EGG_DBUS_ERROR_TIMED_OUT,
+ NULL,
+ &error));
g_assert_error (error, EGG_DBUS_ERROR, EGG_DBUS_ERROR_TIMED_OUT);
g_assert_cmpstr (error->message, ==, "Remote Exception invoking com.example.Tweak.ReturnGError() on /com/example/TestObject at name com.example.TestService: org.freedesktop.DBus.Error.TimedOut: This is the error you requested (domain='EggDBusError', error_code=23).");
g_error_free (error);
error = NULL;
- g_assert (!test_tweak_invoke_return_gerror (TEST_TWEAK (proxy),
- 0, /* flags */
- g_quark_to_string (G_KEY_FILE_ERROR),
- G_KEY_FILE_ERROR_GROUP_NOT_FOUND, /* Free the group. Nuke the kernel! */
- NULL,
- &error));
+ g_assert (!test_tweak_invoke_return_gerror_sync (TEST_TWEAK (proxy),
+ 0, /* flags */
+ g_quark_to_string (G_KEY_FILE_ERROR),
+ G_KEY_FILE_ERROR_GROUP_NOT_FOUND, /* Free the group. Nuke the kernel! */
+ NULL,
+ &error));
g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND);
g_assert_cmpstr (error->message, ==, "Remote Exception invoking com.example.Tweak.ReturnGError() on /com/example/TestObject at name com.example.TestService: org.gtk.EggDBus.UnmappedGError.Quark0x672d6b65792d66696c652d6572726f722d717561726b.Code4: This is the error you requested (domain='g-key-file-error-quark', error_code=4).");
g_error_free (error);
error = NULL;
- g_assert (!test_tweak_invoke_return_gerror (TEST_TWEAK (proxy),
- 0, /* flags */
- g_quark_to_string (G_IO_ERROR),
- G_IO_ERROR_WOULD_RECURSE,
- NULL,
- &error));
+ g_assert (!test_tweak_invoke_return_gerror_sync (TEST_TWEAK (proxy),
+ 0, /* flags */
+ g_quark_to_string (G_IO_ERROR),
+ G_IO_ERROR_WOULD_RECURSE,
+ NULL,
+ &error));
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_RECURSE);
g_assert_cmpstr (error->message, ==, "Remote Exception invoking com.example.Tweak.ReturnGError() on /com/example/TestObject at name com.example.TestService: org.gtk.EggDBus.UnmappedGError.Quark0x672d696f2d6572726f722d717561726b.Code25: This is the error you requested (domain='g-io-error-quark', error_code=25).");
g_error_free (error);
@@ -3103,12 +3103,12 @@ test_ctypes(void)
(GCallback) signal_with_ctype_cb,
&got_signal);
some_value = 42;
- g_assert (test_tweak_invoke_method_with_ctypes (TEST_TWEAK (proxy),
- EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
- some_value,
- &some_better_value,
- NULL,
- &error));
+ g_assert (test_tweak_invoke_method_with_ctypes_sync (TEST_TWEAK (proxy),
+ EGG_DBUS_CALL_FLAGS_BLOCK_IN_MAINLOOP,
+ some_value,
+ &some_better_value,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmpint (some_better_value, ==, some_value + 1);
g_assert (got_signal == TRUE);
@@ -3146,11 +3146,11 @@ test_user_supplied_structs (void)
/* Note, I'm actually not religious; it's just that this whole
* god-thing is reasonably well-understood so it's a good example.
*/
- g_assert (test_twiddle_invoke_get_most_powerful_subject (TEST_TWIDDLE (proxy),
- 0, /* call_flags */
- &subject,
- NULL,
- &error));
+ g_assert (test_twiddle_invoke_get_most_powerful_subject_sync (TEST_TWIDDLE (proxy),
+ 0, /* call_flags */
+ &subject,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert (TEST_IS_SUBJECT (subject));
g_assert_cmpint (test_subject_get_kind (subject), ==, TEST_SUBJECT_KIND_DEITY);
@@ -3159,11 +3159,11 @@ test_user_supplied_structs (void)
g_assert_cmpstr (test_subject_get_favorite_color (subject), ==, "infrared");
g_object_unref (subject); /* sacrilegious! sue me! */
- g_assert (test_twiddle_invoke_get_all_subjects (TEST_TWIDDLE (proxy),
- 0, /* call_flags */
- &list,
- NULL,
- &error));
+ g_assert (test_twiddle_invoke_get_all_subjects_sync (TEST_TWIDDLE (proxy),
+ 0, /* call_flags */
+ &list,
+ NULL,
+ &error));
g_assert_no_error (error);
g_assert_cmpint (g_list_length (list), ==, 4);
diff --git a/src/tests/testserver.c b/src/tests/testserver.c
index 679895b..da2fc36 100644
--- a/src/tests/testserver.c
+++ b/src/tests/testserver.c
@@ -822,13 +822,13 @@ main (int argc, char *argv[])
connection = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SESSION);
- if (!egg_dbus_bus_invoke_request_name (egg_dbus_connection_get_bus_proxy (connection),
- 0, /* call flags */
- "com.example.TestService",
- EGG_DBUS_REQUEST_NAME_FLAGS_NONE,
- &request_name_reply,
- NULL,
- &error))
+ if (!egg_dbus_bus_invoke_request_name_sync (egg_dbus_connection_get_bus_proxy (connection),
+ 0, /* call flags */
+ "com.example.TestService",
+ EGG_DBUS_REQUEST_NAME_FLAGS_NONE,
+ &request_name_reply,
+ NULL,
+ &error))
{
g_warning ("error: %s", error->message);
g_error_free (error);