summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-03-06 20:30:26 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-03-06 20:30:26 +0000
commitda342841ee660413c58a82fec428b64ebe1b2a6a (patch)
tree88eedd9aa19c74d59a45a8836a42e2728f8886d8
parent292944401d9f71eb8fcbb8781b73bdf61826da08 (diff)
WiP: port telepathy-glib to GDBuswip-next-gdbus
-rw-r--r--docs/reference/telepathy-glib/telepathy-glib-docs.sgml1
-rw-r--r--docs/reference/telepathy-glib/telepathy-glib-sections.txt28
-rw-r--r--docs/reference/telepathy-glib/tp-svc.xml32
-rw-r--r--examples/client/extended-client.c2
-rw-r--r--examples/cm/call/call-channel.c6
-rw-r--r--examples/cm/contactlist/conn.c8
-rw-r--r--examples/cm/echo-message-parts/chan.c4
-rw-r--r--examples/cm/extended/conn.c6
-rw-r--r--examples/extensions/Makefile.am6
-rw-r--r--examples/extensions/extensions-cli.c24
-rw-r--r--examples/extensions/extensions.h2
-rw-r--r--telepathy-farstream/call-content.c1
-rw-r--r--telepathy-farstream/call-stream.c1
-rw-r--r--telepathy-glib/Makefile.am7
-rw-r--r--telepathy-glib/account-manager.c32
-rw-r--r--telepathy-glib/account-manager.h2
-rw-r--r--telepathy-glib/account.c32
-rw-r--r--telepathy-glib/account.h2
-rw-r--r--telepathy-glib/add-dispatch-operation-context-internal.h2
-rw-r--r--telepathy-glib/add-dispatch-operation-context.c12
-rw-r--r--telepathy-glib/base-call-channel.c26
-rw-r--r--telepathy-glib/base-call-content.c22
-rw-r--r--telepathy-glib/base-call-stream.c8
-rw-r--r--telepathy-glib/base-channel.c5
-rw-r--r--telepathy-glib/base-client.c75
-rw-r--r--telepathy-glib/base-connection-manager.c4
-rw-r--r--telepathy-glib/base-connection.c60
-rw-r--r--telepathy-glib/base-connection.h2
-rw-r--r--telepathy-glib/base-contact-list.c62
-rw-r--r--telepathy-glib/base-media-call-channel.c4
-rw-r--r--telepathy-glib/base-media-call-content.c22
-rw-r--r--telepathy-glib/base-media-call-stream.c26
-rw-r--r--telepathy-glib/base-password-channel.c12
-rw-r--r--telepathy-glib/base-protocol.c16
-rw-r--r--telepathy-glib/base-room-config.c10
-rw-r--r--telepathy-glib/call-channel.c1
-rw-r--r--telepathy-glib/call-content-media-description.c10
-rw-r--r--telepathy-glib/call-content.c33
-rw-r--r--telepathy-glib/call-content.h3
-rw-r--r--telepathy-glib/call-misc.c95
-rw-r--r--telepathy-glib/call-stream-endpoint.c20
-rw-r--r--telepathy-glib/call-stream.c33
-rw-r--r--telepathy-glib/call-stream.h3
-rw-r--r--telepathy-glib/channel-dispatch-operation.c33
-rw-r--r--telepathy-glib/channel-dispatch-operation.h2
-rw-r--r--telepathy-glib/channel-dispatcher.c32
-rw-r--r--telepathy-glib/channel-dispatcher.h2
-rw-r--r--telepathy-glib/channel-manager-request-internal.h4
-rw-r--r--telepathy-glib/channel-manager-request.c6
-rw-r--r--telepathy-glib/channel-request.c32
-rw-r--r--telepathy-glib/channel-request.h2
-rw-r--r--telepathy-glib/channel.c37
-rw-r--r--telepathy-glib/channel.h2
-rw-r--r--telepathy-glib/cli-call.h1
-rw-r--r--telepathy-glib/cli-channel.c1
-rw-r--r--telepathy-glib/cli-connection.c1
-rw-r--r--telepathy-glib/cli-misc.c1
-rw-r--r--telepathy-glib/client.c32
-rw-r--r--telepathy-glib/client.h2
-rw-r--r--telepathy-glib/cm-message-internal.h2
-rw-r--r--telepathy-glib/codegen.am5
-rw-r--r--telepathy-glib/connection-manager.c33
-rw-r--r--telepathy-glib/connection-manager.h2
-rw-r--r--telepathy-glib/connection.c37
-rw-r--r--telepathy-glib/connection.h2
-rw-r--r--telepathy-glib/core-dbus.c7
-rw-r--r--telepathy-glib/core-proxy.c118
-rw-r--r--telepathy-glib/core-svc-interface.c93
-rw-r--r--telepathy-glib/core-svc-interface.h (renamed from telepathy-glib/call-misc.h)30
-rw-r--r--telepathy-glib/core-util.c183
-rw-r--r--telepathy-glib/dbus-daemon.c904
-rw-r--r--telepathy-glib/dbus-daemon.h4
-rw-r--r--telepathy-glib/dbus-internal.h2
-rw-r--r--telepathy-glib/dbus-properties-mixin.c10
-rw-r--r--telepathy-glib/dbus.h2
-rw-r--r--telepathy-glib/debug-client.c32
-rw-r--r--telepathy-glib/debug-client.h3
-rw-r--r--telepathy-glib/debug-sender.c2
-rw-r--r--telepathy-glib/errors.c30
-rw-r--r--telepathy-glib/group-mixin.c14
-rw-r--r--telepathy-glib/handle-channel-context-internal.h2
-rw-r--r--telepathy-glib/handle-channel-context.c12
-rw-r--r--telepathy-glib/logger.c20
-rw-r--r--telepathy-glib/message-mixin.c27
-rw-r--r--telepathy-glib/observe-channel-context-internal.h2
-rw-r--r--telepathy-glib/observe-channel-context.c12
-rw-r--r--telepathy-glib/presence-mixin.c4
-rw-r--r--telepathy-glib/protocol.c34
-rw-r--r--telepathy-glib/protocol.h2
-rw-r--r--telepathy-glib/proxy-internal.h61
-rw-r--r--telepathy-glib/proxy-methods.c505
-rw-r--r--telepathy-glib/proxy-signals.c316
-rw-r--r--telepathy-glib/proxy-subclass.h48
-rw-r--r--telepathy-glib/proxy.c513
-rw-r--r--telepathy-glib/proxy.h4
-rw-r--r--telepathy-glib/run.c37
-rw-r--r--telepathy-glib/svc-interface-skeleton-internal.h71
-rw-r--r--telepathy-glib/svc-interface-skeleton.c218
-rw-r--r--telepathy-glib/telepathy-glib.h2
-rw-r--r--telepathy-glib/tls-certificate.c33
-rw-r--r--telepathy-glib/tls-certificate.h3
-rw-r--r--telepathy-glib/util.c148
-rw-r--r--telepathy-logger/call-channel.c10
-rw-r--r--telepathy-logger/dbus-service.c28
-rw-r--r--tests/dbus/call-cancellation.c28
-rw-r--r--tests/dbus/channel-dispatch-operation.c28
-rw-r--r--tests/dbus/channel-request.c28
-rw-r--r--tests/dbus/cm.c4
-rw-r--r--tests/dbus/connection-aliasing.c18
-rw-r--r--tests/dbus/connection-balance.c18
-rw-r--r--tests/dbus/connection-error.c51
-rw-r--r--tests/dbus/connection-interests.c27
-rw-r--r--tests/dbus/connection.c9
-rw-r--r--tests/dbus/dbus.c6
-rw-r--r--tests/dbus/disconnection.c12
-rw-r--r--tests/dbus/get-interface-after-invalidate.c2
-rw-r--r--tests/dbus/with-properties.xml9
-rw-r--r--tests/lib/bug-19101-conn.c2
-rw-r--r--tests/lib/contacts-conn.c22
-rw-r--r--tests/lib/dbus-tube-chan.c4
-rw-r--r--tests/lib/echo-chan.c2
-rw-r--r--tests/lib/file-transfer-chan.c8
-rw-r--r--tests/lib/room-list-chan.c6
-rw-r--r--tests/lib/simple-account-manager.c4
-rw-r--r--tests/lib/simple-account.c2
-rw-r--r--tests/lib/simple-channel-dispatch-operation.c10
-rw-r--r--tests/lib/simple-channel-dispatcher.c10
-rw-r--r--tests/lib/simple-channel-request.c6
-rw-r--r--tests/lib/simple-conn.c2
-rw-r--r--tests/lib/stream-tube-chan.c8
-rw-r--r--tests/lib/textchan-group.c4
-rw-r--r--tests/lib/tls-certificate.c10
-rw-r--r--tests/lib/util.c37
-rw-r--r--tests/lib/util.h17
-rw-r--r--tests/suppressions/tpl.supp46
-rw-r--r--tools/glib-client-gen.py524
-rw-r--r--tools/glib-ginterface-gen.py339
-rw-r--r--tools/libglibcodegen.py225
-rw-r--r--tools/libtpcodegen.py10
-rw-r--r--tools/spec-to-introspect.xsl51
-rw-r--r--tools/telepathy-glib.supp64
141 files changed, 2317 insertions, 3915 deletions
diff --git a/docs/reference/telepathy-glib/telepathy-glib-docs.sgml b/docs/reference/telepathy-glib/telepathy-glib-docs.sgml
index 1398e1cca..edf21241a 100644
--- a/docs/reference/telepathy-glib/telepathy-glib-docs.sgml
+++ b/docs/reference/telepathy-glib/telepathy-glib-docs.sgml
@@ -59,7 +59,6 @@
<xi:include href="xml/call-channel.xml"/>
<xi:include href="xml/call-content.xml"/>
<xi:include href="xml/call-stream.xml"/>
- <xi:include href="xml/call-misc.xml"/>
<xi:include href="xml/debug-client.xml"/>
<xi:include href="xml/debug-message.xml"/>
<xi:include href="xml/room-list.xml"/>
diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
index 44771aa8e..2b9f88bea 100644
--- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt
@@ -1937,7 +1937,6 @@ tp_dbus_daemon_release_name
tp_dbus_daemon_request_name
tp_dbus_daemon_register_object
tp_dbus_daemon_unregister_object
-tp_dbus_daemon_init_known_interfaces
<SUBSECTION Standard>
tp_dbus_name_type_get_type
tp_dbus_daemon_get_type
@@ -3007,10 +3006,6 @@ tp_proxy_add_interfaces
tp_proxy_get_interface_by_id
tp_proxy_invalidate
TpProxyInterfaceAddedCb
-tp_proxy_or_subclass_hook_on_interface_add
-tp_proxy_init_known_interfaces
-tp_proxy_subclass_add_error_mapping
-tp_proxy_dbus_g_proxy_claim_for_signal_adding
<SUBSECTION>
TpProxyInvokeFunc
tp_proxy_pending_call_v0_new
@@ -3027,7 +3022,6 @@ tp_proxy_signal_connection_v0_take_results
<INCLUDE>telepathy-glib/channel.h</INCLUDE>
TpChannel
TpChannelClass
-tp_channel_init_known_interfaces
<SUBSECTION>
TP_CHANNEL_FEATURE_CORE
tp_channel_get_connection
@@ -3278,7 +3272,6 @@ tp_connection_get_status
tp_connection_get_cm_name
tp_connection_get_protocol_name
tp_connection_get_self_contact
-tp_connection_init_known_interfaces
tp_connection_presence_type_cmp_availability
tp_connection_get_capabilities
tp_connection_get_avatar_requirements
@@ -3674,7 +3667,6 @@ tp_connection_manager_param_get_default
tp_connection_manager_param_dup_default_variant
tp_connection_manager_check_valid_name
tp_connection_manager_check_valid_protocol_name
-tp_connection_manager_init_known_interfaces
tp_connection_manager_param_copy
tp_connection_manager_param_free
<SUBSECTION Standard>
@@ -3977,7 +3969,6 @@ TP_SVC_ACCOUNT_MANAGER_GET_CLASS
<TITLE>account</TITLE>
TpAccount
TpAccountClass
-tp_account_init_known_interfaces
tp_account_get_path_suffix
tp_account_get_connection
tp_account_get_display_name
@@ -4105,7 +4096,6 @@ TpAccountManager
TpAccountManagerClass
tp_account_manager_new
tp_account_manager_new_with_factory
-tp_account_manager_init_known_interfaces
tp_account_manager_set_default
tp_account_manager_can_set_default
tp_account_manager_dup
@@ -4168,7 +4158,6 @@ tp_cli_account_manager_add_signals
TpChannelDispatcher
TpChannelDispatcherClass
tp_channel_dispatcher_new
-tp_channel_dispatcher_init_known_interfaces
<SUBSECTION>
tp_cli_channel_dispatcher_interface_messages1_call_send_message
tp_cli_channel_dispatcher_interface_messages1_callback_for_send_message
@@ -4287,7 +4276,6 @@ TP_SVC_CHANNEL_DISPATCHER_INTERFACE_OPERATION_LIST_GET_CLASS
<TITLE>channel-dispatch-operation</TITLE>
TpChannelDispatchOperation
TpChannelDispatchOperationClass
-tp_channel_dispatch_operation_init_known_interfaces
<SUBSECTION>
TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE
tp_channel_dispatch_operation_get_account
@@ -4322,7 +4310,6 @@ tp_channel_dispatch_operation_get_feature_quark_core
<TITLE>channel-request</TITLE>
TpChannelRequest
TpChannelRequestClass
-tp_channel_request_init_known_interfaces
tp_channel_request_dup_immutable_properties
tp_channel_request_get_account
tp_channel_request_get_user_action_time
@@ -4389,7 +4376,6 @@ TP_TYPE_SVC_CHANNEL_REQUEST
<TITLE>client</TITLE>
TpClient
TpClientClass
-tp_client_init_known_interfaces
<SUBSECTION Standard>
tp_client_get_type
TP_CLIENT
@@ -4846,7 +4832,6 @@ TpProtocolClass
tp_protocol_new
tp_protocol_get_name
tp_protocol_get_cm_name
-tp_protocol_init_known_interfaces
<SUBSECTION>
TP_PROTOCOL_FEATURE_PARAMETERS
tp_protocol_get_params
@@ -5594,7 +5579,6 @@ tp_cli_call_content_add_signals
<SUBSECTION>
TpCallContent
TpCallContentClass
-tp_call_content_init_known_interfaces
TP_CALL_CONTENT_FEATURE_CORE
<SUBSECTION>
tp_call_content_get_disposition
@@ -5678,7 +5662,6 @@ tp_cli_call_stream_add_signals
<SUBSECTION>
TpCallStream
TpCallStreamClass
-tp_call_stream_init_known_interfaces
TP_CALL_STREAM_FEATURE_CORE
<SUBSECTION>
tp_call_stream_can_request_receiving
@@ -5736,15 +5719,6 @@ tp_cli_call_stream_endpoint_add_signals
</SECTION>
<SECTION>
-<FILE>call-misc</FILE>
-<TITLE>call-misc</TITLE>
-<INCLUDE>telepathy-glib/telepathy-glib.h</INCLUDE>
-<SUBSECTION>
-tp_call_content_media_description_init_known_interfaces
-tp_call_stream_endpoint_init_known_interfaces
-</SECTION>
-
-<SECTION>
<FILE>client-factory</FILE>
<TITLE>client-factory</TITLE>
<INCLUDE>telepathy-glib/telepathy-glib.h</INCLUDE>
@@ -6060,7 +6034,6 @@ TpBaseMediaCallChannelPrivate
<SUBSECTION>
TpDebugClient
TpDebugClientClass
-tp_debug_client_init_known_interfaces
tp_debug_client_new
tp_debug_client_set_enabled_async
tp_debug_client_set_enabled_finish
@@ -6172,7 +6145,6 @@ TpRoomInfoPriv
<INCLUDE>telepathy-glib/telepathy-glib.h</INCLUDE>
<TITLE>TpTLSCertificate</TITLE>
TpTLSCertificate
-tp_tls_certificate_init_known_interfaces
tp_tls_certificate_new
TP_TLS_CERTIFICATE_FEATURE_CORE
tp_tls_certificate_get_rejection
diff --git a/docs/reference/telepathy-glib/tp-svc.xml b/docs/reference/telepathy-glib/tp-svc.xml
index 8c35d6de1..e9bbfaf0a 100644
--- a/docs/reference/telepathy-glib/tp-svc.xml
+++ b/docs/reference/telepathy-glib/tp-svc.xml
@@ -14,10 +14,8 @@
<para>
The GInterfaces whose names start with TpSvc are generated automatically
- from the Telepathy specification, and can be used to make it easier
- to export methods and signals onto D-Bus. By implementing these
- GInterfaces you can avoid needing to generate any "glue" using the
- dbus-glib tools - this is all done internally inside telepathy-glib.
+ from the Telepathy specification, and can be used to make it
+ somewhat easier to export methods and signals onto D-Bus.
</para>
@@ -100,7 +98,7 @@ G_DEFINE_TYPE_WITH_CODE(GabbleConnection,
<informalexample><programlisting>
void (*tp_svc_media_session_handler_error_impl)
(TpSvcMediaSessionHandler *self, guint errno, const char *message,
- DBusGMethodInvocation *context);
+ GDBusMethodInvocation *context);
</programlisting></informalexample>
and here's the beginning of the corresponding implementation:
<informalexample><programlisting>
@@ -108,39 +106,36 @@ static void
gabble_media_session_error (TpSvcMediaSessionHandler *iface,
guint errno,
const char *message,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GabbleMediaSession *self = GABBLE_MEDIA_SESSION (iface);
/* do stuff with self here */
</programlisting></informalexample>
- All service methods in telepathy-glib are asynchronous - you can of
- course implement them synchronously if you like, but you have to return
- the result or error to D-Bus by calling a callback rather than by
- returning from a function.
</para>
<para>
- The method implementation's last parameter is a DBusGMethodInvocation.
- To send the reply, you must either call dbus_g_method_return_error
- (for a failure), dbus_g_method_return (for a successful return),
+ The method implementation's last parameter is a GDBusMethodInvocation.
+ To send the reply, you must either call
+ g_dbus_method_invocation_return_gerror or similar (for a failure),
+ g_dbus_method_invocation_return_value (for a successful return),
or an inline function whose name contains "_return_from_" provided by
the TpSvc interface. For example, for Error there's an inline function
tp_svc_media_session_handler_return_from_error(). These inline functions
- are just a simple wrapper around dbus_g_method_return() to make it
- type-safe - it's recommended that you use them where possible.
+ are just a simple wrapper around g_dbus_method_invocation_return_value()
+ to make it type-safe.
</para>
<para>
For instance, Error doesn't return anything, so
tp_svc_media_session_handler_return_from_error() doesn't take any
- parameters apart from the DBusGMethodInvocation:
+ parameters apart from the GDBusMethodInvocation:
<informalexample><programlisting>
static void
gabble_media_session_error (TpSvcMediaSessionHandler *iface,
guint errno,
const char *message,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GabbleMediaSession *self = GABBLE_MEDIA_SESSION (iface);
@@ -152,7 +147,8 @@ gabble_media_session_error (TpSvcMediaSessionHandler *iface,
</para>
<para>
- As for signals, they're named as dictated by dbus-glib. This normally
+ As for signals, they're named as dictated by dbus-glib
+ (even though we don't actually use dbus-glib any more). This normally
gives you a sensible lower-case name - for instance NewStreamHandler
is mapped to "new-stream-handler".
</para>
diff --git a/examples/client/extended-client.c b/examples/client/extended-client.c
index 8e1ae39a5..21eb738af 100644
--- a/examples/client/extended-client.c
+++ b/examples/client/extended-client.c
@@ -287,8 +287,6 @@ main (int argc,
tp_debug_set_flags (g_getenv ("EXAMPLE_DEBUG"));
- example_cli_init ();
-
dbus = tp_dbus_daemon_dup (&error);
if (dbus == NULL)
diff --git a/examples/cm/call/call-channel.c b/examples/cm/call/call-channel.c
index 2985a2f7b..4699173cc 100644
--- a/examples/cm/call/call-channel.c
+++ b/examples/cm/call/call-channel.c
@@ -753,7 +753,7 @@ simulate_inability_to_unhold (gpointer p)
static void
hold_get_hold_state (TpSvcChannelInterfaceHold1 *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
ExampleCallChannel *self = EXAMPLE_CALL_CHANNEL (iface);
@@ -764,7 +764,7 @@ hold_get_hold_state (TpSvcChannelInterfaceHold1 *iface,
static void
hold_request_hold (TpSvcChannelInterfaceHold1 *iface,
gboolean hold,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
ExampleCallChannel *self = EXAMPLE_CALL_CHANNEL (iface);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles
@@ -828,7 +828,7 @@ hold_request_hold (TpSvcChannelInterfaceHold1 *iface,
return;
error:
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
diff --git a/examples/cm/contactlist/conn.c b/examples/cm/contactlist/conn.c
index e97663912..b1a717927 100644
--- a/examples/cm/contactlist/conn.c
+++ b/examples/cm/contactlist/conn.c
@@ -483,7 +483,7 @@ example_contact_list_connection_class_init (
static void
request_aliases (TpSvcConnectionInterfaceAliasing1 *aliasing,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
ExampleContactListConnection *self =
EXAMPLE_CONTACT_LIST_CONNECTION (aliasing);
@@ -499,7 +499,7 @@ request_aliases (TpSvcConnectionInterfaceAliasing1 *aliasing,
if (!tp_handles_are_valid (contact_repo, contacts, FALSE, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -525,7 +525,7 @@ request_aliases (TpSvcConnectionInterfaceAliasing1 *aliasing,
static void
set_aliases (TpSvcConnectionInterfaceAliasing1 *aliasing,
GHashTable *aliases,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
ExampleContactListConnection *self =
EXAMPLE_CONTACT_LIST_CONNECTION (aliasing);
@@ -544,7 +544,7 @@ set_aliases (TpSvcConnectionInterfaceAliasing1 *aliasing,
if (!tp_handle_is_valid (contact_repo, GPOINTER_TO_UINT (key),
&error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
diff --git a/examples/cm/echo-message-parts/chan.c b/examples/cm/echo-message-parts/chan.c
index 7d2a6fabf..fd601d299 100644
--- a/examples/cm/echo-message-parts/chan.c
+++ b/examples/cm/echo-message-parts/chan.c
@@ -360,7 +360,7 @@ example_echo_2_channel_class_init (ExampleEcho2ChannelClass *klass)
static void
destroyable_destroy (TpSvcChannelInterfaceDestroyable1 *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseChannel *self = TP_BASE_CHANNEL (iface);
@@ -398,7 +398,7 @@ example_echo_2_channel_set_sms (ExampleEcho2Channel *self,
static void
sms_get_sms_length (TpSvcChannelInterfaceSMS1 *self,
const GPtrArray *parts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpMessage *message;
guint i;
diff --git a/examples/cm/extended/conn.c b/examples/cm/extended/conn.c
index b6279209b..cb7846fd7 100644
--- a/examples/cm/extended/conn.c
+++ b/examples/cm/extended/conn.c
@@ -229,7 +229,7 @@ example_extended_connection_class_init (ExampleExtendedConnectionClass *klass)
static void
my_get_hats (ExampleSvcConnectionInterfaceHats *iface,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
ExampleExtendedConnection *self = EXAMPLE_EXTENDED_CONNECTION (iface);
TpBaseConnection *base = (TpBaseConnection *) self;
@@ -241,7 +241,7 @@ my_get_hats (ExampleSvcConnectionInterfaceHats *iface,
if (!tp_handles_are_valid (contact_repo, contacts, FALSE, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -291,7 +291,7 @@ my_set_hat (ExampleSvcConnectionInterfaceHats *iface,
const gchar *color,
guint style,
GHashTable *properties,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
ExampleExtendedConnection *self = EXAMPLE_EXTENDED_CONNECTION (iface);
TpBaseConnection *base = (TpBaseConnection *) self;
diff --git a/examples/extensions/Makefile.am b/examples/extensions/Makefile.am
index d6ba4472b..ff92bc33b 100644
--- a/examples/extensions/Makefile.am
+++ b/examples/extensions/Makefile.am
@@ -44,7 +44,6 @@ libexample_extensions_la_SOURCES = \
extensions.h
nodist_libexample_extensions_la_SOURCES = \
- _gen/register-dbus-glib-marshallers-body.h \
_gen/enums.h \
_gen/gtypes.h \
_gen/gtypes-body.h \
@@ -88,11 +87,6 @@ _gen/gtypes-body.h: _gen/all.xml \
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/tools/glib-gtypes-generator.py \
$< _gen/gtypes Example
-_gen/register-dbus-glib-marshallers-body.h: _gen/all.xml \
- $(tools_dir)/glib-client-marshaller-gen.py
- $(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-client-marshaller-gen.py $< \
- _example_ext > $@
-
_gen/enums.h: _gen/all.xml \
$(tools_dir)/c-constants-gen.py
$(AM_V_GEN)$(PYTHON) $(tools_dir)/c-constants-gen.py \
diff --git a/examples/extensions/extensions-cli.c b/examples/extensions/extensions-cli.c
index aba168013..059c12e9d 100644
--- a/examples/extensions/extensions-cli.c
+++ b/examples/extensions/extensions-cli.c
@@ -7,29 +7,5 @@
#include <telepathy-glib/proxy-subclass.h>
-static void _example_ext_register_dbus_glib_marshallers (void);
-
/* include auto-generated stubs for client-specific code */
#include "_gen/cli-connection-body.h"
-#include "_gen/register-dbus-glib-marshallers-body.h"
-
-static gpointer
-example_cli_once (gpointer data)
-{
- _example_ext_register_dbus_glib_marshallers ();
-
- tp_connection_init_known_interfaces ();
-
- tp_proxy_or_subclass_hook_on_interface_add (TP_TYPE_CONNECTION,
- example_cli_connection_add_signals);
-
- return NULL;
-}
-
-void
-example_cli_init (void)
-{
- static GOnce once = G_ONCE_INIT;
-
- g_once (&once, example_cli_once, NULL);
-}
diff --git a/examples/extensions/extensions.h b/examples/extensions/extensions.h
index 40c1e7510..88cc8b610 100644
--- a/examples/extensions/extensions.h
+++ b/examples/extensions/extensions.h
@@ -14,8 +14,6 @@ G_BEGIN_DECLS
#include "examples/extensions/_gen/gtypes.h"
#include "examples/extensions/_gen/interfaces.h"
-void example_cli_init (void);
-
G_END_DECLS
#endif
diff --git a/telepathy-farstream/call-content.c b/telepathy-farstream/call-content.c
index db1e3c68e..b8172006b 100644
--- a/telepathy-farstream/call-content.c
+++ b/telepathy-farstream/call-content.c
@@ -845,7 +845,6 @@ process_media_description (TfCallContent *self,
return;
}
- tp_call_content_media_description_init_known_interfaces ();
proxy = g_object_new (TP_TYPE_PROXY,
"dbus-daemon", tp_proxy_get_dbus_daemon (self->proxy),
"bus-name", tp_proxy_get_bus_name (self->proxy),
diff --git a/telepathy-farstream/call-stream.c b/telepathy-farstream/call-stream.c
index 4052c2481..c4c4a005f 100644
--- a/telepathy-farstream/call-stream.c
+++ b/telepathy-farstream/call-stream.c
@@ -911,7 +911,6 @@ tf_call_stream_add_endpoint (TfCallStream *self, const gchar *obj_path)
self->endpoint_objpath = g_strdup (obj_path);
- tp_call_stream_endpoint_init_known_interfaces ();
self->endpoint = g_object_new (TP_TYPE_PROXY,
"dbus-daemon", tp_proxy_get_dbus_daemon (self->proxy),
"bus-name", tp_proxy_get_bus_name (self->proxy),
diff --git a/telepathy-glib/Makefile.am b/telepathy-glib/Makefile.am
index 4d2ba3438..bd5954e7e 100644
--- a/telepathy-glib/Makefile.am
+++ b/telepathy-glib/Makefile.am
@@ -62,7 +62,6 @@ tpginclude_HEADERS = \
call-channel.h \
call-content.h \
call-content-media-description.h \
- call-misc.h \
call-stream.h \
call-stream-endpoint.h \
channel.h \
@@ -190,6 +189,9 @@ libtelepathy_glib_core_internal_la_LIBADD = $(ALL_LIBS)
libtelepathy_glib_core_internal_la_SOURCES = \
core-dbus.c \
core-proxy.c \
+ core-svc-interface.c \
+ core-svc-interface.h \
+ core-util.c \
errors.c \
$(NULL)
@@ -245,7 +247,6 @@ libtelepathy_glib_main_internal_la_SOURCES = \
call-content.c \
call-content-media-description.c \
call-internal.h \
- call-misc.c \
call-stream.c \
call-stream-endpoint.c \
channel.c \
@@ -333,6 +334,8 @@ libtelepathy_glib_main_internal_la_SOURCES = \
stream-tube-channel.c \
stream-tube-connection-internal.h \
stream-tube-connection.c \
+ svc-interface-skeleton.c \
+ svc-interface-skeleton-internal.h \
text-channel.c \
tls-certificate.c \
tls-certificate-rejection.c \
diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c
index 643d4303a..f0202bff7 100644
--- a/telepathy-glib/account-manager.c
+++ b/telepathy-glib/account-manager.c
@@ -566,7 +566,6 @@ tp_account_manager_class_init (TpAccountManagerClass *klass)
proxy_class->interface = TP_IFACE_QUARK_ACCOUNT_MANAGER;
proxy_class->list_features = _tp_account_manager_list_features;
- tp_account_manager_init_known_interfaces ();
/**
* TpAccountManager::account-usability-changed:
@@ -672,37 +671,6 @@ tp_account_manager_class_init (TpAccountManagerClass *klass)
G_TYPE_STRING); /* stauts message*/
}
-/**
- * tp_account_manager_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpAccountManager have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_ACCOUNT_MANAGER.
- *
- * Since: 0.7.32
- */
-void
-tp_account_manager_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_ACCOUNT_MANAGER;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_account_manager_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
-}
-
static TpAccountManager *
_tp_account_manager_new_internal (TpClientFactory *factory,
TpDBusDaemon *bus_daemon)
diff --git a/telepathy-glib/account-manager.h b/telepathy-glib/account-manager.h
index d5f330db7..f66a82fef 100644
--- a/telepathy-glib/account-manager.h
+++ b/telepathy-glib/account-manager.h
@@ -88,8 +88,6 @@ gboolean tp_account_manager_can_set_default (void);
TpAccountManager *tp_account_manager_dup (void) G_GNUC_WARN_UNUSED_RESULT;
-void tp_account_manager_init_known_interfaces (void);
-
_TP_AVAILABLE_IN_0_20
GList *tp_account_manager_dup_usable_accounts (TpAccountManager *manager)
G_GNUC_WARN_UNUSED_RESULT;
diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index b578ee66b..e42f15939 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -2122,38 +2122,6 @@ tp_account_class_init (TpAccountClass *klass)
proxy_class->interface = TP_IFACE_QUARK_ACCOUNT;
proxy_class->list_features = _tp_account_list_features;
- tp_account_init_known_interfaces ();
-}
-
-/**
- * tp_account_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpAccount have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_ACCOUNT.
- *
- * Since: 0.7.32
- */
-void
-tp_account_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_ACCOUNT;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_account_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
}
TpAccount *
diff --git a/telepathy-glib/account.h b/telepathy-glib/account.h
index ff36adf04..14215138a 100644
--- a/telepathy-glib/account.h
+++ b/telepathy-glib/account.h
@@ -88,8 +88,6 @@ GQuark tp_account_get_feature_quark_addressing (void) G_GNUC_CONST;
const gchar *tp_account_get_path_suffix (TpAccount *account);
-void tp_account_init_known_interfaces (void);
-
TpConnection *tp_account_get_connection (TpAccount *account);
const gchar *tp_account_get_display_name (TpAccount *account);
diff --git a/telepathy-glib/add-dispatch-operation-context-internal.h b/telepathy-glib/add-dispatch-operation-context-internal.h
index fdec31fce..c186ad8b1 100644
--- a/telepathy-glib/add-dispatch-operation-context-internal.h
+++ b/telepathy-glib/add-dispatch-operation-context-internal.h
@@ -55,7 +55,7 @@ TpAddDispatchOperationContext * _tp_add_dispatch_operation_context_new (
TpConnection *connection,
TpChannel *channel,
TpChannelDispatchOperation *dispatch_operation,
- DBusGMethodInvocation *dbus_context);
+ GDBusMethodInvocation *dbus_context);
TpAddDispatchOperationContextState _tp_add_dispatch_operation_context_get_state
(TpAddDispatchOperationContext *self);
diff --git a/telepathy-glib/add-dispatch-operation-context.c b/telepathy-glib/add-dispatch-operation-context.c
index b7a5e84d5..ebaec360c 100644
--- a/telepathy-glib/add-dispatch-operation-context.c
+++ b/telepathy-glib/add-dispatch-operation-context.c
@@ -78,7 +78,7 @@ struct _TpAddDispatchOperationContextPrivate
{
TpAddDispatchOperationContextState state;
GSimpleAsyncResult *result;
- DBusGMethodInvocation *dbus_context;
+ GDBusMethodInvocation *dbus_context;
/* Number of calls we are waiting they return. Once they have all returned
* the context is considered as prepared */
@@ -324,14 +324,14 @@ tp_add_dispatch_operation_context_class_init (
/**
* TpAddDispatchOperationContext:dbus-context: (skip)
*
- * The #DBusGMethodInvocation representing the D-Bus context of the
+ * The #GDBusMethodInvocation representing the D-Bus context of the
* AddDispatchOperation call.
* Can only be written during construction.
*
* Since: 0.11.5
*/
param_spec = g_param_spec_pointer ("dbus-context", "D-Bus context",
- "The DBusGMethodInvocation associated with the AddDispatchOperation call",
+ "The GDBusMethodInvocation associated with the AddDispatchOperation call",
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_DBUS_CONTEXT,
param_spec);
@@ -343,7 +343,7 @@ _tp_add_dispatch_operation_context_new (
TpConnection *connection,
TpChannel *channel,
TpChannelDispatchOperation *dispatch_operation,
- DBusGMethodInvocation *dbus_context)
+ GDBusMethodInvocation *dbus_context)
{
return g_object_new (TP_TYPE_ADD_DISPATCH_OPERATION_CONTEXT,
"account", account,
@@ -372,7 +372,7 @@ tp_add_dispatch_operation_context_accept (TpAddDispatchOperationContext *self)
g_return_if_fail (self->priv->dbus_context != NULL);
self->priv->state = TP_ADD_DISPATCH_OPERATION_CONTEXT_STATE_DONE;
- dbus_g_method_return (self->priv->dbus_context);
+ g_dbus_method_invocation_return_value (self->priv->dbus_context, NULL);
self->priv->dbus_context = NULL;
}
@@ -396,7 +396,7 @@ tp_add_dispatch_operation_context_fail (TpAddDispatchOperationContext *self,
g_return_if_fail (self->priv->dbus_context != NULL);
self->priv->state = TP_ADD_DISPATCH_OPERATION_CONTEXT_STATE_FAILED;
- dbus_g_method_return_error (self->priv->dbus_context, error);
+ g_dbus_method_invocation_return_gerror (self->priv->dbus_context, error);
self->priv->dbus_context = NULL;
}
diff --git a/telepathy-glib/base-call-channel.c b/telepathy-glib/base-call-channel.c
index 8c5c90397..875348bd1 100644
--- a/telepathy-glib/base-call-channel.c
+++ b/telepathy-glib/base-call-channel.c
@@ -1268,7 +1268,7 @@ tp_base_call_channel_is_accepted (TpBaseCallChannel *self)
static void
tp_base_call_channel_set_ringing (TpSvcChannelTypeCall1 *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallChannel *self = TP_BASE_CALL_CHANNEL (iface);
TpBaseCallChannelClass *klass = TP_BASE_CALL_CHANNEL_GET_CLASS (self);
@@ -1278,13 +1278,13 @@ tp_base_call_channel_set_ringing (TpSvcChannelTypeCall1 *iface,
{
GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Call was requested. Ringing doesn't make sense." };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
}
else if (self->priv->state != TP_CALL_STATE_INITIALISED)
{
GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE,
"Call is not in the right state for Ringing." };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
}
else
{
@@ -1309,7 +1309,7 @@ tp_base_call_channel_set_ringing (TpSvcChannelTypeCall1 *iface,
static void
tp_base_call_channel_set_queued (TpSvcChannelTypeCall1 *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallChannel *self = TP_BASE_CALL_CHANNEL (iface);
TpBaseCallChannelClass *klass = TP_BASE_CALL_CHANNEL_GET_CLASS (self);
@@ -1319,14 +1319,14 @@ tp_base_call_channel_set_queued (TpSvcChannelTypeCall1 *iface,
{
GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Call was requested. Queued doesn't make sense." };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
}
else if (self->priv->state != TP_CALL_STATE_INITIALISING &&
self->priv->state != TP_CALL_STATE_INITIALISED)
{
GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE,
"Call is not in the right state for Queuing." };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
}
else
{
@@ -1351,7 +1351,7 @@ tp_base_call_channel_set_queued (TpSvcChannelTypeCall1 *iface,
static void
raise_accept_state_error (TpBaseCallChannel *self,
TpCallState expected,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GError *e = NULL;
@@ -1360,13 +1360,13 @@ raise_accept_state_error (TpBaseCallChannel *self,
call_state_to_string (expected),
call_state_to_string (self->priv->state));
- dbus_g_method_return_error (context, e);
+ g_dbus_method_invocation_return_gerror (context, e);
g_error_free (e);
}
static void
tp_base_call_channel_accept (TpSvcChannelTypeCall1 *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallChannel *self = TP_BASE_CALL_CHANNEL (iface);
TpBaseCallChannelClass *klass = TP_BASE_CALL_CHANNEL_GET_CLASS (self);
@@ -1429,7 +1429,7 @@ tp_base_call_channel_hangup (TpSvcChannelTypeCall1 *iface,
guint reason,
const gchar *detailed_reason,
const gchar *message,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallChannel *self = TP_BASE_CALL_CHANNEL (iface);
TpBaseCallChannelClass *klass = TP_BASE_CALL_CHANNEL_GET_CLASS (self);
@@ -1439,7 +1439,7 @@ tp_base_call_channel_hangup (TpSvcChannelTypeCall1 *iface,
{
GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE,
"This call has already ended" };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
return;
}
@@ -1458,7 +1458,7 @@ tp_base_call_channel_add_content_dbus (TpSvcChannelTypeCall1 *iface,
const gchar *name,
TpMediaStreamType mtype,
TpMediaStreamDirection initial_direction,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallChannel *self = TP_BASE_CALL_CHANNEL (iface);
TpBaseCallChannelClass *klass = TP_BASE_CALL_CHANNEL_GET_CLASS (self);
@@ -1509,7 +1509,7 @@ tp_base_call_channel_add_content_dbus (TpSvcChannelTypeCall1 *iface,
return;
error:
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
diff --git a/telepathy-glib/base-call-content.c b/telepathy-glib/base-call-content.c
index 68b7c3706..d4f9d2322 100644
--- a/telepathy-glib/base-call-content.c
+++ b/telepathy-glib/base-call-content.c
@@ -756,7 +756,7 @@ tp_base_call_content_remove_stream (TpBaseCallContent *self,
static void
tp_call_content_remove (TpSvcCall1Content *content,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallContent *self = TP_BASE_CALL_CONTENT (content);
@@ -764,7 +764,7 @@ tp_call_content_remove (TpSvcCall1Content *content,
{
GError error = { TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
"Contents are not mutable" };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -864,7 +864,7 @@ _tp_base_call_content_accepted (TpBaseCallContent *self,
static void
tp_call_content_start_tone (TpSvcCall1ContentInterfaceDTMF1 *dtmf,
guchar event,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallContent *self = TP_BASE_CALL_CONTENT (dtmf);
TpBaseCallContentClass *klass = TP_BASE_CALL_CONTENT_GET_CLASS (self);
@@ -874,13 +874,13 @@ tp_call_content_start_tone (TpSvcCall1ContentInterfaceDTMF1 *dtmf,
{
GError err = {G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD,
"Method does not exist"};
- dbus_g_method_return_error (context, &err);
+ g_dbus_method_invocation_return_gerror (context, &err);
return;
}
if (!klass->start_tone (self, event, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
return;
}
@@ -890,7 +890,7 @@ tp_call_content_start_tone (TpSvcCall1ContentInterfaceDTMF1 *dtmf,
static void
tp_call_content_stop_tone (TpSvcCall1ContentInterfaceDTMF1 *dtmf,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallContent *self = TP_BASE_CALL_CONTENT (dtmf);
TpBaseCallContentClass *klass = TP_BASE_CALL_CONTENT_GET_CLASS (self);
@@ -900,13 +900,13 @@ tp_call_content_stop_tone (TpSvcCall1ContentInterfaceDTMF1 *dtmf,
{
GError err = {G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD,
"Method does not exist"};
- dbus_g_method_return_error (context, &err);
+ g_dbus_method_invocation_return_gerror (context, &err);
return;
}
if (!klass->stop_tone (self, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
return;
}
@@ -917,7 +917,7 @@ tp_call_content_stop_tone (TpSvcCall1ContentInterfaceDTMF1 *dtmf,
static void
tp_call_content_multiple_tones (TpSvcCall1ContentInterfaceDTMF1 *dtmf,
const gchar *tones,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallContent *self = TP_BASE_CALL_CONTENT (dtmf);
TpBaseCallContentClass *klass = TP_BASE_CALL_CONTENT_GET_CLASS (self);
@@ -927,13 +927,13 @@ tp_call_content_multiple_tones (TpSvcCall1ContentInterfaceDTMF1 *dtmf,
{
GError err = {G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD,
"Method does not exist"};
- dbus_g_method_return_error (context, &err);
+ g_dbus_method_invocation_return_gerror (context, &err);
return;
}
if (!klass->multiple_tones (self, tones, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
return;
}
diff --git a/telepathy-glib/base-call-stream.c b/telepathy-glib/base-call-stream.c
index 370a1c473..7bfbe8039 100644
--- a/telepathy-glib/base-call-stream.c
+++ b/telepathy-glib/base-call-stream.c
@@ -742,7 +742,7 @@ tp_base_call_stream_remove_member (TpBaseCallStream *self,
static void
tp_base_call_stream_set_sending_dbus (TpSvcCall1Stream *iface,
gboolean sending,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallStream *self = TP_BASE_CALL_STREAM (iface);
GError *error = NULL;
@@ -756,7 +756,7 @@ tp_base_call_stream_set_sending_dbus (TpSvcCall1Stream *iface,
}
else
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
}
g_clear_error (&error);
@@ -766,7 +766,7 @@ static void
tp_base_call_stream_request_receiving (TpSvcCall1Stream *iface,
TpHandle contact,
gboolean receiving,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseCallStream *self = TP_BASE_CALL_STREAM (iface);
TpBaseCallStreamClass *klass = TP_BASE_CALL_STREAM_GET_CLASS (self);
@@ -825,7 +825,7 @@ out:
return;
error:
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
}
diff --git a/telepathy-glib/base-channel.c b/telepathy-glib/base-channel.c
index 7e3ee42b2..e14545e79 100644
--- a/telepathy-glib/base-channel.c
+++ b/telepathy-glib/base-channel.c
@@ -1066,16 +1066,15 @@ tp_base_channel_class_init (TpBaseChannelClass *tp_base_channel_class)
static void
tp_base_channel_close_dbus (
TpSvcChannel *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseChannel *chan = TP_BASE_CHANNEL (iface);
if (DEBUGGING)
{
- gchar *caller = dbus_g_method_get_sender (context);
+ const gchar *caller = g_dbus_method_invocation_get_sender (context);
DEBUG ("called by %s", caller);
- g_free (caller);
}
tp_base_channel_close (chan);
diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c
index 8f61d70c0..2a6006a40 100644
--- a/telepathy-glib/base-client.c
+++ b/telepathy-glib/base-client.c
@@ -227,8 +227,6 @@ enum {
static guint signals[N_SIGNALS] = { 0 };
-static dbus_int32_t clients_slot = -1;
-
typedef enum {
CLIENT_IS_OBSERVER = 1 << 0,
CLIENT_IS_APPROVER = 1 << 1,
@@ -246,7 +244,7 @@ struct _TpBaseClientPrivate
gchar *name;
gboolean uniquify_name;
/* reffed */
- DBusConnection *libdbus;
+ GDBusConnection *gdbus;
gboolean registered;
ClientFlags flags;
@@ -811,6 +809,19 @@ tp_base_client_add_handler_capabilities_varargs (TpBaseClient *self,
va_end (ap);
}
+static GQuark
+clients_quark (void)
+{
+ static GQuark q = 0;
+
+ if (G_UNLIKELY (q == 0))
+ {
+ q = g_quark_from_static_string ("tp_base_client_register");
+ }
+
+ return q;
+}
+
/**
* tp_base_client_register:
* @self: a #TpBaseClient, which must not have been registered with
@@ -857,16 +868,10 @@ tp_base_client_register (TpBaseClient *self,
return TRUE;
/* Client is an handler */
- self->priv->libdbus = dbus_connection_ref (
- dbus_g_connection_get_connection (
- tp_proxy_get_dbus_connection (self->priv->dbus)));
-
- /* one ref per TpBaseClient with CLIENT_IS_HANDLER, released
- * in tp_base_client_unregister() */
- if (!dbus_connection_allocate_data_slot (&clients_slot))
- ERROR ("Out of memory");
+ self->priv->gdbus = g_object_ref (
+ tp_proxy_get_dbus_connection (self->priv->dbus));
- clients = dbus_connection_get_data (self->priv->libdbus, clients_slot);
+ clients = g_object_get_qdata (G_OBJECT (self->priv->gdbus), clients_quark ());
if (clients == NULL)
{
@@ -876,8 +881,8 @@ tp_base_client_register (TpBaseClient *self,
* borrowed client path => borrowed (GHashTable *) */
clients = g_hash_table_new (g_str_hash, g_str_equal);
- dbus_connection_set_data (self->priv->libdbus, clients_slot, clients,
- (DBusFreeFunction) g_hash_table_unref);
+ g_object_set_qdata_full (G_OBJECT (self->priv->gdbus),
+ clients_quark (), clients, (GDestroyNotify) g_hash_table_unref);
}
g_hash_table_insert (clients, self->priv->object_path, self->priv->my_chans);
@@ -930,12 +935,9 @@ tp_base_client_dup_handled_channels (TpBaseClient *self)
g_return_val_if_fail (self->priv->flags & CLIENT_IS_HANDLER, NULL);
- if (clients_slot == -1)
- return NULL;
-
set = g_hash_table_new (g_str_hash, g_str_equal);
- clients = dbus_connection_get_data (self->priv->libdbus, clients_slot);
+ clients = g_object_get_qdata (G_OBJECT (self->priv->gdbus), clients_quark ());
g_hash_table_iter_init (&iter, clients);
while (g_hash_table_iter_next (&iter, NULL, &value))
@@ -1565,7 +1567,7 @@ _tp_base_client_observe_channel (TpSvcClientObserver *iface,
const gchar *dispatch_operation_path,
GHashTable *requests_hash,
GHashTable *observer_info,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseClient *self = TP_BASE_CLIENT (iface);
TpObserveChannelContext *ctx;
@@ -1674,8 +1676,7 @@ out:
if (error == NULL)
return;
- dbus_g_method_return_error (context, error);
- g_error_free (error);
+ g_dbus_method_invocation_take_error (context, error);
}
static void
@@ -1732,7 +1733,7 @@ static void
_tp_base_client_add_dispatch_operation (TpSvcClientApprover *iface,
const gchar *dispatch_operation_path,
GHashTable *properties,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseClient *self = TP_BASE_CLIENT (iface);
TpAddDispatchOperationContext *ctx;
@@ -1852,9 +1853,7 @@ out:
if (error == NULL)
return;
- dbus_g_method_return_error (context, error);
- g_error_free (error);
-
+ g_dbus_method_invocation_take_error (context, error);
}
static void
@@ -2080,7 +2079,7 @@ _tp_base_client_handle_channel (TpSvcClientHandler *iface,
GHashTable *requests_hash,
gint64 user_action_time,
GHashTable *handler_info,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseClient *self = TP_BASE_CLIENT (iface);
TpHandleChannelContext *ctx;
@@ -2170,8 +2169,7 @@ out:
if (error == NULL)
return;
- dbus_g_method_return_error (context, error);
- g_error_free (error);
+ g_dbus_method_invocation_take_error (context, error);
}
static void
@@ -2236,7 +2234,7 @@ static void
_tp_base_client_add_request (TpSvcClientInterfaceRequests *iface,
const gchar *path,
GHashTable *properties,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseClient *self = TP_BASE_CLIENT (iface);
TpChannelRequest *request;
@@ -2287,8 +2285,7 @@ _tp_base_client_add_request (TpSvcClientInterfaceRequests *iface,
err:
g_clear_object (&account);
- dbus_g_method_return_error (context, error);
- g_error_free (error);
+ g_dbus_method_invocation_take_error (context, error);
}
static void
@@ -2296,7 +2293,7 @@ _tp_base_client_remove_request (TpSvcClientInterfaceRequests *iface,
const gchar *path,
const gchar *error,
const gchar *reason,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseClient *self = TP_BASE_CLIENT (iface);
TpChannelRequest *request;
@@ -2304,10 +2301,8 @@ _tp_base_client_remove_request (TpSvcClientInterfaceRequests *iface,
request = find_request_by_path (self, path);
if (request == NULL)
{
- GError err = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
- "Uknown ChannelRequest" };
-
- dbus_g_method_return_error (context, &err);
+ g_dbus_method_invocation_return_error_literal (context,
+ TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Unknown ChannelRequest");
return;
}
@@ -2530,14 +2525,12 @@ tp_base_client_unregister (TpBaseClient *self)
{
GHashTable *clients;
- clients = dbus_connection_get_data (self->priv->libdbus, clients_slot);
+ clients = g_object_get_qdata (G_OBJECT (self->priv->gdbus),
+ clients_quark ());
if (clients != NULL)
g_hash_table_remove (clients, self->priv->object_path);
- dbus_connection_unref (self->priv->libdbus);
- self->priv->libdbus = NULL;
-
- dbus_connection_free_data_slot (&clients_slot);
+ g_clear_object (&self->priv->gdbus);
}
self->priv->registered = FALSE;
diff --git a/telepathy-glib/base-connection-manager.c b/telepathy-glib/base-connection-manager.c
index b68d44236..b21accb75 100644
--- a/telepathy-glib/base-connection-manager.c
+++ b/telepathy-glib/base-connection-manager.c
@@ -740,7 +740,7 @@ static void
tp_base_connection_manager_request_connection (TpSvcConnectionManager *iface,
const gchar *proto,
GHashTable *parameters,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseConnectionManager *self = TP_BASE_CONNECTION_MANAGER (iface);
TpBaseConnectionManagerClass *cls =
@@ -800,7 +800,7 @@ tp_base_connection_manager_request_connection (TpSvcConnectionManager *iface,
return;
ERROR:
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c
index 290ea1ae2..0b278837f 100644
--- a/telepathy-glib/base-connection.c
+++ b/telepathy-glib/base-connection.c
@@ -221,7 +221,7 @@
/**
* TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED: (skip)
* @conn: A TpBaseConnection
- * @context: A DBusGMethodInvocation
+ * @context: A GDBusMethodInvocation
*
* If @conn is not in state #TP_CONNECTION_STATUS_CONNECTED, complete the
* D-Bus method invocation @context by raising the Telepathy error
@@ -330,7 +330,7 @@ struct _TpBaseConnectionPrivate
* so that we can use GArray's convenient auto-null-termination. */
GArray *interfaces;
- /* Array of DBusGMethodInvocation * representing Disconnect calls.
+ /* Array of GDBusMethodInvocation * representing Disconnect calls.
* If NULL and we are in a state != DISCONNECTED, then we have not started
* shutting down yet.
* If NULL and we are in state DISCONNECTED, then we have finished shutting
@@ -483,6 +483,8 @@ tp_base_connection_unregister (TpBaseConnection *self)
if (priv->bus_name != NULL)
tp_dbus_daemon_release_name (priv->bus_proxy, priv->bus_name, NULL);
+ else
+ DEBUG ("not releasing bus name: nothing to release");
priv->been_registered = FALSE;
}
@@ -1456,7 +1458,7 @@ conn_status_reason_from_g_error (GError *error)
static void
tp_base_connection_connect (TpSvcConnection *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseConnection *self = TP_BASE_CONNECTION (iface);
TpBaseConnectionClass *cls = TP_BASE_CONNECTION_GET_CLASS (self);
@@ -1483,7 +1485,7 @@ tp_base_connection_connect (TpSvcConnection *iface,
TP_CONNECTION_STATUS_DISCONNECTED,
conn_status_reason_from_g_error (error));
}
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -1493,7 +1495,7 @@ tp_base_connection_connect (TpSvcConnection *iface,
static void
tp_base_connection_disconnect (TpSvcConnection *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseConnection *self = TP_BASE_CONNECTION (iface);
@@ -2164,10 +2166,10 @@ tp_base_connection_add_client_interest (TpBaseConnection *self,
static void
tp_base_connection_dbus_add_client_interest (TpSvcConnection *svc,
const gchar **interests,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseConnection *self = (TpBaseConnection *) svc;
- gchar *unique_name = NULL;
+ const gchar *unique_name = NULL;
g_return_if_fail (TP_IS_BASE_CONNECTION (self));
g_return_if_fail (self->priv->bus_proxy != NULL);
@@ -2175,22 +2177,21 @@ tp_base_connection_dbus_add_client_interest (TpSvcConnection *svc,
if (interests == NULL || interests[0] == NULL)
goto finally;
- unique_name = dbus_g_method_get_sender (context);
+ unique_name = g_dbus_method_invocation_get_sender (context);
tp_base_connection_add_client_interest_impl (self, unique_name,
(const gchar * const *) interests, FALSE);
finally:
tp_svc_connection_return_from_add_client_interest (context);
- g_free (unique_name);
}
static void
tp_base_connection_dbus_remove_client_interest (TpSvcConnection *svc,
const gchar **interests,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
- gchar *unique_name = NULL;
+ const gchar *unique_name = NULL;
const gchar **interest;
TpBaseConnection *self = (TpBaseConnection *) svc;
gpointer name_in_hash, count_p;
@@ -2202,7 +2203,7 @@ tp_base_connection_dbus_remove_client_interest (TpSvcConnection *svc,
if (interests == NULL || interests[0] == NULL)
goto finally;
- unique_name = dbus_g_method_get_sender (context);
+ unique_name = g_dbus_method_invocation_get_sender (context);
/* this method isn't really meant to fail, so we might as well return now */
@@ -2285,7 +2286,6 @@ tp_base_connection_dbus_remove_client_interest (TpSvcConnection *svc,
finally:
tp_svc_connection_return_from_remove_client_interest (context);
- g_free (unique_name);
}
/* The handling of calls to Connection.Interface.Requests.CreateChannel is
@@ -2294,25 +2294,25 @@ finally:
*/
static void conn_requests_check_basic_properties (TpBaseConnection *self,
GHashTable *requested_properties, TpChannelManagerRequestMethod method,
- DBusGMethodInvocation *context);
+ GDBusMethodInvocation *context);
static void
conn_requests_requestotron_validate_handle (TpBaseConnection *self,
GHashTable *requested_properties, TpChannelManagerRequestMethod method,
const gchar *type, TpEntityType target_entity_type,
TpHandle target_handle, const gchar *target_id,
- DBusGMethodInvocation *context);
+ GDBusMethodInvocation *context);
static void conn_requests_offer_request (TpBaseConnection *self,
GHashTable *requested_properties, TpChannelManagerRequestMethod method,
const gchar *type, TpEntityType target_entity_type,
- TpHandle target_handle, DBusGMethodInvocation *context);
+ TpHandle target_handle, GDBusMethodInvocation *context);
#define RETURN_INVALID_ARGUMENT(message) \
G_STMT_START { \
GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, message }; \
- dbus_g_method_return_error (context, &e); \
+ g_dbus_method_invocation_return_gerror (context, &e); \
return; \
} G_STMT_END
@@ -2321,7 +2321,7 @@ static void
conn_requests_requestotron (TpBaseConnection *self,
GHashTable *requested_properties,
TpChannelManagerRequestMethod method,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (self, context);
@@ -2337,7 +2337,7 @@ static void
conn_requests_check_basic_properties (TpBaseConnection *self,
GHashTable *requested_properties,
TpChannelManagerRequestMethod method,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
/* Step 1:
* Check that ChannelType, TargetEntityType, TargetHandle, TargetID have
@@ -2416,7 +2416,7 @@ conn_requests_requestotron_validate_handle (TpBaseConnection *self,
TpEntityType target_entity_type,
TpHandle target_handle,
const gchar *target_id,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
/* Step 2: Validate the supplied set of Handle properties */
TpHandleRepoIface *handles = NULL;
@@ -2453,7 +2453,7 @@ conn_requests_requestotron_validate_handle (TpBaseConnection *self,
GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE,
"Handle type not supported by this connection manager" };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
return;
}
@@ -2469,7 +2469,7 @@ conn_requests_requestotron_validate_handle (TpBaseConnection *self,
*/
error->domain = TP_ERROR;
error->code = TP_ERROR_INVALID_HANDLE;
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -2492,7 +2492,7 @@ conn_requests_requestotron_validate_handle (TpBaseConnection *self,
{
error->domain = TP_ERROR;
error->code = TP_ERROR_INVALID_HANDLE;
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -2539,7 +2539,7 @@ conn_requests_offer_request (TpBaseConnection *self,
const gchar *type,
TpEntityType target_entity_type,
TpHandle target_handle,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
/* Step 3: offer the incoming, vaguely sanitized request to the channel
* managers.
@@ -2587,7 +2587,7 @@ conn_requests_offer_request (TpBaseConnection *self,
static void
conn_requests_create_channel (TpSvcConnectionInterfaceRequests *svc,
GHashTable *requested_properties,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseConnection *self = TP_BASE_CONNECTION (svc);
@@ -2599,7 +2599,7 @@ conn_requests_create_channel (TpSvcConnectionInterfaceRequests *svc,
static void
conn_requests_ensure_channel (TpSvcConnectionInterfaceRequests *svc,
GHashTable *requested_properties,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseConnection *self = TP_BASE_CONNECTION (svc);
@@ -2980,7 +2980,7 @@ static void
contacts_get_contact_attributes_impl (TpSvcConnection *iface,
const GArray *handles,
const char **interfaces,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseConnection *conn = TP_BASE_CONNECTION (iface);
GHashTable *result;
@@ -3002,7 +3002,7 @@ typedef struct
{
TpBaseConnection *conn;
GStrv interfaces;
- DBusGMethodInvocation *context;
+ GDBusMethodInvocation *context;
} GetContactByIdData;
static void
@@ -3022,7 +3022,7 @@ ensure_handle_cb (GObject *source,
if (handle == 0)
{
- dbus_g_method_return_error (data->context, error);
+ g_dbus_method_invocation_return_gerror (data->context, error);
g_clear_error (&error);
goto out;
}
@@ -3053,7 +3053,7 @@ static void
contacts_get_contact_by_id_impl (TpSvcConnection *iface,
const gchar *id,
const gchar **interfaces,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseConnection *conn = TP_BASE_CONNECTION (iface);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn,
diff --git a/telepathy-glib/base-connection.h b/telepathy-glib/base-connection.h
index 81610c5ac..91dc176a8 100644
--- a/telepathy-glib/base-connection.h
+++ b/telepathy-glib/base-connection.h
@@ -198,7 +198,7 @@ gboolean tp_base_connection_channel_manager_iter_next (
\
if (!tp_base_connection_check_connected (c_, &e_)) \
{ \
- dbus_g_method_return_error ((context), e_); \
+ g_dbus_method_invocation_return_gerror ((context), e_); \
g_error_free (e_); \
return; \
} \
diff --git a/telepathy-glib/base-contact-list.c b/telepathy-glib/base-contact-list.c
index 4018fbd36..a81e2aa1d 100644
--- a/telepathy-glib/base-contact-list.c
+++ b/telepathy-glib/base-contact-list.c
@@ -278,7 +278,7 @@ struct _TpBaseContactListPrivate
/* owned gchar* => owned TpHandleSet */
GHashTable *groups;
- /* DBusGMethodInvocation *s for calls to RequestBlockedContacts which are
+ /* GDBusMethodInvocation *s for calls to RequestBlockedContacts which are
* waiting for the contact list to (fail to) be downloaded.
*/
GQueue blocked_contact_requests;
@@ -530,11 +530,11 @@ tp_base_contact_list_fail_blocked_contact_requests (
TpBaseContactList *self,
const GError *error)
{
- DBusGMethodInvocation *context;
+ GDBusMethodInvocation *context;
while ((context = g_queue_pop_head (&self->priv->blocked_contact_requests))
!= NULL)
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
}
static void
@@ -994,7 +994,7 @@ tp_base_contact_list_set_list_received (TpBaseContactList *self)
self->priv->blocked_contact_requests.length > 0)
{
GHashTable *map = tp_handle_set_to_identifier_map (blocked);
- DBusGMethodInvocation *context;
+ GDBusMethodInvocation *context;
while ((context = g_queue_pop_head (
&self->priv->blocked_contact_requests)) != NULL)
@@ -3624,7 +3624,7 @@ static void
tp_base_contact_list_mixin_get_contact_list_attributes (
TpSvcConnectionInterfaceContactList1 *svc,
const gchar **interfaces,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -3635,7 +3635,7 @@ tp_base_contact_list_mixin_get_contact_list_attributes (
if (tp_base_contact_list_get_state (self, &error)
!= TP_CONTACT_LIST_STATE_SUCCESS)
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
}
else
@@ -3892,13 +3892,13 @@ tp_base_contact_list_check_group_change (TpBaseContactList *self,
/* Normally we'd use the return_from functions, but these methods all return
* void, and life's too short. */
static void
-tp_base_contact_list_mixin_return_void (DBusGMethodInvocation *context,
+tp_base_contact_list_mixin_return_void (GDBusMethodInvocation *context,
const GError *error)
{
if (error == NULL)
- dbus_g_method_return (context);
+ g_dbus_method_invocation_return_value (context, NULL);
else
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
}
static void
@@ -3919,7 +3919,7 @@ tp_base_contact_list_mixin_request_subscription (
TpSvcConnectionInterfaceContactList1 *svc,
const GArray *contacts,
const gchar *message,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -3958,7 +3958,7 @@ static void
tp_base_contact_list_mixin_authorize_publication (
TpSvcConnectionInterfaceContactList1 *svc,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -3997,7 +3997,7 @@ static void
tp_base_contact_list_mixin_remove_contacts (
TpSvcConnectionInterfaceContactList1 *svc,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4036,7 +4036,7 @@ static void
tp_base_contact_list_mixin_unsubscribe (
TpSvcConnectionInterfaceContactList1 *svc,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4075,7 +4075,7 @@ static void
tp_base_contact_list_mixin_unpublish (
TpSvcConnectionInterfaceContactList1 *svc,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4273,7 +4273,7 @@ tp_base_contact_list_mixin_download_cb (GObject *source,
static void
tp_base_contact_list_mixin_download (
TpSvcConnectionInterfaceContactList1 *svc,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4384,7 +4384,7 @@ tp_base_contact_list_mixin_set_contact_groups (
TpSvcConnectionInterfaceContactGroups1 *svc,
guint contact,
const gchar **groups,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4448,7 +4448,7 @@ tp_base_contact_list_mixin_set_group_members (
TpSvcConnectionInterfaceContactGroups1 *svc,
const gchar *group,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4489,7 +4489,7 @@ tp_base_contact_list_mixin_add_to_group (
TpSvcConnectionInterfaceContactGroups1 *svc,
const gchar *group,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4536,7 +4536,7 @@ tp_base_contact_list_mixin_remove_from_group (
TpSvcConnectionInterfaceContactGroups1 *svc,
const gchar *group,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4585,7 +4585,7 @@ static void
tp_base_contact_list_mixin_remove_group (
TpSvcConnectionInterfaceContactGroups1 *svc,
const gchar *group,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4631,7 +4631,7 @@ tp_base_contact_list_mixin_rename_group (
TpSvcConnectionInterfaceContactGroups1 *svc,
const gchar *before,
const gchar *after,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4762,14 +4762,14 @@ tp_base_contact_list_mixin_groups_iface_init (gpointer klass)
{ \
GError e = { TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, \
"ContactBlocking is not supported on this connection" }; \
- dbus_g_method_return_error (context, &e); \
+ g_dbus_method_invocation_return_gerror (context, &e); \
return; \
}
static void
tp_base_contact_list_mixin_request_blocked_contacts (
TpSvcConnectionInterfaceContactBlocking1 *svc,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4785,7 +4785,7 @@ tp_base_contact_list_mixin_request_blocked_contacts (
case TP_CONTACT_LIST_STATE_FAILURE:
g_warn_if_fail (self->priv->failure != NULL);
- dbus_g_method_return_error (context, self->priv->failure);
+ g_dbus_method_invocation_return_gerror (context, self->priv->failure);
break;
case TP_CONTACT_LIST_STATE_SUCCESS:
@@ -4805,7 +4805,7 @@ tp_base_contact_list_mixin_request_blocked_contacts (
GError broken = { TP_ERROR, TP_ERROR_CONFUSED,
"My internal list of blocked contacts is inconsistent! "
"I apologise for any inconvenience caused." };
- dbus_g_method_return_error (context, &broken);
+ g_dbus_method_invocation_return_gerror (context, &broken);
g_return_if_reached ();
}
}
@@ -4818,7 +4818,7 @@ blocked_cb (
gpointer user_data)
{
TpBaseContactList *self = TP_BASE_CONTACT_LIST (source);
- DBusGMethodInvocation *context = user_data;
+ GDBusMethodInvocation *context = user_data;
GError *error = NULL;
if (tp_base_contact_list_block_contacts_with_abuse_finish (self, result,
@@ -4829,7 +4829,7 @@ blocked_cb (
}
else
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
}
}
@@ -4839,7 +4839,7 @@ tp_base_contact_list_mixin_block_contacts (
TpSvcConnectionInterfaceContactBlocking1 *svc,
const GArray *contacts_arr,
gboolean report_abusive,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
@@ -4861,7 +4861,7 @@ unblocked_cb (
gpointer user_data)
{
TpBaseContactList *self = TP_BASE_CONTACT_LIST (source);
- DBusGMethodInvocation *context = user_data;
+ GDBusMethodInvocation *context = user_data;
GError *error = NULL;
if (tp_base_contact_list_unblock_contacts_finish (self, result, &error))
@@ -4870,7 +4870,7 @@ unblocked_cb (
}
else
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
}
}
@@ -4879,7 +4879,7 @@ static void
tp_base_contact_list_mixin_unblock_contacts (
TpSvcConnectionInterfaceContactBlocking1 *svc,
const GArray *contacts_arr,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseContactList *self = g_object_get_qdata ((GObject *) svc,
BASE_CONTACT_LIST);
diff --git a/telepathy-glib/base-media-call-channel.c b/telepathy-glib/base-media-call-channel.c
index 508e14569..ee093d8ea 100644
--- a/telepathy-glib/base-media-call-channel.c
+++ b/telepathy-glib/base-media-call-channel.c
@@ -461,7 +461,7 @@ hold_change_failed (TpBaseMediaCallChannel *self)
static void
tp_base_media_call_channel_get_hold_state (
TpSvcChannelInterfaceHold1 *hold_iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallChannel *self = TP_BASE_MEDIA_CALL_CHANNEL (hold_iface);
@@ -473,7 +473,7 @@ static void
tp_base_media_call_channel_request_hold (
TpSvcChannelInterfaceHold1 *hold_iface,
gboolean hold,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallChannel *self = TP_BASE_MEDIA_CALL_CHANNEL (hold_iface);
diff --git a/telepathy-glib/base-media-call-content.c b/telepathy-glib/base-media-call-content.c
index 6e94dd6f2..cfa0aff4e 100644
--- a/telepathy-glib/base-media-call-content.c
+++ b/telepathy-glib/base-media-call-content.c
@@ -676,7 +676,7 @@ static void
tp_base_media_call_content_update_local_media_description (
TpSvcCall1ContentInterfaceMedia *iface,
GHashTable *properties,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallContent *self = TP_BASE_MEDIA_CALL_CONTENT (iface);
GHashTable *current_properties;
@@ -691,7 +691,7 @@ tp_base_media_call_content_update_local_media_description (
{
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"The media description is missing the RemoteContact key." };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -703,7 +703,7 @@ tp_base_media_call_content_update_local_media_description (
{
GError error = { TP_ERROR, TP_ERROR_NOT_AVAILABLE,
"The initial MediaDescription object has not yet appeared" };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -715,7 +715,7 @@ tp_base_media_call_content_update_local_media_description (
{
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Codecs can not be empty" };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -725,7 +725,7 @@ tp_base_media_call_content_update_local_media_description (
GError error = { TP_ERROR, TP_ERROR_NOT_AVAILABLE,
"Can not update the media description while there is"
" an outstanding offer for this contact." };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -738,7 +738,7 @@ tp_base_media_call_content_update_local_media_description (
static void
tp_base_media_call_content_fail (TpSvcCall1ContentInterfaceMedia *iface,
const GValueArray *reason_array,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallContent *self = TP_BASE_MEDIA_CALL_CONTENT (iface);
TpBaseCallContent *content = (TpBaseCallContent *) self;
@@ -756,7 +756,7 @@ tp_base_media_call_content_acknowledge_dtmf_change (
TpSvcCall1ContentInterfaceMedia *iface,
guchar in_Event,
guint in_State,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallContent *self = TP_BASE_MEDIA_CALL_CONTENT (iface);
@@ -764,7 +764,7 @@ tp_base_media_call_content_acknowledge_dtmf_change (
{
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"The acknoledgement is not for the right event"};
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -773,7 +773,7 @@ tp_base_media_call_content_acknowledge_dtmf_change (
{
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"The new sending state can not be a pending state"};
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -785,7 +785,7 @@ tp_base_media_call_content_acknowledge_dtmf_change (
{
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Acknowledge rejected because we are not in a pending state"};
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -797,7 +797,7 @@ tp_base_media_call_content_acknowledge_dtmf_change (
{
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"The new sending state does not match the pending state"};
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
diff --git a/telepathy-glib/base-media-call-stream.c b/telepathy-glib/base-media-call-stream.c
index 47f1d6711..f04261253 100644
--- a/telepathy-glib/base-media-call-stream.c
+++ b/telepathy-glib/base-media-call-stream.c
@@ -1203,7 +1203,7 @@ static void
tp_base_media_call_stream_complete_sending_state_change (
TpSvcCall1StreamInterfaceMedia *iface,
TpStreamFlowState state,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallStream *self = TP_BASE_MEDIA_CALL_STREAM (iface);
TpBaseMediaCallStreamClass *klass =
@@ -1215,7 +1215,7 @@ tp_base_media_call_stream_complete_sending_state_change (
{
GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Invalid sending state transition" };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
return;
}
@@ -1243,7 +1243,7 @@ tp_base_media_call_stream_report_sending_failure (
TpCallStateChangeReason reason,
const gchar *dbus_reason,
const gchar *message,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallStream *self = TP_BASE_MEDIA_CALL_STREAM (iface);
TpBaseMediaCallStreamClass *klass =
@@ -1289,7 +1289,7 @@ static void
tp_base_media_call_stream_complete_receiving_state_change (
TpSvcCall1StreamInterfaceMedia *iface,
TpStreamFlowState state,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallStream *self = TP_BASE_MEDIA_CALL_STREAM (iface);
TpBaseMediaCallStreamClass *klass =
@@ -1301,7 +1301,7 @@ tp_base_media_call_stream_complete_receiving_state_change (
{
GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Invalid receiving state transition" };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
return;
}
@@ -1338,7 +1338,7 @@ tp_base_media_call_stream_report_receiving_failure (
TpCallStateChangeReason reason,
const gchar *dbus_reason,
const gchar *message,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallStream *self = TP_BASE_MEDIA_CALL_STREAM (iface);
TpBaseMediaCallStreamClass *klass =
@@ -1381,7 +1381,7 @@ static void
tp_base_media_call_stream_set_credentials (TpSvcCall1StreamInterfaceMedia *iface,
const gchar *username,
const gchar *password,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallStream *self = TP_BASE_MEDIA_CALL_STREAM (iface);
@@ -1406,7 +1406,7 @@ tp_base_media_call_stream_set_credentials (TpSvcCall1StreamInterfaceMedia *iface
static void
tp_base_media_call_stream_add_candidates (TpSvcCall1StreamInterfaceMedia *iface,
const GPtrArray *candidates,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallStream *self = TP_BASE_MEDIA_CALL_STREAM (iface);
TpBaseMediaCallStreamClass *klass =
@@ -1420,7 +1420,7 @@ tp_base_media_call_stream_add_candidates (TpSvcCall1StreamInterfaceMedia *iface,
GError e = { TP_ERROR, TP_ERROR_NOT_IMPLEMENTED,
"Connection Manager did not implement "
"TpBaseMediaCallStream::add_local_candidates vmethod" };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
return;
}
@@ -1430,7 +1430,7 @@ tp_base_media_call_stream_add_candidates (TpSvcCall1StreamInterfaceMedia *iface,
accepted_candidates = klass->add_local_candidates (self, candidates, &error);
if (accepted_candidates == NULL)
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
return;
}
@@ -1455,7 +1455,7 @@ tp_base_media_call_stream_add_candidates (TpSvcCall1StreamInterfaceMedia *iface,
static void
tp_base_media_call_stream_finish_initial_candidates (
TpSvcCall1StreamInterfaceMedia *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallStream *self = TP_BASE_MEDIA_CALL_STREAM (iface);
TpBaseMediaCallStreamClass *klass =
@@ -1465,7 +1465,7 @@ tp_base_media_call_stream_finish_initial_candidates (
if (klass->finish_initial_candidates != NULL)
if (!klass->finish_initial_candidates (self, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
return;
}
@@ -1477,7 +1477,7 @@ tp_base_media_call_stream_finish_initial_candidates (
static void
tp_base_media_call_stream_fail (TpSvcCall1StreamInterfaceMedia *iface,
const GValueArray *reason_array,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseMediaCallStream *self = TP_BASE_MEDIA_CALL_STREAM (iface);
TpBaseCallStream *base = TP_BASE_CALL_STREAM (self);
diff --git a/telepathy-glib/base-password-channel.c b/telepathy-glib/base-password-channel.c
index 8418155fb..3bdd12021 100644
--- a/telepathy-glib/base-password-channel.c
+++ b/telepathy-glib/base-password-channel.c
@@ -504,7 +504,7 @@ tp_base_password_channel_start_mechanism_with_data (
TpSvcChannelInterfaceSASLAuthentication1 *self,
const gchar *mechanism,
const GArray *initial_data,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBasePasswordChannel *channel = TP_BASE_PASSWORD_CHANNEL (self);
TpBasePasswordChannelPrivate *priv = channel->priv;
@@ -549,14 +549,14 @@ tp_base_password_channel_start_mechanism_with_data (
error:
DEBUG ("%s", error->message);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
static void
tp_base_password_channel_accept_sasl (
TpSvcChannelInterfaceSASLAuthentication1 *self,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBasePasswordChannel *channel = TP_BASE_PASSWORD_CHANNEL (self);
TpBasePasswordChannelPrivate *priv = channel->priv;
@@ -565,7 +565,7 @@ tp_base_password_channel_accept_sasl (
{
GError *error = g_error_new (TP_ERROR, TP_ERROR_NOT_AVAILABLE,
"AcceptSASL cannot be called in state %u", priv->sasl_status);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -584,7 +584,7 @@ tp_base_password_channel_abort_sasl (
TpSvcChannelInterfaceSASLAuthentication1 *self,
TpSASLAbortReason reason,
const gchar *debug_message,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBasePasswordChannel *channel = TP_BASE_PASSWORD_CHANNEL (self);
TpBasePasswordChannelPrivate *priv = channel->priv;
@@ -594,7 +594,7 @@ tp_base_password_channel_abort_sasl (
{
GError *error = g_error_new (TP_ERROR, TP_ERROR_NOT_AVAILABLE,
"AbortSASL cannot be called in state %u", priv->sasl_status);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
diff --git a/telepathy-glib/base-protocol.c b/telepathy-glib/base-protocol.c
index 84d83f2f3..b232faa04 100644
--- a/telepathy-glib/base-protocol.c
+++ b/telepathy-glib/base-protocol.c
@@ -1725,7 +1725,7 @@ tp_base_protocol_new_connection (TpBaseProtocol *self,
static void
protocol_normalize_contact (TpSvcProtocol *protocol,
const gchar *contact,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseProtocol *self = TP_BASE_PROTOCOL (protocol);
TpBaseProtocolClass *cls = TP_BASE_PROTOCOL_GET_CLASS (self);
@@ -1746,7 +1746,7 @@ protocol_normalize_contact (TpSvcProtocol *protocol,
if (ret == NULL)
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
else
@@ -1759,7 +1759,7 @@ protocol_normalize_contact (TpSvcProtocol *protocol,
static void
protocol_identify_account (TpSvcProtocol *protocol,
GHashTable *parameters,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseProtocol *self = TP_BASE_PROTOCOL (protocol);
TpBaseProtocolClass *cls = TP_BASE_PROTOCOL_GET_CLASS (self);
@@ -1787,7 +1787,7 @@ protocol_identify_account (TpSvcProtocol *protocol,
if (ret == NULL)
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
else
@@ -1800,7 +1800,7 @@ protocol_identify_account (TpSvcProtocol *protocol,
static void
addressing_normalize_contact_uri (TpSvcProtocolInterfaceAddressing1 *protocol,
const gchar *uri,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseProtocol *self = TP_BASE_PROTOCOL (protocol);
TpProtocolAddressingInterface *iface;
@@ -1819,7 +1819,7 @@ addressing_normalize_contact_uri (TpSvcProtocolInterfaceAddressing1 *protocol,
if (ret == NULL)
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -1839,7 +1839,7 @@ static void
addressing_normalize_vcard_address (TpSvcProtocolInterfaceAddressing1 *protocol,
const gchar *vcard_field,
const gchar *vcard_address,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseProtocol *self = TP_BASE_PROTOCOL (protocol);
TpProtocolAddressingInterface *iface;
@@ -1859,7 +1859,7 @@ addressing_normalize_vcard_address (TpSvcProtocolInterfaceAddressing1 *protocol,
if (ret == NULL)
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
diff --git a/telepathy-glib/base-room-config.c b/telepathy-glib/base-room-config.c
index f94888603..3e48ccc67 100644
--- a/telepathy-glib/base-room-config.c
+++ b/telepathy-glib/base-room-config.c
@@ -209,7 +209,7 @@ struct _TpBaseRoomConfigPrivate {
/* Details of a pending update, or both NULL if no call to
* UpdateConfiguration is in progress.
*/
- DBusGMethodInvocation *update_configuration_ctx;
+ GDBusMethodInvocation *update_configuration_ctx;
GHashTable *validated_properties;
};
@@ -898,7 +898,7 @@ update_cb (
}
else
{
- dbus_g_method_return_error (priv->update_configuration_ctx, error);
+ g_dbus_method_invocation_return_gerror (priv->update_configuration_ctx, error);
g_clear_error (&error);
}
@@ -922,7 +922,7 @@ static void
tp_base_room_config_update_configuration (
TpSvcChannelInterfaceRoomConfig1 *iface,
GHashTable *properties,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseRoomConfig *self = find_myself ((GObject *) iface);
TpBaseChannel *channel = TP_BASE_CHANNEL (iface);
@@ -989,7 +989,7 @@ tp_base_room_config_update_configuration (
* mainly as a convenience to the subclass, which would probably like
* tp_base_room_config_get_channel() to work reliably.
*
- * If the DBusGMethodInvocation kept the object alive, we wouldn't need this.
+ * If the GDBusMethodInvocation kept the object alive, we wouldn't need this.
*/
g_object_ref (priv->channel);
/* This means the CM could modify validated_properties if it wanted. This is
@@ -1000,7 +1000,7 @@ tp_base_room_config_update_configuration (
return;
err:
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
}
diff --git a/telepathy-glib/call-channel.c b/telepathy-glib/call-channel.c
index ae89c441a..a620c791b 100644
--- a/telepathy-glib/call-channel.c
+++ b/telepathy-glib/call-channel.c
@@ -50,7 +50,6 @@
#include <config.h>
#include <telepathy-glib/call-content.h>
-#include <telepathy-glib/call-misc.h>
#include <telepathy-glib/call-stream.h>
#include <telepathy-glib/cli-channel.h>
#include <telepathy-glib/cli-misc.h>
diff --git a/telepathy-glib/call-content-media-description.c b/telepathy-glib/call-content-media-description.c
index 8a144af4c..8cbd324e3 100644
--- a/telepathy-glib/call-content-media-description.c
+++ b/telepathy-glib/call-content-media-description.c
@@ -1185,7 +1185,7 @@ _tp_call_content_media_description_dup_properties (
static void
tp_call_content_media_description_accept (TpSvcCall1ContentMediaDescription *iface,
GHashTable *properties,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpCallContentMediaDescription *self = (TpCallContentMediaDescription *) iface;
GPtrArray *codecs;
@@ -1208,7 +1208,7 @@ tp_call_content_media_description_accept (TpSvcCall1ContentMediaDescription *ifa
{
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Codecs can not be empty" };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -1219,7 +1219,7 @@ tp_call_content_media_description_accept (TpSvcCall1ContentMediaDescription *ifa
{
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Remote contact must the same as in request." };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -1236,7 +1236,7 @@ tp_call_content_media_description_accept (TpSvcCall1ContentMediaDescription *ifa
static void
tp_call_content_media_description_reject (TpSvcCall1ContentMediaDescription *iface,
const GValueArray *reason_array,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpCallContentMediaDescription *self = (TpCallContentMediaDescription *) iface;
@@ -1246,7 +1246,7 @@ tp_call_content_media_description_reject (TpSvcCall1ContentMediaDescription *ifa
{
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Can not reject an empty Media Description" };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
diff --git a/telepathy-glib/call-content.c b/telepathy-glib/call-content.c
index fe569926a..da2df837b 100644
--- a/telepathy-glib/call-content.c
+++ b/telepathy-glib/call-content.c
@@ -48,7 +48,6 @@
#include "telepathy-glib/call-content.h"
#include <telepathy-glib/call-channel.h>
-#include <telepathy-glib/call-misc.h>
#include <telepathy-glib/call-stream.h>
#include <telepathy-glib/cli-call.h>
#include <telepathy-glib/cli-misc.h>
@@ -556,7 +555,6 @@ tp_call_content_class_init (TpCallContentClass *klass)
proxy_class->interface = TP_IFACE_QUARK_CALL1_CONTENT;
g_type_class_add_private (gobject_class, sizeof (TpCallContentPrivate));
- tp_call_content_init_known_interfaces ();
/**
* TpCallContent:connection:
@@ -724,37 +722,6 @@ tp_call_content_init (TpCallContent *self)
}
/**
- * tp_call_content_init_known_interfaces:
- *
- * Ensure that the known interfaces for #TpCallContent have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_CALL_CONTENT.
- *
- * Since: 0.17.5
- */
-void
-tp_call_content_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_CALL_CONTENT;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_call_content_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
-}
-
-/**
* TP_CALL_CONTENT_FEATURE_CORE:
*
* Expands to a call to a function that returns a quark for the "core"
diff --git a/telepathy-glib/call-content.h b/telepathy-glib/call-content.h
index a43b9302a..dfac0f4f8 100644
--- a/telepathy-glib/call-content.h
+++ b/telepathy-glib/call-content.h
@@ -59,9 +59,6 @@ struct _TpCallContentClass
_TP_AVAILABLE_IN_0_18
GType tp_call_content_get_type (void);
-_TP_AVAILABLE_IN_0_18
-void tp_call_content_init_known_interfaces (void);
-
#define TP_CALL_CONTENT_FEATURE_CORE \
tp_call_content_get_feature_quark_core ()
_TP_AVAILABLE_IN_0_18
diff --git a/telepathy-glib/call-misc.c b/telepathy-glib/call-misc.c
deleted file mode 100644
index aee48f1f8..000000000
--- a/telepathy-glib/call-misc.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * call.c - misc low level API for Call
- *
- * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * SECTION:call-misc
- * @title: Misc Call APIs
- * @short_description: Misc generated APISs for Call
- *
- * This contains generated APIs to be used by #TpCallChannel, #TpCallStream,
- * #TpCallContent or telepathy-farstream. Should not be needed for normal
- * clients.
- */
-
-#include "config.h"
-
-#include "telepathy-glib/call-misc.h"
-#include "telepathy-glib/cli-call.h"
-#include "telepathy-glib/errors.h"
-#include "telepathy-glib/interfaces.h"
-#include "telepathy-glib/proxy-subclass.h"
-
-/**
- * tp_call_stream_endpoint_init_known_interfaces:
- *
- * Ensure that the known interfaces for #TpProxy have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_PROXY.
- *
- * Since: 0.17.5
- */
-void
-tp_call_stream_endpoint_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_PROXY;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_call_stream_endpoint_add_signals);
-
- g_once_init_leave (&once, 1);
- }
-}
-
-/**
- * tp_call_content_media_description_init_known_interfaces:
- *
- * Ensure that the known interfaces for #TpProxy have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_PROXY.
- *
- * Since: 0.17.5
- */
-void
-tp_call_content_media_description_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_PROXY;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_call_content_media_description_add_signals);
-
- g_once_init_leave (&once, 1);
- }
-}
diff --git a/telepathy-glib/call-stream-endpoint.c b/telepathy-glib/call-stream-endpoint.c
index bdd1e53b4..929e9113e 100644
--- a/telepathy-glib/call-stream-endpoint.c
+++ b/telepathy-glib/call-stream-endpoint.c
@@ -764,7 +764,7 @@ static void
call_stream_endpoint_set_selected_candidate_pair (TpSvcCall1StreamEndpoint *iface,
const GValueArray *local_candidate,
const GValueArray *remote_candidate,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpCallStreamEndpoint *self = TP_CALL_STREAM_ENDPOINT (iface);
TpStreamComponent component;
@@ -774,7 +774,7 @@ call_stream_endpoint_set_selected_candidate_pair (TpSvcCall1StreamEndpoint *ifac
if (!common_checks (self, local_candidate, remote_candidate, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
return;
}
@@ -822,7 +822,7 @@ static void
call_stream_endpoint_set_endpoint_state (TpSvcCall1StreamEndpoint *iface,
TpStreamComponent component,
TpStreamEndpointState state,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpCallStreamEndpoint *self = TP_CALL_STREAM_ENDPOINT (iface);
@@ -830,7 +830,7 @@ call_stream_endpoint_set_endpoint_state (TpSvcCall1StreamEndpoint *iface,
{
GError *error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Stream component %d is out of the valid range.", state);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -839,7 +839,7 @@ call_stream_endpoint_set_endpoint_state (TpSvcCall1StreamEndpoint *iface,
{
GError *error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Stream state %d is out of the valid range.", state);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -873,14 +873,14 @@ call_stream_endpoint_accept_selected_candidate_pair (
TpSvcCall1StreamEndpoint *iface,
const GValueArray *local_candidate,
const GValueArray *remote_candidate,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpCallStreamEndpoint *self = TP_CALL_STREAM_ENDPOINT (iface);
GError *error = NULL;
if (!common_checks (self, local_candidate, remote_candidate, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
return;
}
@@ -900,14 +900,14 @@ call_stream_endpoint_reject_selected_candidate_pair (
TpSvcCall1StreamEndpoint *iface,
const GValueArray *local_candidate,
const GValueArray *remote_candidate,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpCallStreamEndpoint *self = TP_CALL_STREAM_ENDPOINT (iface);
GError *error = NULL;
if (!common_checks (self, local_candidate, remote_candidate, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
return;
}
@@ -925,7 +925,7 @@ call_stream_endpoint_reject_selected_candidate_pair (
static void
call_stream_endpoint_set_controlling (TpSvcCall1StreamEndpoint *iface,
gboolean controlling,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpCallStreamEndpoint *self = TP_CALL_STREAM_ENDPOINT (iface);
diff --git a/telepathy-glib/call-stream.c b/telepathy-glib/call-stream.c
index 96c027270..b07247a75 100644
--- a/telepathy-glib/call-stream.c
+++ b/telepathy-glib/call-stream.c
@@ -48,7 +48,6 @@
#include "telepathy-glib/call-stream.h"
#include <telepathy-glib/call-content.h>
-#include <telepathy-glib/call-misc.h>
#include <telepathy-glib/cli-call.h>
#include <telepathy-glib/cli-misc.h>
#include <telepathy-glib/dbus.h>
@@ -343,7 +342,6 @@ tp_call_stream_class_init (TpCallStreamClass *klass)
proxy_class->interface = TP_IFACE_QUARK_CALL1_STREAM;
g_type_class_add_private (gobject_class, sizeof (TpCallStreamPrivate));
- tp_call_stream_init_known_interfaces ();
/**
* TpCallStream:connection:
@@ -458,37 +456,6 @@ tp_call_stream_init (TpCallStream *self)
}
/**
- * tp_call_stream_init_known_interfaces:
- *
- * Ensure that the known interfaces for #TpCallStream have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_CALL_STREAM.
- *
- * Since: 0.17.5
- */
-void
-tp_call_stream_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_CALL_STREAM;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_call_stream_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
-}
-
-/**
* TP_CALL_STREAM_FEATURE_CORE:
*
* Expands to a call to a function that returns a quark for the "core"
diff --git a/telepathy-glib/call-stream.h b/telepathy-glib/call-stream.h
index d55ec1d3a..ff93ead6b 100644
--- a/telepathy-glib/call-stream.h
+++ b/telepathy-glib/call-stream.h
@@ -59,9 +59,6 @@ struct _TpCallStreamClass
_TP_AVAILABLE_IN_0_18
GType tp_call_stream_get_type (void);
-_TP_AVAILABLE_IN_0_18
-void tp_call_stream_init_known_interfaces (void);
-
#define TP_CALL_STREAM_FEATURE_CORE \
tp_call_stream_get_feature_quark_core ()
_TP_AVAILABLE_IN_0_18
diff --git a/telepathy-glib/channel-dispatch-operation.c b/telepathy-glib/channel-dispatch-operation.c
index dcbc7eca8..81640a841 100644
--- a/telepathy-glib/channel-dispatch-operation.c
+++ b/telepathy-glib/channel-dispatch-operation.c
@@ -731,39 +731,6 @@ tp_channel_dispatch_operation_class_init (TpChannelDispatchOperationClass *klass
proxy_class->interface = TP_IFACE_QUARK_CHANNEL_DISPATCH_OPERATION;
proxy_class->must_have_unique_name = TRUE;
proxy_class->list_features = tp_channel_dispatch_operation_list_features;
-
- tp_channel_dispatch_operation_init_known_interfaces ();
-}
-
-/**
- * tp_channel_dispatch_operation_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpChannelDispatchOperation have been
- * set up. This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_CHANNEL_DISPATCH_OPERATION.
- *
- * Since: 0.7.32
- */
-void
-tp_channel_dispatch_operation_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_CHANNEL_DISPATCH_OPERATION;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_channel_dispatch_operation_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
}
TpChannelDispatchOperation *
diff --git a/telepathy-glib/channel-dispatch-operation.h b/telepathy-glib/channel-dispatch-operation.h
index 6c563336e..35b74d634 100644
--- a/telepathy-glib/channel-dispatch-operation.h
+++ b/telepathy-glib/channel-dispatch-operation.h
@@ -75,8 +75,6 @@ GType tp_channel_dispatch_operation_get_type (void);
(G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_CHANNEL_DISPATCH_OPERATION, \
TpChannelDispatchOperationClass))
-void tp_channel_dispatch_operation_init_known_interfaces (void);
-
#define TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE \
tp_channel_dispatch_operation_get_feature_quark_core ()
diff --git a/telepathy-glib/channel-dispatcher.c b/telepathy-glib/channel-dispatcher.c
index e87374392..be71f8296 100644
--- a/telepathy-glib/channel-dispatcher.c
+++ b/telepathy-glib/channel-dispatcher.c
@@ -109,38 +109,6 @@ tp_channel_dispatcher_class_init (TpChannelDispatcherClass *klass)
object_class->constructed = tp_channel_dispatcher_constructed;
proxy_class->interface = TP_IFACE_QUARK_CHANNEL_DISPATCHER;
- tp_channel_dispatcher_init_known_interfaces ();
-}
-
-/**
- * tp_channel_dispatcher_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpChannelDispatcher have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_CHANNEL_DISPATCHER.
- *
- * Since: 0.7.32
- */
-void
-tp_channel_dispatcher_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_CHANNEL_DISPATCHER;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_channel_dispatcher_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
}
/**
diff --git a/telepathy-glib/channel-dispatcher.h b/telepathy-glib/channel-dispatcher.h
index 931fea8e9..1946647f2 100644
--- a/telepathy-glib/channel-dispatcher.h
+++ b/telepathy-glib/channel-dispatcher.h
@@ -73,8 +73,6 @@ GType tp_channel_dispatcher_get_type (void);
TpChannelDispatcher *tp_channel_dispatcher_new (TpDBusDaemon *bus_daemon)
G_GNUC_WARN_UNUSED_RESULT;
-void tp_channel_dispatcher_init_known_interfaces (void);
-
_TP_AVAILABLE_IN_0_16
void tp_channel_dispatcher_present_channel_async (TpChannelDispatcher *self,
TpChannel *channel,
diff --git a/telepathy-glib/channel-manager-request-internal.h b/telepathy-glib/channel-manager-request-internal.h
index f47903ea2..a23c2c978 100644
--- a/telepathy-glib/channel-manager-request-internal.h
+++ b/telepathy-glib/channel-manager-request-internal.h
@@ -46,7 +46,7 @@ struct _TpChannelManagerRequest
/*<private>*/
GObject parent;
- DBusGMethodInvocation *context;
+ GDBusMethodInvocation *context;
TpChannelManagerRequestMethod method;
gchar *channel_type;
@@ -85,7 +85,7 @@ GType tp_channel_manager_request_get_type (void);
TpChannelManagerRequestClass))
TpChannelManagerRequest * _tp_channel_manager_request_new (
- DBusGMethodInvocation *context,
+ GDBusMethodInvocation *context,
TpChannelManagerRequestMethod method,
const char *channel_type,
TpEntityType handle_type,
diff --git a/telepathy-glib/channel-manager-request.c b/telepathy-glib/channel-manager-request.c
index 75c36859c..e49d78734 100644
--- a/telepathy-glib/channel-manager-request.c
+++ b/telepathy-glib/channel-manager-request.c
@@ -95,7 +95,7 @@ tp_channel_manager_request_init (TpChannelManagerRequest *self)
TpChannelManagerRequest *
_tp_channel_manager_request_new (
- DBusGMethodInvocation *context,
+ GDBusMethodInvocation *context,
TpChannelManagerRequestMethod method,
const char *channel_type,
TpEntityType handle_type,
@@ -134,7 +134,7 @@ _tp_channel_manager_request_cancel (TpChannelManagerRequest *self)
DEBUG ("cancelling request at %p for %s/%u/%u", self,
self->channel_type, self->handle_type, self->handle);
- dbus_g_method_return_error (self->context, &error);
+ g_dbus_method_invocation_return_gerror (self->context, &error);
self->context = NULL;
}
@@ -189,6 +189,6 @@ _tp_channel_manager_request_fail (TpChannelManagerRequest *self,
"handle_type=%u, handle=%u",
self, self->channel_type, self->handle_type, self->handle);
- dbus_g_method_return_error (self->context, error);
+ g_dbus_method_invocation_return_gerror (self->context, error);
self->context = NULL;
}
diff --git a/telepathy-glib/channel-request.c b/telepathy-glib/channel-request.c
index 2e73cba69..b6159117a 100644
--- a/telepathy-glib/channel-request.c
+++ b/telepathy-glib/channel-request.c
@@ -307,7 +307,6 @@ tp_channel_request_class_init (TpChannelRequestClass *klass)
object_class->dispose = tp_channel_request_dispose;
proxy_class->interface = TP_IFACE_QUARK_CHANNEL_REQUEST;
- tp_channel_request_init_known_interfaces ();
proxy_class->must_have_unique_name = TRUE;
/**
@@ -427,37 +426,6 @@ tp_channel_request_class_init (TpChannelRequestClass *klass)
G_TYPE_NONE, 2, TP_TYPE_CONNECTION, TP_TYPE_CHANNEL);
}
-/**
- * tp_channel_request_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpChannelRequest have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_CHANNEL_REQUEST.
- *
- * Since: 0.7.32
- */
-void
-tp_channel_request_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_CHANNEL_REQUEST;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_channel_request_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
-}
-
TpChannelRequest *
_tp_channel_request_new_with_factory (TpClientFactory *factory,
TpDBusDaemon *bus_daemon,
diff --git a/telepathy-glib/channel-request.h b/telepathy-glib/channel-request.h
index 576764e01..81bd72ade 100644
--- a/telepathy-glib/channel-request.h
+++ b/telepathy-glib/channel-request.h
@@ -69,8 +69,6 @@ GType tp_channel_request_get_type (void);
(G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_CHANNEL_REQUEST, \
TpChannelRequestClass))
-void tp_channel_request_init_known_interfaces (void);
-
_TP_AVAILABLE_IN_0_20
GVariant *tp_channel_request_dup_immutable_properties (TpChannelRequest *self);
diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c
index e212aca08..d802f4299 100644
--- a/telepathy-glib/channel.c
+++ b/telepathy-glib/channel.c
@@ -1137,8 +1137,6 @@ tp_channel_class_init (TpChannelClass *klass)
TpProxyClass *proxy_class = (TpProxyClass *) klass;
GObjectClass *object_class = (GObjectClass *) klass;
- tp_channel_init_known_interfaces ();
-
g_type_class_add_private (klass, sizeof (TpChannelPrivate));
object_class->constructor = tp_channel_constructor;
@@ -1450,41 +1448,6 @@ finally:
return ret;
}
-static gpointer
-tp_channel_once (gpointer data G_GNUC_UNUSED)
-{
- GType type = TP_TYPE_CHANNEL;
-
- tp_proxy_init_known_interfaces ();
-
- tp_proxy_or_subclass_hook_on_interface_add (type,
- tp_cli_channel_add_signals);
- tp_proxy_subclass_add_error_mapping (type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- return NULL;
-}
-
-/**
- * tp_channel_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpChannel have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_CHANNEL.
- *
- * Since: 0.7.6
- */
-void
-tp_channel_init_known_interfaces (void)
-{
- static GOnce once = G_ONCE_INIT;
-
- g_once (&once, tp_channel_once, NULL);
-}
-
/**
* tp_channel_get_requested:
* @self: a #TpChannel
diff --git a/telepathy-glib/channel.h b/telepathy-glib/channel.h
index 0887ff23b..d8d6a88e2 100644
--- a/telepathy-glib/channel.h
+++ b/telepathy-glib/channel.h
@@ -77,8 +77,6 @@ GQuark tp_errors_removed_from_group_quark (void);
(G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_CHANNEL, \
TpChannelClass))
-void tp_channel_init_known_interfaces (void);
-
_TP_AVAILABLE_IN_0_20
TpConnection *tp_channel_get_connection (TpChannel *self);
_TP_AVAILABLE_IN_0_20
diff --git a/telepathy-glib/cli-call.h b/telepathy-glib/cli-call.h
index d611564a0..aa6d2b5b6 100644
--- a/telepathy-glib/cli-call.h
+++ b/telepathy-glib/cli-call.h
@@ -23,7 +23,6 @@
#define TELEPATHY_GLIB_CLI_CALL_H
#include <telepathy-glib/call-content.h>
-#include <telepathy-glib/call-misc.h>
#include <telepathy-glib/call-stream.h>
#include <telepathy-glib/_gen/tp-cli-call-content.h>
diff --git a/telepathy-glib/cli-channel.c b/telepathy-glib/cli-channel.c
index a2f6226c2..8ecbc5079 100644
--- a/telepathy-glib/cli-channel.c
+++ b/telepathy-glib/cli-channel.c
@@ -25,5 +25,6 @@
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/proxy-subclass.h>
+#include <telepathy-glib/util.h>
#include "_gen/tp-cli-channel-body.h"
diff --git a/telepathy-glib/cli-connection.c b/telepathy-glib/cli-connection.c
index cf75d7b70..51aa4bac4 100644
--- a/telepathy-glib/cli-connection.c
+++ b/telepathy-glib/cli-connection.c
@@ -25,5 +25,6 @@
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/proxy-subclass.h>
+#include <telepathy-glib/util.h>
#include "_gen/tp-cli-connection-body.h"
diff --git a/telepathy-glib/cli-misc.c b/telepathy-glib/cli-misc.c
index f6532f84c..9aa005bf1 100644
--- a/telepathy-glib/cli-misc.c
+++ b/telepathy-glib/cli-misc.c
@@ -26,6 +26,7 @@
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/proxy-subclass.h>
+#include <telepathy-glib/util.h>
#include "telepathy-glib/_gen/tp-cli-account-body.h"
#include "telepathy-glib/_gen/tp-cli-account-manager-body.h"
diff --git a/telepathy-glib/client.c b/telepathy-glib/client.c
index a0f123135..483aeb775 100644
--- a/telepathy-glib/client.c
+++ b/telepathy-glib/client.c
@@ -106,36 +106,4 @@ tp_client_class_init (TpClientClass *klass)
object_class->constructed = tp_client_constructed;
proxy_class->interface = TP_IFACE_QUARK_CLIENT;
- tp_client_init_known_interfaces ();
-}
-
-/**
- * tp_client_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpClient have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_CLIENT.
- *
- * Since: 0.7.32
- */
-void
-tp_client_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_CLIENT;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_client_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
}
diff --git a/telepathy-glib/client.h b/telepathy-glib/client.h
index 893050d77..657d72d89 100644
--- a/telepathy-glib/client.h
+++ b/telepathy-glib/client.h
@@ -68,8 +68,6 @@ GType tp_client_get_type (void);
(G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_CLIENT, \
TpClientClass))
-void tp_client_init_known_interfaces (void);
-
G_END_DECLS
#endif
diff --git a/telepathy-glib/cm-message-internal.h b/telepathy-glib/cm-message-internal.h
index 5c13da626..55424c5c2 100644
--- a/telepathy-glib/cm-message-internal.h
+++ b/telepathy-glib/cm-message-internal.h
@@ -50,7 +50,7 @@ struct _TpCMMessage {
guint32 incoming_id;
/* for sending */
- DBusGMethodInvocation *outgoing_context;
+ GDBusMethodInvocation *outgoing_context;
TpMessageSendingFlags outgoing_flags;
};
diff --git a/telepathy-glib/codegen.am b/telepathy-glib/codegen.am
index 5e2beaf80..00ccb9eb3 100644
--- a/telepathy-glib/codegen.am
+++ b/telepathy-glib/codegen.am
@@ -103,7 +103,6 @@ nodist_libtelepathy_glib_main_internal_la_SOURCES = \
$(NULL)
nodist_libtelepathy_glib_dbus_internal_la_SOURCES += \
- _gen/register-dbus-glib-marshallers-body.h \
_gen/tp-cli-account-body.h \
_gen/tp-cli-account-manager-body.h \
_gen/tp-cli-call-content-body.h \
@@ -213,10 +212,6 @@ _gen/telepathy-interfaces.h: _gen/stable-spec.xml \
$(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-interfaces-gen.py \
Tp _gen/interfaces-body.h _gen/telepathy-interfaces.h $<
-_gen/register-dbus-glib-marshallers-body.h: _gen/stable-spec.xml \
- $(tools_dir)/glib-client-marshaller-gen.py
- $(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-client-marshaller-gen.py $< _tp > $@
-
_gen/genums.c: _gen/spec-stamp genums.c.template \
$(tpginclude_HEADERS) codegen.am
$(AM_V_GEN)( cd $(srcdir) && \
diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c
index 863795105..48bcc4aa4 100644
--- a/telepathy-glib/connection-manager.c
+++ b/telepathy-glib/connection-manager.c
@@ -950,37 +950,6 @@ tp_connection_manager_set_property (GObject *object,
}
}
-/**
- * tp_connection_manager_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpConnectionManager have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_CONNECTION_MANAGER.
- *
- * Since: 0.7.32
- */
-void
-tp_connection_manager_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_CONNECTION_MANAGER;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_connection_manager_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
-}
-
enum {
FEAT_CORE,
N_FEAT
@@ -1010,8 +979,6 @@ tp_connection_manager_class_init (TpConnectionManagerClass *klass)
GObjectClass *object_class = (GObjectClass *) klass;
GParamSpec *param_spec;
- tp_connection_manager_init_known_interfaces ();
-
g_type_class_add_private (klass, sizeof (TpConnectionManagerPrivate));
object_class->constructor = tp_connection_manager_constructor;
diff --git a/telepathy-glib/connection-manager.h b/telepathy-glib/connection-manager.h
index 212e76255..db6fd35c7 100644
--- a/telepathy-glib/connection-manager.h
+++ b/telepathy-glib/connection-manager.h
@@ -135,8 +135,6 @@ _TP_AVAILABLE_IN_0_20
GVariant *tp_connection_manager_param_dup_default_variant (
const TpConnectionManagerParam *param);
-void tp_connection_manager_init_known_interfaces (void);
-
#define TP_CONNECTION_MANAGER_FEATURE_CORE \
(tp_connection_manager_get_feature_quark_core ())
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index 09ee97df2..32c270c8c 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -1413,8 +1413,6 @@ tp_connection_class_init (TpConnectionClass *klass)
TpProxyClass *proxy_class = (TpProxyClass *) klass;
GObjectClass *object_class = (GObjectClass *) klass;
- tp_connection_init_known_interfaces ();
-
g_type_class_add_private (klass, sizeof (TpConnectionPrivate));
object_class->constructed = tp_connection_constructed;
@@ -2355,41 +2353,6 @@ tp_list_connection_names (TpDBusDaemon *bus_daemon,
list_context_free, weak_object);
}
-static gpointer
-tp_connection_once (gpointer data G_GNUC_UNUSED)
-{
- GType type = TP_TYPE_CONNECTION;
-
- tp_proxy_init_known_interfaces ();
-
- tp_proxy_or_subclass_hook_on_interface_add (type,
- tp_cli_connection_add_signals);
- tp_proxy_subclass_add_error_mapping (type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- return NULL;
-}
-
-/**
- * tp_connection_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpConnection have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_CONNECTION.
- *
- * Since: 0.7.6
- */
-void
-tp_connection_init_known_interfaces (void)
-{
- static GOnce once = G_ONCE_INIT;
-
- g_once (&once, tp_connection_once, NULL);
-}
-
static guint
get_presence_type_availability (TpConnectionPresenceType type)
{
diff --git a/telepathy-glib/connection.h b/telepathy-glib/connection.h
index 1959d5850..183f2d76e 100644
--- a/telepathy-glib/connection.h
+++ b/telepathy-glib/connection.h
@@ -177,8 +177,6 @@ void tp_list_connection_names (TpDBusDaemon *bus_daemon,
gpointer user_data, GDestroyNotify destroy,
GObject *weak_object);
-void tp_connection_init_known_interfaces (void);
-
gint tp_connection_presence_type_cmp_availability (TpConnectionPresenceType p1,
TpConnectionPresenceType p2);
diff --git a/telepathy-glib/core-dbus.c b/telepathy-glib/core-dbus.c
index 6e0e33ade..48f0d4c6a 100644
--- a/telepathy-glib/core-dbus.c
+++ b/telepathy-glib/core-dbus.c
@@ -33,11 +33,10 @@
* given by @context.
*/
void
-tp_dbus_g_method_return_not_implemented (DBusGMethodInvocation *context)
+tp_dbus_g_method_return_not_implemented (GDBusMethodInvocation *context)
{
- GError e = { TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Not implemented" };
-
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_dbus_error (context,
+ TP_ERROR_STR_NOT_IMPLEMENTED, "Not implemented");
}
/* this is the core library, we don't have debug infrastructure yet */
diff --git a/telepathy-glib/core-proxy.c b/telepathy-glib/core-proxy.c
index 59c121a4d..3307318c2 100644
--- a/telepathy-glib/core-proxy.c
+++ b/telepathy-glib/core-proxy.c
@@ -29,52 +29,9 @@
#define DEBUG_FLAG TP_DEBUG_PROXY
#include "debug-internal.h"
-/**
- * tp_proxy_dbus_g_proxy_claim_for_signal_adding:
- * @proxy: a #DBusGProxy
- *
- * Attempt to "claim" a #DBusGProxy for addition of signal signatures.
- * If this function has not been called on @proxy before, %TRUE is
- * returned, and the caller may safely call dbus_g_proxy_add_signal()
- * on @proxy. If this function has already been caled, %FALSE is
- * returned, and the caller may not safely call dbus_g_proxy_add_signal().
- *
- * This is intended for use by auto-generated signal-adding functions,
- * to allow interfaces provided as local extensions to override those in
- * telepathy-glib without causing assertion failures.
- *
- * Returns: %TRUE if it is safe to call dbus_g_proxy_add_signal()
- * Since: 0.7.6
- */
-gboolean
-tp_proxy_dbus_g_proxy_claim_for_signal_adding (DBusGProxy *proxy)
-{
- static GQuark q = 0;
-
- g_return_val_if_fail (proxy != NULL, FALSE);
-
- if (G_UNLIKELY (q == 0))
- {
- q = g_quark_from_static_string (
- "tp_proxy_dbus_g_proxy_claim_for_signal_adding@0.7.6");
- }
-
- if (g_object_get_qdata ((GObject *) proxy, q) != NULL)
- {
- /* Someone else has already added signal signatures for this interface.
- * We can't do it again or it'll cause an assertion */
- return FALSE;
- }
-
- /* the proxy is just used as qdata here because it's a convenient
- * non-NULL pointer */
- g_object_set_qdata ((GObject *) proxy, q, proxy);
- return TRUE;
-}
-
static TpProxyImplementation _tp_proxy_implementation = { NULL };
-DBusGProxy *
+GDBusProxy *
tp_proxy_get_interface_by_id (TpProxy *proxy,
GQuark iface,
GError **error)
@@ -84,54 +41,30 @@ tp_proxy_get_interface_by_id (TpProxy *proxy,
}
TpProxyPendingCall *
-tp_proxy_pending_call_v0_new (TpProxy *proxy,
+tp_proxy_pending_call_v1_new (TpProxy *proxy,
+ gint timeout_ms,
GQuark iface,
const gchar *member,
- DBusGProxy *iface_proxy,
- TpProxyInvokeFunc invoke_callback,
+ GVariant *args,
+ const GVariantType *reply_type,
+ TpProxyWrapperFunc wrapper,
GCallback callback,
gpointer user_data,
GDestroyNotify destroy,
- GObject *weak_object,
- gboolean cancel_must_raise)
-{
- g_assert (_tp_proxy_implementation.version != NULL);
- return _tp_proxy_implementation.pending_call_new (proxy, iface, member,
- iface_proxy, invoke_callback, callback, user_data, destroy,
- weak_object, cancel_must_raise);
-}
-
-void
-tp_proxy_pending_call_v0_take_pending_call (TpProxyPendingCall *pc,
- DBusGProxyCall *pending_call)
-{
- g_assert (_tp_proxy_implementation.version != NULL);
- _tp_proxy_implementation.pending_call_take_pending_call (pc, pending_call);
-}
-
-void
-tp_proxy_pending_call_v0_completed (gpointer p)
-{
- g_assert (_tp_proxy_implementation.version != NULL);
- _tp_proxy_implementation.pending_call_completed (p);
-}
-
-void
-tp_proxy_pending_call_v0_take_results (TpProxyPendingCall *pc,
- GError *error,
- GValueArray *args)
+ GObject *weak_object)
{
g_assert (_tp_proxy_implementation.version != NULL);
- _tp_proxy_implementation.pending_call_take_results (pc, error, args);
+ return _tp_proxy_implementation.pending_call_new (proxy, timeout_ms,
+ iface, member, args, reply_type, wrapper,
+ callback, user_data, destroy, weak_object);
}
TpProxySignalConnection *
-tp_proxy_signal_connection_v0_new (TpProxy *self,
+tp_proxy_signal_connection_v1_new (TpProxy *self,
GQuark iface,
const gchar *member,
- const GType *expected_types,
- GCallback collect_args,
- TpProxyInvokeFunc invoke_callback,
+ const GVariantType *expected_types,
+ TpProxyWrapperFunc wrapper,
GCallback callback,
gpointer user_data,
GDestroyNotify destroy,
@@ -140,35 +73,24 @@ tp_proxy_signal_connection_v0_new (TpProxy *self,
{
g_assert (_tp_proxy_implementation.version != NULL);
return _tp_proxy_implementation.signal_connection_new (self, iface, member,
- expected_types, collect_args, invoke_callback, callback, user_data,
- destroy, weak_object, error);
-}
-
-void
-tp_proxy_signal_connection_v0_take_results (TpProxySignalConnection *sc,
- GValueArray *args)
-{
- g_assert (_tp_proxy_implementation.version != NULL);
- _tp_proxy_implementation.signal_connection_take_results (sc, args);
+ expected_types, wrapper, callback, user_data, destroy, weak_object,
+ error);
}
void
tp_private_proxy_set_implementation (TpProxyImplementation *impl)
{
- g_assert_cmpstr (impl->version, ==, VERSION);
- g_assert_cmpuint (impl->size, ==, sizeof (TpProxyImplementation));
- g_assert_cmpstr (g_type_name (impl->type), ==, "TpProxy");
+ /* not using tp_strdiff because it isn't available in the core library */
+ g_assert (strcmp (impl->version, VERSION) == 0);
+ g_assert (impl->size == sizeof (TpProxyImplementation));
+ g_assert (strcmp (g_type_name (impl->type), "TpProxy") == 0);
g_assert (_tp_proxy_implementation.version == NULL);
g_assert (impl->get_interface_by_id != NULL);
g_assert (impl->pending_call_new != NULL);
- g_assert (impl->pending_call_take_pending_call != NULL);
- g_assert (impl->pending_call_take_results != NULL);
- g_assert (impl->pending_call_completed != NULL);
g_assert (impl->signal_connection_new != NULL);
- g_assert (impl->signal_connection_take_results != NULL);
memcpy (&_tp_proxy_implementation, impl, sizeof (TpProxyImplementation));
- g_assert_cmpstr (_tp_proxy_implementation.version, ==, VERSION);
+ g_assert (strcmp (_tp_proxy_implementation.version, VERSION) == 0);
}
diff --git a/telepathy-glib/core-svc-interface.c b/telepathy-glib/core-svc-interface.c
new file mode 100644
index 000000000..9a46a691d
--- /dev/null
+++ b/telepathy-glib/core-svc-interface.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2014 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <config.h>
+#include <telepathy-glib/core-svc-interface.h>
+
+/**
+ * TpSvcInterfaceInfo: (skip)
+ * @ref_count: currently -1 since these structures can only be statically
+ * allocated; will be used for the reference count in the same way
+ * as #GDBusInterfaceInfo if necessary
+ * @interface_info: the GDBus interface information
+ * @vtable: the GDBus vtable
+ * @signals: (array zero-terminated=1): a %NULL-terminated array of
+ * GLib signal names in the same order as `interface_info->signals`
+ *
+ * The necessary glue between a dbus-glib-style `TpSvc` #GInterface
+ * and telepathy-glib.
+ *
+ * These structs are intended to be programmatically-generated.
+ */
+
+static GQuark
+quark (void)
+{
+ static GQuark q = 0;
+
+ if (G_UNLIKELY (q == 0))
+ {
+ q = g_quark_from_static_string (
+ "tp_svc_interface_set_dbus_interface_info");
+ }
+
+ return q;
+}
+
+/**
+ * tp_svc_interface_peek_dbus_interface_info: (skip)
+ * @g_interface: The #GType of a service interface
+ *
+ * See whether the given interface has Telepathy code generation data
+ * attached.
+ *
+ * Returns: (transfer null): a #TpSvcInterfaceInfo struct, or %NULL
+ */
+const TpSvcInterfaceInfo *
+tp_svc_interface_peek_dbus_interface_info (GType g_interface)
+{
+ return g_type_get_qdata (g_interface, quark ());
+}
+
+/**
+ * tp_svc_interface_set_dbus_interface_info: (skip)
+ * @g_interface: The #GType of a service interface
+ * @info: struct encapsulating the #GDBusInterfaceInfo, the #GDBusVTable
+ * and the GLib signal names corresponding to D-Bus signals
+ * @vtable: the vtable, whose methods must expect the object
+ * implementing @g_interface as their user-data
+ *
+ * Declare that @g_interface implements the given D-Bus interface, with the
+ * given vtable. This may only be called once per GInterface, usually from
+ * a section of its base_init function that only runs once.
+ *
+ * This is typically only used within generated code; there is normally no
+ * reason to call it manually.
+ */
+void
+tp_svc_interface_set_dbus_interface_info (GType g_interface,
+ const TpSvcInterfaceInfo *info)
+{
+ g_return_if_fail (G_TYPE_IS_INTERFACE (g_interface));
+ g_return_if_fail (info->ref_count == -1);
+ g_return_if_fail (tp_svc_interface_peek_dbus_interface_info (g_interface)
+ == NULL);
+
+ /* g_type_set_qdata wants a non-const pointer */
+ g_type_set_qdata (g_interface, quark (), (gpointer) info);
+}
diff --git a/telepathy-glib/call-misc.h b/telepathy-glib/core-svc-interface.h
index 5fbac6ead..dd5d7933f 100644
--- a/telepathy-glib/call-misc.h
+++ b/telepathy-glib/core-svc-interface.h
@@ -1,7 +1,5 @@
/*
- * call.h - misc low level API for Call
- *
- * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright © 2014 Collabora Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -22,18 +20,30 @@
#error "Only <telepathy-glib/telepathy-glib.h> can be included directly."
#endif
-#ifndef __TP_CALL_MISC_H__
-#define __TP_CALL_MISC_H__
+#ifndef __TP_CORE_SVC_INTERFACE_H__
+#define __TP_CORE_SVC_INTERFACE_H__
+
+#include <gio/gio.h>
#include <telepathy-glib/defs.h>
-#include <telepathy-glib/proxy.h>
G_BEGIN_DECLS
-_TP_AVAILABLE_IN_0_18
-void tp_call_stream_endpoint_init_known_interfaces (void);
-_TP_AVAILABLE_IN_0_18
-void tp_call_content_media_description_init_known_interfaces (void);
+typedef struct _TpSvcInterfaceInfo TpSvcInterfaceInfo;
+
+struct _TpSvcInterfaceInfo {
+ volatile gint ref_count;
+ GDBusInterfaceInfo *interface_info;
+ GDBusInterfaceVTable *vtable;
+ gchar **signals;
+ gpointer _reserved[8];
+};
+
+void tp_svc_interface_set_dbus_interface_info (GType type,
+ const TpSvcInterfaceInfo *info);
+
+const TpSvcInterfaceInfo *tp_svc_interface_peek_dbus_interface_info (
+ GType type);
G_END_DECLS
diff --git a/telepathy-glib/core-util.c b/telepathy-glib/core-util.c
new file mode 100644
index 000000000..91f4cb610
--- /dev/null
+++ b/telepathy-glib/core-util.c
@@ -0,0 +1,183 @@
+/*
+ * util.c - Source for telepathy-glib utility functions
+ * Copyright © 2006-2014 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright © 2006-2008 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <config.h>
+#include <telepathy-glib/util.h>
+
+#include <string.h>
+#include <gobject/gvaluecollector.h>
+
+#include <telepathy-glib/defs.h>
+
+/* this is the core library, we don't have debug infrastructure yet */
+#define CRITICAL(format, ...) \
+ g_log (G_LOG_DOMAIN "/misc", G_LOG_LEVEL_CRITICAL, "%s: " format, \
+ G_STRFUNC, ##__VA_ARGS__)
+#define WARNING(format, ...) \
+ g_log (G_LOG_DOMAIN "/misc", G_LOG_LEVEL_WARNING, "%s: " format, \
+ G_STRFUNC, ##__VA_ARGS__)
+
+/**
+ * tp_value_array_build: (skip)
+ * @length: The number of elements that should be in the array
+ * @type: The type of the first argument.
+ * @...: The value of the first item in the struct followed by a list of type,
+ * value pairs terminated by G_TYPE_INVALID.
+ *
+ * Creates a new #GValueArray for use with structs, containing the values
+ * passed in as parameters. The values are copied or reffed as appropriate for
+ * their type.
+ *
+ * <example>
+ * <title> using tp_value_array_build</title>
+ * <programlisting>
+ * GValueArray *array = tp_value_array_build (2,
+ * G_TYPE_STRING, host,
+ * G_TYPE_UINT, port,
+ * G_TYPE_INVALID);
+ * </programlisting>
+ * </example>
+ *
+ * Returns: a newly created #GValueArray, free with tp_value_array_free()
+ *
+ * Since: 0.9.2
+ */
+GValueArray *
+tp_value_array_build (gsize length,
+ GType type,
+ ...)
+{
+ GValueArray *arr;
+ GType t;
+ va_list var_args;
+ char *error = NULL;
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ arr = g_value_array_new (length);
+ G_GNUC_END_IGNORE_DEPRECATIONS
+
+ va_start (var_args, type);
+
+ for (t = type; t != G_TYPE_INVALID; t = va_arg (var_args, GType))
+ {
+ GValue *v = arr->values + arr->n_values;
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ g_value_array_append (arr, NULL);
+ G_GNUC_END_IGNORE_DEPRECATIONS
+
+ g_value_init (v, t);
+
+ G_VALUE_COLLECT (v, var_args, 0, &error);
+
+ if (error != NULL)
+ {
+ CRITICAL ("%s", error);
+ g_free (error);
+
+ tp_value_array_free (arr);
+ va_end (var_args);
+ return NULL;
+ }
+ }
+
+ g_warn_if_fail (arr->n_values == length);
+
+ va_end (var_args);
+ return arr;
+}
+
+/**
+ * tp_value_array_unpack: (skip)
+ * @array: the array to unpack
+ * @len: The number of elements that should be in the array
+ * @...: a list of correctly typed pointers to store the values in
+ *
+ * Unpacks a #GValueArray into separate variables.
+ *
+ * The contents of the values aren't copied into the variables, and so become
+ * invalid when @array is freed.
+ *
+ * <example>
+ * <title>using tp_value_array_unpack</title>
+ * <programlisting>
+ * const gchar *host;
+ * guint port;
+ *
+ * tp_value_array_unpack (array, 2,
+ * &host,
+ * &port);
+ * </programlisting>
+ * </example>
+ *
+ * Since: 0.11.0
+ */
+void
+tp_value_array_unpack (GValueArray *array,
+ gsize len,
+ ...)
+{
+ va_list var_args;
+ guint i;
+
+ va_start (var_args, len);
+
+ for (i = 0; i < len; i++)
+ {
+ GValue *value;
+ char *error = NULL;
+
+ if (G_UNLIKELY (i > array->n_values))
+ {
+ WARNING ("More parameters than entries in the struct!");
+ break;
+ }
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ value = g_value_array_get_nth (array, i);
+ G_GNUC_END_IGNORE_DEPRECATIONS
+
+ G_VALUE_LCOPY (value, var_args, G_VALUE_NOCOPY_CONTENTS, &error);
+ if (error != NULL)
+ {
+ WARNING ("%s", error);
+ g_free (error);
+ break;
+ }
+ }
+
+ va_end (var_args);
+}
+
+/**
+ * tp_value_array_free:
+ * @va: a #GValueArray
+ *
+ * Free @va. This is exactly the same as g_value_array_free(), but does not
+ * provoke deprecation warnings from GLib when used in conjunction with
+ * tp_value_array_build() and tp_value_array_unpack().
+ *
+ * Since: 0.23.0
+ */
+void
+(tp_value_array_free) (GValueArray *va)
+{
+ _tp_value_array_free_inline (va);
+}
diff --git a/telepathy-glib/dbus-daemon.c b/telepathy-glib/dbus-daemon.c
index a51daba6e..09ac32f83 100644
--- a/telepathy-glib/dbus-daemon.c
+++ b/telepathy-glib/dbus-daemon.c
@@ -31,6 +31,7 @@
#include <telepathy-glib/errors.h>
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/proxy-subclass.h>
+#include <telepathy-glib/svc-interface-skeleton-internal.h>
#include <telepathy-glib/util.h>
#define DEBUG_FLAG TP_DEBUG_PROXY
@@ -70,13 +71,11 @@ struct _TpDBusDaemonPrivate
{
/* dup'd name => _NameOwnerWatch */
GHashTable *name_owner_watches;
- /* reffed */
- DBusConnection *libdbus;
};
G_DEFINE_TYPE (TpDBusDaemon, tp_dbus_daemon, TP_TYPE_PROXY)
-static gpointer starter_bus_daemon = NULL;
+static gpointer default_bus_daemon = NULL;
/**
* tp_dbus_daemon_dup:
@@ -101,21 +100,21 @@ static gpointer starter_bus_daemon = NULL;
TpDBusDaemon *
tp_dbus_daemon_dup (GError **error)
{
- DBusGConnection *conn;
+ GDBusConnection *conn;
- if (starter_bus_daemon != NULL)
- return g_object_ref (starter_bus_daemon);
+ if (default_bus_daemon != NULL)
+ return g_object_ref (default_bus_daemon);
- conn = dbus_g_bus_get (DBUS_BUS_STARTER, error);
+ conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error);
if (conn == NULL)
return NULL;
- starter_bus_daemon = tp_dbus_daemon_new (conn);
- g_assert (starter_bus_daemon != NULL);
- g_object_add_weak_pointer (starter_bus_daemon, &starter_bus_daemon);
+ default_bus_daemon = tp_dbus_daemon_new (conn);
+ g_assert (default_bus_daemon != NULL);
+ g_object_add_weak_pointer (default_bus_daemon, &default_bus_daemon);
- return starter_bus_daemon;
+ return default_bus_daemon;
}
/**
@@ -126,7 +125,7 @@ tp_dbus_daemon_dup (GError **error)
* connection.
*
* Use tp_dbus_daemon_dup() instead if you just want a connection to the
- * starter or session bus (which is almost always the right thing for
+ * session bus (which is almost always the right thing for
* Telepathy).
*
* Returns: a new proxy for signals and method calls on the bus daemon
@@ -135,7 +134,7 @@ tp_dbus_daemon_dup (GError **error)
* Since: 0.7.1
*/
TpDBusDaemon *
-tp_dbus_daemon_new (DBusGConnection *connection)
+tp_dbus_daemon_new (GDBusConnection *connection)
{
g_return_val_if_fail (connection != NULL, NULL);
@@ -148,6 +147,7 @@ tp_dbus_daemon_new (DBusGConnection *connection)
typedef struct
{
+ guint id;
gchar *last_owner;
GArray *callbacks;
gsize invoking;
@@ -247,180 +247,21 @@ _tp_dbus_daemon_name_owner_changed (TpDBusDaemon *self,
g_object_unref (self);
}
-static dbus_int32_t daemons_slot = -1;
-
-typedef struct {
- DBusConnection *libdbus;
- DBusMessage *message;
-} NOCIdleContext;
-
-static NOCIdleContext *
-noc_idle_context_new (DBusConnection *libdbus,
- DBusMessage *message)
-{
- NOCIdleContext *context = g_slice_new (NOCIdleContext);
-
- context->libdbus = dbus_connection_ref (libdbus);
- context->message = dbus_message_ref (message);
- return context;
-}
-
static void
-noc_idle_context_free (gpointer data)
-{
- NOCIdleContext *context = data;
-
- dbus_connection_unref (context->libdbus);
- dbus_message_unref (context->message);
- g_slice_free (NOCIdleContext, context);
-}
-
-static gboolean
-noc_idle_context_invoke (gpointer data)
-{
- NOCIdleContext *context = data;
- const gchar *name;
- const gchar *old_owner;
- const gchar *new_owner;
- DBusError dbus_error = DBUS_ERROR_INIT;
- GSList **daemons;
-
- if (daemons_slot == -1)
- return FALSE;
-
- if (!dbus_message_get_args (context->message, &dbus_error,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &old_owner,
- DBUS_TYPE_STRING, &new_owner,
- DBUS_TYPE_INVALID))
- {
- DEBUG ("Couldn't unpack NameOwnerChanged(s, s, s): %s: %s",
- dbus_error.name, dbus_error.message);
- dbus_error_free (&dbus_error);
- return FALSE;
- }
-
- daemons = dbus_connection_get_data (context->libdbus, daemons_slot);
-
- DEBUG ("NameOwnerChanged(%s, %s -> %s)", name, old_owner, new_owner);
-
- /* should always be non-NULL, barring bugs */
- if (G_LIKELY (daemons != NULL))
- {
- GSList *iter;
-
- for (iter = *daemons; iter != NULL; iter = iter->next)
- {
- _tp_dbus_daemon_name_owner_changed (iter->data, name, new_owner);
- }
- }
-
- return FALSE;
-}
-
-static DBusHandlerResult
-_tp_dbus_daemon_name_owner_changed_filter (DBusConnection *libdbus,
- DBusMessage *message,
- void *unused G_GNUC_UNUSED)
-{
- /* We have to do the real work in an idle, so we don't break re-entrant
- * calls (the dbus-glib event source isn't re-entrant) */
- if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS,
- "NameOwnerChanged") &&
- dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
- g_idle_add_full (G_PRIORITY_HIGH, noc_idle_context_invoke,
- noc_idle_context_new (libdbus, message),
- noc_idle_context_free);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-typedef struct {
- TpDBusDaemon *self;
- gchar *name;
- DBusMessage *reply;
- gsize refs;
-} GetNameOwnerContext;
-
-static GetNameOwnerContext *
-get_name_owner_context_new (TpDBusDaemon *self,
- const gchar *name)
+_tp_dbus_daemon_name_appeared_cb (GDBusConnection *connection G_GNUC_UNUSED,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
{
- GetNameOwnerContext *context = g_slice_new (GetNameOwnerContext);
-
- context->self = g_object_ref (self);
- context->name = g_strdup (name);
- context->reply = NULL;
- context->refs = 1;
- return context;
+ _tp_dbus_daemon_name_owner_changed (user_data, name, name_owner);
}
static void
-get_name_owner_context_unref (gpointer data)
-{
- GetNameOwnerContext *context = data;
-
- if (--context->refs == 0)
- {
- g_object_unref (context->self);
- g_free (context->name);
-
- if (context->reply != NULL)
- dbus_message_unref (context->reply);
-
- g_slice_free (GetNameOwnerContext, context);
- }
-}
-
-static gboolean
-_tp_dbus_daemon_get_name_owner_idle (gpointer data)
+_tp_dbus_daemon_name_vanished_cb (GDBusConnection *connection G_GNUC_UNUSED,
+ const gchar *name,
+ gpointer user_data)
{
- GetNameOwnerContext *context = data;
- const gchar *owner = "";
-
- if (context->reply == NULL)
- {
- DEBUG ("Connection disconnected or no reply to GetNameOwner(%s)",
- context->name);
- }
- else if (dbus_message_get_type (context->reply) ==
- DBUS_MESSAGE_TYPE_METHOD_RETURN)
- {
- if (dbus_message_get_args (context->reply, NULL,
- DBUS_TYPE_STRING, &owner,
- DBUS_TYPE_INVALID))
- {
- DEBUG ("GetNameOwner(%s) -> %s", context->name, owner);
- }
- else
- {
- DEBUG ("Malformed reply from GetNameOwner(%s), assuming no owner",
- context->name);
- }
- }
- else
- {
- if (DEBUGGING)
- {
- DBusError error = DBUS_ERROR_INIT;
-
- if (dbus_set_error_from_message (&error, context->reply))
- {
- DEBUG ("GetNameOwner(%s) raised %s: %s", context->name,
- error.name, error.message);
- dbus_error_free (&error);
- }
- else
- {
- DEBUG ("Unexpected message type from GetNameOwner(%s)",
- context->name);
- }
- }
- }
-
- _tp_dbus_daemon_name_owner_changed (context->self, context->name, owner);
-
- return FALSE;
+ _tp_dbus_daemon_name_owner_changed (user_data, name, NULL);
}
/**
@@ -436,38 +277,6 @@ _tp_dbus_daemon_get_name_owner_idle (gpointer data)
* Since: 0.7.1
*/
-static inline gchar *
-_tp_dbus_daemon_get_noc_rule (const gchar *name)
-{
- return g_strdup_printf ("type='signal',"
- "sender='" DBUS_SERVICE_DBUS "',"
- "path='" DBUS_PATH_DBUS "',"
- "interface='"DBUS_INTERFACE_DBUS "',"
- "member='NameOwnerChanged',"
- "arg0='%s'", name);
-}
-
-static void
-_tp_dbus_daemon_get_name_owner_notify (DBusPendingCall *pc,
- gpointer data)
-{
- GetNameOwnerContext *context = data;
-
- /* we recycle this function for the case where the connection is already
- * disconnected: in that case we use pc = NULL */
- if (pc != NULL)
- context->reply = dbus_pending_call_steal_reply (pc);
-
- /* We have to do the real work in an idle, so we don't break re-entrant
- * calls (the dbus-glib event source isn't re-entrant) */
- context->refs++;
- g_idle_add_full (G_PRIORITY_HIGH, _tp_dbus_daemon_get_name_owner_idle,
- context, get_name_owner_context_unref);
-
- if (pc != NULL)
- dbus_pending_call_unref (pc);
-}
-
/**
* tp_dbus_daemon_watch_name_owner:
* @self: The D-Bus daemon
@@ -484,6 +293,8 @@ _tp_dbus_daemon_get_name_owner_notify (DBusPendingCall *pc,
* If multiple watches are registered for the same @name, they will be called
* in the order they were registered.
*
+ * New code should use g_bus_watch_name() or similar instead.
+ *
* Since: 0.7.1
*/
void
@@ -504,11 +315,6 @@ tp_dbus_daemon_watch_name_owner (TpDBusDaemon *self,
if (watch == NULL)
{
- gchar *match_rule;
- DBusMessage *message;
- DBusPendingCall *pc = NULL;
- GetNameOwnerContext *context = get_name_owner_context_new (self, name);
-
/* Allocate a new watch */
watch = g_slice_new0 (_NameOwnerWatch);
watch->last_owner = NULL;
@@ -518,46 +324,13 @@ tp_dbus_daemon_watch_name_owner (TpDBusDaemon *self,
g_hash_table_insert (self->priv->name_owner_watches, g_strdup (name),
watch);
- /* We want to be notified about name owner changes for this one.
- * Assume the match addition will succeed; there's no good way to cope
- * with failure here... */
- match_rule = _tp_dbus_daemon_get_noc_rule (name);
- DEBUG ("Adding match rule %s", match_rule);
- dbus_bus_add_match (self->priv->libdbus, match_rule, NULL);
- g_free (match_rule);
-
- message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "GetNameOwner");
-
- if (message == NULL)
- ERROR ("Out of memory");
-
- /* We already checked that @name was in (a small subset of) UTF-8,
- * so OOM is the only thing that can go wrong. The use of &name here
- * is because libdbus is strange. */
- if (!dbus_message_append_args (message,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INVALID))
- ERROR ("Out of memory");
-
- if (!dbus_connection_send_with_reply (self->priv->libdbus,
- message, &pc, -1))
- ERROR ("Out of memory");
- /* pc is unreffed by _tp_dbus_daemon_get_name_owner_notify */
- dbus_message_unref (message);
-
- if (pc == NULL || dbus_pending_call_get_completed (pc))
- {
- /* pc can be NULL when the connection is already disconnected */
- _tp_dbus_daemon_get_name_owner_notify (pc, context);
- get_name_owner_context_unref (context);
- }
- else if (!dbus_pending_call_set_notify (pc,
- _tp_dbus_daemon_get_name_owner_notify,
- context, get_name_owner_context_unref))
- {
- ERROR ("Out of memory");
- }
+ watch->id = g_bus_watch_name_on_connection (
+ tp_proxy_get_dbus_connection (self),
+ name, G_BUS_NAME_WATCHER_FLAGS_NONE,
+ _tp_dbus_daemon_name_appeared_cb,
+ _tp_dbus_daemon_name_vanished_cb,
+ g_object_ref (self),
+ g_object_unref);
}
g_array_append_val (watch->callbacks, tmp);
@@ -574,8 +347,6 @@ _tp_dbus_daemon_stop_watching (TpDBusDaemon *self,
const gchar *name,
_NameOwnerWatch *watch)
{
- gchar *match_rule;
-
/* Clean up any leftöver callbacks. */
if (watch->callbacks->len > 0)
{
@@ -591,14 +362,10 @@ _tp_dbus_daemon_stop_watching (TpDBusDaemon *self,
}
}
+ g_bus_unwatch_name (watch->id);
g_array_unref (watch->callbacks);
g_free (watch->last_owner);
g_slice_free (_NameOwnerWatch, watch);
-
- match_rule = _tp_dbus_daemon_get_noc_rule (name);
- DEBUG ("Removing match rule %s", match_rule);
- dbus_bus_remove_match (self->priv->libdbus, match_rule, NULL);
- g_free (match_rule);
}
/**
@@ -666,13 +433,8 @@ _tp_dbus_daemon_get_name_owner (TpDBusDaemon *self,
gchar **unique_name,
GError **error)
{
- DBusGConnection *gconn;
- DBusConnection *dbc;
- DBusMessage *message;
- DBusMessage *reply;
- DBusError dbus_error;
- const char *name_in_reply;
const GError *invalidated;
+ GVariant *tuple;
g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -687,56 +449,18 @@ _tp_dbus_daemon_get_name_owner (TpDBusDaemon *self,
return FALSE;
}
- gconn = tp_proxy_get_dbus_connection (self);
- dbc = dbus_g_connection_get_connection (gconn);
-
- message = dbus_message_new_method_call (DBUS_SERVICE_DBUS, DBUS_PATH_DBUS,
- DBUS_INTERFACE_DBUS, "GetNameOwner");
-
- if (message == NULL)
- ERROR ("Out of memory");
-
- if (!dbus_message_append_args (message,
- DBUS_TYPE_STRING, &well_known_name,
- DBUS_TYPE_INVALID))
- ERROR ("Out of memory");
-
- dbus_error_init (&dbus_error);
- reply = dbus_connection_send_with_reply_and_block (dbc, message,
- timeout_ms, &dbus_error);
-
- dbus_message_unref (message);
-
- if (reply == NULL)
- {
- if (!tp_strdiff (dbus_error.name, DBUS_ERROR_NO_MEMORY))
- ERROR ("Out of memory");
-
- /* FIXME: ideally we'd use dbus-glib's error mapping for this */
- g_set_error (error, TP_DBUS_ERRORS, TP_DBUS_ERROR_NAME_OWNER_LOST,
- "%s: %s", dbus_error.name, dbus_error.message);
-
- dbus_error_free (&dbus_error);
- return FALSE;
- }
-
- if (!dbus_message_get_args (reply, &dbus_error,
- DBUS_TYPE_STRING, &name_in_reply,
- DBUS_TYPE_INVALID))
- {
- g_set_error (error, TP_DBUS_ERRORS, TP_DBUS_ERROR_NAME_OWNER_LOST,
- "%s: %s", dbus_error.name, dbus_error.message);
+ tuple = g_dbus_connection_call_sync (tp_proxy_get_dbus_connection (self),
+ "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
+ "GetNameOwner", g_variant_new ("(s)", well_known_name),
+ G_VARIANT_TYPE ("(s)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error);
- dbus_error_free (&dbus_error);
- dbus_message_unref (reply);
- return FALSE;
- }
+ if (tuple == NULL)
+ return FALSE;
if (unique_name != NULL)
- *unique_name = g_strdup (name_in_reply);
-
- dbus_message_unref (reply);
+ g_variant_get (tuple, "(s)", unique_name);
+ g_variant_unref (tuple);
return TRUE;
}
@@ -763,10 +487,8 @@ tp_dbus_daemon_request_name (TpDBusDaemon *self,
gboolean idempotent,
GError **error)
{
- DBusGConnection *gconn;
- DBusConnection *dbc;
- DBusError dbus_error;
- int result;
+ GVariant *tuple;
+ guint32 result;
const GError *invalidated;
g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), FALSE);
@@ -774,6 +496,8 @@ tp_dbus_daemon_request_name (TpDBusDaemon *self,
TP_DBUS_NAME_TYPE_WELL_KNOWN, error), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ DEBUG ("%s", well_known_name);
+
invalidated = tp_proxy_get_invalidated (self);
if (invalidated != NULL)
@@ -781,22 +505,35 @@ tp_dbus_daemon_request_name (TpDBusDaemon *self,
if (error != NULL)
*error = g_error_copy (invalidated);
+ DEBUG ("- not requesting, we have fallen off D-Bus");
return FALSE;
}
- gconn = tp_proxy_get_dbus_connection (self);
- dbc = dbus_g_connection_get_connection (gconn);
+ tuple = g_dbus_connection_call_sync (tp_proxy_get_dbus_connection (self),
+ "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
+ "RequestName",
+ g_variant_new ("(su)", well_known_name,
+ (guint32) DBUS_NAME_FLAG_DO_NOT_QUEUE),
+ G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error);
- dbus_error_init (&dbus_error);
- result = dbus_bus_request_name (dbc, well_known_name,
- DBUS_NAME_FLAG_DO_NOT_QUEUE, &dbus_error);
+ if (tuple == NULL)
+ {
+ DEBUG ("- D-Bus error");
+ return FALSE;
+ }
+
+ g_variant_get (tuple, "(u)", &result);
+ g_variant_unref (tuple);
switch (result)
{
case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
+ DEBUG ("- acquired");
return TRUE;
case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
+ DEBUG ("- already owned by us");
+
if (idempotent)
{
return TRUE;
@@ -810,20 +547,16 @@ tp_dbus_daemon_request_name (TpDBusDaemon *self,
case DBUS_REQUEST_NAME_REPLY_EXISTS:
case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
+ DEBUG ("- already owned by someone else");
/* the latter shouldn't actually happen since we said DO_NOT_QUEUE */
g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
"Name '%s' already in use by another process", well_known_name);
return FALSE;
- case -1:
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
- "%s: %s", dbus_error.name, dbus_error.message);
- dbus_error_free (&dbus_error);
- return FALSE;
-
default:
+ DEBUG ("- unexpected code %u", result);
g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
- "RequestName('%s') returned %d and I don't know what that means",
+ "RequestName('%s') returned %u and I don't know what that means",
well_known_name, result);
return FALSE;
}
@@ -848,17 +581,17 @@ tp_dbus_daemon_release_name (TpDBusDaemon *self,
const gchar *well_known_name,
GError **error)
{
- DBusGConnection *gconn;
- DBusConnection *dbc;
- DBusError dbus_error;
- int result;
+ guint32 result;
const GError *invalidated;
+ GVariant *tuple;
g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), FALSE);
g_return_val_if_fail (tp_dbus_check_valid_bus_name (well_known_name,
TP_DBUS_NAME_TYPE_WELL_KNOWN, error), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ DEBUG ("%s", well_known_name);
+
invalidated = tp_proxy_get_invalidated (self);
if (invalidated != NULL)
@@ -866,51 +599,108 @@ tp_dbus_daemon_release_name (TpDBusDaemon *self,
if (error != NULL)
*error = g_error_copy (invalidated);
+ DEBUG ("- not releasing, we have fallen off D-Bus");
return FALSE;
}
- gconn = tp_proxy_get_dbus_connection (self);
- dbc = dbus_g_connection_get_connection (gconn);
- dbus_error_init (&dbus_error);
- result = dbus_bus_release_name (dbc, well_known_name, &dbus_error);
+ tuple = g_dbus_connection_call_sync (tp_proxy_get_dbus_connection (self),
+ "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
+ "ReleaseName", g_variant_new ("(s)", well_known_name),
+ G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error);
+
+ if (tuple == NULL)
+ {
+ DEBUG ("- D-Bus error");
+ return FALSE;
+ }
+
+ g_variant_get (tuple, "(u)", &result);
+ g_variant_unref (tuple);
switch (result)
{
case DBUS_RELEASE_NAME_REPLY_RELEASED:
+ DEBUG ("- released");
return TRUE;
case DBUS_RELEASE_NAME_REPLY_NOT_OWNER:
+ DEBUG ("- not ours");
g_set_error (error, TP_ERROR, TP_ERROR_NOT_YOURS,
"Name '%s' owned by another process", well_known_name);
return FALSE;
case DBUS_RELEASE_NAME_REPLY_NON_EXISTENT:
+ DEBUG ("- not owned");
g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
"Name '%s' not owned", well_known_name);
return FALSE;
- case -1:
- g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
- "%s: %s", dbus_error.name, dbus_error.message);
- dbus_error_free (&dbus_error);
- return FALSE;
-
default:
+ DEBUG ("- unexpected code %u", result);
g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
- "ReleaseName('%s') returned %d and I don't know what that means",
+ "ReleaseName('%s') returned %u and I don't know what that means",
well_known_name, result);
return FALSE;
}
}
+typedef struct _Registration Registration;
+
+struct _Registration {
+ /* (transfer full) */
+ GDBusConnection *conn;
+ /* (transfer full) */
+ gchar *object_path;
+ /* (transfer full) */
+ GSList *skeletons;
+};
+
+static GQuark
+registration_quark (void)
+{
+ static GQuark q = 0;
+
+ if (G_UNLIKELY (q == 0))
+ {
+ q = g_quark_from_static_string ("tp_dbus_daemon_register_object");
+ }
+
+ return q;
+}
+
+static void
+tp_dbus_daemon_registration_free (gpointer p)
+{
+ Registration *r = p;
+ GSList *iter;
+
+ DEBUG ("%s (r=%p)", r->object_path, r);
+
+ for (iter = r->skeletons; iter != NULL; iter = iter->next)
+ {
+ DEBUG ("%p", iter->data);
+ g_assert (TP_IS_SVC_INTERFACE_SKELETON (iter->data));
+ g_dbus_interface_skeleton_unexport (iter->data);
+ g_object_unref (iter->data);
+ }
+
+ g_slist_free (r->skeletons);
+ g_free (r->object_path);
+ g_clear_object (&r->conn);
+ g_slice_free (Registration, r);
+}
+
/**
* tp_dbus_daemon_register_object:
* @self: object representing a connection to a bus
* @object_path: an object path
* @object: (type GObject.Object) (transfer none): an object to export
*
- * Export @object at @object_path. This is a convenience wrapper around
- * dbus_g_connection_register_g_object(), and behaves similarly.
+ * Export @object at @object_path. Its `TpSvc` interfaces will all
+ * be exported.
+ *
+ * Since 0.UNRELEASED, as a simplification, exporting an object in this
+ * way at more than one location or on more than one bus is not allowed.
*
* Since: 0.11.3
*/
@@ -919,12 +709,86 @@ tp_dbus_daemon_register_object (TpDBusDaemon *self,
const gchar *object_path,
gpointer object)
{
+ GDBusConnection *conn;
+ GType *interfaces;
+ guint n = 0;
+ guint i;
+ Registration *r;
+
g_return_if_fail (TP_IS_DBUS_DAEMON (self));
g_return_if_fail (tp_dbus_check_valid_object_path (object_path, NULL));
g_return_if_fail (G_IS_OBJECT (object));
- dbus_g_connection_register_g_object (tp_proxy_get_dbus_connection (self),
- object_path, object);
+ conn = tp_proxy_get_dbus_connection (self);
+ r = g_slice_new0 (Registration);
+ r->conn = g_object_ref (conn);
+ r->object_path = g_strdup (object_path);
+ r->skeletons = NULL;
+
+ if (!g_object_replace_qdata (object, registration_quark (),
+ NULL, r, tp_dbus_daemon_registration_free, NULL))
+ {
+ tp_dbus_daemon_registration_free (r);
+
+ /* dbus-glib silently allowed duplicate registrations; to avoid
+ * breaking too much existing code, so must we. We don't allow
+ * registrations on different connections or at different object
+ * paths, though, in the hope that nobody actually does that. */
+
+ r = g_object_get_qdata (object, registration_quark ());
+
+ if (!tp_strdiff (r->object_path, object_path) &&
+ r->conn == conn)
+ return;
+
+ CRITICAL ("object has already been exported on %s (%p) at %s, cannot "
+ "export on %s (%p) at %s",
+ g_dbus_connection_get_unique_name (r->conn), r->conn, r->object_path,
+ g_dbus_connection_get_unique_name (conn), conn, object_path);
+ return;
+ }
+
+ DEBUG ("%p (r=%p) at %s", object, r, object_path);
+
+ /* FIXME: if @object is a GDBusObject or GDBusObjectManagerServer,
+ * export it that way instead? */
+
+ interfaces = g_type_interfaces (G_OBJECT_TYPE (object), &n);
+
+ for (i = 0; i < n; i++)
+ {
+ GType iface = interfaces[i];
+ const TpSvcInterfaceInfo *iinfo;
+ TpSvcInterfaceSkeleton *skeleton;
+ GError *error = NULL;
+
+ iinfo = tp_svc_interface_peek_dbus_interface_info (iface);
+
+ if (iinfo == NULL)
+ {
+ /* not a D-Bus interface */
+ continue;
+ }
+
+ skeleton = _tp_svc_interface_skeleton_new (object, iface, iinfo);
+
+ if (!g_dbus_interface_skeleton_export (
+ G_DBUS_INTERFACE_SKELETON (skeleton), conn, object_path,
+ &error))
+ {
+ CRITICAL ("cannot export (%s *) %p as '%s': %s #%d: %s",
+ g_type_name (iface), object, iinfo->interface_info->name,
+ g_quark_to_string (error->domain), error->code, error->message);
+ g_object_unref (skeleton);
+ continue;
+ }
+
+ r->skeletons = g_slist_prepend (r->skeletons, skeleton);
+
+ DEBUG ("- %s (%p)", iinfo->interface_info->name, skeleton);
+ }
+
+ g_free (interfaces);
}
/**
@@ -945,8 +809,9 @@ tp_dbus_daemon_unregister_object (TpDBusDaemon *self,
g_return_if_fail (TP_IS_DBUS_DAEMON (self));
g_return_if_fail (G_IS_OBJECT (object));
- dbus_g_connection_unregister_g_object (tp_proxy_get_dbus_connection (self),
- object);
+ DEBUG ("%p", object);
+
+ g_object_set_qdata (object, registration_quark (), NULL);
}
/**
@@ -964,152 +829,8 @@ tp_dbus_daemon_get_unique_name (TpDBusDaemon *self)
{
g_return_val_if_fail (TP_IS_DBUS_DAEMON (self), NULL);
- return dbus_bus_get_unique_name (self->priv->libdbus);
-}
-
-typedef struct {
- TpDBusDaemon *self;
- DBusMessage *reply;
- TpDBusDaemonListNamesCb callback;
- gpointer user_data;
- GDestroyNotify destroy;
- gpointer weak_object;
- gsize refs;
-} ListNamesContext;
-
-static ListNamesContext *
-list_names_context_new (TpDBusDaemon *self,
- TpDBusDaemonListNamesCb callback,
- gpointer user_data,
- GDestroyNotify destroy,
- GObject *weak_object)
-{
- ListNamesContext *context = g_slice_new (ListNamesContext);
-
- context->self = g_object_ref (self);
- context->reply = NULL;
- context->callback = callback;
- context->user_data = user_data;
- context->destroy = destroy;
- context->weak_object = weak_object;
-
- if (context->weak_object != NULL)
- g_object_add_weak_pointer (weak_object, &context->weak_object);
-
- context->refs = 1;
- return context;
-}
-
-static void
-list_names_context_unref (gpointer data)
-{
- ListNamesContext *context = data;
-
- if (--context->refs == 0)
- {
- g_object_unref (context->self);
-
- if (context->reply != NULL)
- dbus_message_unref (context->reply);
-
- if (context->destroy != NULL)
- context->destroy (context->user_data);
-
- context->destroy = NULL;
-
- if (context->weak_object != NULL)
- g_object_remove_weak_pointer (context->weak_object,
- &context->weak_object);
-
- g_slice_free (ListNamesContext, context);
- }
-}
-
-static gboolean
-_tp_dbus_daemon_list_names_idle (gpointer data)
-{
- ListNamesContext *context = data;
- char **array = NULL;
- const gchar * const *result = NULL;
- GError *error = NULL;
-
- if (context->callback == NULL)
- {
- DEBUG ("Caller no longer cares (weak object vanished), ignoring");
- return FALSE;
- }
-
- if (context->reply == NULL)
- {
- g_set_error_literal (&error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED,
- "DBusConnection disconnected");
- }
- else if (dbus_message_get_type (context->reply) ==
- DBUS_MESSAGE_TYPE_METHOD_RETURN)
- {
- int n_elements;
-
- if (dbus_message_get_args (context->reply, NULL,
- DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &array, &n_elements,
- DBUS_TYPE_INVALID))
- {
- result = (const gchar * const *) array;
- g_assert (result[n_elements] == NULL);
- }
- else
- {
- g_set_error_literal (&error, DBUS_GERROR, DBUS_GERROR_INVALID_ARGS,
- "Malformed reply from List*Names()");
- }
- }
- else
- {
- DBusError dbus_error = DBUS_ERROR_INIT;
-
- if (dbus_set_error_from_message (&dbus_error, context->reply))
- {
- /* FIXME: ideally we'd use dbus-glib's error mapping here, but we
- * don't have access to it */
- g_set_error (&error, DBUS_GERROR, DBUS_GERROR_FAILED,
- "List*Names() raised %s: %s", dbus_error.name,
- dbus_error.message);
- dbus_error_free (&dbus_error);
- }
- else
- {
- g_set_error_literal (&error, DBUS_GERROR, DBUS_GERROR_INVALID_ARGS,
- "Unexpected message type from List*Names()");
- }
- }
-
- if (error != NULL)
- DEBUG ("%s", error->message);
-
- context->callback (context->self, result, error, context->user_data,
- context->weak_object);
- dbus_free_string_array (array); /* NULL-safe */
- return FALSE;
-}
-
-static void
-_tp_dbus_daemon_list_names_notify (DBusPendingCall *pc,
- gpointer data)
-{
- ListNamesContext *context = data;
-
- /* we recycle this function for the case where the connection is already
- * disconnected: in that case we use pc = NULL */
- if (pc != NULL)
- context->reply = dbus_pending_call_steal_reply (pc);
-
- /* We have to do the real work in an idle, so we don't break re-entrant
- * calls (the dbus-glib event source isn't re-entrant) */
- context->refs++;
- g_idle_add_full (G_PRIORITY_HIGH, _tp_dbus_daemon_list_names_idle,
- context, list_names_context_unref);
-
- if (pc != NULL)
- dbus_pending_call_unref (pc);
+ return g_dbus_connection_get_unique_name (
+ tp_proxy_get_dbus_connection (self));
}
/**
@@ -1128,52 +849,6 @@ _tp_dbus_daemon_list_names_notify (DBusPendingCall *pc,
* Since: 0.7.35
*/
-static void
-_tp_dbus_daemon_list_names_common (TpDBusDaemon *self,
- const gchar *method,
- gint timeout_ms,
- TpDBusDaemonListNamesCb callback,
- gpointer user_data,
- GDestroyNotify destroy,
- GObject *weak_object)
-{
- DBusMessage *message;
- DBusPendingCall *pc = NULL;
- ListNamesContext *context;
-
- g_return_if_fail (TP_IS_DBUS_DAEMON (self));
- g_return_if_fail (callback != NULL);
- g_return_if_fail (weak_object == NULL || G_IS_OBJECT (weak_object));
-
- message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, method);
-
- if (message == NULL)
- ERROR ("Out of memory");
-
- if (!dbus_connection_send_with_reply (self->priv->libdbus,
- message, &pc, timeout_ms))
- ERROR ("Out of memory");
- /* pc is unreffed by _tp_dbus_daemon_list_names_notify */
- dbus_message_unref (message);
-
- context = list_names_context_new (self, callback, user_data, destroy,
- weak_object);
-
- if (pc == NULL || dbus_pending_call_get_completed (pc))
- {
- /* pc can be NULL when the connection is already disconnected */
- _tp_dbus_daemon_list_names_notify (pc, context);
- list_names_context_unref (context);
- }
- else if (!dbus_pending_call_set_notify (pc,
- _tp_dbus_daemon_list_names_notify, context,
- list_names_context_unref))
- {
- ERROR ("Out of memory");
- }
-}
-
/**
* tp_dbus_daemon_list_names:
* @self: object representing a connection to a bus
@@ -1189,10 +864,6 @@ _tp_dbus_daemon_list_names_common (TpDBusDaemon *self,
* will be called from the main loop with a list of all the names (either
* unique or well-known) that exist on the bus.
*
- * In versions of telepathy-glib that have it, this should be preferred
- * instead of calling tp_cli_dbus_daemon_call_list_names(), since that
- * function will result in wakeups for every NameOwnerChanged signal.
- *
* Since: 0.7.35
*/
void
@@ -1203,8 +874,20 @@ tp_dbus_daemon_list_names (TpDBusDaemon *self,
GDestroyNotify destroy,
GObject *weak_object)
{
- _tp_dbus_daemon_list_names_common (self, "ListNames", timeout_ms,
- callback, user_data, destroy, weak_object);
+ /* This is the same type as TpDBusDaemonListNamesCb, spelled out
+ * explicitly to make it clearer that the cast below is OK... */
+ void (*explicit_callback) (TpDBusDaemon *, const gchar * const *,
+ const GError *, gpointer, GObject *) = callback;
+ /* ... and this is the same type as
+ * tp_cli_dbus_daemon_callback_for_list_names, which differs only in
+ * the constness of its second parameter. Again, spelling it out explicitly
+ * in the declaration to make it clearer that it's OK to do. */
+ void (*cast_callback) (TpDBusDaemon *, const gchar **,
+ const GError *, gpointer, GObject *) =
+ (tp_cli_dbus_daemon_callback_for_list_names) explicit_callback;
+
+ tp_cli_dbus_daemon_call_list_names (self, timeout_ms,
+ cast_callback, user_data, destroy, weak_object);
}
/**
@@ -1222,10 +905,6 @@ tp_dbus_daemon_list_names (TpDBusDaemon *self,
* The @callback will be called from the main loop with a list of all the
* well-known names that are available for service-activation on the bus.
*
- * In versions of telepathy-glib that have it, this should be preferred
- * instead of calling tp_cli_dbus_daemon_call_list_activatable_names(), since
- * that function will result in wakeups for every NameOwnerChanged signal.
- *
* Since: 0.7.35
*/
void
@@ -1236,63 +915,30 @@ tp_dbus_daemon_list_activatable_names (TpDBusDaemon *self,
GDestroyNotify destroy,
GObject *weak_object)
{
- _tp_dbus_daemon_list_names_common (self, "ListActivatableNames", timeout_ms,
- callback, user_data, destroy, weak_object);
-}
-
-static void
-free_daemon_list (gpointer p)
-{
- GSList **slistp = p;
+ /* Same comments as for ListNames */
+ void (*explicit_callback) (TpDBusDaemon *, const gchar * const *,
+ const GError *, gpointer, GObject *) = callback;
+ void (*cast_callback) (TpDBusDaemon *, const gchar **,
+ const GError *, gpointer, GObject *) =
+ (tp_cli_dbus_daemon_callback_for_list_activatable_names) explicit_callback;
- g_slist_free (*slistp);
- g_slice_free (GSList *, slistp);
+ tp_cli_dbus_daemon_call_list_activatable_names (self, timeout_ms,
+ cast_callback, user_data, destroy, weak_object);
}
-/* If you add more slice-allocation in this function, make the suppression
- * "tp_dbus_daemon_constructor @daemons once per DBusConnection" in
- * telepathy-glib.supp more specific. */
static GObject *
tp_dbus_daemon_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
- GObjectClass *object_class =
- (GObjectClass *) tp_dbus_daemon_parent_class;
+ GObjectClass *object_class = G_OBJECT_CLASS (tp_dbus_daemon_parent_class);
+
TpDBusDaemon *self = TP_DBUS_DAEMON (object_class->constructor (type,
n_params, params));
- GSList **daemons;
g_assert (!tp_strdiff (tp_proxy_get_bus_name (self), DBUS_SERVICE_DBUS));
g_assert (!tp_strdiff (tp_proxy_get_object_path (self), DBUS_PATH_DBUS));
- self->priv->libdbus = dbus_connection_ref (
- dbus_g_connection_get_connection (
- tp_proxy_get_dbus_connection (self)));
-
- /* one ref per TpDBusDaemon, released in finalize */
- if (!dbus_connection_allocate_data_slot (&daemons_slot))
- ERROR ("Out of memory");
-
- daemons = dbus_connection_get_data (self->priv->libdbus, daemons_slot);
-
- if (daemons == NULL)
- {
- /* This slice is never freed; it's a one-per-DBusConnection leak. */
- daemons = g_slice_new (GSList *);
-
- *daemons = NULL;
- dbus_connection_set_data (self->priv->libdbus, daemons_slot, daemons,
- free_daemon_list);
-
- /* we add this filter at most once per DBusConnection */
- if (!dbus_connection_add_filter (self->priv->libdbus,
- _tp_dbus_daemon_name_owner_changed_filter, NULL, NULL))
- ERROR ("Out of memory");
- }
-
- *daemons = g_slist_prepend (*daemons, self);
-
return (GObject *) self;
}
@@ -1310,7 +956,6 @@ static void
tp_dbus_daemon_dispose (GObject *object)
{
TpDBusDaemon *self = TP_DBUS_DAEMON (object);
- GSList **daemons;
if (self->priv->name_owner_watches != NULL)
{
@@ -1334,28 +979,6 @@ tp_dbus_daemon_dispose (GObject *object)
g_hash_table_unref (tmp);
}
- if (self->priv->libdbus != NULL)
- {
- /* remove myself from the list to be notified on NoC */
- daemons = dbus_connection_get_data (self->priv->libdbus, daemons_slot);
-
- /* should always be non-NULL, barring bugs */
- if (G_LIKELY (daemons != NULL))
- {
- *daemons = g_slist_remove (*daemons, self);
-
- if (*daemons == NULL)
- {
- /* this results in a call to free_daemon_list (daemons) */
- dbus_connection_set_data (self->priv->libdbus, daemons_slot,
- NULL, NULL);
- }
- }
-
- dbus_connection_unref (self->priv->libdbus);
- self->priv->libdbus = NULL;
- }
-
G_OBJECT_CLASS (tp_dbus_daemon_parent_class)->dispose (object);
}
@@ -1364,48 +987,16 @@ tp_dbus_daemon_finalize (GObject *object)
{
GObjectFinalizeFunc chain_up = G_OBJECT_CLASS (tp_dbus_daemon_parent_class)->finalize;
- /* one ref per TpDBusDaemon, from constructor */
- dbus_connection_free_data_slot (&daemons_slot);
-
if (chain_up != NULL)
chain_up (object);
}
-/**
- * tp_dbus_daemon_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpDBusDaemon have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_DBUS_DAEMON.
- *
- * Since: 0.7.32
- */
-void
-tp_dbus_daemon_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (TP_TYPE_DBUS_DAEMON,
- tp_cli_dbus_daemon_add_signals);
-
- g_once_init_leave (&once, 1);
- }
-}
-
static void
tp_dbus_daemon_class_init (TpDBusDaemonClass *klass)
{
TpProxyClass *proxy_class = (TpProxyClass *) klass;
GObjectClass *object_class = (GObjectClass *) klass;
- tp_dbus_daemon_init_known_interfaces ();
-
g_type_class_add_private (klass, sizeof (TpDBusDaemonPrivate));
object_class->constructor = tp_dbus_daemon_constructor;
@@ -1418,8 +1009,5 @@ tp_dbus_daemon_class_init (TpDBusDaemonClass *klass)
gboolean
_tp_dbus_daemon_is_the_shared_one (TpDBusDaemon *self)
{
- return (self != NULL && self == starter_bus_daemon);
+ return (self != NULL && self == default_bus_daemon);
}
-
-/* Auto-generated implementation of _tp_register_dbus_glib_marshallers */
-#include "_gen/register-dbus-glib-marshallers-body.h"
diff --git a/telepathy-glib/dbus-daemon.h b/telepathy-glib/dbus-daemon.h
index 07aec712c..ed5c71962 100644
--- a/telepathy-glib/dbus-daemon.h
+++ b/telepathy-glib/dbus-daemon.h
@@ -54,11 +54,9 @@ GType tp_dbus_daemon_get_type (void);
TpDBusDaemon *tp_dbus_daemon_dup (GError **error) G_GNUC_WARN_UNUSED_RESULT;
-TpDBusDaemon *tp_dbus_daemon_new (DBusGConnection *connection)
+TpDBusDaemon *tp_dbus_daemon_new (GDBusConnection *connection)
G_GNUC_WARN_UNUSED_RESULT;
-void tp_dbus_daemon_init_known_interfaces (void);
-
typedef void (*TpDBusDaemonNameOwnerChangedCb) (TpDBusDaemon *bus_daemon,
const gchar *name, const gchar *new_owner, gpointer user_data);
diff --git a/telepathy-glib/dbus-internal.h b/telepathy-glib/dbus-internal.h
index 728e6cd96..977ea6ad5 100644
--- a/telepathy-glib/dbus-internal.h
+++ b/telepathy-glib/dbus-internal.h
@@ -30,8 +30,6 @@ G_BEGIN_DECLS
gboolean _tp_dbus_daemon_get_name_owner (TpDBusDaemon *self, gint timeout_ms,
const gchar *well_known_name, gchar **unique_name, GError **error);
-void _tp_register_dbus_glib_marshallers (void);
-
gboolean _tp_dbus_daemon_is_the_shared_one (TpDBusDaemon *self);
G_END_DECLS
diff --git a/telepathy-glib/dbus-properties-mixin.c b/telepathy-glib/dbus-properties-mixin.c
index 050e2d8e8..555c3cc19 100644
--- a/telepathy-glib/dbus-properties-mixin.c
+++ b/telepathy-glib/dbus-properties-mixin.c
@@ -1068,7 +1068,7 @@ static void
_tp_dbus_properties_mixin_get (TpSvcDBusProperties *iface,
const gchar *interface_name,
const gchar *property_name,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GObject *self = G_OBJECT (iface);
GValue value = { 0 };
@@ -1082,7 +1082,7 @@ _tp_dbus_properties_mixin_get (TpSvcDBusProperties *iface,
}
else
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
}
@@ -1141,7 +1141,7 @@ tp_dbus_properties_mixin_dup_all (GObject *self,
static void
_tp_dbus_properties_mixin_get_all_dbus (TpSvcDBusProperties *iface,
const gchar *interface_name,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GHashTable *values = tp_dbus_properties_mixin_dup_all (G_OBJECT (iface),
interface_name);
@@ -1259,7 +1259,7 @@ _tp_dbus_properties_mixin_set (TpSvcDBusProperties *iface,
const gchar *interface_name,
const gchar *property_name,
const GValue *value,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GObject *self = G_OBJECT (iface);
GError *error = NULL;
@@ -1271,7 +1271,7 @@ _tp_dbus_properties_mixin_set (TpSvcDBusProperties *iface,
}
else
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
}
diff --git a/telepathy-glib/dbus.h b/telepathy-glib/dbus.h
index af91f383d..d1ac97a58 100644
--- a/telepathy-glib/dbus.h
+++ b/telepathy-glib/dbus.h
@@ -34,7 +34,7 @@
G_BEGIN_DECLS
-void tp_dbus_g_method_return_not_implemented (DBusGMethodInvocation *context);
+void tp_dbus_g_method_return_not_implemented (GDBusMethodInvocation *context);
typedef enum /*< flags >*/
{
diff --git a/telepathy-glib/debug-client.c b/telepathy-glib/debug-client.c
index 986f63f2e..9dfd637da 100644
--- a/telepathy-glib/debug-client.c
+++ b/telepathy-glib/debug-client.c
@@ -229,7 +229,6 @@ tp_debug_client_class_init (TpDebugClientClass *klass)
1, TP_TYPE_DEBUG_MESSAGE);
g_type_class_add_private (klass, sizeof (TpDebugClientPrivate));
- tp_debug_client_init_known_interfaces ();
}
GQuark
@@ -319,37 +318,6 @@ tp_debug_client_list_features (TpProxyClass *klass)
}
/**
- * tp_debug_client_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpDebugClient have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_DEBUG_CLIENT.
- *
- * Since: 0.19.0
- */
-void
-tp_debug_client_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_DEBUG_CLIENT;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_debug_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
-}
-
-/**
* tp_debug_client_new:
* @dbus: a D-Bus daemon; may not be %NULL
* @unique_name: the unique name of the process to be debugged; may not be
diff --git a/telepathy-glib/debug-client.h b/telepathy-glib/debug-client.h
index de6825d21..40df631f0 100644
--- a/telepathy-glib/debug-client.h
+++ b/telepathy-glib/debug-client.h
@@ -84,9 +84,6 @@ GType tp_debug_client_get_type (void);
TpDebugClientClass))
_TP_AVAILABLE_IN_0_20
-void tp_debug_client_init_known_interfaces (void);
-
-_TP_AVAILABLE_IN_0_20
void tp_debug_client_get_messages_async (
TpDebugClient *self,
GAsyncReadyCallback callback,
diff --git a/telepathy-glib/debug-sender.c b/telepathy-glib/debug-sender.c
index 7cbc053dd..6350220bb 100644
--- a/telepathy-glib/debug-sender.c
+++ b/telepathy-glib/debug-sender.c
@@ -282,7 +282,7 @@ tp_debug_sender_class_init (TpDebugSenderClass *klass)
static void
get_messages (TpSvcDebug1 *self,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpDebugSender *dbg = TP_DEBUG_SENDER (self);
GPtrArray *messages;
diff --git a/telepathy-glib/errors.c b/telepathy-glib/errors.c
index 978e61d87..ae3039660 100644
--- a/telepathy-glib/errors.c
+++ b/telepathy-glib/errors.c
@@ -44,8 +44,8 @@
* enumeration.
*
* This macro expands to a call to a function returning the Telepathy error
- * domain. Since 0.7.17, this function automatically registers the domain with
- * dbus-glib for server-side use (using dbus_g_error_domain_register()) when
+ * domain. Since 0.UNRELEASED, this function automatically registers the
+ * domain with GIO (using g_dbus_error_register_error()) when
* called.
*
* This used to be called %TP_ERRORS.
@@ -318,11 +318,31 @@ tp_error_quark (void)
if (g_once_init_enter (&quark))
{
- GQuark domain = g_quark_from_static_string ("tp-error-quark");
+ gsize domain = 0;
+ GEnumClass *cls;
+ guint i;
+ GDBusErrorEntry *entries;
+
+ cls = g_type_class_ref (TP_TYPE_ERROR);
+ entries = g_new0 (GDBusErrorEntry, cls->n_values);
+
+ for (i = 0; i < cls->n_values; i++)
+ {
+ entries[i].error_code = cls->values[i].value;
+ entries[i].dbus_error_name = g_strdup_printf ("%s.%s",
+ TP_ERROR_PREFIX, cls->values[i].value_nick);
+ }
+
+ g_dbus_error_register_error_domain ("tp-error-quark", &domain,
+ entries, cls->n_values);
+
+ for (i = 0; i < cls->n_values; i++)
+ g_free ((gchar *) entries[i].dbus_error_name);
+
+ g_free (entries);
- dbus_g_error_domain_register (domain, TP_ERROR_PREFIX,
- TP_TYPE_ERROR);
g_once_init_leave (&quark, domain);
+ g_type_class_unref (cls);
}
return (GQuark) quark;
diff --git a/telepathy-glib/group-mixin.c b/telepathy-glib/group-mixin.c
index 8c9eb08c3..f299feff9 100644
--- a/telepathy-glib/group-mixin.c
+++ b/telepathy-glib/group-mixin.c
@@ -552,7 +552,7 @@ static void
tp_group_mixin_add_members_async (TpSvcChannelInterfaceGroup1 *obj,
const GArray *contacts,
const gchar *message,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GError *error = NULL;
@@ -562,7 +562,7 @@ tp_group_mixin_add_members_async (TpSvcChannelInterfaceGroup1 *obj,
}
else
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
}
@@ -692,7 +692,7 @@ tp_group_mixin_remove_members_async
const GArray *contacts,
const gchar *message,
guint reason,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GError *error = NULL;
@@ -704,7 +704,7 @@ tp_group_mixin_remove_members_async
}
else
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
}
@@ -2008,7 +2008,7 @@ tp_external_group_mixin_get_dbus_property (GObject *object,
GError na = { TP_ERROR, TP_ERROR_NOT_AVAILABLE, "I'm sure I " \
"had a group object around here somewhere?" };\
\
- dbus_g_method_return_error (context, &na); \
+ g_dbus_method_invocation_return_gerror (context, &na); \
return; \
} \
@@ -2016,7 +2016,7 @@ static void
tp_external_group_mixin_add_members_async (TpSvcChannelInterfaceGroup1 *obj,
const GArray *contacts,
const gchar *message,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
EXTERNAL_OR_DIE (group)
tp_group_mixin_add_members_async ((TpSvcChannelInterfaceGroup1 *) group,
@@ -2029,7 +2029,7 @@ tp_external_group_mixin_remove_members_async
const GArray *contacts,
const gchar *message,
guint reason,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
EXTERNAL_OR_DIE (group)
tp_group_mixin_remove_members_async
diff --git a/telepathy-glib/handle-channel-context-internal.h b/telepathy-glib/handle-channel-context-internal.h
index a8024eeb4..1d3d2e0e5 100644
--- a/telepathy-glib/handle-channel-context-internal.h
+++ b/telepathy-glib/handle-channel-context-internal.h
@@ -59,7 +59,7 @@ TpHandleChannelContext * _tp_handle_channel_context_new (
GPtrArray *requests_satisfied,
guint64 user_action_time,
GHashTable *handler_info,
- DBusGMethodInvocation *dbus_context);
+ GDBusMethodInvocation *dbus_context);
TpHandleChannelContextState _tp_handle_channel_context_get_state
(TpHandleChannelContext *self);
diff --git a/telepathy-glib/handle-channel-context.c b/telepathy-glib/handle-channel-context.c
index 1b3842426..938ed5ac2 100644
--- a/telepathy-glib/handle-channel-context.c
+++ b/telepathy-glib/handle-channel-context.c
@@ -91,7 +91,7 @@ struct _TpHandleChannelContextPrivate
{
TpHandleChannelContextState state;
GSimpleAsyncResult *result;
- DBusGMethodInvocation *dbus_context;
+ GDBusMethodInvocation *dbus_context;
/* Number of calls we are waiting they return. Once they have all returned
* the context is considered as prepared */
@@ -402,14 +402,14 @@ tp_handle_channel_context_class_init (
/**
* TpHandleChannelContext:dbus-context: (skip)
*
- * The #DBusGMethodInvocation representing the D-Bus context of the
+ * The #GDBusMethodInvocation representing the D-Bus context of the
* HandleChannels call.
* Can only be written during construction.
*
* Since: 0.11.6
*/
param_spec = g_param_spec_pointer ("dbus-context", "D-Bus context",
- "The DBusGMethodInvocation associated with the HandleChannels call",
+ "The GDBusMethodInvocation associated with the HandleChannels call",
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_DBUS_CONTEXT,
param_spec);
@@ -438,7 +438,7 @@ TpHandleChannelContext * _tp_handle_channel_context_new (
GPtrArray *requests_satisfied,
guint64 user_action_time,
GHashTable *handler_info,
- DBusGMethodInvocation *dbus_context)
+ GDBusMethodInvocation *dbus_context)
{
return g_object_new (TP_TYPE_HANDLE_CHANNELS_CONTEXT,
"account", account,
@@ -472,7 +472,7 @@ tp_handle_channel_context_accept (TpHandleChannelContext *self)
g_return_if_fail (self->priv->dbus_context != NULL);
self->priv->state = TP_HANDLE_CHANNEL_CONTEXT_STATE_DONE;
- dbus_g_method_return (self->priv->dbus_context);
+ g_dbus_method_invocation_return_value (self->priv->dbus_context, NULL);
self->priv->dbus_context = NULL;
@@ -498,7 +498,7 @@ tp_handle_channel_context_fail (TpHandleChannelContext *self,
g_return_if_fail (self->priv->dbus_context != NULL);
self->priv->state = TP_HANDLE_CHANNEL_CONTEXT_STATE_FAILED;
- dbus_g_method_return_error (self->priv->dbus_context, error);
+ g_dbus_method_invocation_return_gerror (self->priv->dbus_context, error);
self->priv->dbus_context = NULL;
}
diff --git a/telepathy-glib/logger.c b/telepathy-glib/logger.c
index f833af925..369388164 100644
--- a/telepathy-glib/logger.c
+++ b/telepathy-glib/logger.c
@@ -62,32 +62,12 @@ struct _TpLoggerPriv
};
static void
-tp_logger_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_ACCOUNT_MANAGER;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_logger_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
-}
-
-static void
tp_logger_class_init (
TpLoggerClass *klass)
{
TpProxyClass *proxy_class = (TpProxyClass *) klass;
proxy_class->interface = TP_IFACE_QUARK_LOGGER;
- tp_logger_init_known_interfaces ();
g_type_class_add_private (klass, sizeof (TpLoggerPriv));
}
diff --git a/telepathy-glib/message-mixin.c b/telepathy-glib/message-mixin.c
index 128fe6688..c3d402287 100644
--- a/telepathy-glib/message-mixin.c
+++ b/telepathy-glib/message-mixin.c
@@ -389,7 +389,7 @@ tp_message_mixin_maybe_send_gone (GObject *object)
static void
tp_message_mixin_set_chat_state_async (TpSvcChannelInterfaceChatState1 *iface,
guint state,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GObject *object = (GObject *) iface;
TpMessageMixin *mixin = TP_MESSAGE_MIXIN (object);
@@ -432,7 +432,7 @@ tp_message_mixin_set_chat_state_async (TpSvcChannelInterfaceChatState1 *iface,
return;
error:
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
}
@@ -536,7 +536,7 @@ static void
tp_message_mixin_acknowledge_pending_messages_async (
TpSvcChannelTypeText *iface,
const GArray *ids,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpMessageMixin *mixin = TP_MESSAGE_MIXIN (iface);
GPtrArray *links = g_ptr_array_sized_new (ids->len);
@@ -550,11 +550,10 @@ tp_message_mixin_acknowledge_pending_messages_async (
if (tp_intset_is_member (seen, id))
{
- gchar *client = dbus_g_method_get_sender (context);
+ const gchar *client = g_dbus_method_invocation_get_sender (context);
DEBUG ("%s passed message id %u more than once in one call to "
"AcknowledgePendingMessages. Foolish pup.", client, id);
- g_free (client);
continue;
}
@@ -568,7 +567,7 @@ tp_message_mixin_acknowledge_pending_messages_async (
"invalid message id %u", id);
DEBUG ("%s", error->message);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
g_ptr_array_unref (links);
@@ -746,7 +745,7 @@ tp_message_mixin_set_rescued (GObject *obj)
struct _TpMessageMixinOutgoingMessagePrivate {
- DBusGMethodInvocation *context;
+ GDBusMethodInvocation *context;
gboolean messages:1;
};
@@ -794,7 +793,7 @@ tp_message_mixin_sent (GObject *object,
{
GError *e = g_error_copy (error);
- dbus_g_method_return_error (cm_msg->outgoing_context, e);
+ g_dbus_method_invocation_return_gerror (cm_msg->outgoing_context, e);
g_error_free (e);
}
else
@@ -828,7 +827,7 @@ static void
tp_message_mixin_send_message_async (TpSvcChannelTypeText *iface,
const GPtrArray *parts,
guint flags,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpMessageMixin *mixin = TP_MESSAGE_MIXIN (iface);
TpMessage *message;
@@ -849,7 +848,7 @@ tp_message_mixin_send_message_async (TpSvcChannelTypeText *iface,
GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Cannot send a message that does not have at least one part" };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
return;
}
@@ -865,7 +864,7 @@ tp_message_mixin_send_message_async (TpSvcChannelTypeText *iface,
TP_ERROR_INVALID_ARGUMENT,
"Key '%s' not allowed in a sent message", *iter);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
return;
}
}
@@ -879,7 +878,7 @@ tp_message_mixin_send_message_async (TpSvcChannelTypeText *iface,
TP_ERROR_INVALID_ARGUMENT,
"Key '%s' not allowed in a message header", *iter);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
return;
}
}
@@ -892,7 +891,7 @@ tp_message_mixin_send_message_async (TpSvcChannelTypeText *iface,
TP_ERROR_INVALID_ARGUMENT,
"Key '%s' not allowed in an outgoing message header", *iter);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
return;
}
}
@@ -908,7 +907,7 @@ tp_message_mixin_send_message_async (TpSvcChannelTypeText *iface,
TP_ERROR_INVALID_ARGUMENT,
"Key '%s' not allowed in a message body", *iter);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
return;
}
}
diff --git a/telepathy-glib/observe-channel-context-internal.h b/telepathy-glib/observe-channel-context-internal.h
index e3e363228..bc21bada5 100644
--- a/telepathy-glib/observe-channel-context-internal.h
+++ b/telepathy-glib/observe-channel-context-internal.h
@@ -60,7 +60,7 @@ TpObserveChannelContext * _tp_observe_channel_context_new (
TpChannelDispatchOperation *dispatch_operation,
GPtrArray *requests,
GHashTable *observer_info,
- DBusGMethodInvocation *dbus_context);
+ GDBusMethodInvocation *dbus_context);
TpObserveChannelContextState _tp_observe_channel_context_get_state (
TpObserveChannelContext *self);
diff --git a/telepathy-glib/observe-channel-context.c b/telepathy-glib/observe-channel-context.c
index e5efa57c5..68a952ace 100644
--- a/telepathy-glib/observe-channel-context.c
+++ b/telepathy-glib/observe-channel-context.c
@@ -81,7 +81,7 @@ struct _TpObserveChannelContextPrivate
{
TpObserveChannelContextState state;
GSimpleAsyncResult *result;
- DBusGMethodInvocation *dbus_context;
+ GDBusMethodInvocation *dbus_context;
/* Number of calls we are waiting they return. Once they have all returned
* the context is considered as prepared */
@@ -358,14 +358,14 @@ tp_observe_channel_context_class_init (TpObserveChannelContextClass *cls)
/**
* TpObserveChannelContext:dbus-context: (skip)
*
- * The #DBusGMethodInvocation representing the D-Bus context of the
+ * The #GDBusMethodInvocation representing the D-Bus context of the
* ObserveChannels call.
* Can only be written during construction.
*
* Since: 0.11.5
*/
param_spec = g_param_spec_pointer ("dbus-context", "D-Bus context",
- "The DBusGMethodInvocation associated with the ObserveChannels call",
+ "The GDBusMethodInvocation associated with the ObserveChannels call",
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_DBUS_CONTEXT,
param_spec);
@@ -399,7 +399,7 @@ _tp_observe_channel_context_new (
TpChannelDispatchOperation *dispatch_operation,
GPtrArray *requests,
GHashTable *observer_info,
- DBusGMethodInvocation *dbus_context)
+ GDBusMethodInvocation *dbus_context)
{
return g_object_new (TP_TYPE_OBSERVE_CHANNELS_CONTEXT,
"account", account,
@@ -429,7 +429,7 @@ tp_observe_channel_context_accept (TpObserveChannelContext *self)
g_return_if_fail (self->priv->dbus_context != NULL);
self->priv->state = TP_OBSERVE_CHANNEL_CONTEXT_STATE_DONE;
- dbus_g_method_return (self->priv->dbus_context);
+ g_dbus_method_invocation_return_value (self->priv->dbus_context, NULL);
self->priv->dbus_context = NULL;
}
@@ -452,7 +452,7 @@ tp_observe_channel_context_fail (TpObserveChannelContext *self,
g_return_if_fail (self->priv->dbus_context != NULL);
self->priv->state = TP_OBSERVE_CHANNEL_CONTEXT_STATE_FAILED;
- dbus_g_method_return_error (self->priv->dbus_context, error);
+ g_dbus_method_invocation_return_gerror (self->priv->dbus_context, error);
self->priv->dbus_context = NULL;
}
diff --git a/telepathy-glib/presence-mixin.c b/telepathy-glib/presence-mixin.c
index c17dc8ab1..493315215 100644
--- a/telepathy-glib/presence-mixin.c
+++ b/telepathy-glib/presence-mixin.c
@@ -766,7 +766,7 @@ tp_presence_mixin_set_presence (
TpSvcConnectionInterfacePresence1 *iface,
const gchar *status,
const gchar *message,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GObject *obj = (GObject *) iface;
TpPresenceMixinClass *mixin_cls =
@@ -803,7 +803,7 @@ out:
}
else
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
diff --git a/telepathy-glib/protocol.c b/telepathy-glib/protocol.c
index ab26ebd4f..c01fd4c85 100644
--- a/telepathy-glib/protocol.c
+++ b/telepathy-glib/protocol.c
@@ -874,7 +874,6 @@ tp_protocol_class_init (TpProtocolClass *klass)
proxy_class->list_features = tp_protocol_list_features;
proxy_class->must_have_unique_name = FALSE;
proxy_class->interface = TP_IFACE_QUARK_PROTOCOL;
- tp_protocol_init_known_interfaces ();
}
static void
@@ -939,39 +938,6 @@ finally:
}
/**
- * tp_protocol_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpProtocol have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_PROTOCOL.
- *
- * Since: 0.11.11
- */
-void
-tp_protocol_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType type = TP_TYPE_PROTOCOL;
-
- tp_proxy_init_known_interfaces ();
-
- tp_proxy_or_subclass_hook_on_interface_add (type,
- tp_cli_protocol_add_signals);
- tp_proxy_subclass_add_error_mapping (type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
-}
-
-
-/**
* tp_protocol_get_name:
* @self: a protocol object
*
diff --git a/telepathy-glib/protocol.h b/telepathy-glib/protocol.h
index a889fb3c1..6aabc03c9 100644
--- a/telepathy-glib/protocol.h
+++ b/telepathy-glib/protocol.h
@@ -65,8 +65,6 @@ struct _TpProtocol
TpProtocolPrivate *priv;
};
-void tp_protocol_init_known_interfaces (void);
-
TpProtocol *tp_protocol_new (TpDBusDaemon *dbus, const gchar *cm_name,
const gchar *protocol_name, const GHashTable *immutable_properties,
GError **error);
diff --git a/telepathy-glib/proxy-internal.h b/telepathy-glib/proxy-internal.h
index e82d52ac5..82b996672 100644
--- a/telepathy-glib/proxy-internal.h
+++ b/telepathy-glib/proxy-internal.h
@@ -28,83 +28,65 @@ typedef struct {
const gchar *version;
gsize size;
- DBusGProxy *(*get_interface_by_id) (TpProxy *,
+ GDBusProxy *(*get_interface_by_id) (TpProxy *,
GQuark,
GError **);
TpProxyPendingCall *(*pending_call_new) (TpProxy *,
+ gint,
GQuark,
const gchar *,
- DBusGProxy *,
- TpProxyInvokeFunc,
+ GVariant *,
+ const GVariantType *,
+ TpProxyWrapperFunc,
GCallback,
gpointer,
GDestroyNotify,
- GObject *,
- gboolean);
- void (*pending_call_take_pending_call) (TpProxyPendingCall *,
- DBusGProxyCall *);
- void (*pending_call_take_results) (TpProxyPendingCall *,
- GError *,
- GValueArray *);
- GDestroyNotify pending_call_completed;
+ GObject *);
TpProxySignalConnection *(*signal_connection_new) (TpProxy *,
GQuark,
const gchar *,
- const GType *,
- GCallback,
- TpProxyInvokeFunc,
+ const GVariantType *,
+ TpProxyWrapperFunc,
GCallback,
gpointer,
GDestroyNotify,
GObject *,
GError **);
- void (*signal_connection_take_results) (TpProxySignalConnection *,
- GValueArray *);
GType type;
} TpProxyImplementation;
-DBusGProxy *_tp_proxy_get_interface_by_id (TpProxy *self,
+GDBusProxy *_tp_proxy_get_interface_by_id (TpProxy *self,
GQuark iface,
GError **error);
-TpProxyPendingCall *_tp_proxy_pending_call_new (TpProxy *self,
+TpProxyPendingCall *
+_tp_proxy_pending_call_v1_new (TpProxy *proxy,
+ gint timeout_ms,
GQuark iface,
const gchar *member,
- DBusGProxy *iface_proxy,
- TpProxyInvokeFunc invoke_callback,
+ GVariant *args,
+ const GVariantType *reply_type,
+ TpProxyWrapperFunc wrapper,
GCallback callback,
gpointer user_data,
GDestroyNotify destroy,
- GObject *weak_object,
- gboolean cancel_must_raise);
-
-void _tp_proxy_pending_call_take_pending_call (TpProxyPendingCall *pc,
- DBusGProxyCall *pending_call);
+ GObject *weak_object);
-void _tp_proxy_pending_call_take_results (TpProxyPendingCall *pc,
- GError *error,
- GValueArray *args);
-
-void _tp_proxy_pending_call_completed (gpointer p);
-
-TpProxySignalConnection *_tp_proxy_signal_connection_new (TpProxy *self,
+TpProxySignalConnection *
+_tp_proxy_signal_connection_v1_new (TpProxy *self,
GQuark iface,
const gchar *member,
- const GType *expected_types,
- GCallback collect_args,
- TpProxyInvokeFunc invoke_callback,
+ const GVariantType *expected_types,
+ TpProxyWrapperFunc wrapper,
GCallback callback,
gpointer user_data,
GDestroyNotify destroy,
GObject *weak_object,
GError **error);
-void _tp_proxy_signal_connection_take_results (TpProxySignalConnection *sc,
- GValueArray *args);
-
/*
* Implemented in the -core library, and called by the -main library.
*
@@ -114,9 +96,6 @@ void _tp_proxy_signal_connection_take_results (TpProxySignalConnection *sc,
*/
void tp_private_proxy_set_implementation (TpProxyImplementation *impl);
-GError *_tp_proxy_take_and_remap_error (TpProxy *self, GError *error)
- G_GNUC_WARN_UNUSED_RESULT;
-
typedef void (*TpProxyProc) (TpProxy *);
gboolean _tp_proxy_is_preparing (gpointer self,
diff --git a/telepathy-glib/proxy-methods.c b/telepathy-glib/proxy-methods.c
index 00231cd65..3dcf19ab1 100644
--- a/telepathy-glib/proxy-methods.c
+++ b/telepathy-glib/proxy-methods.c
@@ -24,6 +24,7 @@
#define DEBUG_FLAG TP_DEBUG_PROXY
#include "telepathy-glib/debug-internal.h"
+#include "telepathy-glib/errors.h"
#include <telepathy-glib/util.h>
#if 0
@@ -41,50 +42,14 @@
*/
struct _TpProxyPendingCall {
- /* This structure's "reference count" is implicit:
- * - 1 if D-Bus has us (from creation until _completed)
- * - 1 if results have come in but we haven't run the callback yet
- * (idle_source is nonzero)
- *
- * In normal use, its life cycle should go like this:
- * - Created by tp_proxy_pending_call_v0_new
- * - Given to dbus-glib by generated code (actual call starts here)
- * - tp_proxy_pending_call_v0_take_pending_call
- * - (Phase 1)
- * - tp_proxy_pending_call_v0_take_results
- * - Idle handler queued
- * - (Phase 2)
- * - tp_proxy_pending_call_v0_completed
- * - (Phase 3)
- * - tp_proxy_pending_call_idle_invoke
- * - tp_proxy_pending_call_free
- *
- * although we can't guarantee that idle_invoke won't go off before
- * completed does, if the dbus-glib implementation changes.
- *
- * Exceptional conditions that can occur:
- * - Weak object dies
- * - Reference cleared, otherwise equivalent to explicit cancellation
- * - Explicitly cancelled
- * - All phases: callback invoked if cancel_must_raise, otherwise
- * not
- * - DBusGProxy destroy signal (or _completed before _take_results)
- * - Phase 1: error callback queued
- * - Phase 2: ignored, we use the results we've already got
- * - Phase 3: ignored, we use the results we've already got
- */
-
- /* Always non-NULL */
TpProxy *proxy;
/* Set to NULL after it's been invoked once, or if cancellation means
* it should never be called. Supplied by the generated code */
- TpProxyInvokeFunc invoke_callback;
+ TpProxyWrapperFunc wrapper;
- /* arguments for invoke_callback supplied by _take_results, by
- * cancellation or by the destroy signal */
+ /* error if no interface */
GError *error /* implicitly initialized */;
- GValueArray *args;
/* user-supplied arguments for invoke_callback */
GCallback callback;
@@ -92,22 +57,8 @@ struct _TpProxyPendingCall {
GDestroyNotify destroy;
GObject *weak_object;
- /* Non-NULL until either _completed or destroy, whichever comes first */
- DBusGProxy *iface_proxy;
- DBusGProxyCall *pending_call;
-
- /* Nonzero if _idle_invoke has been queued (even if it has already
- * happened), i.e. if results have been taken or the DBusGProxy
- * was destroyed */
- guint idle_source;
-
- /* If TRUE, invoke the callback even on cancellation */
- unsigned cancel_must_raise:1;
-
- /* If TRUE, the idle_invoke callback has either run or been cancelled */
- unsigned idle_completed:1;
- /* If TRUE, dbus-glib no longer holds a reference to us */
- unsigned dbus_completed:1;
+ /* Used to cancel the call early */
+ GCancellable *cancellable;
/* Marker to indicate that this is, in fact, a valid TpProxyPendingCall */
gconstpointer priv;
@@ -125,175 +76,34 @@ tp_proxy_pending_call_lost_weak_ref (gpointer data,
g_assert (pc->priv == pending_call_magic);
g_assert (dead == pc->weak_object);
-
pc->weak_object = NULL;
- if (!pc->idle_completed)
- tp_proxy_pending_call_cancel (pc);
+ tp_proxy_pending_call_cancel (pc);
}
static gboolean
-tp_proxy_pending_call_idle_invoke (gpointer p)
+tp_proxy_pending_call_idle_error (gpointer p)
{
TpProxyPendingCall *pc = p;
- TpProxyInvokeFunc invoke = pc->invoke_callback;
-
- MORE_DEBUG ("%p", pc);
+ TpProxyWrapperFunc wrapper = pc->wrapper;
- if (invoke == NULL)
+ if (wrapper == NULL || pc->proxy == NULL ||
+ g_cancellable_is_cancelled (pc->cancellable))
{
/* either already invoked (bug?), or cancelled */
return FALSE;
}
- MORE_DEBUG ("%p: invoking user callback", pc);
+ g_assert (pc->error != NULL);
- g_assert (pc->proxy != NULL);
- g_assert (pc->error == NULL || pc->args == NULL);
- g_assert (!pc->idle_completed);
-
- pc->invoke_callback = NULL;
- invoke (pc->proxy, pc->error, pc->args, pc->callback,
+ pc->wrapper = NULL;
+ wrapper (pc->proxy, pc->error, NULL, pc->callback,
pc->user_data, pc->weak_object);
- pc->error = NULL;
- pc->args = NULL;
-
- /* don't clear pc->idle_source here! tp_proxy_pending_call_v0_completed
- * compares it to 0 to determine whether to free the object */
+ g_clear_error (&pc->error);
return FALSE;
}
-static void _tp_proxy_pending_call_idle_completed (gpointer p);
-
-static void
-_tp_proxy_pending_call_dgproxy_destroy (DBusGProxy *iface_proxy,
- TpProxyPendingCall *pc)
-{
- g_assert (iface_proxy != NULL);
- g_assert (pc != NULL);
- g_assert (pc->iface_proxy == iface_proxy);
- g_assert (pc->proxy != NULL);
-
- DEBUG ("%p: DBusGProxy %p invalidated", pc, iface_proxy);
-
- if (pc->idle_source == 0)
- {
- /* we haven't already received and queued a reply, so synthesize
- * one */
- g_assert (pc->args == NULL);
- g_assert (pc->error == NULL);
-
- pc->error = g_error_new_literal (TP_DBUS_ERRORS,
- TP_DBUS_ERROR_NAME_OWNER_LOST, "Name owner lost (service crashed?)");
-
- pc->idle_source = g_idle_add_full (G_PRIORITY_HIGH,
- tp_proxy_pending_call_idle_invoke, pc,
- _tp_proxy_pending_call_idle_completed);
- }
-
- g_signal_handlers_disconnect_by_func (pc->iface_proxy,
- _tp_proxy_pending_call_dgproxy_destroy, pc);
- g_object_unref (pc->iface_proxy);
- pc->iface_proxy = NULL;
-}
-
-/**
- * tp_proxy_pending_call_v0_new:
- * @self: a proxy
- * @iface: a quark whose string value is the D-Bus interface
- * @member: the name of the method being called
- * @iface_proxy: the interface-specific #DBusGProxy for @iface,
- * or %NULL if the call will immediately fail
- * @invoke_callback: an implementation of #TpProxyInvokeFunc which will
- * invoke @callback with appropriate arguments
- * @callback: a callback to be called when the call completes
- * @user_data: user-supplied data for the callback
- * @destroy: user-supplied destructor for the data
- * @weak_object: if not %NULL, a #GObject which will be weakly referenced by
- * the signal connection - if it is destroyed, the pending call will
- * automatically be cancelled
- * @cancel_must_raise: if %TRUE, the @invoke_callback will be run with
- * error %TP_DBUS_ERROR_CANCELLED if the call is cancelled by a call to
- * tp_proxy_pending_call_cancel() or by destruction of the @weak_object;
- * if %FALSE, the @invoke_callback will not be run at all in these cases
- *
- * Allocate a new pending call structure. After calling this function, the
- * caller must start an asynchronous D-Bus call and give the resulting
- * DBusGProxyCall to the pending call object using
- * tp_proxy_pending_call_v0_take_pending_call().
- *
- * If dbus-glib gets a reply to the call before it's cancelled, the caller
- * must arrange for tp_proxy_pending_call_v0_take_results() to be called
- * with the results (the intention is for this to be done immediately
- * after dbus_g_proxy_end_call in the callback supplied to dbus-glib).
- *
- * When dbus-glib discards its reference to the user_data supplied in the
- * asynchronous D-Bus call (i.e. after the call is cancelled or a reply
- * arrives), tp_proxy_pending_call_v0_completed must be called (the intention
- * is for the #TpProxyPendingCall to be the @user_data in the async call,
- * and for tp_proxy_pending_call_v0_completed to be the #GDestroyNotify
- * passed to the same async call).
- *
- * This function is for use by #TpProxy subclass implementations only, and
- * should usually only be called from code generated by
- * tools/glib-client-gen.py.
- *
- * Returns: a new pending call structure
- *
- * Since: 0.7.1
- */
-
-/* that's implemented in the core library, but it calls this: */
-
-TpProxyPendingCall *
-_tp_proxy_pending_call_new (TpProxy *self,
- GQuark iface,
- const gchar *member,
- DBusGProxy *iface_proxy,
- TpProxyInvokeFunc invoke_callback,
- GCallback callback,
- gpointer user_data,
- GDestroyNotify destroy,
- GObject *weak_object,
- gboolean cancel_must_raise)
-{
- TpProxyPendingCall *pc;
-
- g_return_val_if_fail (invoke_callback != NULL, NULL);
- g_return_val_if_fail ((gpointer) iface_proxy != (gpointer) self, NULL);
-
- pc = g_slice_new0 (TpProxyPendingCall);
-
- MORE_DEBUG ("(proxy=%p, if=%s, meth=%s, ic=%p; cb=%p, ud=%p, dn=%p, wo=%p)"
- " -> %p", self, g_quark_to_string (iface), member, invoke_callback,
- callback, user_data, destroy, weak_object, pc);
-
- pc->proxy = g_object_ref (self);
- pc->invoke_callback = invoke_callback;
- pc->callback = callback;
- pc->user_data = user_data;
- pc->destroy = destroy;
- pc->weak_object = weak_object;
- pc->iface_proxy = NULL;
- pc->pending_call = NULL;
- pc->priv = pending_call_magic;
- pc->cancel_must_raise = cancel_must_raise;
-
- if (weak_object != NULL)
- g_object_weak_ref (weak_object, tp_proxy_pending_call_lost_weak_ref, pc);
-
- if (iface_proxy != NULL)
- {
- pc->iface_proxy = g_object_ref (iface_proxy);
-
- g_signal_connect (iface_proxy, "destroy",
- G_CALLBACK (_tp_proxy_pending_call_dgproxy_destroy), pc);
- }
-
- return pc;
-}
-
/**
* tp_proxy_pending_call_cancel:
* @pc: a pending call
@@ -307,58 +117,16 @@ _tp_proxy_pending_call_new (TpProxy *self,
void
tp_proxy_pending_call_cancel (TpProxyPendingCall *pc)
{
- DEBUG ("%p", pc);
-
g_return_if_fail (pc->priv == pending_call_magic);
- g_return_if_fail (pc->proxy != NULL);
- /* If the callback has already run, it's too late to cancel */
- g_return_if_fail (!pc->idle_completed);
-
- if (pc->cancel_must_raise)
- {
- if (pc->error != NULL)
- g_error_free (pc->error);
- pc->error = g_error_new_literal (TP_DBUS_ERRORS,
- TP_DBUS_ERROR_CANCELLED, "Re-entrant D-Bus call cancelled");
-
- if (pc->args != NULL)
- {
- tp_value_array_free (pc->args);
- pc->args = NULL;
- }
- }
- else
- {
- pc->invoke_callback = NULL;
- }
-
- /* If we're calling the callback due to cancellation, we must free the
- * pending call object afterwards. Otherwise, we must free the pending
- * call object later anyway, in case this function was called due to
- * weak refs (like fd.o #14750). */
- if (pc->idle_source == 0)
- {
- pc->idle_source = g_idle_add_full (G_PRIORITY_HIGH,
- tp_proxy_pending_call_idle_invoke, pc,
- _tp_proxy_pending_call_idle_completed);
- }
-
- if (!pc->dbus_completed && pc->pending_call != NULL)
- {
- /* Implicitly asserts that iface_proxy is non-NULL */
- DBusGProxy *iface_proxy = g_object_ref (pc->iface_proxy);
-
- dbus_g_proxy_cancel_call (iface_proxy, pc->pending_call);
- g_object_unref (iface_proxy);
- }
+ g_cancellable_cancel (pc->cancellable);
+ g_clear_object (&pc->proxy);
+ pc->wrapper = NULL;
}
static void
tp_proxy_pending_call_free (TpProxyPendingCall *pc)
{
- MORE_DEBUG ("%p", pc);
-
g_assert (pc->priv == pending_call_magic);
if (pc->destroy != NULL)
@@ -367,171 +135,128 @@ tp_proxy_pending_call_free (TpProxyPendingCall *pc)
pc->destroy = NULL;
pc->user_data = NULL;
- if (pc->error != NULL)
- g_error_free (pc->error);
-
- pc->error = NULL;
-
- if (pc->args != NULL)
- tp_value_array_free (pc->args);
-
- pc->args = NULL;
+ g_clear_error (&pc->error);
if (pc->weak_object != NULL)
g_object_weak_unref (pc->weak_object,
tp_proxy_pending_call_lost_weak_ref, pc);
- if (pc->iface_proxy != NULL)
- {
- g_signal_handlers_disconnect_by_func (pc->iface_proxy,
- _tp_proxy_pending_call_dgproxy_destroy, pc);
- g_object_unref (pc->iface_proxy);
- pc->iface_proxy = NULL;
- }
-
- g_assert (pc->proxy != NULL);
- g_object_unref (pc->proxy);
- pc->proxy = NULL;
-
+ g_clear_object (&pc->cancellable);
+ g_clear_object (&pc->proxy);
g_slice_free (TpProxyPendingCall, pc);
}
-/**
- * tp_proxy_pending_call_v0_completed:
- * @p: a #TpProxyPendingCall allocated with tp_proxy_pending_call_v0_new()
- *
- * Indicate that dbus-glib has finished with this pending call, and therefore
- * either tp_proxy_pending_call_v0_take_results() has already been called,
- * or it will never be called. See tp_proxy_pending_call_v0_new().
- *
- * The signature is chosen to match #GDestroyNotify.
- *
- * This function is for use by #TpProxy subclass implementations only, and
- * should usually only be called from code generated by
- * tools/glib-client-gen.py.
- *
- * Since: 0.7.1
- */
-
-/* that's implemented in the core library, but it calls this: */
-
-void
-_tp_proxy_pending_call_completed (gpointer p)
+static void
+tp_proxy_pending_call_async_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
- TpProxyPendingCall *pc = p;
+ TpProxyPendingCall *pc = user_data;
+ GVariant *args;
+ GError *error = NULL;
- MORE_DEBUG ("%p", pc);
+ if (pc->proxy == NULL ||
+ pc->wrapper == NULL ||
+ g_cancellable_is_cancelled (pc->cancellable))
+ goto finally;
- g_return_if_fail (pc->priv == pending_call_magic);
- g_return_if_fail (!pc->dbus_completed);
- g_return_if_fail (pc->proxy != NULL);
+ args = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object),
+ result, &error);
- /* dbus-glib frees its user_data *before* it emits destroy; if we
- * haven't yet queued the callback, assume that's what's going on. */
- if (pc->idle_source == 0 && pc->iface_proxy != NULL)
+ if (args != NULL)
{
- MORE_DEBUG ("Looks like this pending call hasn't finished, assuming "
- "the DBusGProxy is about to die");
- /* this causes the pending call to be freed */
- _tp_proxy_pending_call_dgproxy_destroy (pc->iface_proxy, pc);
-
- g_assert (pc->iface_proxy == NULL);
+ pc->wrapper (pc->proxy, NULL, args,
+ pc->callback, pc->user_data, pc->weak_object);
+ g_variant_unref (args);
+ }
+ else
+ {
+ pc->wrapper (pc->proxy, error, NULL,
+ pc->callback, pc->user_data, pc->weak_object);
+ g_clear_error (&error);
}
- pc->dbus_completed = TRUE;
-
- /* If the idle callback has been run already, we can go away */
- if (pc->idle_completed)
- tp_proxy_pending_call_free (pc);
-}
-
-/**
- * tp_proxy_pending_call_v0_take_pending_call:
- * @pc: A pending call on which this function has not yet been called
- * @pending_call: The underlying dbus-glib pending call
- *
- * Set the underlying pending call to be used by this object.
- * See also tp_proxy_pending_call_v0_new().
- *
- * This function is for use by #TpProxy subclass implementations only, and
- * should usually only be called from code generated by
- * tools/glib-client-gen.py.
- *
- * This function may not be called if @pc was constructed with a %NULL
- * #DBusGProxy.
- *
- * Since: 0.7.1
- */
-
-/* that's implemented in the core library, but it calls this: */
+ pc->wrapper = NULL;
-void
-_tp_proxy_pending_call_take_pending_call (TpProxyPendingCall *pc,
- DBusGProxyCall *pending_call)
-{
- g_return_if_fail (pc->priv == pending_call_magic);
- g_return_if_fail (pc->pending_call == NULL);
- g_return_if_fail (pc->proxy != NULL);
- g_return_if_fail (pc->iface_proxy != NULL);
-
- pc->pending_call = pending_call;
+finally:
+ tp_proxy_pending_call_free (pc);
}
-static void
-_tp_proxy_pending_call_idle_completed (gpointer p)
+TpProxyPendingCall *
+_tp_proxy_pending_call_v1_new (TpProxy *self,
+ gint timeout_ms,
+ GQuark iface,
+ const gchar *member,
+ GVariant *args,
+ const GVariantType *reply_type,
+ TpProxyWrapperFunc wrapper,
+ GCallback callback,
+ gpointer user_data,
+ GDestroyNotify destroy,
+ GObject *weak_object)
{
- TpProxyPendingCall *pc = p;
-
- MORE_DEBUG ("%p", pc);
-
- pc->idle_completed = TRUE;
+ TpProxyPendingCall *pc;
- if (pc->dbus_completed)
- tp_proxy_pending_call_free (pc);
-}
+ g_return_val_if_fail (callback != NULL || user_data == NULL, NULL);
+ g_return_val_if_fail (callback != NULL || destroy == NULL, NULL);
+ g_return_val_if_fail (callback != NULL || weak_object == NULL, NULL);
-/**
- * tp_proxy_pending_call_v0_take_results:
- * @pc: A pending call on which this function has not yet been called
- * @error: %NULL if the call was successful, or an error (whose ownership
- * is taken over by the pending call object). Because of dbus-glib
- * idiosyncrasies, this must be the error produced by dbus-glib, not a copy.
- * @args: %NULL if the call failed or had no "out" arguments, or an array
- * of "out" arguments (whose ownership is taken over by the pending call
- * object)
- *
- * Set the "out" arguments (return values) from this pending call.
- * See also tp_proxy_pending_call_v0_new().
- *
- * This function is for use by #TpProxy subclass implementations only, and
- * should usually only be called from code generated by
- * tools/glib-client-gen.py.
- *
- * Since: 0.7.1
- */
+ if (callback == NULL)
+ {
+ if (tp_proxy_has_interface_by_id (self, iface))
+ {
+ g_dbus_connection_call (tp_proxy_get_dbus_connection (self),
+ tp_proxy_get_bus_name (self),
+ tp_proxy_get_object_path (self),
+ g_quark_to_string (iface),
+ member,
+ /* consume floating ref */
+ args,
+ reply_type,
+ G_DBUS_CALL_FLAGS_NONE,
+ timeout_ms,
+ NULL,
+ NULL,
+ NULL);
+ }
-/* that's implemented in the core library, but it calls this: */
+ return NULL;
+ }
-void
-_tp_proxy_pending_call_take_results (TpProxyPendingCall *pc,
- GError *error,
- GValueArray *args)
-{
- g_return_if_fail (pc->proxy != NULL);
- g_return_if_fail (pc->priv == pending_call_magic);
- g_return_if_fail (pc->args == NULL);
- g_return_if_fail (pc->error == NULL);
- g_return_if_fail (pc->idle_source == 0);
- g_return_if_fail (error == NULL || args == NULL);
+ pc = g_slice_new0 (TpProxyPendingCall);
+ pc->proxy = g_object_ref (self);
+ pc->wrapper = wrapper;
+ pc->callback = callback;
+ pc->user_data = user_data;
+ pc->destroy = destroy;
+ pc->weak_object = weak_object;
+ pc->priv = pending_call_magic;
+ pc->cancellable = g_cancellable_new ();
- MORE_DEBUG ("%p (error: %s)", pc,
- error == NULL ? "(none)" : error->message);
+ if (weak_object != NULL)
+ g_object_weak_ref (weak_object, tp_proxy_pending_call_lost_weak_ref, pc);
- pc->args = args;
- pc->error = _tp_proxy_take_and_remap_error (pc->proxy, error);
+ if (tp_proxy_check_interface_by_id (self, iface, &pc->error))
+ {
+ g_dbus_connection_call (tp_proxy_get_dbus_connection (self),
+ tp_proxy_get_bus_name (self),
+ tp_proxy_get_object_path (self),
+ g_quark_to_string (iface),
+ member,
+ /* consume floating ref */
+ args,
+ reply_type,
+ G_DBUS_CALL_FLAGS_NONE,
+ timeout_ms,
+ pc->cancellable,
+ tp_proxy_pending_call_async_ready_cb,
+ pc);
+ }
+ else
+ {
+ g_idle_add_full (G_PRIORITY_HIGH,
+ tp_proxy_pending_call_idle_error, pc, NULL);
+ }
- /* queue up the actual callback to run after we go back to the event loop */
- pc->idle_source = g_idle_add_full (G_PRIORITY_HIGH,
- tp_proxy_pending_call_idle_invoke, pc,
- _tp_proxy_pending_call_idle_completed);
+ return pc;
}
diff --git a/telepathy-glib/proxy-signals.c b/telepathy-glib/proxy-signals.c
index 2e389ae55..2f93b7415 100644
--- a/telepathy-glib/proxy-signals.c
+++ b/telepathy-glib/proxy-signals.c
@@ -40,58 +40,64 @@
* Since: 0.7.1
*/
-typedef struct _TpProxySignalInvocation TpProxySignalInvocation;
-
-struct _TpProxySignalInvocation {
- TpProxySignalConnection *sc;
- TpProxy *proxy;
- GValueArray *args;
- guint idle_source;
-};
-
struct _TpProxySignalConnection {
/* 1 if D-Bus has us
- * 1 per member of @invocations
- * 1 per callback being invoked right now */
+ * 1 if per callback being invoked (possibly nested!) right now */
gsize refcount;
+ /* (transfer full) */
+ GDBusConnection *conn;
+
/* borrowed ref (discarded when we see invalidated signal)
- * + 1 per member of @invocations
* + 1 per callback being invoked (possibly nested!) right now */
TpProxy *proxy;
- DBusGProxy *iface_proxy;
- gchar *member;
+ guint id;
+ GVariantType *expected_types;
GCallback collect_args;
- TpProxyInvokeFunc invoke_callback;
+ TpProxyWrapperFunc wrapper;
GCallback callback;
gpointer user_data;
GDestroyNotify destroy;
GObject *weak_object;
- /* queue of _TpProxySignalInvocation, not including any that are
- * being invoked right now */
- GQueue invocations;
};
-static void _tp_proxy_signal_connection_dgproxy_destroy (DBusGProxy *,
- TpProxySignalConnection *);
-
-static void
-tp_proxy_signal_connection_disconnect_dbus_glib (TpProxySignalConnection *sc)
+/**
+ * tp_proxy_signal_connection_disconnect:
+ * @sc: a signal connection
+ *
+ * Disconnect the given signal connection. After this function returns, you
+ * must not assume that the signal connection remains valid, but you must not
+ * explicitly free it either.
+ *
+ * It is not safe to call this function if @sc has been disconnected already,
+ * which happens in each of these situations:
+ *
+ * <itemizedlist>
+ * <listitem>the @weak_object used when @sc was created has been
+ * destroyed</listitem>
+ * <listitem>tp_proxy_signal_connection_disconnect has already been
+ * used</listitem>
+ * <listitem>the proxy has been invalidated</listitem>
+ * </itemizedlist>
+ *
+ * Since: 0.7.1
+ */
+void
+tp_proxy_signal_connection_disconnect (TpProxySignalConnection *sc)
{
- DBusGProxy *iface_proxy = sc->iface_proxy;
+ guint id;
/* ignore if already done */
- if (iface_proxy == NULL)
+ if (sc->id == 0)
return;
- sc->iface_proxy = NULL;
- g_signal_handlers_disconnect_by_func (iface_proxy,
- _tp_proxy_signal_connection_dgproxy_destroy, sc);
- dbus_g_proxy_disconnect_signal (iface_proxy, sc->member,
- sc->collect_args, (gpointer) sc);
+ id = sc->id;
+ sc->id = 0;
- g_object_unref (iface_proxy);
+ sc->refcount++;
+ g_dbus_connection_signal_unsubscribe (sc->conn, id);
+ sc->refcount--;
}
static void
@@ -113,7 +119,7 @@ tp_proxy_signal_connection_proxy_invalidated (TpProxy *proxy,
tp_proxy_signal_connection_proxy_invalidated, sc);
sc->proxy = NULL;
- tp_proxy_signal_connection_disconnect_dbus_glib (sc);
+ tp_proxy_signal_connection_disconnect (sc);
}
static void
@@ -167,15 +173,12 @@ tp_proxy_signal_connection_unref (TpProxySignalConnection *sc)
sc->proxy = NULL;
}
- g_assert (sc->invocations.length == 0);
-
if (sc->destroy != NULL)
sc->destroy (sc->user_data);
sc->destroy = NULL;
sc->user_data = NULL;
-
- g_free (sc->member);
+ g_clear_object (&sc->conn);
/* We can't inline this here, because of fd.o #14750. If our signal
* connection gets destroyed by side-effects of something else losing a
@@ -190,153 +193,52 @@ tp_proxy_signal_connection_unref (TpProxySignalConnection *sc)
return TRUE;
}
-/**
- * tp_proxy_signal_connection_disconnect:
- * @sc: a signal connection
- *
- * Disconnect the given signal connection. After this function returns, you
- * must not assume that the signal connection remains valid, but you must not
- * explicitly free it either.
- *
- * It is not safe to call this function if @sc has been disconnected already,
- * which happens in each of these situations:
- *
- * <itemizedlist>
- * <listitem>the @weak_object used when @sc was created has been
- * destroyed</listitem>
- * <listitem>tp_proxy_signal_connection_disconnect has already been
- * used</listitem>
- * <listitem>the proxy has been invalidated</listitem>
- * </itemizedlist>
- *
- * Since: 0.7.1
- */
-void
-tp_proxy_signal_connection_disconnect (TpProxySignalConnection *sc)
-{
- TpProxySignalInvocation *invocation;
-
- while ((invocation = g_queue_pop_head (&sc->invocations)) != NULL)
- {
- g_assert (invocation->sc == sc);
- g_object_unref (invocation->proxy);
- invocation->proxy = NULL;
- invocation->sc = NULL;
- g_source_remove (invocation->idle_source);
-
- if (tp_proxy_signal_connection_unref (sc))
- return;
- }
-
- tp_proxy_signal_connection_disconnect_dbus_glib (sc);
-}
-
static void
-tp_proxy_signal_invocation_free (gpointer p)
-{
- TpProxySignalInvocation *invocation = p;
-
- if (invocation->sc != NULL)
- {
- /* this shouldn't really happen - it'll get run if the idle source
- * is removed by something other than t_p_s_c_disconnect or
- * t_p_s_i_run */
- WARNING ("idle source removed by someone else");
-
- g_queue_remove (&invocation->sc->invocations, invocation);
- g_object_unref (invocation->proxy);
- tp_proxy_signal_connection_unref (invocation->sc);
- }
-
- g_assert (invocation->proxy == NULL);
-
- if (invocation->args != NULL)
- tp_value_array_free (invocation->args);
-
- g_slice_free (TpProxySignalInvocation, invocation);
-}
-
-static gboolean
-tp_proxy_signal_invocation_run (gpointer p)
-{
- TpProxySignalInvocation *invocation = p;
- TpProxySignalInvocation *popped = g_queue_pop_head
- (&invocation->sc->invocations);
-
- /* if GLib is running idle handlers in the wrong order, then we've lost */
- MORE_DEBUG ("%p: popped %p", invocation->sc, popped);
- g_assert (popped == invocation);
-
- invocation->sc->invoke_callback (invocation->proxy, NULL,
- invocation->args, invocation->sc->callback, invocation->sc->user_data,
- invocation->sc->weak_object);
-
- /* the invoke callback steals args */
- invocation->args = NULL;
-
- /* there's one ref to the proxy per queued invocation, to keep it
- * alive */
- MORE_DEBUG ("%p refcount-- due to %p run, sc=%p", invocation->proxy,
- invocation, invocation->sc);
- g_object_unref (invocation->proxy);
- invocation->proxy = NULL;
- tp_proxy_signal_connection_unref (invocation->sc);
- invocation->sc = NULL;
-
- return FALSE;
-}
-
-static void
-tp_proxy_signal_connection_dropped (gpointer p,
- GClosure *unused)
+tp_proxy_signal_connection_dropped (gpointer p)
{
TpProxySignalConnection *sc = p;
- MORE_DEBUG ("%p (%u invocations queued)", sc, sc->invocations.length);
-
tp_proxy_signal_connection_unref (sc);
}
static void
-_tp_proxy_signal_connection_dgproxy_destroy (DBusGProxy *iface_proxy,
- TpProxySignalConnection *sc)
+tp_proxy_signal_connection_cb (GDBusConnection *connection,
+ const gchar *sender_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
{
- g_assert (iface_proxy != NULL);
- g_assert (sc != NULL);
- g_assert (sc->iface_proxy == iface_proxy);
+ TpProxySignalConnection *sc = user_data;
+ TpProxy *proxy;
- DEBUG ("%p: DBusGProxy %p invalidated", sc, iface_proxy);
+ if (!g_variant_is_of_type (parameters, sc->expected_types))
+ return;
- sc->iface_proxy = NULL;
- g_signal_handlers_disconnect_by_func (iface_proxy,
- _tp_proxy_signal_connection_dgproxy_destroy, sc);
- g_object_unref (iface_proxy);
-}
+ sc->refcount++;
+ /* The callback might invalidate proxy, which disconnects the signal
+ * and sets sc->proxy to NULL, so we need to use a temporary here */
+ proxy = g_object_ref (sc->proxy);
-static void
-collect_none (DBusGProxy *dgproxy, TpProxySignalConnection *sc)
-{
- _tp_proxy_signal_connection_take_results (sc, NULL);
+ sc->wrapper (sc->proxy, NULL, parameters,
+ sc->callback, sc->user_data, sc->weak_object);
+
+ sc->refcount--;
+ g_object_unref (proxy);
}
/**
- * tp_proxy_signal_connection_v0_new:
+ * tp_proxy_signal_connection_v1_new:
* @self: a proxy
* @iface: a quark whose string value is the D-Bus interface
* @member: the name of the signal to which we're connecting
* @expected_types: an array of expected GTypes for the arguments, terminated
* by %G_TYPE_INVALID
- * @collect_args: a callback to be given to dbus_g_proxy_connect_signal(),
- * which must marshal the arguments into a #GValueArray and use them to call
- * tp_proxy_signal_connection_v0_take_results(); this callback is not
- * guaranteed to be called by future versions of telepathy-glib, which might
- * be able to implement its functionality internally. If no arguments are
- * expected at all (expected_types = { G_TYPE_INVALID }) then this callback
- * should instead be %NULL
- * @invoke_callback: a function which will be called with @error = %NULL,
+ * @wrapper: a function which will be called with @error = %NULL,
* which should invoke @callback with @user_data, @weak_object and other
* appropriate arguments taken from @args
- * @callback: user callback to be invoked by @invoke_callback
+ * @callback: user callback to be invoked by @wrapper
* @user_data: user-supplied data for the callback
* @destroy: user-supplied destructor for the data, which will be called
* when the signal connection is disconnected for any reason,
@@ -347,7 +249,7 @@ collect_none (DBusGProxy *dgproxy, TpProxySignalConnection *sc)
* @error: If not %NULL, used to raise an error if %NULL is returned
*
* Allocate a new structure representing a signal connection, and connect to
- * the signal, arranging for @invoke_callback to be called when it arrives.
+ * the signal, arranging for @wrapper to be called when it arrives.
*
* This function is for use by #TpProxy subclass implementations only, and
* should usually only be called from code generated by
@@ -362,12 +264,11 @@ collect_none (DBusGProxy *dgproxy, TpProxySignalConnection *sc)
/* that's implemented in the core library, but it calls this: */
TpProxySignalConnection *
-_tp_proxy_signal_connection_new (TpProxy *self,
+_tp_proxy_signal_connection_v1_new (TpProxy *self,
GQuark iface,
const gchar *member,
- const GType *expected_types,
- GCallback collect_args,
- TpProxyInvokeFunc invoke_callback,
+ const GVariantType *expected_types,
+ TpProxyWrapperFunc wrapper,
GCallback callback,
gpointer user_data,
GDestroyNotify destroy,
@@ -375,10 +276,8 @@ _tp_proxy_signal_connection_new (TpProxy *self,
GError **error)
{
TpProxySignalConnection *sc;
- DBusGProxy *iface_proxy = tp_proxy_get_interface_by_id (self,
- iface, error);
- if (iface_proxy == NULL)
+ if (!tp_proxy_check_interface_by_id (self, iface, error))
{
if (destroy != NULL)
destroy (user_data);
@@ -386,28 +285,13 @@ _tp_proxy_signal_connection_new (TpProxy *self,
return NULL;
}
- if (expected_types[0] == G_TYPE_INVALID)
- {
- collect_args = G_CALLBACK (collect_none);
- }
- else
- {
- g_return_val_if_fail (collect_args != NULL, NULL);
- }
-
sc = g_slice_new0 (TpProxySignalConnection);
- MORE_DEBUG ("(proxy=%p, if=%s, sig=%s, collect=%p, invoke=%p, "
- "cb=%p, ud=%p, dn=%p, wo=%p) -> %p",
- self, g_quark_to_string (iface), member, collect_args,
- invoke_callback, callback, user_data, destroy, weak_object, sc);
-
sc->refcount = 1;
+ sc->expected_types = g_variant_type_copy (expected_types);
+ sc->conn = g_object_ref (tp_proxy_get_dbus_connection (self));
sc->proxy = self;
- sc->iface_proxy = g_object_ref (iface_proxy);
- sc->member = g_strdup (member);
- sc->collect_args = collect_args;
- sc->invoke_callback = invoke_callback;
+ sc->wrapper = wrapper;
sc->callback = callback;
sc->user_data = user_data;
sc->destroy = destroy;
@@ -420,55 +304,15 @@ _tp_proxy_signal_connection_new (TpProxy *self,
g_signal_connect (self, "invalidated",
G_CALLBACK (tp_proxy_signal_connection_proxy_invalidated), sc);
- g_signal_connect (iface_proxy, "destroy",
- G_CALLBACK (_tp_proxy_signal_connection_dgproxy_destroy), sc);
-
- dbus_g_proxy_connect_signal (iface_proxy, member, collect_args, sc,
+ sc->id = g_dbus_connection_signal_subscribe (sc->conn,
+ tp_proxy_get_bus_name (self),
+ g_quark_to_string (iface),
+ member,
+ tp_proxy_get_object_path (self),
+ NULL, /* arg0 */
+ G_DBUS_SIGNAL_FLAGS_NONE,
+ tp_proxy_signal_connection_cb,
+ sc,
tp_proxy_signal_connection_dropped);
-
return sc;
}
-
-/**
- * tp_proxy_signal_connection_v0_take_results:
- * @sc: The signal connection
- * @args: The arguments of the signal
- *
- * Feed the results of a signal invocation back into the signal connection
- * machinery.
- *
- * This method should only be called from #TpProxy subclass implementations,
- * in the callback that implements @collect_args.
- *
- * Since: 0.7.1
- */
-
-/* that's implemented in the core library, but it calls this: */
-
-void
-_tp_proxy_signal_connection_take_results (TpProxySignalConnection *sc,
- GValueArray *args)
-{
- TpProxySignalInvocation *invocation = g_slice_new0 (TpProxySignalInvocation);
- /* FIXME: assert that the GValueArray is the right length, or
- * even that it contains the right types? */
-
- /* as long as there are queued invocations, we keep one ref to the TpProxy
- * and one ref to the TpProxySignalConnection per invocation */
- MORE_DEBUG ("%p refcount++ due to %p, sc=%p", sc->proxy, invocation, sc);
- invocation->proxy = g_object_ref (sc->proxy);
- sc->refcount++;
-
- invocation->sc = sc;
- invocation->args = args;
-
- g_queue_push_tail (&sc->invocations, invocation);
-
- MORE_DEBUG ("invocations: head=%p tail=%p count=%u",
- sc->invocations.head, sc->invocations.tail,
- sc->invocations.length);
-
- invocation->idle_source = g_idle_add_full (G_PRIORITY_HIGH,
- tp_proxy_signal_invocation_run, invocation,
- tp_proxy_signal_invocation_free);
-}
diff --git a/telepathy-glib/proxy-subclass.h b/telepathy-glib/proxy-subclass.h
index d931df776..f143a1d54 100644
--- a/telepathy-glib/proxy-subclass.h
+++ b/telepathy-glib/proxy-subclass.h
@@ -29,42 +29,23 @@
G_BEGIN_DECLS
-typedef void (*TpProxyInvokeFunc) (TpProxy *self,
- GError *error, GValueArray *args, GCallback callback, gpointer user_data,
- GObject *weak_object);
+typedef void (*TpProxyWrapperFunc) (TpProxy *self,
+ const GError *error, GVariant *args,
+ GCallback callback, gpointer user_data, GObject *weak_object);
-TpProxyPendingCall *tp_proxy_pending_call_v0_new (TpProxy *self,
- GQuark iface, const gchar *member, DBusGProxy *iface_proxy,
- TpProxyInvokeFunc invoke_callback,
+TpProxyPendingCall *tp_proxy_pending_call_v1_new (TpProxy *self,
+ gint timeout_ms, GQuark iface, const gchar *member,
+ GVariant *args, const GVariantType *reply_type, TpProxyWrapperFunc wrapper,
GCallback callback, gpointer user_data, GDestroyNotify destroy,
- GObject *weak_object, gboolean cancel_must_raise);
-
-void tp_proxy_pending_call_v0_take_pending_call (TpProxyPendingCall *pc,
- DBusGProxyCall *pending_call);
-
-void tp_proxy_pending_call_v0_take_results (TpProxyPendingCall *pc,
- GError *error, GValueArray *args);
-
-void tp_proxy_pending_call_v0_completed (gpointer p);
+ GObject *weak_object);
-TpProxySignalConnection *tp_proxy_signal_connection_v0_new (TpProxy *self,
- GQuark iface, const gchar *member,
- const GType *expected_types,
- GCallback collect_args, TpProxyInvokeFunc invoke_callback,
+TpProxySignalConnection *tp_proxy_signal_connection_v1_new (TpProxy *self,
+ GQuark iface, const gchar *member, const GVariantType *expected_types,
+ TpProxyWrapperFunc wrapper,
GCallback callback, gpointer user_data, GDestroyNotify destroy,
GObject *weak_object, GError **error);
-void tp_proxy_signal_connection_v0_take_results
- (TpProxySignalConnection *sc, GValueArray *args);
-
-typedef void (*TpProxyInterfaceAddedCb) (TpProxy *self,
- guint quark, DBusGProxy *proxy, gpointer unused);
-
-void tp_proxy_or_subclass_hook_on_interface_add (GType proxy_or_subclass,
- TpProxyInterfaceAddedCb callback);
-
-_TP_AVAILABLE_IN_0_20
-DBusGProxy *tp_proxy_get_interface_by_id (TpProxy *self, GQuark iface,
+GDBusProxy *tp_proxy_get_interface_by_id (TpProxy *self, GQuark iface,
GError **error);
void tp_proxy_add_interface_by_id (TpProxy *self, GQuark iface);
@@ -72,13 +53,6 @@ void tp_proxy_add_interfaces (TpProxy *self, const gchar * const *interfaces);
void tp_proxy_invalidate (TpProxy *self, const GError *error);
-void tp_proxy_subclass_add_error_mapping (GType proxy_subclass,
- const gchar *static_prefix, GQuark domain, GType code_enum_type);
-
-gboolean tp_proxy_dbus_g_proxy_claim_for_signal_adding (DBusGProxy *proxy);
-
-void tp_proxy_init_known_interfaces (void);
-
G_END_DECLS
#undef _TP_GLIB_H_INSIDE
diff --git a/telepathy-glib/proxy.c b/telepathy-glib/proxy.c
index bf9ed4076..e93f8f4b1 100644
--- a/telepathy-glib/proxy.c
+++ b/telepathy-glib/proxy.c
@@ -151,7 +151,7 @@ tp_dbus_errors_quark (void)
* @see_also: #TpProxy
*
* The implementations of #TpProxy subclasses and "mixin" functions need
- * access to the underlying dbus-glib objects used to implement the
+ * access to the underlying GDBus objects used to implement the
* #TpProxy API.
*
* Mixin functions to implement particular D-Bus interfaces should usually
@@ -169,18 +169,6 @@ tp_dbus_errors_quark (void)
*/
/**
- * TpProxyInterfaceAddedCb:
- * @self: the proxy
- * @quark: a quark whose string value is the interface being added
- * @proxy: the #DBusGProxy for the added interface
- * @unused: unused
- *
- * The signature of a #TpProxy::interface-added signal callback.
- *
- * Since: 0.7.1
- */
-
-/**
* TpProxyClass:
* @parent_class: The parent class structure
* @interface: If set non-zero by a subclass, #TpProxy will
@@ -241,22 +229,6 @@ tp_dbus_errors_quark (void)
* Since: 0.11.3
*/
-typedef struct _TpProxyErrorMappingLink TpProxyErrorMappingLink;
-
-struct _TpProxyErrorMappingLink {
- const gchar *prefix;
- GQuark domain;
- GEnumClass *code_enum_class;
- TpProxyErrorMappingLink *next;
-};
-
-typedef struct _TpProxyInterfaceAddLink TpProxyInterfaceAddLink;
-
-struct _TpProxyInterfaceAddLink {
- TpProxyInterfaceAddedCb callback;
- TpProxyInterfaceAddLink *next;
-};
-
struct _TpProxyFeaturePrivate
{
gpointer unused;
@@ -358,15 +330,15 @@ tp_proxy_prepare_request_finish (TpProxyPrepareRequest *req,
struct _TpProxyPrivate {
TpDBusDaemon *dbus_daemon;
- DBusGConnection *dbus_connection;
+ GDBusConnection *dbus_connection;
gchar *bus_name;
gchar *object_path;
GError *invalidated;
- /* GQuark for interface => either a ref'd DBusGProxy *,
+ /* GQuark for interface => either a ref'd GDBusProxy *,
* or the TpProxy itself used as a dummy value to indicate that
- * the DBusGProxy has not been needed yet */
+ * the GDBusProxy has not been needed yet */
GData *interfaces;
/* feature => FeatureState */
@@ -402,15 +374,12 @@ enum
};
enum {
- SIGNAL_INTERFACE_ADDED,
SIGNAL_INVALIDATED,
N_SIGNALS
};
static guint signals[N_SIGNALS] = {0};
-static void tp_proxy_iface_destroyed_cb (DBusGProxy *dgproxy, TpProxy *self);
-
/**
* tp_proxy_get_interface_by_id: (skip)
* @self: the TpProxy
@@ -421,7 +390,7 @@ static void tp_proxy_iface_destroyed_cb (DBusGProxy *dgproxy, TpProxy *self);
*
* <!-- -->
*
- * Returns: a borrowed reference to a #DBusGProxy
+ * Returns: a borrowed reference to a #GDBusProxy
* for which the bus name and object path are the same as for @self, but the
* interface is as given (or %NULL if an @error is raised).
* The reference is only valid as long as @self is.
@@ -431,58 +400,84 @@ static void tp_proxy_iface_destroyed_cb (DBusGProxy *dgproxy, TpProxy *self);
/* that's implemented in the core library, but it calls this: */
-DBusGProxy *
+GDBusProxy *
_tp_proxy_get_interface_by_id (TpProxy *self,
GQuark iface,
GError **error)
{
- gpointer dgproxy;
+ gpointer iface_proxy;
g_return_val_if_fail (TP_IS_PROXY (self), NULL);
- if (self->priv->invalidated != NULL)
- {
- g_set_error (error, self->priv->invalidated->domain, self->priv->invalidated->code,
- "%s", self->priv->invalidated->message);
- return NULL;
- }
-
- if (!tp_dbus_check_valid_interface_name (g_quark_to_string (iface),
- error))
- return NULL;
+ if (!tp_proxy_check_interface_by_id (self, iface, error))
+ return NULL;
- dgproxy = g_datalist_id_get_data (&self->priv->interfaces, iface);
+ iface_proxy = g_datalist_id_get_data (&self->priv->interfaces, iface);
- if (dgproxy == self)
+ if (iface_proxy == self)
{
/* dummy value - we've never actually needed the interface, so we
* didn't create it, to avoid binding to all the signals */
- dgproxy = dbus_g_proxy_new_for_name (self->priv->dbus_connection,
- self->priv->bus_name, self->priv->object_path, g_quark_to_string (iface));
- DEBUG ("%p: %s DBusGProxy is %p", self, g_quark_to_string (iface),
- dgproxy);
-
- g_signal_connect (dgproxy, "destroy",
- G_CALLBACK (tp_proxy_iface_destroyed_cb), self);
+ iface_proxy = g_dbus_proxy_new_sync (self->priv->dbus_connection,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+ NULL, /* FIXME: add interface info */
+ self->priv->bus_name,
+ self->priv->object_path,
+ g_quark_to_string (iface),
+ NULL, /* cancellable */
+ error);
g_datalist_id_set_data_full (&self->priv->interfaces, iface,
- dgproxy, g_object_unref);
-
- g_signal_emit (self, signals[SIGNAL_INTERFACE_ADDED], 0,
- (guint) iface, dgproxy);
+ iface_proxy, g_object_unref);
}
- if (dgproxy != NULL)
+ return iface_proxy;
+}
+
+/**
+ * tp_proxy_check_interface_by_id:
+ * @self: the #TpProxy (or subclass)
+ * @iface: quark representing the D-Bus interface required
+ * @error: used to raise an error in the #TP_DBUS_ERRORS domain if @iface
+ * is invalid, @self has been invalidated or @self does not implement
+ * @iface
+ *
+ * Return whether this proxy is known to have a particular interface, by its
+ * quark ID.
+ *
+ * Returns: %TRUE if this proxy implements the given interface.
+ */
+gboolean
+tp_proxy_check_interface_by_id (gpointer self,
+ GQuark iface,
+ GError **error)
+{
+ TpProxy *proxy = self;
+
+ g_return_val_if_fail (TP_IS_PROXY (self), FALSE);
+
+ if (proxy->priv->invalidated != NULL)
{
- return dgproxy;
+ g_set_error (error, proxy->priv->invalidated->domain,
+ proxy->priv->invalidated->code,
+ "%s", proxy->priv->invalidated->message);
+ return FALSE;
}
- g_set_error (error, TP_DBUS_ERRORS, TP_DBUS_ERROR_NO_INTERFACE,
- "Object %s does not have interface %s",
- self->priv->object_path, g_quark_to_string (iface));
+ if (!tp_dbus_check_valid_interface_name (g_quark_to_string (iface),
+ error))
+ return FALSE;
+
+ if (g_datalist_id_get_data (&proxy->priv->interfaces, iface) == NULL)
+ {
+ g_set_error (error, TP_DBUS_ERRORS, TP_DBUS_ERROR_NO_INTERFACE,
+ "Object %s does not have interface %s",
+ proxy->priv->object_path, g_quark_to_string (iface));
+ return FALSE;
+ }
- return NULL;
+ return TRUE;
}
/**
@@ -542,24 +537,6 @@ tp_proxy_has_interface (gpointer self,
g_datalist_id_get_data (&proxy->priv->interfaces, q) != NULL);
}
-static void
-tp_proxy_lose_interface (GQuark unused,
- gpointer dgproxy_or_self,
- gpointer self)
-{
- if (dgproxy_or_self != self)
- g_signal_handlers_disconnect_by_func (dgproxy_or_self,
- G_CALLBACK (tp_proxy_iface_destroyed_cb), self);
-}
-
-static void
-tp_proxy_lose_interfaces (TpProxy *self)
-{
- g_datalist_foreach (&self->priv->interfaces,
- tp_proxy_lose_interface, self);
-
- g_datalist_clear (&self->priv->interfaces);
-}
static void tp_proxy_poll_features (TpProxy *self, const GError *error);
@@ -580,14 +557,8 @@ tp_proxy_emit_invalidated (gpointer p)
/* Don't clear the datalist until after we've emitted the signal, so
* the pending call and signal connection friend classes can still get
* to the proxies */
- tp_proxy_lose_interfaces (self);
-
- if (self->priv->dbus_connection != NULL)
- {
- dbus_g_connection_unref (self->priv->dbus_connection);
- self->priv->dbus_connection = NULL;
- }
-
+ g_datalist_clear (&self->priv->interfaces);
+ g_clear_object (&self->priv->dbus_connection);
return FALSE;
}
@@ -618,13 +589,21 @@ tp_proxy_invalidate (TpProxy *self, const GError *error)
}
static void
-tp_proxy_iface_destroyed_cb (DBusGProxy *dgproxy,
- TpProxy *self)
+tp_proxy_unique_name_owner_cb (TpProxy *self,
+ GParamSpec *pspec G_GNUC_UNUSED,
+ GDBusProxy *gdbus)
{
+ gchar *owner;
+
+ owner = g_dbus_proxy_get_name_owner (gdbus);
+
+ if (!tp_strdiff (self->priv->bus_name, owner))
+ return;
+
/* We can't call any API on the proxy now. Because the proxies are all
* for the same bus name, we can assume that all of them are equally
* useless now */
- tp_proxy_lose_interfaces (self);
+ g_datalist_clear (&self->priv->interfaces);
/* We need to be able to delay emitting the invalidated signal, so that
* any queued-up method calls and signal handlers will run first, and so
@@ -632,7 +611,7 @@ tp_proxy_iface_destroyed_cb (DBusGProxy *dgproxy,
*/
if (self->priv->invalidated == NULL)
{
- DEBUG ("%p", self);
+ DEBUG ("%p: lost", self);
self->priv->invalidated = g_error_new_literal (TP_DBUS_ERRORS,
TP_DBUS_ERROR_NAME_OWNER_LOST, "Name owner lost (service crashed?)");
@@ -649,7 +628,7 @@ tp_proxy_iface_destroyed_cb (DBusGProxy *dgproxy,
* Declare that this proxy supports a given interface.
*
* To use methods and signals of that interface, either call
- * tp_proxy_get_interface_by_id() to get the #DBusGProxy, or use the
+ * tp_proxy_get_interface_by_id() to get the #GDBusProxy, or use the
* tp_cli_* wrapper functions (strongly recommended).
*
* If the interface is the proxy's "main interface", or has already been
@@ -661,7 +640,7 @@ void
tp_proxy_add_interface_by_id (TpProxy *self,
GQuark iface)
{
- DBusGProxy *iface_proxy = g_datalist_id_get_data (&self->priv->interfaces,
+ GDBusProxy *iface_proxy = g_datalist_id_get_data (&self->priv->interfaces,
iface);
g_return_if_fail
@@ -672,8 +651,8 @@ tp_proxy_add_interface_by_id (TpProxy *self,
if (iface_proxy == NULL)
{
- /* we don't want to actually create it just yet - dbus-glib will
- * helpfully wake us up on every signal, if we do. So we set a
+ /* we don't want to actually create it just yet - we'll get
+ * woken up on every signal, if we do. So we set a
* dummy value (self), and replace it with the real value in
* tp_proxy_get_interface_by_id */
g_datalist_id_set_data_full (&self->priv->interfaces, iface,
@@ -717,19 +696,6 @@ tp_proxy_add_interfaces (TpProxy *self,
}
}
-static GQuark
-error_mapping_quark (void)
-{
- static GQuark q = 0;
-
- if (G_UNLIKELY (q == 0))
- {
- q = g_quark_from_static_string ("TpProxyErrorMappingCb_0.7.1");
- }
-
- return q;
-}
-
/**
* tp_proxy_dbus_error_to_gerror:
* @self: a #TpProxy or subclass
@@ -751,78 +717,12 @@ tp_proxy_dbus_error_to_gerror (gpointer self,
const char *debug_message,
GError **error)
{
- GType proxy_type = TP_TYPE_PROXY;
- GType type;
-
g_return_if_fail (TP_IS_PROXY (self));
+ g_return_if_fail (dbus_error != NULL);
+ g_return_if_fail (debug_message != NULL);
- if (error == NULL)
- return;
-
- g_return_if_fail (*error == NULL);
-
- if (!tp_dbus_check_valid_interface_name (dbus_error, error))
- {
- return;
- }
-
- if (debug_message == NULL)
- debug_message = "";
-
- for (type = G_TYPE_FROM_INSTANCE (self);
- type != proxy_type;
- type = g_type_parent (type))
- {
- TpProxyErrorMappingLink *iter;
-
- for (iter = g_type_get_qdata (type, error_mapping_quark ());
- iter != NULL;
- iter = iter->next)
- {
- size_t prefix_len = strlen (iter->prefix);
-
- if (!strncmp (dbus_error, iter->prefix, prefix_len)
- && dbus_error[prefix_len] == '.')
- {
- GEnumValue *code =
- g_enum_get_value_by_nick (iter->code_enum_class,
- dbus_error + prefix_len + 1);
-
- if (code != NULL)
- {
- g_set_error (error, iter->domain, code->value,
- "%s", debug_message);
- return;
- }
- }
- }
- }
-
- /* we don't have an error mapping - so let's just paste the
- * error name and message into TP_DBUS_ERROR_UNKNOWN_REMOTE_ERROR */
- g_set_error (error, TP_DBUS_ERRORS,
- TP_DBUS_ERROR_UNKNOWN_REMOTE_ERROR, "%s: %s", dbus_error, debug_message);
-}
-
-GError *
-_tp_proxy_take_and_remap_error (TpProxy *self,
- GError *error)
-{
- if (error == NULL ||
- error->domain != DBUS_GERROR ||
- error->code != DBUS_GERROR_REMOTE_EXCEPTION)
- {
- return error;
- }
- else
- {
- GError *replacement = NULL;
- const gchar *dbus = dbus_g_error_get_name (error);
-
- tp_proxy_dbus_error_to_gerror (self, dbus, error->message, &replacement);
- g_error_free (error);
- return replacement;
- }
+ if (error != NULL)
+ *error = g_dbus_error_new_for_dbus_error (dbus_error, debug_message);
}
static void
@@ -856,7 +756,7 @@ tp_proxy_get_property (GObject *object,
}
break;
case PROP_DBUS_CONNECTION:
- g_value_set_boxed (value, self->priv->dbus_connection);
+ g_value_set_object (value, self->priv->dbus_connection);
break;
case PROP_BUS_NAME:
g_value_set_string (value, self->priv->bus_name);
@@ -907,7 +807,7 @@ tp_proxy_set_property (GObject *object,
{
if (self->priv->dbus_connection == NULL)
{
- self->priv->dbus_connection = dbus_g_connection_ref (
+ self->priv->dbus_connection = g_object_ref (
tp_proxy_get_dbus_connection (self->priv->dbus_daemon));
}
else
@@ -920,17 +820,17 @@ tp_proxy_set_property (GObject *object,
break;
case PROP_DBUS_CONNECTION:
{
- DBusGConnection *conn = g_value_get_boxed (value);
+ GDBusConnection *conn = g_value_get_object (value);
/* if we're given a NULL dbus-connection, but we've got a
- * DBusGConnection from the dbus-daemon, we want to keep it */
+ * GDBusConnection from the dbus-daemon, we want to keep it */
if (conn == NULL)
return;
if (self->priv->dbus_connection == NULL)
- self->priv->dbus_connection = g_value_dup_boxed (value);
+ self->priv->dbus_connection = g_value_dup_object (value);
- g_assert (self->priv->dbus_connection == g_value_get_boxed (value));
+ g_assert (self->priv->dbus_connection == g_value_get_object (value));
}
break;
case PROP_BUS_NAME:
@@ -960,19 +860,6 @@ tp_proxy_init (TpProxy *self)
self->priv->prepare_requests = g_queue_new ();
}
-static GQuark
-interface_added_cb_quark (void)
-{
- static GQuark q = 0;
-
- if (G_UNLIKELY (q == 0))
- {
- q = g_quark_from_static_string ("TpProxyInterfaceAddedCb_0.7.1");
- }
-
- return q;
-}
-
static FeatureState
tp_proxy_get_feature_state (TpProxy *self,
GQuark feature)
@@ -1015,11 +902,10 @@ tp_proxy_constructor (GType type,
TpProxy *self = TP_PROXY (object_class->constructor (type,
n_params, params));
TpProxyClass *klass = TP_PROXY_GET_CLASS (self);
- TpProxyInterfaceAddLink *iter;
GType proxy_parent_type = G_TYPE_FROM_CLASS (tp_proxy_parent_class);
GType ancestor_type;
-
- _tp_register_dbus_glib_marshallers ();
+ GQuark main_interface;
+ GDBusProxy *gdp;
for (ancestor_type = type;
ancestor_type != proxy_parent_type && ancestor_type != 0;
@@ -1030,13 +916,6 @@ tp_proxy_constructor (GType type,
guint i;
GArray *core_features;
- for (iter = g_type_get_qdata (ancestor_type,
- interface_added_cb_quark ());
- iter != NULL;
- iter = iter->next)
- g_signal_connect (self, "interface-added", G_CALLBACK (iter->callback),
- NULL);
-
if (ancestor == NULL || ancestor->list_features == NULL)
continue;
@@ -1102,6 +981,29 @@ tp_proxy_constructor (GType type,
g_return_val_if_fail (self->priv->bus_name[0] == ':', NULL);
}
+ /* Monitor whether we get destroyed */
+ if (klass->interface != 0)
+ {
+ main_interface = klass->interface;
+ }
+ else
+ {
+ /* it's as good as any */
+ main_interface = TP_IFACE_QUARK_DBUS_PEER;
+ }
+
+ if (self->priv->bus_name[0] == ':')
+ {
+ /* We're tracking a unique name. When it becomes unowned,
+ * signal the destruction of the TpProxy. */
+ gdp = _tp_proxy_get_interface_by_id (self, main_interface, NULL);
+ /* Constructing the proxy can't fail for unique names, if we don't
+ * load properties, which we don't. */
+ g_assert (gdp != NULL);
+ g_signal_connect_object (gdp, "notify::g-name-owner",
+ G_CALLBACK (tp_proxy_unique_name_owner_cb), self, G_CONNECT_SWAPPED);
+ }
+
return (GObject *) self;
}
@@ -1151,110 +1053,22 @@ tp_proxy_finalize (GObject *object)
G_OBJECT_CLASS (tp_proxy_parent_class)->finalize (object);
}
-/**
- * tp_proxy_or_subclass_hook_on_interface_add:
- * @proxy_or_subclass: The #GType of #TpProxy or a subclass
- * @callback: A signal handler for #TpProxy::interface-added
- *
- * Arrange for @callback to be connected to #TpProxy::interface-added
- * during the #TpProxy constructor. This is done sufficiently early that
- * it will see the signal for the default interface (@interface member of
- * #TpProxyClass), if any, being added. The intended use is for the callback
- * to call dbus_g_proxy_add_signal() on the new #DBusGProxy.
- *
- * Since 0.7.6, to ensure correct overriding of interfaces that might be
- * added to telepathy-glib, before calling this function you should
- * call tp_proxy_init_known_interfaces, tp_connection_init_known_interfaces,
- * tp_channel_init_known_interfaces etc. as appropriate for the subclass.
- *
- * Since: 0.7.1
- */
-void
-tp_proxy_or_subclass_hook_on_interface_add (GType proxy_or_subclass,
- TpProxyInterfaceAddedCb callback)
-{
- GQuark q = interface_added_cb_quark ();
- TpProxyInterfaceAddLink *old_link = g_type_get_qdata (proxy_or_subclass, q);
- TpProxyInterfaceAddLink *new_link;
-
- g_return_if_fail (g_type_is_a (proxy_or_subclass, TP_TYPE_PROXY));
- g_return_if_fail (callback != NULL);
-
- /* never freed, suppressed in telepathy-glib.supp */
- new_link = g_slice_new0 (TpProxyInterfaceAddLink);
- new_link->callback = callback;
- new_link->next = old_link; /* may be NULL */
- g_type_set_qdata (proxy_or_subclass, q, new_link);
-}
-
-/**
- * tp_proxy_subclass_add_error_mapping:
- * @proxy_subclass: The #GType of a subclass of #TpProxy (which must not be
- * #TpProxy itself)
- * @static_prefix: A prefix for D-Bus error names, not including the trailing
- * dot (which must remain valid forever, and should usually be in static
- * storage)
- * @domain: A quark representing the corresponding #GError domain
- * @code_enum_type: The type of a subclass of #GEnumClass
- *
- * Register a mapping from D-Bus errors received from the given proxy
- * subclass to #GError instances.
- *
- * When a D-Bus error is received, the #TpProxy code checks for error
- * mappings registered for the class of the proxy receiving the error,
- * then for all of its parent classes.
- *
- * If there is an error mapping for which the D-Bus error name
- * starts with the mapping's @static_prefix, the proxy will check the
- * corresponding @code_enum_type for a value whose @value_nick is
- * the rest of the D-Bus error name (with the leading dot removed). If there
- * isn't such a value, it will continue to try other error mappings.
- *
- * If a suitable error mapping and code are found, the #GError that is raised
- * will have its error domain set to the @domain from the error mapping,
- * and its error code taken from the enum represented by the @code_enum_type.
- *
- * If no suitable error mapping or code is found, the #GError will have
- * error domain %TP_DBUS_ERRORS and error code
- * %TP_DBUS_ERROR_UNKNOWN_REMOTE_ERROR.
- *
- * Since: 0.7.1
- */
-void
-tp_proxy_subclass_add_error_mapping (GType proxy_subclass,
- const gchar *static_prefix,
- GQuark domain,
- GType code_enum_type)
-{
- GQuark q = error_mapping_quark ();
- TpProxyErrorMappingLink *old_link = g_type_get_qdata (proxy_subclass, q);
- TpProxyErrorMappingLink *new_link;
- GType tp_type_proxy = TP_TYPE_PROXY;
-
- g_return_if_fail (proxy_subclass != tp_type_proxy);
- g_return_if_fail (g_type_is_a (proxy_subclass, tp_type_proxy));
- g_return_if_fail (static_prefix != NULL);
- g_return_if_fail (domain != 0);
- g_return_if_fail (code_enum_type != G_TYPE_INVALID);
-
- new_link = g_slice_new0 (TpProxyErrorMappingLink);
- new_link->prefix = static_prefix;
- new_link->domain = domain;
- /* We never unref the enum type - intentional one-per-process leak.
- * See "tp_proxy_subclass_add_error_mapping refs the enum" in our valgrind
- * suppressions file */
- new_link->code_enum_class = g_type_class_ref (code_enum_type);
- new_link->next = old_link; /* may be NULL */
- g_type_set_qdata (proxy_subclass, q, new_link);
-}
-
static void
tp_proxy_class_init (TpProxyClass *klass)
{
+ TpProxyImplementation impl = {
+ VERSION,
+ sizeof (TpProxyImplementation),
+ _tp_proxy_get_interface_by_id,
+ _tp_proxy_pending_call_v1_new,
+ _tp_proxy_signal_connection_v1_new,
+ /* keep this at the end as a final sanity-check of the size */
+ TP_TYPE_PROXY
+ };
GParamSpec *param_spec;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- tp_proxy_init_known_interfaces ();
+ tp_private_proxy_set_implementation (&impl);
g_type_class_add_private (klass, sizeof (TpProxyPrivate));
@@ -1283,8 +1097,8 @@ tp_proxy_class_init (TpProxyClass *klass)
* The D-Bus connection for this object. Read-only except during
* construction.
*/
- param_spec = g_param_spec_boxed ("dbus-connection", "D-Bus connection",
- "The D-Bus connection used by this object", DBUS_TYPE_G_CONNECTION,
+ param_spec = g_param_spec_object ("dbus-connection", "D-Bus connection",
+ "The D-Bus connection used by this object", G_TYPE_DBUS_CONNECTION,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_DBUS_CONNECTION,
param_spec);
@@ -1337,28 +1151,6 @@ tp_proxy_class_init (TpProxyClass *klass)
param_spec);
/**
- * TpProxy::interface-added: (skip)
- * @self: the proxy object
- * @id: the GQuark representing the interface
- * @proxy: the dbus-glib proxy representing the interface
- *
- * Emitted when this proxy has gained an interface. It is not guaranteed
- * to be emitted immediately, but will be emitted before the interface is
- * first used (at the latest: before it's returned from
- * tp_proxy_get_interface_by_id(), any signal is connected, or any
- * method is called).
- *
- * The intended use is to call dbus_g_proxy_add_signals(). This signal
- * should only be used by TpProy implementations
- */
- signals[SIGNAL_INTERFACE_ADDED] = g_signal_new ("interface-added",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
- 0,
- NULL, NULL, NULL,
- G_TYPE_NONE, 2, G_TYPE_UINT, DBUS_TYPE_G_PROXY);
-
- /**
* TpProxy::invalidated:
* @self: the proxy object
* @domain: domain of a GError indicating why this proxy was invalidated
@@ -1454,11 +1246,11 @@ tp_proxy_get_dbus_daemon (gpointer self)
*
* Returns: a borrowed reference to the D-Bus connection used by this object.
* The caller must reference the returned pointer with
- * dbus_g_connection_ref() if it will be kept.
+ * g_object_ref() if it will be kept.
*
* Since: 0.7.17
*/
-DBusGConnection *
+GDBusConnection *
tp_proxy_get_dbus_connection (gpointer self)
{
TpProxy *proxy = TP_PROXY (self);
@@ -1524,53 +1316,6 @@ tp_proxy_get_invalidated (gpointer self)
return proxy->priv->invalidated;
}
-static gpointer
-tp_proxy_once (gpointer data G_GNUC_UNUSED)
-{
- TpProxyImplementation impl = {
- VERSION,
- sizeof (TpProxyImplementation),
- _tp_proxy_get_interface_by_id,
- _tp_proxy_pending_call_new,
- _tp_proxy_pending_call_take_pending_call,
- _tp_proxy_pending_call_take_results,
- _tp_proxy_pending_call_completed,
- _tp_proxy_signal_connection_new,
- _tp_proxy_signal_connection_take_results,
- /* keep this at the end as a final sanity-check of the size */
- TP_TYPE_PROXY
- };
-
- tp_private_proxy_set_implementation (&impl);
-
- tp_proxy_or_subclass_hook_on_interface_add (impl.type,
- tp_cli_generic_add_signals);
-
- return NULL;
-}
-
-/**
- * tp_proxy_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpProxy have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add().
- *
- * Functions like tp_connection_init_known_interfaces and
- * tp_channel_init_known_interfaces do this automatically.
- *
- * Since: 0.7.6
- */
-void
-tp_proxy_init_known_interfaces (void)
-{
- static GOnce once = G_ONCE_INIT;
-
- g_once (&once, tp_proxy_once, NULL);
-}
-
static const TpProxyFeature *
tp_proxy_subclass_get_feature (GType type,
GQuark feature)
diff --git a/telepathy-glib/proxy.h b/telepathy-glib/proxy.h
index 814061f94..3b4c68f16 100644
--- a/telepathy-glib/proxy.h
+++ b/telepathy-glib/proxy.h
@@ -151,6 +151,8 @@ GType tp_proxy_get_type (void);
TpProxyClass))
gboolean tp_proxy_has_interface_by_id (gpointer self, GQuark iface);
+gboolean tp_proxy_check_interface_by_id (gpointer self, GQuark iface,
+ GError **error);
gboolean tp_proxy_has_interface (gpointer self, const gchar *iface);
_TP_AVAILABLE_IN_0_16
@@ -158,7 +160,7 @@ TpClientFactory *tp_proxy_get_factory (gpointer self);
TpDBusDaemon *tp_proxy_get_dbus_daemon (gpointer self);
-DBusGConnection *tp_proxy_get_dbus_connection (gpointer self);
+GDBusConnection *tp_proxy_get_dbus_connection (gpointer self);
const gchar *tp_proxy_get_bus_name (gpointer self);
diff --git a/telepathy-glib/run.c b/telepathy-glib/run.c
index 215b16ebb..5de43f73b 100644
--- a/telepathy-glib/run.c
+++ b/telepathy-glib/run.c
@@ -167,19 +167,18 @@ add_signal_handlers (void)
#endif /* HAVE_SIGNAL && ENABLE_BACKTRACE */
}
-static DBusHandlerResult
-dbus_filter_function (DBusConnection *connection,
- DBusMessage *message,
- void *user_data)
+static void
+gdbus_closed_cb (GDBusConnection *connection,
+ gboolean remote_peer_vanished,
+ GError *error,
+ gpointer user_data)
{
- if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected") &&
- !tp_strdiff (dbus_message_get_path (message), DBUS_PATH_LOCAL))
- {
- g_message ("Got disconnected from the session bus");
- quit_loop ();
- }
+ if (error)
+ g_message ("Got disconnected from the session bus: %s", error->message);
+ else
+ g_message ("Disconnected from the session bus from our side");
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ quit_loop ();
}
/**
@@ -212,7 +211,7 @@ tp_run_connection_manager (const char *prog_name,
int argc,
char **argv)
{
- DBusConnection *connection = NULL;
+ GDBusConnection *connection = NULL;
TpDBusDaemon *bus_daemon = NULL;
GError *error = NULL;
int ret = 1;
@@ -260,14 +259,9 @@ tp_run_connection_manager (const char *prog_name,
g_signal_connect (manager, "no-more-connections",
(GCallback) no_more_connections, NULL);
- /* It appears that dbus-glib registers a filter that wrongly returns
- * DBUS_HANDLER_RESULT_HANDLED for signals, so for *our* filter to have any
- * effect, we need to install it before calling
- * tp_base_connection_manager_register () */
- connection = dbus_g_connection_get_connection (
- tp_proxy_get_dbus_connection (bus_daemon));
- dbus_connection_add_filter (connection, dbus_filter_function, NULL, NULL);
- dbus_connection_set_exit_on_disconnect (connection, FALSE);
+ connection = tp_proxy_get_dbus_connection (bus_daemon);
+ g_signal_connect (connection, "closed",
+ G_CALLBACK (gdbus_closed_cb), mainloop);
if (!tp_base_connection_manager_register (manager))
{
@@ -290,7 +284,8 @@ tp_run_connection_manager (const char *prog_name,
out:
/* locals */
if (connection != NULL)
- dbus_connection_remove_filter (connection, dbus_filter_function, NULL);
+ g_signal_handlers_disconnect_by_func (connection, gdbus_closed_cb,
+ mainloop);
if (bus_daemon != NULL)
g_object_unref (bus_daemon);
diff --git a/telepathy-glib/svc-interface-skeleton-internal.h b/telepathy-glib/svc-interface-skeleton-internal.h
new file mode 100644
index 000000000..0fb2dd736
--- /dev/null
+++ b/telepathy-glib/svc-interface-skeleton-internal.h
@@ -0,0 +1,71 @@
+/*<private_header>*/
+/*
+ * Copyright © 2014 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __TP_SVC_INTERFACE_SKELETON_INTERNAL_H__
+#define __TP_SVC_INTERFACE_SKELETON_INTERNAL_H__
+
+#include <gio/gio.h>
+
+#include <telepathy-glib/core-svc-interface.h>
+#include <telepathy-glib/defs.h>
+
+G_BEGIN_DECLS
+
+typedef struct _TpSvcInterfaceSkeleton TpSvcInterfaceSkeleton;
+typedef struct _TpSvcInterfaceSkeletonClass TpSvcInterfaceSkeletonClass;
+typedef struct _TpSvcInterfaceSkeletonPrivate TpSvcInterfaceSkeletonPrivate;
+
+GType _tp_svc_interface_skeleton_get_type (void);
+
+#define TP_TYPE_SVC_INTERFACE_SKELETON \
+ (_tp_svc_interface_skeleton_get_type ())
+#define TP_SVC_INTERFACE_SKELETON(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), TP_TYPE_SVC_INTERFACE_SKELETON, \
+ TpSvcInterfaceSkeleton))
+#define TP_SVC_INTERFACE_SKELETON_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), TP_TYPE_SVC_INTERFACE_SKELETON, \
+ TpSvcInterfaceSkeletonClass))
+#define TP_IS_SVC_INTERFACE_SKELETON(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TP_TYPE_SVC_INTERFACE_SKELETON))
+#define TP_IS_SVC_INTERFACE_SKELETON_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), TP_TYPE_SVC_INTERFACE_SKELETON))
+#define TP_SVC_INTERFACE_SKELETON_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_SVC_INTERFACE_SKELETON, \
+ TpSvcInterfaceSkeletonClass))
+
+struct _TpSvcInterfaceSkeletonClass
+{
+ /*< private >*/
+ GDBusInterfaceSkeletonClass parent_class;
+};
+
+struct _TpSvcInterfaceSkeleton
+{
+ /*< private >*/
+ GDBusInterfaceSkeleton parent;
+ TpSvcInterfaceSkeletonPrivate *priv;
+};
+
+TpSvcInterfaceSkeleton *_tp_svc_interface_skeleton_new (gpointer object,
+ GType iface,
+ const TpSvcInterfaceInfo *iinfo);
+
+G_END_DECLS
+
+#endif
diff --git a/telepathy-glib/svc-interface-skeleton.c b/telepathy-glib/svc-interface-skeleton.c
new file mode 100644
index 000000000..0501f27c6
--- /dev/null
+++ b/telepathy-glib/svc-interface-skeleton.c
@@ -0,0 +1,218 @@
+/*
+ * Copyright © 2014 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <config.h>
+#include <telepathy-glib/svc-interface-skeleton-internal.h>
+
+#include <dbus/dbus-glib.h>
+
+#include <telepathy-glib/dbus-properties-mixin.h>
+#include <telepathy-glib/variant-util.h>
+
+struct _TpSvcInterfaceSkeletonPrivate
+{
+ GWeakRef object;
+ TpSvcInterfaceInfo *iinfo;
+};
+
+G_DEFINE_TYPE (TpSvcInterfaceSkeleton, _tp_svc_interface_skeleton,
+ G_TYPE_DBUS_INTERFACE_SKELETON)
+
+static void
+_tp_svc_interface_skeleton_init (TpSvcInterfaceSkeleton *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ TP_TYPE_SVC_INTERFACE_SKELETON, TpSvcInterfaceSkeletonPrivate);
+}
+
+static GDBusInterfaceInfo *
+tp_svc_interface_skeleton_get_info (GDBusInterfaceSkeleton *skel)
+{
+ TpSvcInterfaceSkeleton *self = TP_SVC_INTERFACE_SKELETON (skel);
+
+ return self->priv->iinfo->interface_info;
+}
+
+static void
+tp_svc_interface_skeleton_method_call (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ TpSvcInterfaceSkeleton *self = TP_SVC_INTERFACE_SKELETON (user_data);
+ GObject *object;
+
+ object = g_weak_ref_get (&self->priv->object);
+ /* TpDBusDaemon is meant to unexport us automatically when the object
+ * goes away */
+ g_return_if_fail (object != NULL);
+
+ self->priv->iinfo->vtable->method_call (connection,
+ sender, object_path, interface_name, method_name, parameters,
+ invocation, object);
+ g_object_unref (object);
+}
+
+static GDBusInterfaceVTable vtable = {
+ tp_svc_interface_skeleton_method_call,
+ NULL,
+ NULL
+};
+
+static GDBusInterfaceVTable *
+tp_svc_interface_skeleton_get_vtable (GDBusInterfaceSkeleton *skel)
+{
+ return &vtable;
+}
+
+static GVariant *
+tp_svc_interface_skeleton_get_properties (GDBusInterfaceSkeleton *skel)
+{
+ TpSvcInterfaceSkeleton *self = TP_SVC_INTERFACE_SKELETON (skel);
+ GVariant *ret;
+ GHashTable *asv;
+ const gchar *iface_name = self->priv->iinfo->interface_info->name;
+
+ /* For now assume we have the TpDBusPropertiesMixin if we have
+ * any properties at all. This never returns NULL. */
+ asv = tp_dbus_properties_mixin_dup_all ((GObject *) self, iface_name);
+
+ ret = g_variant_ref_sink (tp_asv_to_vardict (asv));
+ g_hash_table_unref (asv);
+ return ret;
+}
+
+static void
+tp_svc_interface_skeleton_flush (GDBusInterfaceSkeleton *skel)
+{
+ /* stub: we emit any changes immediately, and we implement Properties
+ * elsewhere anyway */
+}
+
+static void
+_tp_svc_interface_skeleton_class_init (TpSvcInterfaceSkeletonClass *cls)
+{
+ GDBusInterfaceSkeletonClass *skel_cls = G_DBUS_INTERFACE_SKELETON_CLASS (cls);
+
+ g_type_class_add_private (cls, sizeof (TpSvcInterfaceSkeleton));
+
+ skel_cls->get_info = tp_svc_interface_skeleton_get_info;
+ skel_cls->get_vtable = tp_svc_interface_skeleton_get_vtable;
+ skel_cls->get_properties = tp_svc_interface_skeleton_get_properties;
+ skel_cls->flush = tp_svc_interface_skeleton_flush;
+}
+
+typedef struct {
+ GClosure closure;
+ /* (transfer none) - the closure ensures we have a ref */
+ TpSvcInterfaceSkeleton *self;
+ /* (transfer none) - borrowed from the interface info */
+ const gchar *name;
+} SignalClosure;
+
+static void
+marshal_signal (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data)
+{
+ SignalClosure *sc = (SignalClosure *) closure;
+ TpSvcInterfaceSkeleton *self = sc->self;
+ GDBusInterfaceSkeleton *skel = G_DBUS_INTERFACE_SKELETON (self);
+ GVariantBuilder builder;
+ guint i;
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
+
+ /* Skip parameter 0, which is the GObject. */
+ for (i = 1; i < n_param_values; i++)
+ g_variant_builder_add_value (&builder,
+ dbus_g_value_build_g_variant (param_values + i));
+
+ /* we only support being exported on one connection */
+ g_dbus_connection_emit_signal (
+ g_dbus_interface_skeleton_get_connection (skel),
+ NULL, /* broadcast */
+ g_dbus_interface_skeleton_get_object_path (skel),
+ g_dbus_interface_skeleton_get_info (skel)->name,
+ sc->name,
+ /* consume floating ref */
+ g_variant_builder_end (&builder),
+ /* cannot fail unless a parameter is incompatible with D-Bus,
+ * so ignore error */
+ NULL);
+}
+
+/*
+ * _tp_svc_interface_skeleton_new: (skip)
+ * @object: (type GObject.Object): a #GObject
+ * @iface: a `TpSvc` interface on the object
+ * @iinfo: a description of the corresponding D-Bus interface
+ *
+ * Returns: (transfer full): a new interface skeleton wrapping @iface
+ * on @object
+ */
+TpSvcInterfaceSkeleton *
+_tp_svc_interface_skeleton_new (gpointer object,
+ GType iface,
+ const TpSvcInterfaceInfo *iinfo)
+{
+ TpSvcInterfaceSkeleton *self;
+
+ /* not bothering to refcount it, it must be static for now */
+ g_return_val_if_fail (iinfo->ref_count == -1, NULL);
+
+ self = g_object_new (TP_TYPE_SVC_INTERFACE_SKELETON,
+ NULL);
+ g_weak_ref_init (&self->priv->object, object);
+ self->priv->iinfo = (TpSvcInterfaceInfo *) iinfo;
+
+ if (iinfo->signals != NULL)
+ {
+ guint i;
+
+ for (i = 0; iinfo->signals[i] != NULL; i++)
+ {
+ const gchar *glib_name;
+ const gchar *dbus_name;
+ SignalClosure *closure;
+
+ g_assert (iinfo->interface_info->signals[i] != NULL);
+
+ glib_name = iinfo->signals[i];
+ dbus_name = iinfo->interface_info->signals[i]->name;
+
+ closure = (SignalClosure *) g_closure_new_object (sizeof (*closure),
+ (GObject *) self);
+ g_closure_set_marshal ((GClosure *) closure, marshal_signal);
+ closure->self = self;
+ closure->name = dbus_name;
+
+ g_signal_connect_closure (object, glib_name, (GClosure *) closure,
+ FALSE);
+ }
+ }
+
+ return self;
+}
diff --git a/telepathy-glib/telepathy-glib.h b/telepathy-glib/telepathy-glib.h
index 491f4d37a..afbec294c 100644
--- a/telepathy-glib/telepathy-glib.h
+++ b/telepathy-glib/telepathy-glib.h
@@ -54,7 +54,6 @@
#include <telepathy-glib/call-channel.h>
#include <telepathy-glib/call-content-media-description.h>
#include <telepathy-glib/call-content.h>
-#include <telepathy-glib/call-misc.h>
#include <telepathy-glib/call-stream-endpoint.h>
#include <telepathy-glib/call-stream.h>
#include <telepathy-glib/capabilities.h>
@@ -66,6 +65,7 @@
#include <telepathy-glib/channel.h>
#include <telepathy-glib/client.h>
#include <telepathy-glib/client-message.h>
+#include <telepathy-glib/core-svc-interface.h>
#include <telepathy-glib/cm-message.h>
#include <telepathy-glib/connection-contact-list.h>
#include <telepathy-glib/connection-manager.h>
diff --git a/telepathy-glib/tls-certificate.c b/telepathy-glib/tls-certificate.c
index 35a600aaa..1dcbe55da 100644
--- a/telepathy-glib/tls-certificate.c
+++ b/telepathy-glib/tls-certificate.c
@@ -442,8 +442,6 @@ tp_tls_certificate_class_init (TpTLSCertificateClass *klass)
GObjectClass *oclass = G_OBJECT_CLASS (klass);
TpProxyClass *pclass = TP_PROXY_CLASS (klass);
- tp_tls_certificate_init_known_interfaces ();
-
oclass->get_property = tp_tls_certificate_get_property;
oclass->set_property = tp_tls_certificate_set_property;
oclass->constructed = tp_tls_certificate_constructed;
@@ -810,37 +808,6 @@ tp_tls_certificate_reject_finish (TpTLSCertificate *self,
#include <telepathy-glib/_gen/tp-cli-tls-cert-body.h>
/**
- * tp_tls_certificate_init_known_interfaces:
- *
- * Ensure that the known interfaces for TpTLSCertificate have been set up.
- * This is done automatically when necessary, but for correct
- * overriding of library interfaces by local extensions, you should
- * call this function before calling
- * tp_proxy_or_subclass_hook_on_interface_add() with first argument
- * %TP_TYPE_TLS_CERTIFICATE.
- *
- * Since: 0.19.0
- */
-void
-tp_tls_certificate_init_known_interfaces (void)
-{
- static gsize once = 0;
-
- if (g_once_init_enter (&once))
- {
- GType tp_type = TP_TYPE_TLS_CERTIFICATE;
-
- tp_proxy_init_known_interfaces ();
- tp_proxy_or_subclass_hook_on_interface_add (tp_type,
- tp_cli_tls_cert_add_signals);
- tp_proxy_subclass_add_error_mapping (tp_type,
- TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
-
- g_once_init_leave (&once, 1);
- }
-}
-
-/**
* tp_tls_certificate_get_rejection:
* @self: a TLS certificate
*
diff --git a/telepathy-glib/tls-certificate.h b/telepathy-glib/tls-certificate.h
index c47d623bc..1841bd7ba 100644
--- a/telepathy-glib/tls-certificate.h
+++ b/telepathy-glib/tls-certificate.h
@@ -117,9 +117,6 @@ gboolean tp_tls_certificate_reject_finish (TpTLSCertificate *self,
GError **error);
_TP_AVAILABLE_IN_0_20
-void tp_tls_certificate_init_known_interfaces (void);
-
-_TP_AVAILABLE_IN_0_20
const gchar * tp_tls_certificate_get_cert_type (TpTLSCertificate *self);
_TP_AVAILABLE_IN_0_20
GPtrArray * tp_tls_certificate_get_cert_data (TpTLSCertificate *self);
diff --git a/telepathy-glib/util.c b/telepathy-glib/util.c
index 0018a38a7..6f5f5110c 100644
--- a/telepathy-glib/util.c
+++ b/telepathy-glib/util.c
@@ -919,138 +919,6 @@ _tp_quark_array_copy (const GQuark *quarks)
}
/**
- * tp_value_array_build: (skip)
- * @length: The number of elements that should be in the array
- * @type: The type of the first argument.
- * @...: The value of the first item in the struct followed by a list of type,
- * value pairs terminated by G_TYPE_INVALID.
- *
- * Creates a new #GValueArray for use with structs, containing the values
- * passed in as parameters. The values are copied or reffed as appropriate for
- * their type.
- *
- * <example>
- * <title> using tp_value_array_build</title>
- * <programlisting>
- * GValueArray *array = tp_value_array_build (2,
- * G_TYPE_STRING, host,
- * G_TYPE_UINT, port,
- * G_TYPE_INVALID);
- * </programlisting>
- * </example>
- *
- * Returns: a newly created #GValueArray, free with tp_value_array_free()
- *
- * Since: 0.9.2
- */
-GValueArray *
-tp_value_array_build (gsize length,
- GType type,
- ...)
-{
- GValueArray *arr;
- GType t;
- va_list var_args;
- char *error = NULL;
-
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- arr = g_value_array_new (length);
- G_GNUC_END_IGNORE_DEPRECATIONS
-
- va_start (var_args, type);
-
- for (t = type; t != G_TYPE_INVALID; t = va_arg (var_args, GType))
- {
- GValue *v = arr->values + arr->n_values;
-
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- g_value_array_append (arr, NULL);
- G_GNUC_END_IGNORE_DEPRECATIONS
-
- g_value_init (v, t);
-
- G_VALUE_COLLECT (v, var_args, 0, &error);
-
- if (error != NULL)
- {
- CRITICAL ("%s", error);
- g_free (error);
-
- tp_value_array_free (arr);
- va_end (var_args);
- return NULL;
- }
- }
-
- g_warn_if_fail (arr->n_values == length);
-
- va_end (var_args);
- return arr;
-}
-
-/**
- * tp_value_array_unpack: (skip)
- * @array: the array to unpack
- * @len: The number of elements that should be in the array
- * @...: a list of correctly typed pointers to store the values in
- *
- * Unpacks a #GValueArray into separate variables.
- *
- * The contents of the values aren't copied into the variables, and so become
- * invalid when @array is freed.
- *
- * <example>
- * <title>using tp_value_array_unpack</title>
- * <programlisting>
- * const gchar *host;
- * guint port;
- *
- * tp_value_array_unpack (array, 2,
- * &host,
- * &port);
- * </programlisting>
- * </example>
- *
- * Since: 0.11.0
- */
-void
-tp_value_array_unpack (GValueArray *array,
- gsize len,
- ...)
-{
- va_list var_args;
- guint i;
-
- va_start (var_args, len);
-
- for (i = 0; i < len; i++)
- {
- GValue *value;
- char *error = NULL;
-
- if (G_UNLIKELY (i > array->n_values))
- {
- WARNING ("More parameters than entries in the struct!");
- break;
- }
-
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- value = g_value_array_get_nth (array, i);
- G_GNUC_END_IGNORE_DEPRECATIONS
-
- G_VALUE_LCOPY (value, var_args, G_VALUE_NOCOPY_CONTENTS, &error);
- if (error != NULL)
- {
- WARNING ("%s", error);
- g_free (error);
- break;
- }
- }
-
- va_end (var_args);
-}
-
-/**
* TpWeakRef:
*
* A simple wrapper for a weak reference to a #GObject, suitable for use in
@@ -1935,19 +1803,3 @@ _tp_g_list_copy_deep (GList *list,
return ret;
}
-
-/**
- * tp_value_array_free:
- * @va: a #GValueArray
- *
- * Free @va. This is exactly the same as g_value_array_free(), but does not
- * provoke deprecation warnings from GLib when used in conjunction with
- * tp_value_array_build() and tp_value_array_unpack().
- *
- * Since: 0.23.0
- */
-void
-(tp_value_array_free) (GValueArray *va)
-{
- _tp_value_array_free_inline (va);
-}
diff --git a/telepathy-logger/call-channel.c b/telepathy-logger/call-channel.c
index aa5e52cfa..a8d65e08c 100644
--- a/telepathy-logger/call-channel.c
+++ b/telepathy-logger/call-channel.c
@@ -390,16 +390,6 @@ _tpl_call_channel_class_init (TplCallChannelClass *klass)
proxy_class->list_features = tpl_call_channel_list_features;
g_type_class_add_private (object_class, sizeof (TplCallChannelPriv));
-
- dbus_g_object_register_marshaller (tpl_marshal_VOID__UINT_UINT_BOXED_BOXED,
- G_TYPE_NONE,
- G_TYPE_UINT, G_TYPE_UINT, G_TYPE_BOXED, G_TYPE_BOXED,
- G_TYPE_INVALID);
-
- dbus_g_object_register_marshaller (tpl_marshal_VOID__BOXED_BOXED,
- G_TYPE_NONE,
- G_TYPE_BOXED, G_TYPE_BOXED,
- G_TYPE_INVALID);
}
diff --git a/telepathy-logger/dbus-service.c b/telepathy-logger/dbus-service.c
index 978c485c8..3f1d7c8b7 100644
--- a/telepathy-logger/dbus-service.c
+++ b/telepathy-logger/dbus-service.c
@@ -65,7 +65,7 @@ struct _FavouriteContactClosure {
gchar *account;
gchar *contact_id;
gchar *file_contents;
- DBusGMethodInvocation *context;
+ GDBusMethodInvocation *context;
FavouriteContactCallback cb;
};
@@ -90,7 +90,7 @@ static FavouriteContactClosure *
favourite_contact_closure_new (TplDBusService *self,
const gchar *account,
const gchar *contact_id,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
FavouriteContactClosure *closure;
@@ -427,7 +427,7 @@ pendingproc_get_favourite_contacts (TplActionChain *action_chain,
static void
tpl_dbus_service_get_favourite_contacts (TpSvcLogger *logger,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TplDBusService *self;
TplDBusServicePriv *priv;
@@ -576,7 +576,7 @@ pendingproc_add_favourite_contact (TplActionChain *action_chain,
if (!tp_dbus_check_valid_object_path (closure->account, &error))
{
- dbus_g_method_return_error (closure->context, error);
+ g_dbus_method_invocation_return_gerror (closure->context, error);
goto pendingproc_add_favourite_contact_ERROR;
}
@@ -605,7 +605,7 @@ static void
tpl_dbus_service_add_favourite_contact (TpSvcLogger *logger,
const gchar *account,
const gchar *contact_id,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TplDBusService *self = TPL_DBUS_SERVICE (logger);
TplDBusServicePriv *priv;
@@ -673,7 +673,7 @@ pendingproc_remove_favourite_contact (TplActionChain *action_chain,
if (!tp_dbus_check_valid_object_path (closure->account, &error))
{
- dbus_g_method_return_error (closure->context, error);
+ g_dbus_method_invocation_return_gerror (closure->context, error);
goto pendingproc_remove_favourite_contact_ERROR;
}
@@ -706,7 +706,7 @@ static void
tpl_dbus_service_remove_favourite_contact (TpSvcLogger *logger,
const gchar *account,
const gchar *contact_id,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TplDBusService *self = TPL_DBUS_SERVICE (logger);
TplDBusServicePriv *priv;
@@ -733,7 +733,7 @@ tpl_dbus_service_remove_favourite_contact (TpSvcLogger *logger,
static void
tpl_dbus_service_clear (TpSvcLogger *logger,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TplDBusService *self = TPL_DBUS_SERVICE (logger);
@@ -750,7 +750,7 @@ tpl_dbus_service_clear (TpSvcLogger *logger,
static void
tpl_dbus_service_clear_account (TpSvcLogger *logger,
const gchar *account_path,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TplDBusService *self = TPL_DBUS_SERVICE (logger);
TpDBusDaemon *bus;
@@ -765,7 +765,7 @@ tpl_dbus_service_clear_account (TpSvcLogger *logger,
if (bus == NULL)
{
DEBUG ("Unable to acquire the bus daemon: %s", error->message);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
goto out;
}
@@ -777,7 +777,7 @@ tpl_dbus_service_clear_account (TpSvcLogger *logger,
{
DEBUG ("Unable to acquire the account for %s: %s", account_path,
error->message);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
goto out;
}
@@ -801,7 +801,7 @@ tpl_dbus_service_clear_entity (TpSvcLogger *logger,
const gchar *account_path,
const gchar *identifier,
gint type,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TplDBusService *self = TPL_DBUS_SERVICE (logger);
TpDBusDaemon *bus;
@@ -818,7 +818,7 @@ tpl_dbus_service_clear_entity (TpSvcLogger *logger,
if (bus == NULL)
{
DEBUG ("Unable to acquire the bus daemon: %s", error->message);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
goto out;
}
@@ -830,7 +830,7 @@ tpl_dbus_service_clear_entity (TpSvcLogger *logger,
{
DEBUG ("Unable to acquire the account for %s: %s", account_path,
error->message);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
goto out;
}
diff --git a/tests/dbus/call-cancellation.c b/tests/dbus/call-cancellation.c
index b54223d21..1ff4ca1a3 100644
--- a/tests/dbus/call-cancellation.c
+++ b/tests/dbus/call-cancellation.c
@@ -23,7 +23,9 @@ static TpDBusDaemon *b;
static TpDBusDaemon *c;
static TpDBusDaemon *d;
static TpDBusDaemon *e;
+#if 0
static TpDBusDaemon *f;
+#endif
static TpDBusDaemon *g;
static TpDBusDaemon *h;
static TpDBusDaemon *i;
@@ -136,10 +138,12 @@ listed_names (TpDBusDaemon *proxy,
want_proxy = c;
want_object = NULL;
break;
+#if 0
case TEST_F:
want_proxy = f;
want_object = NULL;
break;
+#endif
default:
MYASSERT (FALSE, ": %c (%p) method call failed, which shouldn't "
"happen", 'a' + which, proxy);
@@ -173,7 +177,9 @@ main (int argc,
GObject *b_stub, *i_stub, *j_stub, *k_stub;
GError err = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Because I said so" };
TpProxyPendingCall *pc;
+#if 0
gpointer tmp_obj;
+#endif
tp_tests_abort_after (10);
tp_debug_set_flags ("all");
@@ -197,8 +203,15 @@ main (int argc,
g_message ("d=%p", d);
e = tp_dbus_daemon_new (tp_proxy_get_dbus_connection (a));
g_message ("e=%p", e);
+
+ /* We can't use the TpDBusDaemon for this one because we need it to
+ * lose its name. */
+ /* FIXME */
+#if 0
f = tp_dbus_daemon_new (tp_proxy_get_dbus_connection (a));
g_message ("f=%p", f);
+#endif
+
g = tp_dbus_daemon_new (tp_proxy_get_dbus_connection (a));
g_message ("g=%p", g);
h = tp_dbus_daemon_new (tp_proxy_get_dbus_connection (a));
@@ -270,16 +283,14 @@ main (int argc,
MYASSERT (!tp_intset_is_member (method_ok, TEST_E), "");
MYASSERT (!tp_intset_is_member (method_error, TEST_E), "");
+#if 0
/* f's method call fails with an error, because it's implicitly
- * invalidated by its DBusGProxy being destroyed.
- *
- * Note that this test case exploits implementation details of dbus-glib.
- * If it stops working after a dbus-glib upgrade, that's probably why. */
+ * invalidated by its name being lost. */
g_message ("Starting call on f");
tp_cli_dbus_daemon_call_list_names (f, -1, listed_names, PTR (TEST_F),
destroy_user_data, NULL);
MYASSERT (!tp_intset_is_member (freed_user_data, TEST_F), "");
- g_message ("Forcibly disposing f's DBusGProxy to simulate name owner loss");
+ g_message ("Losing f's name");
tmp_obj = tp_proxy_get_interface_by_id ((TpProxy *) f,
TP_IFACE_QUARK_DBUS_DAEMON, NULL);
MYASSERT (tmp_obj != NULL, "");
@@ -289,6 +300,7 @@ main (int argc,
MYASSERT (!tp_intset_is_member (freed_user_data, TEST_F), "");
MYASSERT (!tp_intset_is_member (method_ok, TEST_F), "");
MYASSERT (!tp_intset_is_member (method_error, TEST_F), "");
+#endif
/* g gets unreferenced, but survives long enough for the call to complete
* successfully later, because the pending call holds a reference;
@@ -413,10 +425,12 @@ main (int argc,
MYASSERT (!tp_intset_is_member (method_error, TEST_G), "");
MYASSERT (copy_of_g == NULL, "");
+#if 0
/* also, F will have been invalidated */
MYASSERT (tp_intset_is_member (freed_user_data, TEST_F), "");
MYASSERT (!tp_intset_is_member (method_ok, TEST_F), "");
MYASSERT (tp_intset_is_member (method_error, TEST_F), "");
+#endif
/* Now that its call has been cancelled, h will have gone away. Likewise
* for i */
@@ -454,8 +468,10 @@ main (int argc,
MYASSERT (d == NULL, "");
g_object_unref (e);
e = NULL;
+#if 0
g_object_unref (f);
f = NULL;
+#endif
MYASSERT (g == NULL, "");
MYASSERT (h == NULL, "");
MYASSERT (i == NULL, "");
@@ -473,7 +489,9 @@ main (int argc,
MYASSERT (tp_intset_is_member (freed_user_data, TEST_C), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_D), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_E), "");
+#if 0
MYASSERT (tp_intset_is_member (freed_user_data, TEST_F), "");
+#endif
MYASSERT (tp_intset_is_member (freed_user_data, TEST_G), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_H), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_I), "");
diff --git a/tests/dbus/channel-dispatch-operation.c b/tests/dbus/channel-dispatch-operation.c
index 6541e07a6..e32c3c128 100644
--- a/tests/dbus/channel-dispatch-operation.c
+++ b/tests/dbus/channel-dispatch-operation.c
@@ -35,7 +35,7 @@ typedef struct {
GMainLoop *mainloop;
TpDBusDaemon *dbus;
- DBusGConnection *private_conn;
+ GDBusConnection *private_conn;
TpDBusDaemon *private_dbus;
TpTestsSimpleChannelDispatchOperation *cdo_service;
TpTestsEchoChannel *text_chan_service;
@@ -54,22 +54,12 @@ static void
setup (Test *test,
gconstpointer data)
{
- DBusConnection *libdbus;
-
tp_debug_set_flags ("all");
test->mainloop = g_main_loop_new (NULL, FALSE);
test->dbus = tp_tests_dbus_daemon_dup_or_die ();
- libdbus = dbus_bus_get_private (DBUS_BUS_STARTER, NULL);
- g_assert (libdbus != NULL);
- dbus_connection_setup_with_g_main (libdbus, NULL);
- dbus_connection_set_exit_on_disconnect (libdbus, FALSE);
- test->private_conn = dbus_connection_get_g_connection (libdbus);
- /* transfer ref */
- dbus_g_connection_ref (test->private_conn);
- dbus_connection_unref (libdbus);
- g_assert (test->private_conn != NULL);
+ test->private_conn = tp_tests_get_private_bus ();
test->private_dbus = tp_dbus_daemon_new (test->private_conn);
g_assert (test->private_dbus != NULL);
@@ -162,13 +152,9 @@ teardown (Test *test,
test->cdo_service = NULL;
if (test->private_conn != NULL)
- {
- dbus_connection_close (dbus_g_connection_get_connection (
- test->private_conn));
+ g_dbus_connection_close_sync (test->private_conn, NULL, NULL);
- dbus_g_connection_unref (test->private_conn);
- test->private_conn = NULL;
- }
+ g_clear_object (&test->private_conn);
/* make sure any pending things have happened */
tp_tests_proxy_run_until_dbus_queue_processed (test->dbus);
@@ -268,10 +254,8 @@ test_crash (Test *test,
g_assert (tp_proxy_get_invalidated (test->cdo) == NULL);
- dbus_connection_close (dbus_g_connection_get_connection (
- test->private_conn));
- dbus_g_connection_unref (test->private_conn);
- test->private_conn = NULL;
+ g_dbus_connection_close_sync (test->private_conn, NULL, NULL);
+ g_clear_object (&test->private_conn);
while (tp_proxy_get_invalidated (test->cdo) == NULL)
g_main_context_iteration (NULL, TRUE);
diff --git a/tests/dbus/channel-request.c b/tests/dbus/channel-request.c
index 762f07941..95f127293 100644
--- a/tests/dbus/channel-request.c
+++ b/tests/dbus/channel-request.c
@@ -55,7 +55,7 @@ typedef struct {
GMainLoop *mainloop;
TpDBusDaemon *dbus;
- DBusGConnection *private_conn;
+ GDBusConnection *private_conn;
TpDBusDaemon *private_dbus;
GObject *cr_service;
@@ -76,23 +76,13 @@ static void
setup (Test *test,
gconstpointer data)
{
- DBusConnection *libdbus;
-
tp_debug_set_flags ("all");
test->mainloop = g_main_loop_new (NULL, FALSE);
test->dbus = tp_tests_dbus_daemon_dup_or_die ();
g_assert (test->dbus != NULL);
- libdbus = dbus_bus_get_private (DBUS_BUS_STARTER, NULL);
- g_assert (libdbus != NULL);
- dbus_connection_setup_with_g_main (libdbus, NULL);
- dbus_connection_set_exit_on_disconnect (libdbus, FALSE);
- test->private_conn = dbus_connection_get_g_connection (libdbus);
- /* transfer ref */
- dbus_g_connection_ref (test->private_conn);
- dbus_connection_unref (libdbus);
- g_assert (test->private_conn != NULL);
+ test->private_conn = tp_tests_get_private_bus ();
test->private_dbus = tp_dbus_daemon_new (test->private_conn);
g_assert (test->private_dbus != NULL);
@@ -134,13 +124,9 @@ teardown (Test *test,
test->cr_service = NULL;
if (test->private_conn != NULL)
- {
- dbus_connection_close (dbus_g_connection_get_connection (
- test->private_conn));
+ g_dbus_connection_close_sync (test->private_conn, NULL, NULL);
- dbus_g_connection_unref (test->private_conn);
- test->private_conn = NULL;
- }
+ g_clear_object (&test->private_conn);
/* make sure any pending things have happened */
tp_tests_proxy_run_until_dbus_queue_processed (test->dbus);
@@ -223,10 +209,8 @@ test_crash (Test *test,
g_assert (tp_proxy_get_invalidated (test->cr) == NULL);
- dbus_connection_close (dbus_g_connection_get_connection (
- test->private_conn));
- dbus_g_connection_unref (test->private_conn);
- test->private_conn = NULL;
+ g_dbus_connection_close_sync (test->private_conn, NULL, NULL);
+ g_clear_object (&test->private_conn);
while (tp_proxy_get_invalidated (test->cr) == NULL)
g_main_context_iteration (NULL, TRUE);
diff --git a/tests/dbus/cm.c b/tests/dbus/cm.c
index 32c955f2b..456615c93 100644
--- a/tests/dbus/cm.c
+++ b/tests/dbus/cm.c
@@ -62,7 +62,7 @@ static void
my_get (TpSvcDBusProperties *iface G_GNUC_UNUSED,
const gchar *i G_GNUC_UNUSED,
const gchar *p G_GNUC_UNUSED,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
/* The telepathy-glib client side should never call this:
* GetAll() is better. */
@@ -72,7 +72,7 @@ my_get (TpSvcDBusProperties *iface G_GNUC_UNUSED,
static void
my_get_all (TpSvcDBusProperties *iface,
const gchar *i,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
MyConnectionManager *cm = (MyConnectionManager *) iface;
GHashTable *ht;
diff --git a/tests/dbus/connection-aliasing.c b/tests/dbus/connection-aliasing.c
index 0fef4a74c..6b51ea6ba 100644
--- a/tests/dbus/connection-aliasing.c
+++ b/tests/dbus/connection-aliasing.c
@@ -26,8 +26,7 @@
typedef struct {
GMainLoop *mainloop;
TpDBusDaemon *dbus;
- DBusConnection *client_libdbus;
- DBusGConnection *client_dbusglib;
+ GDBusConnection *client_gdbus;
TpDBusDaemon *client_bus;
ExampleContactListConnection *service_conn;
TpBaseConnection *service_conn_as_base;
@@ -55,14 +54,8 @@ setup (Test *test,
test->mainloop = g_main_loop_new (NULL, FALSE);
test->error = NULL;
- test->client_libdbus = dbus_bus_get_private (DBUS_BUS_STARTER, NULL);
- g_assert (test->client_libdbus != NULL);
- dbus_connection_setup_with_g_main (test->client_libdbus, NULL);
- dbus_connection_set_exit_on_disconnect (test->client_libdbus, FALSE);
- test->client_dbusglib = dbus_connection_get_g_connection (
- test->client_libdbus);
- dbus_g_connection_ref (test->client_dbusglib);
- test->client_bus = tp_dbus_daemon_new (test->client_dbusglib);
+ test->client_gdbus = tp_tests_get_private_bus ();
+ test->client_bus = tp_dbus_daemon_new (test->client_gdbus);
g_assert (test->client_bus != NULL);
test->service_conn = tp_tests_object_new_static_class (
@@ -128,9 +121,8 @@ teardown (Test *test,
g_object_unref (test->client_bus);
test->client_bus = NULL;
- dbus_g_connection_unref (test->client_dbusglib);
- dbus_connection_close (test->client_libdbus);
- dbus_connection_unref (test->client_libdbus);
+ g_dbus_connection_close_sync (test->client_gdbus, NULL, NULL);
+ g_object_unref (test->client_gdbus);
}
static void
diff --git a/tests/dbus/connection-balance.c b/tests/dbus/connection-balance.c
index bf397828b..2104af56e 100644
--- a/tests/dbus/connection-balance.c
+++ b/tests/dbus/connection-balance.c
@@ -181,8 +181,7 @@ unbalanced_connection_class_init (UnbalancedConnectionClass *cls)
typedef struct {
GMainLoop *mainloop;
TpDBusDaemon *dbus;
- DBusConnection *client_libdbus;
- DBusGConnection *client_dbusglib;
+ GDBusConnection *client_gdbus;
TpDBusDaemon *client_bus;
TpTestsSimpleConnection *service_conn;
TpBaseConnection *service_conn_as_base;
@@ -211,14 +210,8 @@ setup (Test *test,
test->mainloop = g_main_loop_new (NULL, FALSE);
test->error = NULL;
- test->client_libdbus = dbus_bus_get_private (DBUS_BUS_STARTER, NULL);
- g_assert (test->client_libdbus != NULL);
- dbus_connection_setup_with_g_main (test->client_libdbus, NULL);
- dbus_connection_set_exit_on_disconnect (test->client_libdbus, FALSE);
- test->client_dbusglib = dbus_connection_get_g_connection (
- test->client_libdbus);
- dbus_g_connection_ref (test->client_dbusglib);
- test->client_bus = tp_dbus_daemon_new (test->client_dbusglib);
+ test->client_gdbus = tp_tests_get_private_bus ();
+ test->client_bus = tp_dbus_daemon_new (test->client_gdbus);
g_assert (test->client_bus != NULL);
test->service_conn = tp_tests_object_new_static_class (
@@ -284,9 +277,8 @@ teardown (Test *test,
g_object_unref (test->client_bus);
test->client_bus = NULL;
- dbus_g_connection_unref (test->client_dbusglib);
- dbus_connection_close (test->client_libdbus);
- dbus_connection_unref (test->client_libdbus);
+ g_dbus_connection_close_sync (test->client_gdbus, NULL, NULL);
+ g_object_unref (test->client_gdbus);
}
static void
diff --git a/tests/dbus/connection-error.c b/tests/dbus/connection-error.c
index b9c5cc046..16fd4ce9c 100644
--- a/tests/dbus/connection-error.c
+++ b/tests/dbus/connection-error.c
@@ -53,30 +53,6 @@ typedef enum
DOMAIN_SPECIFIC_ERROR = 0,
} ExampleError;
-/* example_com_error_get_type relies on this */
-G_STATIC_ASSERT (sizeof (GType) <= sizeof (gsize));
-
-static GType
-example_com_error_get_type (void)
-{
- static gsize type = 0;
-
- if (g_once_init_enter (&type))
- {
- static const GEnumValue values[] = {
- { DOMAIN_SPECIFIC_ERROR, "DOMAIN_SPECIFIC_ERROR",
- "DomainSpecificError" },
- { 0 }
- };
- GType gtype;
-
- gtype = g_enum_register_static ("ExampleError", values);
- g_once_init_leave (&type, gtype);
- }
-
- return (GType) type;
-}
-
static GQuark
example_com_error_quark (void)
{
@@ -88,8 +64,10 @@ example_com_error_quark (void)
g_assert (sizeof (GQuark) <= sizeof (gsize));
- dbus_g_error_domain_register (domain, "com.example",
- example_com_error_get_type ());
+ if (!g_dbus_error_register_error (domain, DOMAIN_SPECIFIC_ERROR,
+ "com.example.DomainSpecificError"))
+ g_assert_not_reached ();
+
g_once_init_leave (&quark, domain);
}
@@ -104,26 +82,10 @@ typedef struct {
} Test;
static void
-global_setup (void)
-{
- static gboolean done = FALSE;
-
- if (done)
- return;
-
- done = TRUE;
-
- tp_debug_set_flags ("all");
-
- tp_proxy_subclass_add_error_mapping (TP_TYPE_CONNECTION,
- "com.example", example_com_error_quark (), example_com_error_get_type ());
-}
-
-static void
setup (Test *test,
gconstpointer nil G_GNUC_UNUSED)
{
- global_setup ();
+ tp_debug_set_flags ("all");
test->mainloop = g_main_loop_new (NULL, FALSE);
@@ -169,6 +131,9 @@ test_registered_error (Test *test,
tp_cli_connection_connect_to_status_changed (test->conn, on_status_changed,
test->mainloop, NULL, NULL, NULL);
+ /* evaluate the error quark for its side-effect of registering the domain */
+ g_assert_cmpuint (example_com_error_quark (), !=, 0);
+
tp_base_connection_disconnect_with_dbus_error (
test->service_conn_as_base, "com.example.DomainSpecificError", NULL,
TP_CONNECTION_STATUS_REASON_NETWORK_ERROR);
diff --git a/tests/dbus/connection-interests.c b/tests/dbus/connection-interests.c
index f0dbaa1b9..3b96674e1 100644
--- a/tests/dbus/connection-interests.c
+++ b/tests/dbus/connection-interests.c
@@ -79,8 +79,7 @@ interested_connection_class_init (InterestedConnectionClass *cls)
typedef struct {
TpDBusDaemon *dbus;
- DBusConnection *client_libdbus;
- DBusGConnection *client_dbusglib;
+ GDBusConnection *client_gdbus;
TpDBusDaemon *client_bus;
TpTestsSimpleConnection *service_conn;
TpBaseConnection *service_conn_as_base;
@@ -154,14 +153,8 @@ setup (Test *test,
tp_debug_set_flags ("all");
test->dbus = tp_tests_dbus_daemon_dup_or_die ();
- test->client_libdbus = dbus_bus_get_private (DBUS_BUS_STARTER, NULL);
- g_assert (test->client_libdbus != NULL);
- dbus_connection_setup_with_g_main (test->client_libdbus, NULL);
- dbus_connection_set_exit_on_disconnect (test->client_libdbus, FALSE);
- test->client_dbusglib = dbus_connection_get_g_connection (
- test->client_libdbus);
- dbus_g_connection_ref (test->client_dbusglib);
- test->client_bus = tp_dbus_daemon_new (test->client_dbusglib);
+ test->client_gdbus = tp_tests_get_private_bus ();
+ test->client_bus = tp_dbus_daemon_new (test->client_gdbus);
g_assert (test->client_bus != NULL);
test->service_conn = tp_tests_object_new_static_class (
@@ -252,9 +245,11 @@ teardown (Test *test,
g_object_unref (test->client_bus);
test->client_bus = NULL;
- dbus_g_connection_unref (test->client_dbusglib);
- dbus_connection_close (test->client_libdbus);
- dbus_connection_unref (test->client_libdbus);
+ if (test->client_gdbus != NULL)
+ {
+ g_dbus_connection_close_sync (test->client_gdbus, NULL, NULL);
+ g_object_unref (test->client_gdbus);
+ }
g_ptr_array_unref (test->log);
}
@@ -348,8 +343,10 @@ test_interest (Test *test,
/* we auto-release the Location client interest by dropping the client
* connection */
- dbus_connection_flush (test->client_libdbus);
- dbus_connection_close (test->client_libdbus);
+ g_dbus_connection_flush_sync (test->client_gdbus, NULL, NULL);
+ g_dbus_connection_close_sync (test->client_gdbus, NULL, NULL);
+ g_object_unref (test->client_gdbus);
+ test->client_gdbus = NULL;
while (test->log->len < 6)
g_main_context_iteration (NULL, TRUE);
diff --git a/tests/dbus/connection.c b/tests/dbus/connection.c
index 33f77fcd1..c7d6b0c15 100644
--- a/tests/dbus/connection.c
+++ b/tests/dbus/connection.c
@@ -98,7 +98,7 @@ teardown (Test *test,
g_clear_error (&error);
test->service_conn_as_base = NULL;
- g_object_unref (test->service_conn);
+ tp_tests_assert_last_unref (&test->service_conn);
g_free (test->conn_name);
g_free (test->conn_path);
@@ -280,6 +280,7 @@ test_object_path (Test *test,
"simple_protocol");
/* Register the same connection with an invalid object path */
+ tp_dbus_daemon_unregister_object (test->dbus, test->service_conn);
tp_dbus_daemon_register_object (test->dbus, invalid_path, test->service_conn);
tp_dbus_daemon_request_name (test->dbus, invalid_name, FALSE, &error);
g_assert_no_error (error);
@@ -289,6 +290,12 @@ test_object_path (Test *test,
g_assert (connection == NULL);
g_assert_error (error, TP_DBUS_ERRORS, TP_DBUS_ERROR_INVALID_OBJECT_PATH);
g_clear_error (&error);
+
+ /* Put it back where it was meant to be so we can do teardown. */
+ tp_dbus_daemon_unregister_object (test->dbus, test->service_conn);
+ tp_dbus_daemon_register_object (test->dbus,
+ tp_base_connection_get_object_path (test->service_conn_as_base),
+ test->service_conn);
}
int
diff --git a/tests/dbus/dbus.c b/tests/dbus/dbus.c
index d955b491b..c3c5a615c 100644
--- a/tests/dbus/dbus.c
+++ b/tests/dbus/dbus.c
@@ -111,7 +111,7 @@ test_properties (void)
TpDBusDaemon *bus = tp_dbus_daemon_dup (NULL);
gchar *bus_name;
gchar *object_path;
- DBusGConnection *dbus_conn;
+ GDBusConnection *dbus_conn;
g_object_get (bus,
"dbus-connection", &dbus_conn,
@@ -124,11 +124,11 @@ test_properties (void)
object_path);
g_assert_cmpstr (bus_name, ==, "org.freedesktop.DBus");
- g_assert (dbus_conn != NULL);
+ g_assert (G_IS_DBUS_CONNECTION (dbus_conn));
g_free (bus_name);
g_free (object_path);
- dbus_g_connection_unref (dbus_conn);
+ g_object_unref (dbus_conn);
g_object_unref (bus);
}
diff --git a/tests/dbus/disconnection.c b/tests/dbus/disconnection.c
index d2efcfa76..eb6444aea 100644
--- a/tests/dbus/disconnection.c
+++ b/tests/dbus/disconnection.c
@@ -23,7 +23,9 @@ static TpDBusDaemon *b;
static TpDBusDaemon *c;
static TpDBusDaemon *d;
static TpDBusDaemon *e;
+#if 0
static TpDBusDaemon *f;
+#endif
static TpDBusDaemon *g;
static TpDBusDaemon *h;
static TpDBusDaemon *z;
@@ -175,8 +177,10 @@ main (int argc,
g_message ("d=%p", d);
e = tp_dbus_daemon_new (tp_proxy_get_dbus_connection (a));
g_message ("e=%p", e);
+#if 0
f = tp_dbus_daemon_new (tp_proxy_get_dbus_connection (a));
g_message ("f=%p", f);
+#endif
g = tp_dbus_daemon_new (tp_proxy_get_dbus_connection (a));
g_message ("g=%p", g);
h = tp_dbus_daemon_new (tp_proxy_get_dbus_connection (a));
@@ -246,6 +250,7 @@ main (int argc,
g_message ("Disconnecting signal from e");
tp_proxy_signal_connection_disconnect (sc);
+#if 0
/* f gets its signal connection cancelled because it's implicitly
* invalidated by its DBusGProxy being destroyed.
*
@@ -270,6 +275,7 @@ main (int argc,
MYASSERT (error_out->code == DBUS_GERROR_NAME_HAS_NO_OWNER, "");
g_error_free (error_out);
error_out = NULL;
+#endif
/* g gets its signal connection cancelled because it's
* implicitly invalidated by being destroyed; unlike d, the signal
@@ -323,7 +329,9 @@ main (int argc,
MYASSERT (tp_intset_is_member (freed_user_data, TEST_C), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_D), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_E), "");
+#if 0
MYASSERT (tp_intset_is_member (freed_user_data, TEST_F), "");
+#endif
MYASSERT (tp_intset_is_member (freed_user_data, TEST_G), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_H), "");
@@ -338,7 +346,9 @@ main (int argc,
g_object_unref (c);
MYASSERT (d == NULL, "");
g_object_unref (e);
+#if 0
g_object_unref (f);
+#endif
MYASSERT (g == NULL, "");
g_object_unref (z);
@@ -349,7 +359,9 @@ main (int argc,
MYASSERT (tp_intset_is_member (freed_user_data, TEST_C), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_D), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_E), "");
+#if 0
MYASSERT (tp_intset_is_member (freed_user_data, TEST_F), "");
+#endif
MYASSERT (tp_intset_is_member (freed_user_data, TEST_G), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_H), "");
MYASSERT (tp_intset_is_member (freed_user_data, TEST_Z), "");
diff --git a/tests/dbus/get-interface-after-invalidate.c b/tests/dbus/get-interface-after-invalidate.c
index 675507d09..0fb216250 100644
--- a/tests/dbus/get-interface-after-invalidate.c
+++ b/tests/dbus/get-interface-after-invalidate.c
@@ -11,7 +11,7 @@ static void
test_get_interface_after_invalidate (void)
{
TpDBusDaemon *bus_daemon;
- DBusGProxy *props;
+ GDBusProxy *props;
GError invalidation_reason = { TP_ERROR, TP_ERROR_NOT_YOURS, "bees!" };
GError *error = NULL;
diff --git a/tests/dbus/with-properties.xml b/tests/dbus/with-properties.xml
index 5047a737e..b2befb12b 100644
--- a/tests/dbus/with-properties.xml
+++ b/tests/dbus/with-properties.xml
@@ -10,9 +10,12 @@
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal"
value="true"/>
- <property name="ReadOnly" access="read" type="u"/>
- <property name="WriteOnly" access="write" type="u"/>
- <property name="ReadWrite" access="readwrite" type="u">
+ <property name="ReadOnly" access="read" type="u"
+ tp:name-for-bindings="Read_Only"/>
+ <property name="WriteOnly" access="write" type="u"
+ tp:name-for-bindings="Write_Only"/>
+ <property name="ReadWrite" access="readwrite" type="u"
+ tp:name-for-bindings="Read_Write">
<!-- … and that this overrides the global annotation. -->
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal"
value="invalidates"/>
diff --git a/tests/lib/bug-19101-conn.c b/tests/lib/bug-19101-conn.c
index f12e193ce..19b322a74 100644
--- a/tests/lib/bug-19101-conn.c
+++ b/tests/lib/bug-19101-conn.c
@@ -42,7 +42,7 @@ tp_tests_bug19101_connection_get_contact_by_id (
TpSvcConnection *iface,
const gchar *id,
const char **interfaces,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpBaseConnection *base_conn = TP_BASE_CONNECTION (iface);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
diff --git a/tests/lib/contacts-conn.c b/tests/lib/contacts-conn.c
index f8148c922..44030df02 100644
--- a/tests/lib/contacts-conn.c
+++ b/tests/lib/contacts-conn.c
@@ -742,7 +742,7 @@ tp_tests_contacts_connection_set_default_contact_info (
static void
my_request_aliases (TpSvcConnectionInterfaceAliasing1 *aliasing,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsContactsConnection *self = TP_TESTS_CONTACTS_CONNECTION (aliasing);
TpBaseConnection *base = TP_BASE_CONNECTION (aliasing);
@@ -757,7 +757,7 @@ my_request_aliases (TpSvcConnectionInterfaceAliasing1 *aliasing,
if (!tp_handles_are_valid (contact_repo, contacts, FALSE, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -787,7 +787,7 @@ my_request_aliases (TpSvcConnectionInterfaceAliasing1 *aliasing,
static void
my_set_aliases (TpSvcConnectionInterfaceAliasing1 *aliasing,
GHashTable *table,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsContactsConnection *self = TP_TESTS_CONTACTS_CONNECTION (aliasing);
TpBaseConnection *base = TP_BASE_CONNECTION (aliasing);
@@ -818,7 +818,7 @@ my_set_aliases (TpSvcConnectionInterfaceAliasing1 *aliasing,
/* Verify all handles are valid */
if (!tp_handles_are_valid (contact_repo, handles, FALSE, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_clear_error (&error);
goto out;
}
@@ -851,7 +851,7 @@ init_aliasing (gpointer g_iface,
static void
my_request_avatars (TpSvcConnectionInterfaceAvatars1 *avatars,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsContactsConnection *self = TP_TESTS_CONTACTS_CONNECTION (avatars);
TpBaseConnection *base = TP_BASE_CONNECTION (avatars);
@@ -864,7 +864,7 @@ my_request_avatars (TpSvcConnectionInterfaceAvatars1 *avatars,
if (!tp_handles_are_valid (contact_repo, contacts, FALSE, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -942,7 +942,7 @@ lookup_contact_info (TpTestsContactsConnection *self,
static void
my_refresh_contact_info (TpSvcConnectionInterfaceContactInfo1 *obj,
const GArray *contacts,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsContactsConnection *self = TP_TESTS_CONTACTS_CONNECTION (obj);
TpBaseConnection *base = TP_BASE_CONNECTION (obj);
@@ -955,7 +955,7 @@ my_refresh_contact_info (TpSvcConnectionInterfaceContactInfo1 *obj,
if (!tp_handles_are_valid (contact_repo, contacts, FALSE, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -977,7 +977,7 @@ my_refresh_contact_info (TpSvcConnectionInterfaceContactInfo1 *obj,
static void
my_request_contact_info (TpSvcConnectionInterfaceContactInfo1 *obj,
guint handle,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsContactsConnection *self = TP_TESTS_CONTACTS_CONNECTION (obj);
TpBaseConnection *base = TP_BASE_CONNECTION (obj);
@@ -990,7 +990,7 @@ my_request_contact_info (TpSvcConnectionInterfaceContactInfo1 *obj,
if (!tp_handle_is_valid (contact_repo, handle, &error))
{
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
return;
}
@@ -1006,7 +1006,7 @@ my_request_contact_info (TpSvcConnectionInterfaceContactInfo1 *obj,
static void
my_set_contact_info (TpSvcConnectionInterfaceContactInfo1 *obj,
const GPtrArray *info,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsContactsConnection *self = TP_TESTS_CONTACTS_CONNECTION (obj);
TpBaseConnection *base = TP_BASE_CONNECTION (obj);
diff --git a/tests/lib/dbus-tube-chan.c b/tests/lib/dbus-tube-chan.c
index d2de191e0..ab307d247 100644
--- a/tests/lib/dbus-tube-chan.c
+++ b/tests/lib/dbus-tube-chan.c
@@ -353,7 +353,7 @@ static void
dbus_tube_offer (TpSvcChannelTypeDBusTube1 *chan,
GHashTable *parameters,
guint access_control,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsDBusTubeChannel *self = (TpTestsDBusTubeChannel *) chan;
@@ -374,7 +374,7 @@ dbus_tube_offer (TpSvcChannelTypeDBusTube1 *chan,
static void
dbus_tube_accept (TpSvcChannelTypeDBusTube1 *chan,
guint access_control,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsDBusTubeChannel *self = (TpTestsDBusTubeChannel *) chan;
diff --git a/tests/lib/echo-chan.c b/tests/lib/echo-chan.c
index 644237807..ba1b460ba 100644
--- a/tests/lib/echo-chan.c
+++ b/tests/lib/echo-chan.c
@@ -200,7 +200,7 @@ text_send (GObject *object,
static void
destroyable_destroy (TpSvcChannelInterfaceDestroyable1 *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsEchoChannel *self = TP_TESTS_ECHO_CHANNEL (iface);
diff --git a/tests/lib/file-transfer-chan.c b/tests/lib/file-transfer-chan.c
index 813826e83..d884394f5 100644
--- a/tests/lib/file-transfer-chan.c
+++ b/tests/lib/file-transfer-chan.c
@@ -448,7 +448,7 @@ file_transfer_provide_file (TpSvcChannelTypeFileTransfer1 *iface,
TpSocketAddressType address_type,
TpSocketAccessControl access_control,
const GValue *access_control_param,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsFileTransferChannel *self = (TpTestsFileTransferChannel *) iface;
TpBaseChannel *base_chan = (TpBaseChannel *) iface;
@@ -512,7 +512,7 @@ file_transfer_provide_file (TpSvcChannelTypeFileTransfer1 *iface,
return;
fail:
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
@@ -522,7 +522,7 @@ file_transfer_accept_file (TpSvcChannelTypeFileTransfer1 *iface,
TpSocketAccessControl access_control,
const GValue *access_control_param,
guint64 offset,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsFileTransferChannel *self = (TpTestsFileTransferChannel *) iface;
TpBaseChannel *base_chan = (TpBaseChannel *) iface;
@@ -577,7 +577,7 @@ file_transfer_accept_file (TpSvcChannelTypeFileTransfer1 *iface,
return;
fail:
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
diff --git a/tests/lib/room-list-chan.c b/tests/lib/room-list-chan.c
index a71b29cbc..da1ecc236 100644
--- a/tests/lib/room-list-chan.c
+++ b/tests/lib/room-list-chan.c
@@ -209,7 +209,7 @@ find_rooms (gpointer data)
static void
room_list_list_rooms (TpSvcChannelTypeRoomList1 *chan,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsRoomListChan *self = TP_TESTS_ROOM_LIST_CHAN (chan);
@@ -218,7 +218,7 @@ room_list_list_rooms (TpSvcChannelTypeRoomList1 *chan,
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Already listing" };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -227,7 +227,7 @@ room_list_list_rooms (TpSvcChannelTypeRoomList1 *chan,
GError error = { TP_ERROR, TP_ERROR_SERVICE_CONFUSED,
"Computer says no" };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
diff --git a/tests/lib/simple-account-manager.c b/tests/lib/simple-account-manager.c
index e5bddbc1f..767bce449 100644
--- a/tests/lib/simple-account-manager.c
+++ b/tests/lib/simple-account-manager.c
@@ -52,7 +52,7 @@ tp_tests_simple_account_manager_create_account (TpSvcAccountManager *svc,
const gchar *in_Display_Name,
GHashTable *in_Parameters,
GHashTable *in_Properties,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsSimpleAccountManager *self = (TpTestsSimpleAccountManager *) svc;
const gchar *out = TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/lospolloshermanos";
@@ -61,7 +61,7 @@ tp_tests_simple_account_manager_create_account (TpSvcAccountManager *svc,
if (!tp_strdiff (tp_asv_get_string (in_Parameters, "fail"), "yes"))
{
GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "loldongs" };
- dbus_g_method_return_error (context, &e);
+ g_dbus_method_invocation_return_gerror (context, &e);
return;
}
diff --git a/tests/lib/simple-account.c b/tests/lib/simple-account.c
index 7f9a629b5..7f0d568bd 100644
--- a/tests/lib/simple-account.c
+++ b/tests/lib/simple-account.c
@@ -92,7 +92,7 @@ static void
tp_tests_simple_account_update_parameters (TpSvcAccount *svc,
GHashTable *parameters,
const gchar **unset_parameters,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GPtrArray *reconnect_required = g_ptr_array_new ();
GHashTableIter iter;
diff --git a/tests/lib/simple-channel-dispatch-operation.c b/tests/lib/simple-channel-dispatch-operation.c
index bc95fc811..a935c7e4c 100644
--- a/tests/lib/simple-channel-dispatch-operation.c
+++ b/tests/lib/simple-channel-dispatch-operation.c
@@ -58,27 +58,27 @@ tp_tests_simple_channel_dispatch_operation_handle_with (
TpSvcChannelDispatchOperation *iface,
const gchar *handler,
gint64 user_action_timestamp,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
if (!tp_strdiff (handler, "FAIL"))
{
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Nope" };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
- dbus_g_method_return (context);
+ g_dbus_method_invocation_return_value (context, NULL);
}
static void
tp_tests_simple_channel_dispatch_operation_claim (
TpSvcChannelDispatchOperation *iface,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
tp_svc_channel_dispatch_operation_emit_finished (iface, "", "");
- dbus_g_method_return (context);
+ g_dbus_method_invocation_return_value (context, NULL);
}
static void
diff --git a/tests/lib/simple-channel-dispatcher.c b/tests/lib/simple-channel-dispatcher.c
index 775f915ea..6e42c86b7 100644
--- a/tests/lib/simple-channel-dispatcher.c
+++ b/tests/lib/simple-channel-dispatcher.c
@@ -122,7 +122,7 @@ tp_tests_simple_channel_dispatcher_create_channel (
gint64 user_action_time,
const gchar *preferred_handler,
GHashTable *hints,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsSimpleChannelDispatcher *self = SIMPLE_CHANNEL_DISPATCHER (dispatcher);
gchar *path;
@@ -144,7 +144,7 @@ tp_tests_simple_channel_dispatcher_create_channel (
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Computer says no" };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -169,7 +169,7 @@ tp_tests_simple_channel_dispatcher_ensure_channel (
gint64 user_action_time,
const gchar *preferred_handler,
GHashTable *hints,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsSimpleChannelDispatcher *self = SIMPLE_CHANNEL_DISPATCHER (dispatcher);
gchar *path;
@@ -219,7 +219,7 @@ tp_tests_simple_channel_dispatcher_delegate_channels (
const GPtrArray *channels,
gint64 user_action_time,
const gchar *preferred_handler,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsSimpleChannelDispatcher *self = (TpTestsSimpleChannelDispatcher *)
dispatcher;
@@ -262,7 +262,7 @@ tp_tests_simple_channel_dispatcher_present_channel (
TpSvcChannelDispatcher *dispatcher,
const gchar *channel,
gint64 user_action_time,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
tp_svc_channel_dispatcher_return_from_present_channel (context);
}
diff --git a/tests/lib/simple-channel-request.c b/tests/lib/simple-channel-request.c
index bb6687c54..61be33e03 100644
--- a/tests/lib/simple-channel-request.c
+++ b/tests/lib/simple-channel-request.c
@@ -141,7 +141,7 @@ tp_tests_simple_channel_request_dup_immutable_props (
static void
tp_tests_simple_channel_request_proceed (TpSvcChannelRequest *request,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsSimpleChannelRequest *self = SIMPLE_CHANNEL_REQUEST (request);
TpClient *client;
@@ -161,7 +161,7 @@ tp_tests_simple_channel_request_proceed (TpSvcChannelRequest *request,
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Computer says no" };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -243,7 +243,7 @@ tp_tests_simple_channel_request_proceed (TpSvcChannelRequest *request,
static void
tp_tests_simple_channel_request_cancel (TpSvcChannelRequest *request,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
tp_svc_channel_request_emit_failed (request, TP_ERROR_STR_CANCELLED,
"ChannelRequest has been cancelled");
diff --git a/tests/lib/simple-conn.c b/tests/lib/simple-conn.c
index 34244efb4..efa20c0dd 100644
--- a/tests/lib/simple-conn.c
+++ b/tests/lib/simple-conn.c
@@ -420,7 +420,7 @@ tp_tests_simple_connection_ensure_room_list_chan (TpTestsSimpleConnection *self,
static void
get_all (TpSvcDBusProperties *iface,
const gchar *interface_name,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
GHashTable *values = tp_dbus_properties_mixin_dup_all (G_OBJECT (iface),
interface_name);
diff --git a/tests/lib/stream-tube-chan.c b/tests/lib/stream-tube-chan.c
index 8a41064d0..39b4dc1fd 100644
--- a/tests/lib/stream-tube-chan.c
+++ b/tests/lib/stream-tube-chan.c
@@ -375,7 +375,7 @@ stream_tube_offer (TpSvcChannelTypeStreamTube1 *iface,
const GValue *address,
guint access_control,
GHashTable *parameters,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsStreamTubeChannel *self = (TpTestsStreamTubeChannel *) iface;
GError *error = NULL;
@@ -404,7 +404,7 @@ stream_tube_offer (TpSvcChannelTypeStreamTube1 *iface,
return;
fail:
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
@@ -465,7 +465,7 @@ stream_tube_accept (TpSvcChannelTypeStreamTube1 *iface,
TpSocketAddressType address_type,
TpSocketAccessControl access_control,
const GValue *access_control_param,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsStreamTubeChannel *self = (TpTestsStreamTubeChannel *) iface;
GError *error = NULL;
@@ -503,7 +503,7 @@ stream_tube_accept (TpSvcChannelTypeStreamTube1 *iface,
return;
fail:
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
g_error_free (error);
}
diff --git a/tests/lib/textchan-group.c b/tests/lib/textchan-group.c
index fedb0028d..0ac8baf6a 100644
--- a/tests/lib/textchan-group.c
+++ b/tests/lib/textchan-group.c
@@ -294,7 +294,7 @@ tp_tests_text_channel_set_password (TpTestsTextChannelGroup *self,
static void
password_get_password_flags (TpSvcChannelInterfacePassword1 *chan,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsTextChannelGroup *self = (TpTestsTextChannelGroup *) chan;
TpChannelPasswordFlags flags = 0;
@@ -309,7 +309,7 @@ password_get_password_flags (TpSvcChannelInterfacePassword1 *chan,
static void
password_provide_password (TpSvcChannelInterfacePassword1 *chan,
const gchar *password,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsTextChannelGroup *self = (TpTestsTextChannelGroup *) chan;
diff --git a/tests/lib/tls-certificate.c b/tests/lib/tls-certificate.c
index 0da164562..9a1d441c5 100644
--- a/tests/lib/tls-certificate.c
+++ b/tests/lib/tls-certificate.c
@@ -256,7 +256,7 @@ tp_tests_tls_certificate_class_init (TpTestsTLSCertificateClass *klass)
static void
tp_tests_tls_certificate_accept (TpSvcAuthenticationTLSCertificate *cert,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsTLSCertificate *self = TP_TESTS_TLS_CERTIFICATE (cert);
@@ -272,7 +272,7 @@ tp_tests_tls_certificate_accept (TpSvcAuthenticationTLSCertificate *cert,
"doesn't make sense."
};
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -285,7 +285,7 @@ tp_tests_tls_certificate_accept (TpSvcAuthenticationTLSCertificate *cert,
static void
tp_tests_tls_certificate_reject (TpSvcAuthenticationTLSCertificate *cert,
const GPtrArray *rejections,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
TpTestsTLSCertificate *self = TP_TESTS_TLS_CERTIFICATE (cert);
@@ -298,7 +298,7 @@ tp_tests_tls_certificate_reject (TpSvcAuthenticationTLSCertificate *cert,
GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT,
"Calling Reject() with a zero-length rejection list." };
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
@@ -311,7 +311,7 @@ tp_tests_tls_certificate_reject (TpSvcAuthenticationTLSCertificate *cert,
"doesn't make sense."
};
- dbus_g_method_return_error (context, &error);
+ g_dbus_method_invocation_return_gerror (context, &error);
return;
}
diff --git a/tests/lib/util.c b/tests/lib/util.c
index 245efcc46..1b12c4cf5 100644
--- a/tests/lib/util.c
+++ b/tests/lib/util.c
@@ -265,6 +265,7 @@ tp_tests_create_conn (GType conn_type,
gchar *name;
gchar *conn_path;
GError *error = NULL;
+ gboolean ok;
g_assert (service_conn != NULL);
g_assert (client_conn != NULL);
@@ -278,9 +279,10 @@ tp_tests_create_conn (GType conn_type,
NULL);
g_assert (*service_conn != NULL);
- g_assert (tp_base_connection_register (*service_conn, "simple",
- &name, &conn_path, &error));
+ ok = tp_base_connection_register (*service_conn, "simple",
+ &name, &conn_path, &error);
g_assert_no_error (error);
+ g_assert (ok);
*client_conn = tp_tests_connection_new (dbus, NULL, conn_path, &error);
g_assert (*client_conn != NULL);
@@ -699,3 +701,34 @@ tp_tests_dup_channel_props_asv (TpChannel *channel)
return asv;
}
+
+GDBusConnection *
+tp_tests_get_private_bus (void)
+{
+ GDBusConnection *ret;
+ GError *error = NULL;
+
+ ret = g_dbus_connection_new_for_address_sync (
+ g_getenv ("DBUS_SESSION_BUS_ADDRESS"),
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
+ G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+ NULL, NULL, &error);
+ g_assert_no_error (error);
+ return ret;
+}
+
+void
+_tp_tests_assert_last_unref (gpointer obj,
+ const gchar *file,
+ int line)
+{
+ GWeakRef weak;
+
+ g_weak_ref_init (&weak, obj);
+ g_object_unref (obj);
+ obj = g_weak_ref_get (&weak);
+
+ if (obj != NULL)
+ g_error ("%s:%d: %s %p should not have had any more references",
+ file, line, G_OBJECT_TYPE_NAME (obj), obj);
+}
diff --git a/tests/lib/util.h b/tests/lib/util.h
index 74a03078a..c6ec4a08a 100644
--- a/tests/lib/util.h
+++ b/tests/lib/util.h
@@ -108,4 +108,21 @@ TpChannel *tp_tests_channel_new_from_properties (TpConnection *conn,
GHashTable * tp_tests_dup_channel_props_asv (TpChannel *channel);
+GDBusConnection *tp_tests_get_private_bus (void);
+
+#define tp_tests_assert_last_unref(op) \
+ G_STMT_START \
+ { \
+ gpointer _tmp; \
+ \
+ _tmp = *(op); \
+ *(op) = NULL; \
+ \
+ _tp_tests_assert_last_unref (_tmp, __FILE__, __LINE__); \
+ } \
+ G_STMT_END
+void _tp_tests_assert_last_unref (gpointer obj,
+ const gchar *file,
+ int line);
+
#endif /* #ifndef __TP_TESTS_LIB_UTIL_H__ */
diff --git a/tests/suppressions/tpl.supp b/tests/suppressions/tpl.supp
index a395e82e6..568ade17a 100644
--- a/tests/suppressions/tpl.supp
+++ b/tests/suppressions/tpl.supp
@@ -216,37 +216,6 @@
fun:dbus_g_type_specialized_init
}
-{
- libdbus shared connection
- Memcheck:Leak
- ...
- fun:dbus_g_bus_get
-}
-
-{
- dbus-gobject registrations aren't freed unless we fall off the bus
- Memcheck:Leak
- ...
- fun:g_slist_append
- fun:dbus_g_connection_register_g_object
-}
-
-{
- DBusGProxy slots aren't freed unless we fall off the bus
- Memcheck:Leak
- ...
- fun:dbus_connection_allocate_data_slot
- ...
- fun:dbus_g_proxy_constructor
-}
-
-{
- error registrations are for life, not just for Christmas
- Memcheck:Leak
- ...
- fun:dbus_g_error_domain_register
-}
-
# ============================= telepathy-glib ========================
{
@@ -266,21 +235,6 @@
}
{
- tp_proxy_or_subclass_hook_on_interface_add never frees its list
- Memcheck:Leak
- ...
- fun:tp_proxy_or_subclass_hook_on_interface_add
-}
-
-{
- tp_dbus_daemon_constructor filter not freed til we fall off the bus
- Memcheck:Leak
- ...
- fun:dbus_connection_add_filter
- fun:tp_dbus_daemon_constructor
-}
-
-{
Leak in tp-glib 0.11.16 (Fedora 14)
Memcheck:Leak
...
diff --git a/tools/glib-client-gen.py b/tools/glib-client-gen.py
index cd420a16a..f9d9bc80f 100644
--- a/tools/glib-client-gen.py
+++ b/tools/glib-client-gen.py
@@ -29,8 +29,8 @@ from getopt import gnu_getopt
from libtpcodegen import file_set_contents, key_by_name, u
from libglibcodegen import (Signature, type_to_gtype,
- get_docstring, xml_escape, get_deprecated, copy_into_gvalue)
-
+ get_docstring, xml_escape, get_deprecated, copy_into_gvalue,
+ value_getter)
NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
@@ -113,7 +113,7 @@ class Generator(object):
arg_count = 0
args = []
- out_args = []
+ arg_sig = []
for arg in signal.getElementsByTagName('arg'):
name = arg.getAttribute('name')
@@ -128,11 +128,10 @@ class Generator(object):
info = type_to_gtype(type)
args.append((name, info, tp_type, arg))
+ arg_sig.append(type)
callback_name = ('%s_%s_signal_callback_%s'
% (self.prefix_lc, iface_lc, member_lc))
- collect_name = ('_%s_%s_collect_args_of_%s'
- % (self.prefix_lc, iface_lc, member_lc))
invoke_name = ('_%s_%s_invoke_callback_for_%s'
% (self.prefix_lc, iface_lc, member_lc))
@@ -182,98 +181,41 @@ class Generator(object):
self.h(' gpointer user_data, GObject *weak_object);')
- if args:
- self.b('static void')
- self.b('%s (DBusGProxy *proxy G_GNUC_UNUSED,' % collect_name)
-
- for arg in args:
- name, info, tp_type, elt = arg
- ctype, gtype, marshaller, pointer = info
-
- const = pointer and 'const ' or ''
-
- self.b(' %s%s%s,' % (const, ctype, name))
-
- self.b(' TpProxySignalConnection *sc)')
- self.b('{')
- self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
- self.b(' GValueArray *args = g_value_array_new (%d);' % len(args))
- self.b(' GValue blank = { 0 };')
- self.b(' guint i;')
- self.b('')
- self.b(' g_value_init (&blank, G_TYPE_INT);')
- self.b('')
- self.b(' for (i = 0; i < %d; i++)' % len(args))
- self.b(' g_value_array_append (args, &blank);')
- self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
- self.b('')
-
- for i, arg in enumerate(args):
- name, info, tp_type, elt = arg
- ctype, gtype, marshaller, pointer = info
-
- self.b(' g_value_unset (args->values + %d);' % i)
- self.b(' g_value_init (args->values + %d, %s);' % (i, gtype))
-
- self.b(' ' + copy_into_gvalue('args->values + %d' % i,
- gtype, marshaller, name))
- self.b('')
-
- self.b(' tp_proxy_signal_connection_v0_take_results (sc, args);')
- self.b('}')
-
self.b('static void')
self.b('%s (TpProxy *tpproxy,' % invoke_name)
- self.b(' GError *error G_GNUC_UNUSED,')
- self.b(' GValueArray *args,')
+ self.b(' const GError *error G_GNUC_UNUSED,')
+ self.b(' GVariant *variant,')
self.b(' GCallback generic_callback,')
self.b(' gpointer user_data,')
self.b(' GObject *weak_object)')
self.b('{')
self.b(' %s callback =' % callback_name)
self.b(' (%s) generic_callback;' % callback_name)
+
+ if args:
+ self.b(' GValue args_val = G_VALUE_INIT;')
+ self.b(' GValueArray *args_va;')
+ self.b('')
+ self.b(' dbus_g_value_parse_g_variant (variant, &args_val);')
+ self.b(' args_va = g_value_get_boxed (&args_val);')
+
self.b('')
self.b(' if (callback != NULL)')
self.b(' callback (g_object_ref (tpproxy),')
- # FIXME: factor out into a function
for i, arg in enumerate(args):
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
- if marshaller == 'BOXED':
- self.b(' g_value_get_boxed (args->values + %d),' % i)
- elif gtype == 'G_TYPE_STRING':
- self.b(' g_value_get_string (args->values + %d),' % i)
- elif gtype == 'G_TYPE_UCHAR':
- self.b(' g_value_get_uchar (args->values + %d),' % i)
- elif gtype == 'G_TYPE_BOOLEAN':
- self.b(' g_value_get_boolean (args->values + %d),' % i)
- elif gtype == 'G_TYPE_UINT':
- self.b(' g_value_get_uint (args->values + %d),' % i)
- elif gtype == 'G_TYPE_INT':
- self.b(' g_value_get_int (args->values + %d),' % i)
- elif gtype == 'G_TYPE_UINT64':
- self.b(' g_value_get_uint64 (args->values + %d),' % i)
- elif gtype == 'G_TYPE_INT64':
- self.b(' g_value_get_int64 (args->values + %d),' % i)
- elif gtype == 'G_TYPE_DOUBLE':
- self.b(' g_value_get_double (args->values + %d),' % i)
- else:
- assert False, "Don't know how to get %s from a GValue" % gtype
+ getter = value_getter(gtype, marshaller)
+ self.b(' %s (args_va->values + %d),' % (getter, i))
self.b(' user_data,')
self.b(' weak_object);')
self.b('')
- self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
- if len(args) > 0:
- self.b(' g_value_array_free (args);')
- else:
- self.b(' if (args != NULL)')
- self.b(' g_value_array_free (args);')
- self.b('')
- self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
+ if args:
+ self.b(' g_value_unset (&args_val);')
self.b(' g_object_unref (tpproxy);')
self.b('}')
@@ -339,27 +281,11 @@ class Generator(object):
self.b(' GObject *weak_object,')
self.b(' GError **error)')
self.b('{')
- self.b(' GType expected_types[%d] = {' % (len(args) + 1))
-
- for arg in args:
- name, info, tp_type, elt = arg
- ctype, gtype, marshaller, pointer = info
-
- self.b(' %s,' % gtype)
-
- self.b(' G_TYPE_INVALID };')
- self.b('')
self.b(' g_return_val_if_fail (callback != NULL, NULL);')
self.b('')
- self.b(' return tp_proxy_signal_connection_v0_new ((TpProxy *) proxy,')
+ self.b(' return tp_proxy_signal_connection_v1_new ((TpProxy *) proxy,')
self.b(' %s, \"%s\",' % (self.get_iface_quark(), member))
- self.b(' expected_types,')
-
- if args:
- self.b(' G_CALLBACK (%s),' % collect_name)
- else:
- self.b(' NULL, /* no args => no collector function */')
-
+ self.b(' G_VARIANT_TYPE ("(%s)"),' % ''.join(arg_sig))
self.b(' %s,' % invoke_name)
self.b(' G_CALLBACK (callback), user_data, destroy,')
self.b(' weak_object, error);')
@@ -401,6 +327,8 @@ class Generator(object):
ret_count = 0
in_args = []
out_args = []
+ in_sig = []
+ out_sig = []
for arg in method.getElementsByTagName('arg'):
name = arg.getAttribute('name')
@@ -425,6 +353,7 @@ class Generator(object):
if direction != 'out':
in_args.append((name, info, tp_type, arg))
else:
+ out_sig.append(type)
out_args.append((name, info, tp_type, arg))
# Async reply callback type
@@ -495,109 +424,19 @@ class Generator(object):
iface_lc,
member_lc)
- collect_callback = '_%s_%s_collect_callback_%s' % (self.prefix_lc,
- iface_lc,
- member_lc)
-
- # This is needed by both reentrant and non-reentrant calls
- if self.split_reentrants:
- collector = lambda x: (self.b(x), self.rb(x))
- else:
- collector = self.b
-
- # The callback called by dbus-glib; this ends the call and collects
- # the results into a GValueArray.
- collector('static void')
- collector('%s (DBusGProxy *proxy,' % collect_callback)
- collector(' DBusGProxyCall *call,')
- collector(' gpointer user_data)')
- collector('{')
- collector(' GError *error = NULL;')
-
- if len(out_args) > 0:
- collector(' GValueArray *args;')
- collector(' GValue blank = { 0 };')
- collector(' guint i;')
-
- for arg in out_args:
- name, info, tp_type, elt = arg
- ctype, gtype, marshaller, pointer = info
-
- # "We handle variants specially; the caller is expected to
- # have already allocated storage for them". Thanks,
- # dbus-glib...
- if gtype == 'G_TYPE_VALUE':
- collector(' GValue *%s = g_new0 (GValue, 1);' % name)
- else:
- collector(' %s%s;' % (ctype, name))
-
- collector('')
- collector(' dbus_g_proxy_end_call (proxy, call, &error,')
-
- for arg in out_args:
- name, info, tp_type, elt = arg
- ctype, gtype, marshaller, pointer = info
-
- if gtype == 'G_TYPE_VALUE':
- collector(' %s, %s,' % (gtype, name))
- else:
- collector(' %s, &%s,' % (gtype, name))
-
- collector(' G_TYPE_INVALID);')
-
- if len(out_args) == 0:
- collector(' tp_proxy_pending_call_v0_take_results (user_data, error,'
- 'NULL);')
- else:
- collector('')
- collector(' if (error != NULL)')
- collector(' {')
- collector(' tp_proxy_pending_call_v0_take_results (user_data, error,')
- collector(' NULL);')
-
- for arg in out_args:
- name, info, tp_type, elt = arg
- ctype, gtype, marshaller, pointer = info
- if gtype == 'G_TYPE_VALUE':
- collector(' g_free (%s);' % name)
-
- collector(' return;')
- collector(' }')
- collector('')
- collector(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
- collector('')
- collector(' args = g_value_array_new (%d);' % len(out_args))
- collector(' g_value_init (&blank, G_TYPE_INT);')
- collector('')
- collector(' for (i = 0; i < %d; i++)' % len(out_args))
- collector(' g_value_array_append (args, &blank);')
- collector('')
- collector(' G_GNUC_END_IGNORE_DEPRECATIONS')
-
- for i, arg in enumerate(out_args):
- name, info, tp_type, elt = arg
- ctype, gtype, marshaller, pointer = info
-
- collector('')
- collector(' g_value_unset (args->values + %d);' % i)
- collector(' g_value_init (args->values + %d, %s);'
- % (i, gtype))
- collector(' ' + copy_into_gvalue('args->values + %d' % i,
- gtype, marshaller, name))
-
- collector(' tp_proxy_pending_call_v0_take_results (user_data, '
- 'NULL, args);')
-
- collector('}')
-
self.b('static void')
self.b('%s (TpProxy *self,' % invoke_callback)
- self.b(' GError *error,')
- self.b(' GValueArray *args,')
+ self.b(' const GError *error,')
+ self.b(' GVariant *args,')
self.b(' GCallback generic_callback,')
self.b(' gpointer user_data,')
self.b(' GObject *weak_object)')
self.b('{')
+
+ if out_args:
+ self.b(' GValue args_val = G_VALUE_INIT;')
+ self.b(' GValueArray *args_va;')
+
self.b(' %s callback = (%s) generic_callback;'
% (callback_name, callback_name))
self.b('')
@@ -617,48 +456,29 @@ class Generator(object):
self.b(' 0,')
self.b(' error, user_data, weak_object);')
- self.b(' g_error_free (error);')
self.b(' return;')
self.b(' }')
+ self.b('')
+
+ if out_args:
+ self.b(' dbus_g_value_parse_g_variant (args, &args_val);')
+ self.b(' args_va = g_value_get_boxed (&args_val);')
+ self.b('')
self.b(' callback ((%s) self,' % self.proxy_cls)
- # FIXME: factor out into a function
for i, arg in enumerate(out_args):
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
- if marshaller == 'BOXED':
- self.b(' g_value_get_boxed (args->values + %d),' % i)
- elif gtype == 'G_TYPE_STRING':
- self.b(' g_value_get_string (args->values + %d),' % i)
- elif gtype == 'G_TYPE_UCHAR':
- self.b(' g_value_get_uchar (args->values + %d),' % i)
- elif gtype == 'G_TYPE_BOOLEAN':
- self.b(' g_value_get_boolean (args->values + %d),' % i)
- elif gtype == 'G_TYPE_UINT':
- self.b(' g_value_get_uint (args->values + %d),' % i)
- elif gtype == 'G_TYPE_INT':
- self.b(' g_value_get_int (args->values + %d),' % i)
- elif gtype == 'G_TYPE_UINT64':
- self.b(' g_value_get_uint64 (args->values + %d),' % i)
- elif gtype == 'G_TYPE_INT64':
- self.b(' g_value_get_int64 (args->values + %d),' % i)
- elif gtype == 'G_TYPE_DOUBLE':
- self.b(' g_value_get_double (args->values + %d),' % i)
- else:
- assert False, "Don't know how to get %s from a GValue" % gtype
+ getter = value_getter(gtype, marshaller)
+ self.b(' %s (args_va->values + %d),' % (getter, i))
self.b(' error, user_data, weak_object);')
- self.b('')
- self.b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
- if len(out_args) > 0:
- self.b(' g_value_array_free (args);')
- else:
- self.b(' if (args != NULL)')
- self.b(' g_value_array_free (args);')
- self.b(' G_GNUC_END_IGNORE_DEPRECATIONS')
+ if out_args:
+ self.b('')
+ self.b(' g_value_unset (&args_val);')
self.b('}')
self.b('')
@@ -755,80 +575,42 @@ class Generator(object):
self.b(' GDestroyNotify destroy,')
self.b(' GObject *weak_object)')
self.b('{')
- self.b(' GError *error = NULL;')
- self.b(' GQuark interface = %s;' % self.get_iface_quark())
- self.b(' DBusGProxy *iface;')
- self.b('')
- self.b(' g_return_val_if_fail (callback != NULL || '
- 'user_data == NULL, NULL);')
- self.b(' g_return_val_if_fail (callback != NULL || '
- 'destroy == NULL, NULL);')
- self.b(' g_return_val_if_fail (callback != NULL || '
- 'weak_object == NULL, NULL);')
- self.b('')
- self.b(' iface = tp_proxy_get_interface_by_id (')
- self.b(' (TpProxy *) proxy,')
- self.b(' interface, (callback == NULL ? NULL : &error));')
+ self.b(' TpProxyPendingCall *ret;')
+ self.b(' GValue args_val = G_VALUE_INIT;')
self.b('')
- self.b(' if (callback == NULL)')
- self.b(' {')
- self.b(' if (iface == NULL)')
- self.b(' return NULL;')
- self.b('')
- self.b(' dbus_g_proxy_call_no_reply (iface, "%s",' % member)
+ self.b(' g_value_init (&args_val, '
+ 'dbus_g_type_get_struct ("GValueArray",')
for arg in in_args:
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
+ self.b(' %s,' % gtype)
- const = pointer and 'const ' or ''
-
- self.b(' %s, %s,' % (gtype, name))
-
- self.b(' G_TYPE_INVALID);')
- self.b(' return NULL;')
- self.b(' }')
- self.b(' else')
- self.b(' {')
- self.b(' TpProxyPendingCall *data;')
- self.b('')
- self.b(' data = tp_proxy_pending_call_v0_new ((TpProxy *) proxy,')
- self.b(' interface, "%s", iface,' % member)
- self.b(' %s,' % invoke_callback)
- self.b(' G_CALLBACK (callback), user_data, destroy,')
- self.b(' weak_object, FALSE);')
- self.b('')
- # If iface is NULL then the only valid thing we can do is to
- # terminate the call with an error. Go through the machinery
- # we'd use for dbus-glib anyway, to stop it being re-entrant.
- self.b(' if (iface == NULL)')
- self.b(' {')
- self.b(' tp_proxy_pending_call_v0_take_results (data,')
- self.b(' error, NULL);')
- self.b(' tp_proxy_pending_call_v0_completed (data);')
- self.b(' return data;')
- self.b(' }')
- self.b('')
- self.b(' tp_proxy_pending_call_v0_take_pending_call (data,')
- self.b(' dbus_g_proxy_begin_call_with_timeout (iface,')
- self.b(' "%s",' % member)
- self.b(' %s,' % collect_callback)
- self.b(' data,')
- self.b(' tp_proxy_pending_call_v0_completed,')
- self.b(' timeout_ms,')
+ self.b(' G_TYPE_INVALID));')
+ self.b(' g_value_take_boxed (&args_val,')
+ self.b(' tp_value_array_build (%d,' % len(in_args))
for arg in in_args:
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
+ self.b(' %s, %s,' % (gtype, name))
- const = pointer and 'const ' or ''
-
- self.b(' %s, %s,' % (gtype, name))
-
- self.b(' G_TYPE_INVALID));')
+ self.b(' G_TYPE_INVALID));')
self.b('')
- self.b(' return data;')
- self.b(' }')
+ self.b(' ret = tp_proxy_pending_call_v1_new ((TpProxy *) proxy,')
+ self.b(' timeout_ms,')
+ self.b(' %s,' % self.get_iface_quark())
+ self.b(' "%s",' % member)
+ self.b(' /* consume floating ref */')
+ self.b(' dbus_g_value_build_g_variant (&args_val),')
+ self.b(' G_VARIANT_TYPE ("(%s)"),' % (''.join(out_sig)))
+ self.b(' %s,' % invoke_callback)
+ self.b(' G_CALLBACK (callback),')
+ self.b(' user_data,')
+ self.b(' destroy,')
+ self.b(' weak_object);')
+ self.b(' g_value_unset (&args_val);')
+ self.b(' return ret;')
self.b('}')
self.b('')
@@ -865,7 +647,7 @@ class Generator(object):
self.h('#endif /* __GTK_DOC_IGNORE__ */')
self.do_method_reentrant(method, iface_lc, member, member_lc,
- in_args, out_args, collect_callback)
+ in_args, out_args, out_sig)
# leave a gap for the end of the method
self.d('')
@@ -873,7 +655,7 @@ class Generator(object):
self.h('')
def do_method_reentrant(self, method, iface_lc, member, member_lc, in_args,
- out_args, collect_callback):
+ out_args, out_sig):
# Reentrant blocking calls
# Example:
# gboolean tp_cli_properties_interface_run_get_properties
@@ -920,12 +702,18 @@ class Generator(object):
b('static void')
b('%s (TpProxy *self G_GNUC_UNUSED,' % reentrant_invoke)
- b(' GError *error,')
- b(' GValueArray *args,')
- b(' GCallback unused G_GNUC_UNUSED,')
- b(' gpointer user_data G_GNUC_UNUSED,')
- b(' GObject *unused2 G_GNUC_UNUSED)')
+ b(' const GError *error,')
+ b(' GVariant *args_variant,')
+ b(' GCallback dummy G_GNUC_UNUSED,')
+ b(' gpointer user_data,')
+ b(' GObject *weak_object G_GNUC_UNUSED)')
b('{')
+
+ if out_args:
+ b(' GValue args_val = G_VALUE_INIT;')
+ b(' GValueArray *args;')
+ b('')
+
b(' _%s_%s_run_state_%s *state = user_data;'
% (self.prefix_lc, iface_lc, member_lc))
b('')
@@ -936,14 +724,16 @@ class Generator(object):
b(' if (error != NULL)')
b(' {')
b(' if (state->error != NULL)')
- b(' *state->error = error;')
- b(' else')
- b(' g_error_free (error);')
+ b(' *state->error = g_error_copy (error);')
b('')
b(' return;')
b(' }')
b('')
+ if out_args:
+ b(' dbus_g_value_parse_g_variant (args_variant, &args_val);')
+ b(' args = g_value_get_boxed (&args_val);')
+
for i, arg in enumerate(out_args):
name, info, tp_type, elt = arg
ctype, gtype, marshaller, pointer = info
@@ -964,13 +754,8 @@ class Generator(object):
b('')
- b(' G_GNUC_BEGIN_IGNORE_DEPRECATIONS')
- if len(out_args) > 0:
- b(' g_value_array_free (args);')
- else:
- b(' if (args != NULL)')
- b(' g_value_array_free (args);')
- b(' G_GNUC_END_IGNORE_DEPRECATIONS')
+ if out_args:
+ b(' g_value_unset (&args_val);')
b('}')
b('')
@@ -1067,7 +852,7 @@ class Generator(object):
b(' GError **error,')
b(' GMainLoop **loop)')
b('{')
- b(' DBusGProxy *iface;')
+ b(' GDBusProxy *iface;')
b(' GQuark interface = %s;' % self.get_iface_quark())
b(' TpProxyPendingCall *pc;')
b(' _%s_%s_run_state_%s state = {'
@@ -1080,6 +865,26 @@ class Generator(object):
b(' %s,' % name)
b(' FALSE /* completed */, FALSE /* success */ };')
+ b(' GValue args_val = G_VALUE_INIT;')
+ b('')
+ b(' g_value_init (&args_val, dbus_g_type_get_struct ("GValueArray",')
+
+ for arg in in_args:
+ name, info, tp_type, elt = arg
+ ctype, gtype, marshaller, pointer = info
+ b(' %s,' % gtype)
+
+ b(' G_TYPE_INVALID));')
+
+ b(' g_value_take_boxed (&args_val,')
+ b(' tp_value_array_build (%d,' % len(in_args))
+
+ for arg in in_args:
+ name, info, tp_type, elt = arg
+ ctype, gtype, marshaller, pointer = info
+ b(' %s, %s,' % (gtype, name))
+
+ b(' G_TYPE_INVALID));')
b('')
b(' g_return_val_if_fail (%s (proxy), FALSE);'
% self.proxy_assert)
@@ -1092,31 +897,22 @@ class Generator(object):
b('')
b(' state.loop = g_main_loop_new (NULL, FALSE);')
b('')
- b(' pc = tp_proxy_pending_call_v0_new ((TpProxy *) proxy,')
- b(' interface, "%s", iface,' % member)
- b(' %s,' % reentrant_invoke)
- b(' NULL, &state, NULL, NULL, TRUE);')
- b('')
b(' if (loop != NULL)')
b(' *loop = state.loop;')
b('')
- b(' tp_proxy_pending_call_v0_take_pending_call (pc,')
- b(' dbus_g_proxy_begin_call_with_timeout (iface,')
- b(' "%s",' % member)
- b(' %s,' % collect_callback)
- b(' pc,')
- b(' tp_proxy_pending_call_v0_completed,')
- b(' timeout_ms,')
-
- for arg in in_args:
- name, info, tp_type, elt = arg
- ctype, gtype, marshaller, pointer = info
-
- const = pointer and 'const ' or ''
-
- b(' %s, %s,' % (gtype, name))
-
- b(' G_TYPE_INVALID));')
+ b(' pc = tp_proxy_pending_call_v1_new ((TpProxy *) proxy,')
+ b(' timeout_ms,')
+ b(' interface,')
+ b(' "%s",' % member)
+ b(' /* consume floating ref */')
+ b(' dbus_g_value_build_g_variant (&args_val),')
+ b(' G_VARIANT_TYPE ("(%s)"),' % (''.join(out_sig)))
+ b(' %s,' % reentrant_invoke)
+ b(' (void *) 1, /* any non-NULL pointer */')
+ b(' &state,')
+ b(' NULL,')
+ b(' NULL);')
+ b(' g_value_unset (&args_val);')
b('')
b(' if (!state.completed)')
b(' g_main_loop_run (state.loop);')
@@ -1133,23 +929,6 @@ class Generator(object):
b('}')
b('')
- def do_signal_add(self, signal):
- marshaller_items = []
- gtypes = []
-
- for i in signal.getElementsByTagName('arg'):
- name = i.getAttribute('name')
- type = i.getAttribute('type')
- info = type_to_gtype(type)
- # type, GType, STRING, is a pointer
- gtypes.append(info[1])
-
- self.b(' dbus_g_proxy_add_signal (proxy, "%s",'
- % signal.getAttribute('name'))
- for gtype in gtypes:
- self.b(' %s,' % gtype)
- self.b(' G_TYPE_INVALID);')
-
def do_interface(self, node):
ifaces = node.getElementsByTagName('interface')
assert len(ifaces) == 1
@@ -1165,24 +944,6 @@ class Generator(object):
signals = node.getElementsByTagName('signal')
methods = node.getElementsByTagName('method')
- if signals:
- self.b('static inline void')
- self.b('%s_add_signals_for_%s (DBusGProxy *proxy)'
- % (self.prefix_lc, name.lower()))
- self.b('{')
-
- if self.tp_proxy_api >= (0, 7, 6):
- self.b(' if (!tp_proxy_dbus_g_proxy_claim_for_signal_adding '
- '(proxy))')
- self.b(' return;')
-
- for signal in signals:
- self.do_signal_add(signal)
-
- self.b('}')
- self.b('')
- self.b('')
-
for signal in signals:
self.do_signal(name, signal)
@@ -1216,53 +977,6 @@ class Generator(object):
for node in nodes:
self.do_interface(node)
- if self.group is not None:
- self.h('void %s_%s_add_signals (TpProxy *self,'
- % (self.prefix_lc, self.group))
- self.h(' guint quark,')
- self.h(' DBusGProxy *proxy,')
- self.h(' gpointer unused);')
- self.h('')
-
- self.b('/*')
- self.b(' * %s_%s_add_signals:' % (self.prefix_lc, self.group))
- self.b(' * @self: the #TpProxy')
- self.b(' * @quark: a quark whose string value is the interface')
- self.b(' * name whose signals should be added')
- self.b(' * @proxy: the D-Bus proxy to which to add the signals')
- self.b(' * @unused: not used for anything')
- self.b(' *')
- self.b(' * Tell dbus-glib that @proxy has the signatures of all')
- self.b(' * signals on the given interface, if it\'s one we')
- self.b(' * support.')
- self.b(' *')
- self.b(' * This function should be used as a signal handler for')
- self.b(' * #TpProxy::interface-added.')
- self.b(' */')
- self.b('void')
- self.b('%s_%s_add_signals (TpProxy *self G_GNUC_UNUSED,'
- % (self.prefix_lc, self.group))
- self.b(' guint quark,')
- self.b(' DBusGProxy *proxy,')
- self.b(' gpointer unused G_GNUC_UNUSED)')
-
- self.b('{')
-
- for node in nodes:
- iface = node.getElementsByTagName('interface')[0]
- self.iface_dbus = iface.getAttribute('name')
- signals = node.getElementsByTagName('signal')
- if not signals:
- continue
- name = node.getAttribute('name').replace('/', '').lower()
- self.iface_uc = name.upper()
- self.b(' if (quark == %s)' % self.get_iface_quark())
- self.b(' %s_add_signals_for_%s (proxy);'
- % (self.prefix_lc, name))
-
- self.b('}')
- self.b('')
-
self.h('G_END_DECLS')
self.h('')
diff --git a/tools/glib-ginterface-gen.py b/tools/glib-ginterface-gen.py
index 6ef9f4a02..3bf67d478 100644
--- a/tools/glib-ginterface-gen.py
+++ b/tools/glib-ginterface-gen.py
@@ -26,23 +26,14 @@ import sys
import os.path
import xml.dom.minidom
-from libtpcodegen import file_set_contents, key_by_name, u
-from libglibcodegen import Signature, type_to_gtype, \
- NS_TP, dbus_gutils_wincaps_to_uscore
+from libtpcodegen import file_set_contents, key_by_name, u, get_emits_changed
+from libglibcodegen import (Signature, type_to_gtype,
+ NS_TP, dbus_gutils_wincaps_to_uscore, value_getter,
+ GDBusInterfaceInfo)
NS_TP = "http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
-def get_emits_changed(node):
- try:
- return [
- annotation.getAttribute('value')
- for annotation in node.getElementsByTagName('annotation')
- if annotation.getAttribute('name') == 'org.freedesktop.DBus.Property.EmitsChangedSignal'
- ][0]
- except IndexError:
- return None
-
class Generator(object):
def __init__(self, dom, prefix, basename, signal_marshal_prefix,
@@ -115,15 +106,9 @@ class Generator(object):
iface_emits_changed = get_emits_changed(interface)
- self.b('static const DBusGObjectInfo _%s%s_object_info;'
- % (self.prefix_, node_name_lc))
- self.b('')
-
methods = interface.getElementsByTagName('method')
signals = interface.getElementsByTagName('signal')
properties = interface.getElementsByTagName('property')
- # Don't put properties in dbus-glib glue
- glue_properties = []
self.b('struct _%s%sClass {' % (self.Prefix, node_name_mixed))
self.b(' GTypeInterface parent_class;')
@@ -246,16 +231,67 @@ class Generator(object):
' (G_TYPE_INSTANCE_GET_INTERFACE((obj), %s, %sClass))'
% (self.PREFIX_, node_name_uc, gtype, classname))
self.h('')
- self.h('')
base_init_code = []
+ method_call_code = []
for method in methods:
- self.do_method(method)
+ self.do_method(method, method_call_code)
+
+ signal_table = [
+ 'static const gchar * const _gsignals_%s[] = {' %
+ self.node_name_lc
+ ]
for signal in signals:
- base_init_code.extend(self.do_signal(signal))
+ # we rely on this being in the same order as the interface info
+ self.do_signal(signal, in_base_init=base_init_code,
+ in_signal_table=signal_table)
+
+ signal_table.append(' NULL')
+ signal_table.append('};')
+ signal_table.append('')
+ for line in signal_table:
+ self.b(line)
+
+ # e.g. _interface_info_connection_interface_contact_info1
+ for line in GDBusInterfaceInfo(node_name, interface,
+ '_interface_info_%s' % node_name_lc).to_lines(linkage='static'):
+ self.b(line)
+
+ self.b('')
+ self.b('static void')
+ self.b('_method_call_%s (GDBusConnection *connection,' % node_name_lc)
+ self.b(' const gchar *sender,')
+ self.b(' const gchar *object_path,')
+ self.b(' const gchar *interface_name,')
+ self.b(' const gchar *method_name,')
+ self.b(' GVariant *parameters,')
+ self.b(' GDBusMethodInvocation *invocation,')
+ self.b(' gpointer user_data)')
+ self.b('{')
+ for line in method_call_code:
+ self.b(line)
+
+ self.b('}')
+ self.b('')
+ self.b('static const GDBusInterfaceVTable _vtable_%s = {' %
+ node_name_lc)
+ self.b(' _method_call_%s,' % node_name_lc)
+ self.b(' NULL, /* get property */')
+ self.b(' NULL /* set property */')
+ self.b('};')
+ self.b('')
+ self.b('static const TpSvcInterfaceInfo _tp_interface_info_%s = {' %
+ node_name_lc)
+ self.b(' -1,')
+ self.b(' (GDBusInterfaceInfo *) &_interface_info_%s,' % node_name_lc)
+ self.b(' (GDBusInterfaceVTable *) &_vtable_%s,' % node_name_lc)
+ self.b(' (gchar **) _gsignals_%s' % node_name_lc)
+ self.b(' /* _future is implicitly zero-filled */')
+ self.b('};')
+ self.b('')
self.b('static inline void')
self.b('%s%s_base_init_once (gpointer klass G_GNUC_UNUSED)'
% (self.prefix_, node_name_lc))
@@ -296,13 +332,6 @@ class Generator(object):
self.b(' { 0, properties, NULL, NULL };')
self.b('')
-
- self.b(' dbus_g_object_type_install_info (%s%s_get_type (),'
- % (self.prefix_, node_name_lc))
- self.b(' &_%s%s_object_info);'
- % (self.prefix_, node_name_lc))
- self.b('')
-
if properties:
self.b(' interface.dbus_interface = g_quark_from_static_string '
'("%s");' % self.iface_name)
@@ -318,6 +347,10 @@ class Generator(object):
self.b('')
+ self.b(' tp_svc_interface_set_dbus_interface_info (%s,'
+ % (self.current_gtype))
+ self.b(' &_tp_interface_info_%s);' % node_name_lc)
+
for s in base_init_code:
self.b(s)
self.b('}')
@@ -339,100 +372,10 @@ class Generator(object):
self.h('')
- self.b('static const DBusGMethodInfo _%s%s_methods[] = {'
- % (self.prefix_, node_name_lc))
-
- method_blob, offsets = self.get_method_glue(methods)
-
- for method, offset in zip(methods, offsets):
- self.do_method_glue(method, offset)
-
- if len(methods) == 0:
- # empty arrays are a gcc extension, so put in a dummy member
- self.b(" { NULL, NULL, 0 }")
-
- self.b('};')
- self.b('')
-
- self.b('static const DBusGObjectInfo _%s%s_object_info = {'
- % (self.prefix_, node_name_lc))
- self.b(' 0,') # version
- self.b(' _%s%s_methods,' % (self.prefix_, node_name_lc))
- self.b(' %d,' % len(methods))
- self.b('"' + method_blob.replace('\0', '\\0') + '",')
- self.b('"' + self.get_signal_glue(signals).replace('\0', '\\0') + '",')
- self.b('"' +
- self.get_property_glue(glue_properties).replace('\0', '\\0') +
- '",')
- self.b('};')
- self.b('')
-
self.node_name_mixed = None
self.node_name_lc = None
self.node_name_uc = None
- def get_method_glue(self, methods):
- info = []
- offsets = []
-
- for method in methods:
- offsets.append(len(''.join(info)))
-
- info.append(self.iface_name + '\0')
- info.append(method.getAttribute('name') + '\0')
-
- info.append('A\0') # async
-
- counter = 0
- for arg in method.getElementsByTagName('arg'):
- out = arg.getAttribute('direction') == 'out'
-
- name = arg.getAttribute('name')
- if not name:
- assert out
- name = 'arg%u' % counter
- counter += 1
-
- info.append(name + '\0')
-
- if out:
- info.append('O\0')
- else:
- info.append('I\0')
-
- if out:
- info.append('F\0') # not const
- info.append('N\0') # not error or return
- info.append(arg.getAttribute('type') + '\0')
-
- info.append('\0')
-
- return ''.join(info) + '\0', offsets
-
- def do_method_glue(self, method, offset):
- lc_name = method.getAttribute('tp:name-for-bindings')
- if method.getAttribute('name') != lc_name.replace('_', ''):
- raise AssertionError('Method %s tp:name-for-bindings (%s) does '
- 'not match' % (method.getAttribute('name'), lc_name))
- lc_name = lc_name.lower()
-
- marshaller = 'g_cclosure_marshal_generic'
- wrapper = self.prefix_ + self.node_name_lc + '_' + lc_name
-
- self.b(" { (GCallback) %s, %s, %d }," % (wrapper, marshaller, offset))
-
- def get_signal_glue(self, signals):
- info = []
-
- for signal in signals:
- info.append(self.iface_name)
- info.append(signal.getAttribute('name'))
-
- return '\0'.join(info) + '\0\0'
-
- # the implementation can be the same
- get_property_glue = get_signal_glue
-
def get_method_impl_names(self, method):
dbus_method_name = method.getAttribute('name')
@@ -446,11 +389,9 @@ class Generator(object):
class_member_name)
return (stub_name + '_impl', class_member_name + '_cb')
- def do_method(self, method):
+ def do_method(self, method, method_call_code):
assert self.node_name_mixed is not None
- in_class = []
-
# Examples refer to Thing.DoStuff (su) -> ii
# DoStuff
@@ -462,20 +403,20 @@ class Generator(object):
'not match' % (dbus_method_name, class_member_name))
class_member_name = class_member_name.lower()
- # void tp_svc_thing_do_stuff (TpSvcThing *, const char *, guint,
- # DBusGMethodInvocation *);
+ # tp_svc_thing_do_stuff (signature of GDBusInterfaceMethodCallFunc)
stub_name = (self.prefix_ + self.node_name_lc + '_' +
class_member_name)
# typedef void (*tp_svc_thing_do_stuff_impl) (TpSvcThing *,
- # const char *, guint, DBusGMethodInvocation);
+ # const char *, guint, GDBusMethodInvocation);
impl_name = stub_name + '_impl'
- # void tp_svc_thing_return_from_do_stuff (DBusGMethodInvocation *,
+ # void tp_svc_thing_return_from_do_stuff (GDBusMethodInvocation *,
# gint, gint);
ret_name = (self.prefix_ + self.node_name_lc + '_return_from_' +
class_member_name)
# Gather arguments
in_args = []
+ in_arg_value_getters = []
out_args = []
for i in method.getElementsByTagName('arg'):
name = i.getAttribute('name')
@@ -499,9 +440,22 @@ class Generator(object):
struct = (ctype, name)
if direction == 'in':
- in_args.append(struct)
+ in_args.append((ctype, name))
+ in_arg_value_getters.append(value_getter(gtype, marshaller))
else:
- out_args.append(struct)
+ out_args.append((gtype, ctype, name))
+
+ # bits of _method_call_myiface
+ method_call_code.extend([
+ ' if (g_strcmp0 (method_name, "%s") == 0)' % dbus_method_name,
+ ' {',
+ ' %s (connection, sender, object_path, interface_name, ' %
+ stub_name,
+ ' method_name, parameters, invocation, user_data);',
+ ' return;',
+ ' }',
+ ''
+ ])
# Implementation type declaration (in header, docs separated)
self.d('/**')
@@ -510,7 +464,7 @@ class Generator(object):
for (ctype, name) in in_args:
self.d(' * @%s: %s (FIXME, generate documentation)'
% (name, ctype))
- self.d(' * @context: Used to return values or throw an error')
+ self.d(' * @invocation: Used to return values or throw an error')
self.d(' *')
self.d(' * The signature of an implementation of the D-Bus method')
self.d(' * %s on interface %s.' % (dbus_method_name, self.iface_name))
@@ -520,37 +474,59 @@ class Generator(object):
% (impl_name, self.Prefix, self.node_name_mixed))
for (ctype, name) in in_args:
self.h(' %s%s,' % (ctype, name))
- self.h(' DBusGMethodInvocation *context);')
-
- # Class member (in class definition)
- in_class.append(' %s %s;' % (impl_name, class_member_name))
+ self.h(' GDBusMethodInvocation *invocation);')
# Stub definition (in body only - it's static)
self.b('static void')
- self.b('%s (%s%s *self,'
- % (stub_name, self.Prefix, self.node_name_mixed))
- for (ctype, name) in in_args:
- self.b(' %s%s,' % (ctype, name))
- self.b(' DBusGMethodInvocation *context)')
+ self.b('%s (GDBusConnection *connection,' % stub_name)
+ self.b(' const gchar *sender,')
+ self.b(' const gchar *object_path,')
+ self.b(' const gchar *interface_name,')
+ self.b(' const gchar *method_name,')
+ self.b(' GVariant *parameters,')
+ self.b(' GDBusMethodInvocation *invocation,')
+ self.b(' gpointer user_data)')
self.b('{')
- self.b(' %s impl = (%s%s_GET_CLASS (self)->%s_cb);'
- % (impl_name, self.PREFIX_, self.node_name_uc, class_member_name))
+ self.b(' %s%s *self = %s%s (user_data);'
+ % (self.Prefix, self.node_name_mixed, self.PREFIX_,
+ self.node_name_uc))
+ self.b(' %s%sClass *cls = %s%s_GET_CLASS (self);'
+ % (self.Prefix, self.node_name_mixed, self.PREFIX_,
+ self.node_name_uc))
+ self.b(' %s impl = cls->%s_cb;' % (impl_name, class_member_name))
self.b('')
self.b(' if (impl != NULL)')
- tmp = ['self'] + [name for (ctype, name) in in_args] + ['context']
+ tmp = ['self'] + [name for (ctype, name) in in_args] + ['invocation']
self.b(' {')
- self.b(' (impl) (%s);' % ',\n '.join(tmp))
+
+ if in_args:
+ self.b(' GValue args_val = G_VALUE_INIT;')
+ self.b(' GValueArray *va;')
+ self.b('')
+ self.b(' dbus_g_value_parse_g_variant (parameters, &args_val);')
+ self.b(' va = g_value_get_boxed (&args_val);')
+ self.b('')
+
+ self.b(' (impl) (self,')
+
+ for i, getter in enumerate(in_arg_value_getters):
+ self.b(' %s (va->values + %d),' % (getter, i))
+
+ self.b(' invocation);')
+
+ if in_args:
+ self.b(' g_value_unset (&args_val);')
+
self.b(' }')
self.b(' else')
self.b(' {')
if self.not_implemented_func:
- self.b(' %s (context);' % self.not_implemented_func)
+ self.b(' %s (invocation);' % self.not_implemented_func)
else:
- self.b(' GError e = { DBUS_GERROR, ')
- self.b(' DBUS_GERROR_UNKNOWN_METHOD,')
- self.b(' "Method not implemented" };')
- self.b('')
- self.b(' dbus_g_method_return_error (context, &e);')
+ self.b(' g_dbus_method_invocation_return_error (invocation,')
+ self.b(' G_DBUS_ERROR,')
+ self.b(' G_DBUS_ERROR_UNKNOWN_METHOD,')
+ self.b(' "Method not implemented");')
self.b(' }')
self.b('}')
self.b('')
@@ -582,44 +558,59 @@ class Generator(object):
self.b('}')
self.b('')
- # Return convenience function (static inline, in header)
+ # Return convenience function
self.d('/**')
self.d(' * %s:' % ret_name)
- self.d(' * @context: The D-Bus method invocation context')
- for (ctype, name) in out_args:
+ self.d(' * @invocation: The D-Bus method invocation context')
+ for (gtype, ctype, name) in out_args:
self.d(' * @%s: %s (FIXME, generate documentation)'
% (name, ctype))
self.d(' *')
- self.d(' * Return successfully by calling dbus_g_method_return().')
- self.d(' * This inline function exists only to provide type-safety.')
+ self.d(' * Return successfully by calling g_dbus_method_invocation_return_value().')
self.d(' */')
self.d('')
- tmp = (['DBusGMethodInvocation *context'] +
- [ctype + name for (ctype, name) in out_args])
- self.h('static inline')
- self.h('/* this comment is to stop gtkdoc realising this is static */')
+ tmp = (['GDBusMethodInvocation *invocation'] +
+ [ctype + name for (gtype, ctype, name) in out_args])
self.h(('void %s (' % ret_name) + (',\n '.join(tmp)) + ');')
- self.h('static inline void')
- self.h(('%s (' % ret_name) + (',\n '.join(tmp)) + ')')
- self.h('{')
- tmp = ['context'] + [name for (ctype, name) in out_args]
- self.h(' dbus_g_method_return (' + ',\n '.join(tmp) + ');')
- self.h('}')
- self.h('')
- return in_class
+ self.b('void')
+ self.b(('%s (' % ret_name) + (',\n '.join(tmp)) + ')')
+ self.b('{')
+ self.b(' GValueArray *tmp = tp_value_array_build (%d,' % len(out_args))
+
+ for (gtype, ctype, name) in out_args:
+ self.b(' %s, %s,' % (gtype, name))
+
+ self.b(' G_TYPE_INVALID);')
+ self.b(' GValue args_val = G_VALUE_INIT;')
+ self.b('')
+
+ self.b(' g_value_init (&args_val, '
+ 'dbus_g_type_get_struct ("GValueArray",')
+
+ for (gtype, ctype, name) in out_args:
+ self.b(' %s,' % gtype)
+
+ self.b(' G_TYPE_INVALID));')
+
+ self.b(' g_value_take_boxed (&args_val, tmp);')
+
+ self.b(' g_dbus_method_invocation_return_value (invocation,')
+ self.b(' /* consume floating ref */')
+ self.b(' dbus_g_value_build_g_variant (&args_val));')
+ self.b(' g_value_unset (&args_val);')
+ self.b('}')
+ self.b('')
def get_signal_const_entry(self, signal):
assert self.node_name_uc is not None
return ('SIGNAL_%s_%s'
% (self.node_name_uc, signal.getAttribute('name')))
- def do_signal(self, signal):
+ def do_signal(self, signal, in_base_init, in_signal_table):
assert self.node_name_mixed is not None
- in_base_init = []
-
# for signal: Thing::StuffHappened (s, u)
# we want to emit:
# void tp_svc_thing_emit_stuff_happened (gpointer instance,
@@ -717,7 +708,7 @@ class Generator(object):
in_base_init.append(' %s);' % ',\n '.join(tmp))
in_base_init.append('')
- return in_base_init
+ in_signal_table.append(' "%s",' % signal_name)
def have_properties(self, nodes):
for node in nodes:
@@ -731,6 +722,7 @@ class Generator(object):
nodes.sort(key=key_by_name)
self.h('#include <glib-object.h>')
+ self.h('#include <gio/gio.h>')
self.h('#include <dbus/dbus-glib.h>')
self.h('')
@@ -741,9 +733,10 @@ class Generator(object):
self.b('')
if self.allow_single_include:
+ self.b('#include <telepathy-glib/core-svc-interface.h>')
self.b('#include <telepathy-glib/dbus.h>')
- if self.have_properties(nodes):
- self.b('#include <telepathy-glib/dbus-properties-mixin.h>')
+ self.b('#include <telepathy-glib/dbus-properties-mixin.h>')
+ self.b('#include <telepathy-glib/util.h>')
else:
self.b('#include <telepathy-glib/telepathy-glib.h>')
self.b('')
@@ -786,9 +779,9 @@ options:
--not-implemented-func='symbol'
Set action when methods not implemented in the interface vtable are
called. symbol must have signature
- void symbol (DBusGMethodInvocation *context)
+ void symbol (GDBusMethodInvocation *invocation)
and return some sort of "not implemented" error via
- dbus_g_method_return_error (context, ...)
+ e.g. g_dbus_method_invocation_return_error
""")
sys.exit(1)
diff --git a/tools/libglibcodegen.py b/tools/libglibcodegen.py
index 0b703a5a8..f480fd824 100644
--- a/tools/libglibcodegen.py
+++ b/tools/libglibcodegen.py
@@ -193,3 +193,228 @@ def copy_into_gvalue(gvaluep, gtype, marshaller, name):
return 'g_value_set_double (%s, %s);' % (gvaluep, name)
else:
raise AssertionError("Don't know how to put %s in a GValue" % gtype)
+
+def value_getter(gtype, marshaller):
+ if marshaller == 'BOXED':
+ return 'g_value_get_boxed'
+ elif gtype == 'G_TYPE_STRING':
+ return 'g_value_get_string'
+ elif gtype == 'G_TYPE_UCHAR':
+ return 'g_value_get_uchar'
+ elif gtype == 'G_TYPE_BOOLEAN':
+ return 'g_value_get_boolean'
+ elif gtype == 'G_TYPE_UINT':
+ return 'g_value_get_uint'
+ elif gtype == 'G_TYPE_INT':
+ return 'g_value_get_int'
+ elif gtype == 'G_TYPE_UINT64':
+ return 'g_value_get_uint64'
+ elif gtype == 'G_TYPE_INT64':
+ return 'g_value_get_int64'
+ elif gtype == 'G_TYPE_DOUBLE':
+ return 'g_value_get_double'
+ else:
+ raise AssertionError("Don't know how to get %s from a GValue" % marshaller)
+
+class GDBusInterfaceInfo(object):
+ def __init__(self, ugly_name, iface_element, c_name):
+ self.ugly_name = ugly_name
+ self.mixed_name = ugly_name.replace('_', '')
+ self.lc_name = ugly_name.lower()
+ self.uc_name = ugly_name.upper()
+ self.c_name = c_name
+ self.iface_element = iface_element
+
+ self.method_elements = iface_element.getElementsByTagName('method')
+ self.signal_elements = iface_element.getElementsByTagName('signal')
+ self.property_elements = iface_element.getElementsByTagName('property')
+
+ def do_methods(self):
+ method_args = [
+ ]
+ method_in_arg_pointers = [
+ ]
+ method_out_arg_pointers = [
+ ]
+ methods = [
+ ]
+ method_pointers = [
+ 'static const GDBusMethodInfo *const method_pointers_%s[] = {'
+ % self.c_name,
+ ]
+
+ for meth in self.method_elements:
+ lc_name = meth.getAttribute('tp:name-for-bindings')
+ if meth.getAttribute('name') != lc_name.replace('_', ''):
+ raise AssertionError('Method %s tp:name-for-bindings (%s) '
+ 'does not match' %
+ (meth.getAttribute('name'), lc_name))
+ lc_name = lc_name.lower()
+
+ c_name = 'method_%s_%s' % (self.c_name, lc_name)
+
+ method_in_arg_pointers.append('static const GDBusArgInfo *const '
+ 'method_in_arg_pointers_%s_%s[] = {' %
+ (self.c_name, lc_name))
+ method_out_arg_pointers.append('static const GDBusArgInfo *const '
+ 'method_out_arg_pointers_%s_%s[] = {'
+ % (self.c_name, lc_name))
+
+ for i, arg in enumerate(meth.getElementsByTagName('arg')):
+ name = arg.getAttribute('name')
+ if not name:
+ name = 'arg%d' % i
+
+ method_args.append('static const GDBusArgInfo '
+ 'method_arg_%s_%s_%d = {' % (self.c_name, lc_name, i))
+ method_args.append(' -1, /* refcount */')
+ method_args.append(' "%s",' % name)
+ method_args.append(' "%s",' % arg.getAttribute('type'))
+ method_args.append(' NULL /* annotations */')
+ method_args.append('};')
+
+ if arg.getAttribute('direction') == 'out':
+ method_out_arg_pointers.append(' &method_arg_%s_%s_%d,' %
+ (self.c_name, lc_name, i))
+ else:
+ method_in_arg_pointers.append(' &method_arg_%s_%s_%d,' %
+ (self.c_name, lc_name, i))
+
+ method_in_arg_pointers.append(' NULL')
+ method_in_arg_pointers.append('};')
+ method_out_arg_pointers.append(' NULL')
+ method_out_arg_pointers.append('};')
+
+ methods.append('static const GDBusMethodInfo %s = {' % c_name)
+ methods.append(' -1, /* refcount */')
+ methods.append(' "%s",' % meth.getAttribute("name"))
+ methods.append(' (GDBusArgInfo **) method_in_arg_pointers_%s_%s,'
+ % (self.c_name, lc_name))
+ methods.append(' (GDBusArgInfo **) method_out_arg_pointers_%s_%s,'
+ % (self.c_name, lc_name))
+ methods.append(' NULL /* annotations */')
+ methods.append('};')
+
+ method_pointers.append(' &%s,' % c_name)
+
+ method_pointers.append(' NULL')
+ method_pointers.append('};')
+
+ return (method_args + method_in_arg_pointers +
+ method_out_arg_pointers + methods + method_pointers)
+
+ def do_signals(self):
+ signal_args = [
+ ]
+ signal_arg_pointers = [
+ ]
+ signals = [
+ ]
+ signal_pointers = [
+ 'static const GDBusSignalInfo *const signal_pointers_%s[] = {'
+ % self.c_name,
+ ]
+
+ for sig in self.signal_elements:
+ lc_name = sig.getAttribute('tp:name-for-bindings')
+ if sig.getAttribute('name') != lc_name.replace('_', ''):
+ raise AssertionError('Signal %s tp:name-for-bindings (%s) '
+ 'does not match' %
+ (sig.getAttribute('name'), lc_name))
+ lc_name = lc_name.lower()
+
+ c_name = 'signal_%s_%s' % (self.c_name, lc_name)
+
+ signal_arg_pointers.append('static const GDBusArgInfo *const '
+ 'signal_arg_pointers_%s_%s[] = {' % (self.c_name, lc_name))
+
+ for i, arg in enumerate(sig.getElementsByTagName('arg')):
+ name = arg.getAttribute('name')
+ if not name:
+ name = 'arg%d' % i
+
+ signal_args.append('static const GDBusArgInfo '
+ 'signal_arg_%s_%s_%d = {' % (self.c_name, lc_name, i))
+ signal_args.append(' -1, /* refcount */')
+ signal_args.append(' "%s",' % name)
+ signal_args.append(' "%s",' % arg.getAttribute('type'))
+ signal_args.append(' NULL /* annotations */')
+ signal_args.append('};')
+
+ signal_arg_pointers.append(' &signal_arg_%s_%s_%d,' %
+ (self.c_name, lc_name, i))
+
+ signal_arg_pointers.append(' NULL')
+ signal_arg_pointers.append('};')
+
+ signals.append('static const GDBusSignalInfo %s = {' % c_name)
+ signals.append(' -1, /* refcount */')
+ signals.append(' "%s",' % sig.getAttribute("name"))
+ signals.append(' (GDBusArgInfo **) signal_arg_pointers_%s_%s,'
+ % (self.c_name, lc_name))
+ signals.append(' NULL /* annotations */')
+ signals.append('};')
+
+ signal_pointers.append(' &%s,' % c_name)
+
+ signal_pointers.append(' NULL')
+ signal_pointers.append('};')
+
+ return signal_args + signal_arg_pointers + signals + signal_pointers
+
+ def do_properties(self):
+ properties = [
+ ]
+ property_pointers = [
+ 'static const GDBusPropertyInfo *const property_pointers_%s[] = {'
+ % self.c_name,
+ ]
+
+ for prop in self.property_elements:
+ access = prop.getAttribute('access')
+ flags = {
+ 'read': 'G_DBUS_PROPERTY_INFO_FLAGS_READABLE',
+ 'write': 'G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE',
+ 'readwrite':
+ 'G_DBUS_PROPERTY_INFO_FLAGS_READABLE | '
+ 'G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE',
+ }[access]
+
+ lc_name = prop.getAttribute('tp:name-for-bindings')
+ if prop.getAttribute('name') != lc_name.replace('_', ''):
+ raise AssertionError('Property %s tp:name-for-bindings (%s) '
+ 'does not match' %
+ (prop.getAttribute('name'), lc_name))
+ lc_name = lc_name.lower()
+
+ c_name = 'property_%s_%s' % (self.c_name, lc_name)
+
+ properties.append('static const GDBusPropertyInfo %s = {' % c_name)
+ properties.append(' -1, /* refcount */')
+ properties.append(' "%s",' % prop.getAttribute("name"))
+ properties.append(' "%s",' % prop.getAttribute("type"))
+ properties.append(' %s,' % flags)
+ # FIXME: add annotations?
+ properties.append(' NULL /* annotations */')
+ properties.append('};')
+
+ property_pointers.append(' &%s,' % c_name)
+
+ property_pointers.append(' NULL')
+ property_pointers.append('};')
+
+ return properties + property_pointers
+
+ def to_lines(self, linkage='static'):
+ return (self.do_methods() +
+ self.do_signals() +
+ self.do_properties() + [
+ '%s const GDBusInterfaceInfo %s = {' % (linkage, self.c_name),
+ ' -1, /* refcount */',
+ ' "%s",' % self.iface_element.getAttribute('name'),
+ ' (GDBusMethodInfo **) method_pointers_%s,' % self.c_name,
+ ' (GDBusSignalInfo **) signal_pointers_%s,' % self.c_name,
+ ' (GDBusPropertyInfo **) property_pointers_%s,' % self.c_name,
+ ' NULL /* annotations */',
+ '};'
+ ])
diff --git a/tools/libtpcodegen.py b/tools/libtpcodegen.py
index 99de66340..021a82be4 100644
--- a/tools/libtpcodegen.py
+++ b/tools/libtpcodegen.py
@@ -245,3 +245,13 @@ class Signature(str):
def xml_escape(s):
s = s.replace('&', '&amp;').replace("'", '&apos;').replace('"', '&quot;')
return s.replace('<', '&lt;').replace('>', '&gt;')
+
+def get_emits_changed(node):
+ try:
+ return [
+ annotation.getAttribute('value')
+ for annotation in node.getElementsByTagName('annotation')
+ if annotation.getAttribute('name') == 'org.freedesktop.DBus.Property.EmitsChangedSignal'
+ ][0]
+ except IndexError:
+ return None
diff --git a/tools/spec-to-introspect.xsl b/tools/spec-to-introspect.xsl
new file mode 100644
index 000000000..980604ace
--- /dev/null
+++ b/tools/spec-to-introspect.xsl
@@ -0,0 +1,51 @@
+<!-- Remove Telepathy extensions from a D-Bus interface, trying to leave only
+DTD-compliant introspection XML. The output still needs to be subjected to the
+following sed filter:
+sed -e 's@xmlns:tp="http://telepathy\.freedesktop\.org/wiki/DbusSpec.extensions-v0"@@g'
+
+The master copy of this stylesheet is in the Telepathy spec repository -
+please make any changes there.
+
+Copyright (C) 2006, 2007 Collabora Limited
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+ exclude-result-prefixes="tp">
+
+ <xsl:template match="*">
+ <xsl:copy>
+ <xsl:for-each select="@*">
+ <xsl:if test="not(starts-with(name(), 'tp:'))">
+ <xsl:copy/>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="tp:*"/>
+ <xsl:template match="text()"/>
+
+ <xsl:output method="xml" indent="yes" encoding="UTF-8"
+ omit-xml-declaration="no"
+ doctype-system="http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"
+ doctype-public="-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" />
+
+</xsl:stylesheet>
+
+<!-- vim:set sw=2 sts=2 et: -->
diff --git a/tools/telepathy-glib.supp b/tools/telepathy-glib.supp
index 0fe5e573c..eef86dcd5 100644
--- a/tools/telepathy-glib.supp
+++ b/tools/telepathy-glib.supp
@@ -253,44 +253,6 @@
fun:dbus_g_type_specialized_init
}
-{
- libdbus shared connection
- Memcheck:Leak
- ...
- fun:dbus_g_bus_get
-}
-
-{
- dbus-gobject registrations aren't freed unless we fall off the bus
- Memcheck:Leak
- ...
- fun:g_slist_append
- fun:dbus_g_connection_register_g_object
-}
-
-{
- DBusGProxy slots aren't freed unless we fall off the bus
- Memcheck:Leak
- ...
- fun:dbus_connection_allocate_data_slot
- ...
- fun:dbus_g_proxy_constructor
-}
-
-{
- error registrations are for life, not just for Christmas
- Memcheck:Leak
- ...
- fun:dbus_g_error_domain_register
-}
-
-{
- DBusGProxy class init
- Memcheck:Leak
- ...
- fun:dbus_g_proxy_class_init
-}
-
# ============================= telepathy-glib ========================
{
@@ -310,21 +272,6 @@
}
{
- tp_proxy_or_subclass_hook_on_interface_add never frees its list
- Memcheck:Leak
- ...
- fun:tp_proxy_or_subclass_hook_on_interface_add
-}
-
-{
- tp_dbus_daemon_constructor filter not freed til we fall off the bus
- Memcheck:Leak
- ...
- fun:dbus_connection_add_filter
- fun:tp_dbus_daemon_constructor
-}
-
-{
tp_g_socket_address_from_variant reffing GNIO types
Memcheck:Leak
...
@@ -334,17 +281,6 @@
}
{
- creating classes for DBusGProxy
- Memcheck:Leak
- ...
- fun:g_type_class_ref
- ...
- fun:g_object_new
- ...
- fun:tp_proxy_get_interface_by_id
-}
-
-{
creating classes for tp_dbus_daemon_new
Memcheck:Leak
...