summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2012-06-06 13:31:35 +0200
committerXavier Claessens <xavier.claessens@collabora.co.uk>2012-06-26 12:21:11 +0200
commitb05a2e0bf9e1dda370d4b0c287a3002ac2015a97 (patch)
tree184ba7869c338ab877ad5e11ec51ced8d25ca0e4
parent56f6c4ebe602232be2392179b434619aa358aae3 (diff)
TpProxy: move sealed fields to private
-rw-r--r--telepathy-glib/account-manager.c2
-rw-r--r--telepathy-glib/account.c2
-rw-r--r--telepathy-glib/call-channel.c6
-rw-r--r--telepathy-glib/channel-dispatcher.c2
-rw-r--r--telepathy-glib/channel-request.c2
-rw-r--r--telepathy-glib/channel.c12
-rw-r--r--telepathy-glib/connection-manager.c22
-rw-r--r--telepathy-glib/connection.c14
-rw-r--r--telepathy-glib/dbus-daemon.c20
-rw-r--r--telepathy-glib/dbus-tube-channel.c6
-rw-r--r--telepathy-glib/file-transfer-channel.c6
-rw-r--r--telepathy-glib/proxy.c126
-rw-r--r--telepathy-glib/proxy.h7
-rw-r--r--telepathy-glib/run.c2
-rw-r--r--telepathy-glib/stream-tube-channel.c6
-rw-r--r--telepathy-glib/text-channel.c6
-rw-r--r--telepathy-glib/tls-certificate.c9
17 files changed, 114 insertions, 136 deletions
diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c
index 406ef44ad..69579974d 100644
--- a/telepathy-glib/account-manager.c
+++ b/telepathy-glib/account-manager.c
@@ -724,7 +724,7 @@ _tp_account_manager_new_internal (TpClientFactory *factory,
{
return TP_ACCOUNT_MANAGER (g_object_new (TP_TYPE_ACCOUNT_MANAGER,
"dbus-daemon", bus_daemon,
- "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
+ "dbus-connection", tp_proxy_get_dbus_connection (bus_daemon),
"bus-name", TP_ACCOUNT_MANAGER_BUS_NAME,
"object-path", TP_ACCOUNT_MANAGER_OBJECT_PATH,
"factory", factory,
diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index c30e885cf..ab1171955 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -2107,7 +2107,7 @@ _tp_account_new_with_factory (TpClientFactory *factory,
self = TP_ACCOUNT (g_object_new (TP_TYPE_ACCOUNT,
"dbus-daemon", bus_daemon,
- "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
+ "dbus-connection", tp_proxy_get_dbus_connection (bus_daemon),
"bus-name", TP_ACCOUNT_MANAGER_BUS_NAME,
"object-path", object_path,
"factory", factory,
diff --git a/telepathy-glib/call-channel.c b/telepathy-glib/call-channel.c
index 9a2275b48..0c6e453e9 100644
--- a/telepathy-glib/call-channel.c
+++ b/telepathy-glib/call-channel.c
@@ -1154,8 +1154,6 @@ _tp_call_channel_new_with_factory (TpClientFactory *factory,
const GHashTable *immutable_properties,
GError **error)
{
- TpProxy *conn_proxy = (TpProxy *) conn;
-
g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
g_return_val_if_fail (object_path != NULL, NULL);
g_return_val_if_fail (immutable_properties != NULL, NULL);
@@ -1165,8 +1163,8 @@ _tp_call_channel_new_with_factory (TpClientFactory *factory,
return g_object_new (TP_TYPE_CALL_CHANNEL,
"connection", conn,
- "dbus-daemon", conn_proxy->dbus_daemon,
- "bus-name", conn_proxy->bus_name,
+ "dbus-daemon", tp_proxy_get_dbus_daemon (conn),
+ "bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
"handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
diff --git a/telepathy-glib/channel-dispatcher.c b/telepathy-glib/channel-dispatcher.c
index 77c4f70ad..e87374392 100644
--- a/telepathy-glib/channel-dispatcher.c
+++ b/telepathy-glib/channel-dispatcher.c
@@ -160,7 +160,7 @@ tp_channel_dispatcher_new (TpDBusDaemon *bus_daemon)
self = TP_CHANNEL_DISPATCHER (g_object_new (TP_TYPE_CHANNEL_DISPATCHER,
"dbus-daemon", bus_daemon,
- "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
+ "dbus-connection", tp_proxy_get_dbus_connection (bus_daemon),
"bus-name", TP_CHANNEL_DISPATCHER_BUS_NAME,
"object-path", TP_CHANNEL_DISPATCHER_OBJECT_PATH,
NULL));
diff --git a/telepathy-glib/channel-request.c b/telepathy-glib/channel-request.c
index 9cf157f3f..c61ee3e59 100644
--- a/telepathy-glib/channel-request.c
+++ b/telepathy-glib/channel-request.c
@@ -507,7 +507,7 @@ _tp_channel_request_new_with_factory (TpClientFactory *factory,
self = TP_CHANNEL_REQUEST (g_object_new (TP_TYPE_CHANNEL_REQUEST,
"dbus-daemon", bus_daemon,
- "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
+ "dbus-connection", tp_proxy_get_dbus_connection (bus_daemon),
"bus-name", unique_name,
"object-path", object_path,
"immutable-properties", immutable_properties,
diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c
index ee6ded9a8..f60dcb9e1 100644
--- a/telepathy-glib/channel.c
+++ b/telepathy-glib/channel.c
@@ -1438,7 +1438,6 @@ _tp_channel_new_with_factory (TpClientFactory *factory,
const GHashTable *immutable_properties,
GError **error)
{
- TpProxy *conn_proxy = (TpProxy *) conn;
TpChannel *ret = NULL;
g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
@@ -1455,8 +1454,8 @@ _tp_channel_new_with_factory (TpClientFactory *factory,
ret = TP_CHANNEL (g_object_new (TP_TYPE_CHANNEL,
"connection", conn,
- "dbus-daemon", conn_proxy->dbus_daemon,
- "bus-name", conn_proxy->bus_name,
+ "dbus-daemon", tp_proxy_get_dbus_daemon (conn),
+ "bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
"handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
@@ -1494,13 +1493,12 @@ tp_channel_new (TpConnection *conn,
GError **error)
{
TpChannel *ret = NULL;
- TpProxy *conn_proxy = (TpProxy *) conn;
g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
g_return_val_if_fail (object_path != NULL, NULL);
/* TpConnection always has a unique name, so we can assert this */
- g_assert (tp_dbus_check_valid_bus_name (conn_proxy->bus_name,
+ g_assert (tp_dbus_check_valid_bus_name (tp_proxy_get_bus_name (conn),
TP_DBUS_NAME_TYPE_UNIQUE, NULL));
if (!tp_dbus_check_valid_object_path (object_path, error))
@@ -1529,8 +1527,8 @@ tp_channel_new (TpConnection *conn,
ret = TP_CHANNEL (g_object_new (TP_TYPE_CHANNEL,
"connection", conn,
- "dbus-daemon", conn_proxy->dbus_daemon,
- "bus-name", conn_proxy->bus_name,
+ "dbus-daemon", tp_proxy_get_dbus_daemon (conn),
+ "bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
"channel-type", optional_channel_type,
"handle-type", optional_handle_type,
diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c
index 110a4ab5b..b169fb6f8 100644
--- a/telepathy-glib/connection-manager.c
+++ b/telepathy-glib/connection-manager.c
@@ -722,19 +722,16 @@ tp_connection_manager_constructor (GType type,
TpConnectionManager *self =
TP_CONNECTION_MANAGER (object_class->constructor (type, n_params,
params));
- TpProxy *as_proxy = (TpProxy *) self;
- const gchar *object_path = as_proxy->object_path;
- const gchar *bus_name = as_proxy->bus_name;
- g_return_val_if_fail (object_path != NULL, NULL);
- g_return_val_if_fail (bus_name != NULL, NULL);
+ g_return_val_if_fail (tp_proxy_get_object_path (self) != NULL, NULL);
+ g_return_val_if_fail (tp_proxy_get_bus_name (self) != NULL, NULL);
/* Watch my D-Bus name */
- tp_dbus_daemon_watch_name_owner (as_proxy->dbus_daemon,
- as_proxy->bus_name, tp_connection_manager_name_owner_changed_cb, self,
- NULL);
+ tp_dbus_daemon_watch_name_owner (tp_proxy_get_dbus_daemon (self),
+ tp_proxy_get_bus_name (self), tp_connection_manager_name_owner_changed_cb,
+ self, NULL);
- self->priv->name = strrchr (object_path, '/') + 1;
+ self->priv->name = strrchr (tp_proxy_get_object_path (self), '/') + 1;
g_assert (self->priv->name != NULL);
if (self->priv->manager_file == NULL)
@@ -757,15 +754,14 @@ static void
tp_connection_manager_dispose (GObject *object)
{
TpConnectionManager *self = TP_CONNECTION_MANAGER (object);
- TpProxy *as_proxy = (TpProxy *) self;
if (self->priv->disposed)
goto finally;
self->priv->disposed = TRUE;
- tp_dbus_daemon_cancel_name_owner_watch (as_proxy->dbus_daemon,
- as_proxy->bus_name, tp_connection_manager_name_owner_changed_cb,
+ tp_dbus_daemon_cancel_name_owner_watch (tp_proxy_get_dbus_daemon (self),
+ tp_proxy_get_bus_name (self), tp_connection_manager_name_owner_changed_cb,
object);
if (self->priv->protocols != NULL)
@@ -1111,7 +1107,7 @@ tp_connection_manager_new (TpDBusDaemon *dbus,
cm = TP_CONNECTION_MANAGER (g_object_new (TP_TYPE_CONNECTION_MANAGER,
"dbus-daemon", dbus,
- "dbus-connection", ((TpProxy *) dbus)->dbus_connection,
+ "dbus-connection", tp_proxy_get_dbus_connection (dbus),
"bus-name", bus_name,
"object-path", object_path,
"manager-file", manager_filename,
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index b5040ed7c..044ea5c43 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -2579,7 +2579,7 @@ tp_connection_get_detailed_error (TpConnection *self,
{
TpProxy *proxy = (TpProxy *) self;
- if (proxy->invalidated == NULL)
+ if (tp_proxy_get_invalidated (proxy) == NULL)
return NULL;
if (self->priv->connection_error != NULL)
@@ -2601,20 +2601,20 @@ tp_connection_get_detailed_error (TpConnection *self,
if (self->priv->connection_error_details == NULL)
{
self->priv->connection_error_details = tp_asv_new (
- "debug-message", G_TYPE_STRING, proxy->invalidated->message,
+ "debug-message", G_TYPE_STRING, tp_proxy_get_invalidated (proxy)->message,
NULL);
}
*details = self->priv->connection_error_details;
}
- if (proxy->invalidated->domain == TP_ERROR)
+ if (tp_proxy_get_invalidated (proxy)->domain == TP_ERROR)
{
- return tp_error_get_dbus_name (proxy->invalidated->code);
+ return tp_error_get_dbus_name (tp_proxy_get_invalidated (proxy)->code);
}
- else if (proxy->invalidated->domain == TP_DBUS_ERRORS)
+ else if (tp_proxy_get_invalidated (proxy)->domain == TP_DBUS_ERRORS)
{
- switch (proxy->invalidated->code)
+ switch (tp_proxy_get_invalidated (proxy)->code)
{
case TP_DBUS_ERROR_NAME_OWNER_LOST:
/* the CM probably crashed */
@@ -2717,7 +2717,7 @@ tp_connection_add_client_interest_by_id (TpConnection *self,
g_return_if_fail (TP_IS_CONNECTION (self));
g_return_if_fail (interest != NULL);
- if (proxy->invalidated != NULL ||
+ if (tp_proxy_get_invalidated (proxy) != NULL ||
tp_intset_is_member (self->priv->interests, interested_in))
return;
diff --git a/telepathy-glib/dbus-daemon.c b/telepathy-glib/dbus-daemon.c
index 0fb29b9ac..a51daba6e 100644
--- a/telepathy-glib/dbus-daemon.c
+++ b/telepathy-glib/dbus-daemon.c
@@ -763,7 +763,6 @@ tp_dbus_daemon_request_name (TpDBusDaemon *self,
gboolean idempotent,
GError **error)
{
- TpProxy *as_proxy = (TpProxy *) self;
DBusGConnection *gconn;
DBusConnection *dbc;
DBusError dbus_error;
@@ -785,7 +784,7 @@ tp_dbus_daemon_request_name (TpDBusDaemon *self,
return FALSE;
}
- gconn = as_proxy->dbus_connection;
+ gconn = tp_proxy_get_dbus_connection (self);
dbc = dbus_g_connection_get_connection (gconn);
dbus_error_init (&dbus_error);
@@ -849,7 +848,6 @@ tp_dbus_daemon_release_name (TpDBusDaemon *self,
const gchar *well_known_name,
GError **error)
{
- TpProxy *as_proxy = (TpProxy *) self;
DBusGConnection *gconn;
DBusConnection *dbc;
DBusError dbus_error;
@@ -871,7 +869,7 @@ tp_dbus_daemon_release_name (TpDBusDaemon *self,
return FALSE;
}
- gconn = as_proxy->dbus_connection;
+ 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);
@@ -921,13 +919,11 @@ tp_dbus_daemon_register_object (TpDBusDaemon *self,
const gchar *object_path,
gpointer object)
{
- TpProxy *as_proxy = (TpProxy *) self;
-
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 (as_proxy->dbus_connection,
+ dbus_g_connection_register_g_object (tp_proxy_get_dbus_connection (self),
object_path, object);
}
@@ -946,12 +942,11 @@ void
tp_dbus_daemon_unregister_object (TpDBusDaemon *self,
gpointer object)
{
- TpProxy *as_proxy = (TpProxy *) self;
-
g_return_if_fail (TP_IS_DBUS_DAEMON (self));
g_return_if_fail (G_IS_OBJECT (object));
- dbus_g_connection_unregister_g_object (as_proxy->dbus_connection, object);
+ dbus_g_connection_unregister_g_object (tp_proxy_get_dbus_connection (self),
+ object);
}
/**
@@ -1266,11 +1261,10 @@ tp_dbus_daemon_constructor (GType type,
(GObjectClass *) tp_dbus_daemon_parent_class;
TpDBusDaemon *self = TP_DBUS_DAEMON (object_class->constructor (type,
n_params, params));
- TpProxy *as_proxy = (TpProxy *) self;
GSList **daemons;
- g_assert (!tp_strdiff (as_proxy->bus_name, DBUS_SERVICE_DBUS));
- g_assert (!tp_strdiff (as_proxy->object_path, DBUS_PATH_DBUS));
+ 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 (
diff --git a/telepathy-glib/dbus-tube-channel.c b/telepathy-glib/dbus-tube-channel.c
index b2dc9b792..f64b64be0 100644
--- a/telepathy-glib/dbus-tube-channel.c
+++ b/telepathy-glib/dbus-tube-channel.c
@@ -455,8 +455,6 @@ _tp_dbus_tube_channel_new_with_factory (
const GHashTable *immutable_properties,
GError **error)
{
- TpProxy *conn_proxy = (TpProxy *) conn;
-
g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
g_return_val_if_fail (object_path != NULL, NULL);
g_return_val_if_fail (immutable_properties != NULL, NULL);
@@ -466,8 +464,8 @@ _tp_dbus_tube_channel_new_with_factory (
return g_object_new (TP_TYPE_DBUS_TUBE_CHANNEL,
"connection", conn,
- "dbus-daemon", conn_proxy->dbus_daemon,
- "bus-name", conn_proxy->bus_name,
+ "dbus-daemon", tp_proxy_get_dbus_daemon (conn),
+ "bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
"handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
diff --git a/telepathy-glib/file-transfer-channel.c b/telepathy-glib/file-transfer-channel.c
index e3995c0d5..73226e6b8 100644
--- a/telepathy-glib/file-transfer-channel.c
+++ b/telepathy-glib/file-transfer-channel.c
@@ -1079,8 +1079,6 @@ _tp_file_transfer_channel_new_with_factory (
const GHashTable *immutable_properties,
GError **error)
{
- TpProxy *conn_proxy = (TpProxy *) conn;
-
g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
g_return_val_if_fail (object_path != NULL, NULL);
g_return_val_if_fail (immutable_properties != NULL, NULL);
@@ -1090,8 +1088,8 @@ _tp_file_transfer_channel_new_with_factory (
return g_object_new (TP_TYPE_FILE_TRANSFER_CHANNEL,
"connection", conn,
- "dbus-daemon", conn_proxy->dbus_daemon,
- "bus-name", conn_proxy->bus_name,
+ "dbus-daemon", tp_proxy_get_dbus_daemon (conn),
+ "bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
"handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
diff --git a/telepathy-glib/proxy.c b/telepathy-glib/proxy.c
index 739790638..2596d2c69 100644
--- a/telepathy-glib/proxy.c
+++ b/telepathy-glib/proxy.c
@@ -357,6 +357,13 @@ tp_proxy_prepare_request_finish (TpProxyPrepareRequest *req,
}
struct _TpProxyPrivate {
+ TpDBusDaemon *dbus_daemon;
+ DBusGConnection *dbus_connection;
+ gchar *bus_name;
+ gchar *object_path;
+
+ GError *invalidated;
+
/* GQuark for interface => either a ref'd DBusGProxy *,
* or the TpProxy itself used as a dummy value to indicate that
* the DBusGProxy has not been needed yet */
@@ -433,10 +440,10 @@ _tp_proxy_borrow_interface_by_id (TpProxy *self,
g_return_val_if_fail (TP_IS_PROXY (self), NULL);
- if (self->invalidated != NULL)
+ if (self->priv->invalidated != NULL)
{
- g_set_error (error, self->invalidated->domain, self->invalidated->code,
- "%s", self->invalidated->message);
+ g_set_error (error, self->priv->invalidated->domain, self->priv->invalidated->code,
+ "%s", self->priv->invalidated->message);
return NULL;
}
@@ -451,8 +458,8 @@ _tp_proxy_borrow_interface_by_id (TpProxy *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->dbus_connection,
- self->bus_name, self->object_path, g_quark_to_string (iface));
+ 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);
@@ -473,7 +480,7 @@ _tp_proxy_borrow_interface_by_id (TpProxy *self,
g_set_error (error, TP_DBUS_ERRORS, TP_DBUS_ERROR_NO_INTERFACE,
"Object %s does not have interface %s",
- self->object_path, g_quark_to_string (iface));
+ self->priv->object_path, g_quark_to_string (iface));
return NULL;
}
@@ -563,8 +570,8 @@ tp_proxy_emit_invalidated (gpointer p)
TpProxy *self = TP_PROXY (p);
g_signal_emit (self, signals[SIGNAL_INVALIDATED], 0,
- self->invalidated->domain, self->invalidated->code,
- self->invalidated->message);
+ self->priv->invalidated->domain, self->priv->invalidated->code,
+ self->priv->invalidated->message);
/* make all pending tp_proxy_prepare_async calls fail */
tp_proxy_poll_features (self, NULL);
@@ -575,10 +582,10 @@ tp_proxy_emit_invalidated (gpointer p)
* to the proxies */
tp_proxy_lose_interfaces (self);
- if (self->dbus_connection != NULL)
+ if (self->priv->dbus_connection != NULL)
{
- dbus_g_connection_unref (self->dbus_connection);
- self->dbus_connection = NULL;
+ dbus_g_connection_unref (self->priv->dbus_connection);
+ self->priv->dbus_connection = NULL;
}
return FALSE;
@@ -601,10 +608,10 @@ tp_proxy_invalidate (TpProxy *self, const GError *error)
g_return_if_fail (self != NULL);
g_return_if_fail (error != NULL);
- if (self->invalidated == NULL)
+ if (self->priv->invalidated == NULL)
{
DEBUG ("%p: %s", self, error->message);
- self->invalidated = g_error_copy (error);
+ self->priv->invalidated = g_error_copy (error);
tp_proxy_emit_invalidated (self);
}
@@ -623,10 +630,10 @@ tp_proxy_iface_destroyed_cb (DBusGProxy *dgproxy,
* any queued-up method calls and signal handlers will run first, and so
* it doesn't try to reenter libdbus.
*/
- if (self->invalidated == NULL)
+ if (self->priv->invalidated == NULL)
{
DEBUG ("%p", self);
- self->invalidated = g_error_new_literal (TP_DBUS_ERRORS,
+ self->priv->invalidated = g_error_new_literal (TP_DBUS_ERRORS,
TP_DBUS_ERROR_NAME_OWNER_LOST, "Name owner lost (service crashed?)");
g_idle_add_full (G_PRIORITY_HIGH, tp_proxy_emit_invalidated,
@@ -845,17 +852,17 @@ tp_proxy_get_property (GObject *object,
}
else
{
- g_value_set_object (value, self->dbus_daemon);
+ g_value_set_object (value, self->priv->dbus_daemon);
}
break;
case PROP_DBUS_CONNECTION:
- g_value_set_boxed (value, self->dbus_connection);
+ g_value_set_boxed (value, self->priv->dbus_connection);
break;
case PROP_BUS_NAME:
- g_value_set_string (value, self->bus_name);
+ g_value_set_string (value, self->priv->bus_name);
break;
case PROP_OBJECT_PATH:
- g_value_set_string (value, self->object_path);
+ g_value_set_string (value, self->priv->object_path);
break;
case PROP_INTERFACES:
{
@@ -893,22 +900,21 @@ tp_proxy_set_property (GObject *object,
}
else
{
- TpProxy *daemon_as_proxy = TP_PROXY (g_value_get_object (value));
-
- g_assert (self->dbus_daemon == NULL);
+ g_assert (self->priv->dbus_daemon == NULL);
+ self->priv->dbus_daemon = g_value_dup_object (value);
- if (daemon_as_proxy != NULL)
- self->dbus_daemon = TP_DBUS_DAEMON (g_object_ref
- (daemon_as_proxy));
-
- if (daemon_as_proxy != NULL)
+ if (self->priv->dbus_daemon != NULL)
{
- g_assert (self->dbus_connection == NULL ||
- self->dbus_connection == daemon_as_proxy->dbus_connection);
-
- if (self->dbus_connection == NULL)
- self->dbus_connection =
- dbus_g_connection_ref (daemon_as_proxy->dbus_connection);
+ if (self->priv->dbus_connection == NULL)
+ {
+ self->priv->dbus_connection = dbus_g_connection_ref (
+ tp_proxy_get_dbus_connection (self->priv->dbus_daemon));
+ }
+ else
+ {
+ g_assert (self->priv->dbus_connection ==
+ tp_proxy_get_dbus_connection (self->priv->dbus_daemon));
+ }
}
}
break;
@@ -921,19 +927,19 @@ tp_proxy_set_property (GObject *object,
if (conn == NULL)
return;
- if (self->dbus_connection == NULL)
- self->dbus_connection = g_value_dup_boxed (value);
+ if (self->priv->dbus_connection == NULL)
+ self->priv->dbus_connection = g_value_dup_boxed (value);
- g_assert (self->dbus_connection == g_value_get_boxed (value));
+ g_assert (self->priv->dbus_connection == g_value_get_boxed (value));
}
break;
case PROP_BUS_NAME:
- g_assert (self->bus_name == NULL);
- self->bus_name = g_value_dup_string (value);
+ g_assert (self->priv->bus_name == NULL);
+ self->priv->bus_name = g_value_dup_string (value);
break;
case PROP_OBJECT_PATH:
- g_assert (self->object_path == NULL);
- self->object_path = g_value_dup_string (value);
+ g_assert (self->priv->object_path == NULL);
+ self->priv->object_path = g_value_dup_string (value);
break;
case PROP_FACTORY:
g_assert (self->priv->factory == NULL);
@@ -1071,13 +1077,13 @@ tp_proxy_constructor (GType type,
g_array_unref (core_features);
}
- g_return_val_if_fail (self->dbus_connection != NULL, NULL);
- g_return_val_if_fail (self->object_path != NULL, NULL);
- g_return_val_if_fail (self->bus_name != NULL, NULL);
+ g_return_val_if_fail (self->priv->dbus_connection != NULL, NULL);
+ g_return_val_if_fail (self->priv->object_path != NULL, NULL);
+ g_return_val_if_fail (self->priv->bus_name != NULL, NULL);
- g_return_val_if_fail (tp_dbus_check_valid_object_path (self->object_path,
+ g_return_val_if_fail (tp_dbus_check_valid_object_path (self->priv->object_path,
NULL), NULL);
- g_return_val_if_fail (tp_dbus_check_valid_bus_name (self->bus_name,
+ g_return_val_if_fail (tp_dbus_check_valid_bus_name (self->priv->bus_name,
TP_DBUS_NAME_TYPE_ANY, NULL), NULL);
tp_proxy_add_interface_by_id (self, TP_IFACE_QUARK_DBUS_INTROSPECTABLE);
@@ -1093,7 +1099,7 @@ tp_proxy_constructor (GType type,
* name, like in dbus_g_proxy_new_for_name_owner() */
if (klass->must_have_unique_name)
{
- g_return_val_if_fail (self->bus_name[0] == ':', NULL);
+ g_return_val_if_fail (self->priv->bus_name[0] == ':', NULL);
}
return (GObject *) self;
@@ -1116,7 +1122,7 @@ tp_proxy_dispose (GObject *object)
tp_proxy_invalidate (self, &e);
- tp_clear_object (&self->dbus_daemon);
+ tp_clear_object (&self->priv->dbus_daemon);
tp_clear_object (&self->priv->factory);
G_OBJECT_CLASS (tp_proxy_parent_class)->dispose (object);
@@ -1132,15 +1138,15 @@ tp_proxy_finalize (GObject *object)
if (self->priv->features != NULL)
g_datalist_clear (&self->priv->features);
- g_assert (self->invalidated != NULL);
- g_error_free (self->invalidated);
+ g_assert (self->priv->invalidated != NULL);
+ g_error_free (self->priv->invalidated);
/* invalidation ensures that these have gone away */
g_assert_cmpuint (g_queue_get_length (self->priv->prepare_requests), ==, 0);
tp_clear_pointer (&self->priv->prepare_requests, g_queue_free);
- g_free (self->bus_name);
- g_free (self->object_path);
+ g_free (self->priv->bus_name);
+ g_free (self->priv->object_path);
G_OBJECT_CLASS (tp_proxy_parent_class)->finalize (object);
}
@@ -1413,7 +1419,7 @@ _tp_proxy_ensure_factory (gpointer proxy,
}
else
{
- self->priv->factory = tp_automatic_client_factory_new (self->dbus_daemon);
+ self->priv->factory = tp_automatic_client_factory_new (self->priv->dbus_daemon);
}
_tp_client_factory_insert_proxy (self->priv->factory, self);
@@ -1437,7 +1443,7 @@ tp_proxy_get_dbus_daemon (gpointer self)
{
TpProxy *proxy = TP_PROXY (self);
- return proxy->dbus_daemon;
+ return proxy->priv->dbus_daemon;
}
/**
@@ -1457,7 +1463,7 @@ tp_proxy_get_dbus_connection (gpointer self)
{
TpProxy *proxy = TP_PROXY (self);
- return proxy->dbus_connection;
+ return proxy->priv->dbus_connection;
}
/**
@@ -1476,7 +1482,7 @@ tp_proxy_get_bus_name (gpointer self)
{
TpProxy *proxy = TP_PROXY (self);
- return proxy->bus_name;
+ return proxy->priv->bus_name;
}
/**
@@ -1495,7 +1501,7 @@ tp_proxy_get_object_path (gpointer self)
{
TpProxy *proxy = TP_PROXY (self);
- return proxy->object_path;
+ return proxy->priv->object_path;
}
/**
@@ -1515,7 +1521,7 @@ tp_proxy_get_invalidated (gpointer self)
{
TpProxy *proxy = TP_PROXY (self);
- return proxy->invalidated;
+ return proxy->priv->invalidated;
}
static gpointer
@@ -1912,11 +1918,11 @@ tp_proxy_prepare_async (gpointer self,
result = g_simple_async_result_new (self, callback, user_data,
tp_proxy_prepare_async);
- if (proxy->invalidated != NULL)
+ if (proxy->priv->invalidated != NULL)
{
if (result != NULL)
{
- g_simple_async_result_set_from_error (result, proxy->invalidated);
+ g_simple_async_result_set_from_error (result, proxy->priv->invalidated);
g_simple_async_result_complete_in_idle (result);
}
@@ -2163,7 +2169,7 @@ tp_proxy_poll_features (TpProxy *self,
if (error == NULL)
{
error_source = "invalidated";
- error = self->invalidated;
+ error = self->priv->invalidated;
}
if (error != NULL)
diff --git a/telepathy-glib/proxy.h b/telepathy-glib/proxy.h
index c0317808c..f8a027477 100644
--- a/telepathy-glib/proxy.h
+++ b/telepathy-glib/proxy.h
@@ -65,13 +65,6 @@ struct _TpProxy {
/*<private>*/
GObject parent;
- TpDBusDaemon *_TP_SEAL (dbus_daemon);
- DBusGConnection *_TP_SEAL (dbus_connection);
- gchar *_TP_SEAL (bus_name);
- gchar *_TP_SEAL (object_path);
-
- GError *_TP_SEAL (invalidated);
-
TpProxyPrivate *priv;
};
diff --git a/telepathy-glib/run.c b/telepathy-glib/run.c
index 7ae6e8236..350292faf 100644
--- a/telepathy-glib/run.c
+++ b/telepathy-glib/run.c
@@ -266,7 +266,7 @@ tp_run_connection_manager (const char *prog_name,
* effect, we need to install it before calling
* tp_base_connection_manager_register () */
connection = dbus_g_connection_get_connection (
- ((TpProxy *) bus_daemon)->dbus_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);
diff --git a/telepathy-glib/stream-tube-channel.c b/telepathy-glib/stream-tube-channel.c
index ea038d2e2..eae9c0b50 100644
--- a/telepathy-glib/stream-tube-channel.c
+++ b/telepathy-glib/stream-tube-channel.c
@@ -512,8 +512,6 @@ _tp_stream_tube_channel_new_with_factory (
const GHashTable *immutable_properties,
GError **error)
{
- TpProxy *conn_proxy = (TpProxy *) conn;
-
g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
g_return_val_if_fail (object_path != NULL, NULL);
g_return_val_if_fail (immutable_properties != NULL, NULL);
@@ -523,8 +521,8 @@ _tp_stream_tube_channel_new_with_factory (
return g_object_new (TP_TYPE_STREAM_TUBE_CHANNEL,
"connection", conn,
- "dbus-daemon", conn_proxy->dbus_daemon,
- "bus-name", conn_proxy->bus_name,
+ "dbus-daemon", tp_proxy_get_dbus_daemon (conn),
+ "bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
"handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
diff --git a/telepathy-glib/text-channel.c b/telepathy-glib/text-channel.c
index 91a1d73b4..02dbd55c4 100644
--- a/telepathy-glib/text-channel.c
+++ b/telepathy-glib/text-channel.c
@@ -1142,8 +1142,6 @@ _tp_text_channel_new_with_factory (
const GHashTable *immutable_properties,
GError **error)
{
- TpProxy *conn_proxy = (TpProxy *) conn;
-
g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
g_return_val_if_fail (object_path != NULL, NULL);
g_return_val_if_fail (immutable_properties != NULL, NULL);
@@ -1153,8 +1151,8 @@ _tp_text_channel_new_with_factory (
return g_object_new (TP_TYPE_TEXT_CHANNEL,
"connection", conn,
- "dbus-daemon", conn_proxy->dbus_daemon,
- "bus-name", conn_proxy->bus_name,
+ "dbus-daemon", tp_proxy_get_dbus_daemon (conn),
+ "bus-name", tp_proxy_get_bus_name (conn),
"object-path", object_path,
"handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
"channel-properties", immutable_properties,
diff --git a/telepathy-glib/tls-certificate.c b/telepathy-glib/tls-certificate.c
index 46374c127..0dd5aab52 100644
--- a/telepathy-glib/tls-certificate.c
+++ b/telepathy-glib/tls-certificate.c
@@ -300,9 +300,10 @@ tp_tls_certificate_constructed (GObject *object)
if (self->priv->parent != NULL)
{
- if (self->priv->parent->invalidated != NULL)
+ if (tp_proxy_get_invalidated (self->priv->parent) != NULL)
{
- GError *invalidated = self->priv->parent->invalidated;
+ const GError *invalidated =
+ tp_proxy_get_invalidated (self->priv->parent);
parent_invalidated_cb (self->priv->parent, invalidated->domain,
invalidated->code, invalidated->message, self);
@@ -606,8 +607,8 @@ tp_tls_certificate_new (TpProxy *conn_or_chan,
retval = g_object_new (TP_TYPE_TLS_CERTIFICATE,
"parent", conn_or_chan,
- "dbus-daemon", conn_or_chan->dbus_daemon,
- "bus-name", conn_or_chan->bus_name,
+ "dbus-daemon", tp_proxy_get_dbus_daemon (conn_or_chan),
+ "bus-name", tp_proxy_get_bus_name (conn_or_chan),
"object-path", object_path,
NULL);