From 8bcea38c6e6b8b2622ac849a3369ae672cc537c3 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 31 Mar 2014 20:04:11 +0100 Subject: [PATCH] TpClientFactory: consistently use _ensure_ when creating objects Xavier was going for "singletons use _dup_, objects that are per-path use _ensure_" but we agreed that using _ensure_ for both was less confusing. --- docs/reference/telepathy-glib/telepathy-glib-sections.txt | 6 +++--- telepathy-glib/account-channel-request.c | 4 ++-- telepathy-glib/account-manager.c | 2 +- telepathy-glib/base-client.c | 2 +- telepathy-glib/client-factory.c | 12 ++++++------ telepathy-glib/client-factory.h | 6 +++--- telepathy-glib/logger.c | 2 +- tests/dbus/account-manager.c | 2 +- tests/dbus/base-client.c | 2 +- tests/dbus/channel-dispatcher.c | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/reference/telepathy-glib/telepathy-glib-sections.txt b/docs/reference/telepathy-glib/telepathy-glib-sections.txt index 53c296b..f45ed8a 100644 --- a/docs/reference/telepathy-glib/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib/telepathy-glib-sections.txt @@ -5671,9 +5671,9 @@ tp_client_factory_set_default tp_client_factory_can_set_default tp_client_factory_get_dbus_connection -tp_client_factory_dup_account_manager -tp_client_factory_dup_channel_dispatcher -tp_client_factory_dup_logger +tp_client_factory_ensure_account_manager +tp_client_factory_ensure_channel_dispatcher +tp_client_factory_ensure_logger tp_client_factory_ensure_account tp_client_factory_dup_account_features diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c index 2a8b5dd..a5289a5 100644 --- a/telepathy-glib/account-channel-request.c +++ b/telepathy-glib/account-channel-request.c @@ -958,7 +958,7 @@ request_and_handle_channel_async (TpAccountChannelRequest *self, return; } - cd = tp_client_factory_dup_channel_dispatcher (tp_proxy_get_factory ( + cd = tp_client_factory_ensure_channel_dispatcher (tp_proxy_get_factory ( self->priv->account)); hints = tp_asv_from_vardict (self->priv->hints); @@ -1195,7 +1195,7 @@ request_channel_async (TpAccountChannelRequest *self, callback, user_data)) return; - cd = tp_client_factory_dup_channel_dispatcher (tp_proxy_get_factory ( + cd = tp_client_factory_ensure_channel_dispatcher (tp_proxy_get_factory ( self->priv->account)); hints = tp_asv_from_vardict (self->priv->hints); diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c index d050952..f89690c 100644 --- a/telepathy-glib/account-manager.c +++ b/telepathy-glib/account-manager.c @@ -695,7 +695,7 @@ tp_account_manager_dup (void) return NULL; } - self = tp_client_factory_dup_account_manager (factory); + self = tp_client_factory_ensure_account_manager (factory); g_object_unref (factory); diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c index ad7a11b..e2cb1d9 100644 --- a/telepathy-glib/base-client.c +++ b/telepathy-glib/base-client.c @@ -2820,7 +2820,7 @@ tp_base_client_delegate_channels_async (TpBaseClient *self, g_return_if_fail (TP_IS_BASE_CLIENT (self)); g_return_if_fail (self->priv->flags & CLIENT_IS_HANDLER); - cd = tp_client_factory_dup_channel_dispatcher (self->priv->factory); + cd = tp_client_factory_ensure_channel_dispatcher (self->priv->factory); chans = g_ptr_array_new_full (g_list_length (channels), g_free); diff --git a/telepathy-glib/client-factory.c b/telepathy-glib/client-factory.c index c1bc47f..617f40e 100644 --- a/telepathy-glib/client-factory.c +++ b/telepathy-glib/client-factory.c @@ -600,7 +600,7 @@ tp_client_factory_get_dbus_connection (TpClientFactory *self) } /** - * tp_client_factory_dup_account_manager: + * tp_client_factory_ensure_account_manager: * @self: a #TpClientFactory object * * @@ -610,7 +610,7 @@ tp_client_factory_get_dbus_connection (TpClientFactory *self) * Since: 0.UNRELEASED */ TpAccountManager * -tp_client_factory_dup_account_manager (TpClientFactory *self) +tp_client_factory_ensure_account_manager (TpClientFactory *self) { TpAccountManager *account_manager; @@ -627,7 +627,7 @@ tp_client_factory_dup_account_manager (TpClientFactory *self) } /** - * tp_client_factory_dup_channel_dispatcher: + * tp_client_factory_ensure_channel_dispatcher: * @self: a #TpClientFactory object * * @@ -637,7 +637,7 @@ tp_client_factory_dup_account_manager (TpClientFactory *self) * Since: 0.UNRELEASED */ TpChannelDispatcher * -tp_client_factory_dup_channel_dispatcher (TpClientFactory *self) +tp_client_factory_ensure_channel_dispatcher (TpClientFactory *self) { TpChannelDispatcher *channel_dispatcher; @@ -654,7 +654,7 @@ tp_client_factory_dup_channel_dispatcher (TpClientFactory *self) } /** - * tp_client_factory_dup_logger: + * tp_client_factory_ensure_logger: * @self: a #TpClientFactory object * * @@ -664,7 +664,7 @@ tp_client_factory_dup_channel_dispatcher (TpClientFactory *self) * Since: 0.UNRELEASED */ TpLogger * -tp_client_factory_dup_logger (TpClientFactory *self) +tp_client_factory_ensure_logger (TpClientFactory *self) { TpLogger *logger; diff --git a/telepathy-glib/client-factory.h b/telepathy-glib/client-factory.h index 17e5f58..9bc7856 100644 --- a/telepathy-glib/client-factory.h +++ b/telepathy-glib/client-factory.h @@ -134,10 +134,10 @@ gboolean tp_client_factory_can_set_default (void); GDBusConnection *tp_client_factory_get_dbus_connection (TpClientFactory *self); -TpAccountManager *tp_client_factory_dup_account_manager (TpClientFactory *self); -TpChannelDispatcher *tp_client_factory_dup_channel_dispatcher ( +TpAccountManager *tp_client_factory_ensure_account_manager (TpClientFactory *self); +TpChannelDispatcher *tp_client_factory_ensure_channel_dispatcher ( TpClientFactory *self); -TpLogger *tp_client_factory_dup_logger (TpClientFactory *self); +TpLogger *tp_client_factory_ensure_logger (TpClientFactory *self); /* TpAccount */ TpAccount *tp_client_factory_ensure_account (TpClientFactory *self, diff --git a/telepathy-glib/logger.c b/telepathy-glib/logger.c index 42efbd8..c3d1593 100644 --- a/telepathy-glib/logger.c +++ b/telepathy-glib/logger.c @@ -115,7 +115,7 @@ tp_logger_dup (void) return NULL; } - self = tp_client_factory_dup_logger (factory); + self = tp_client_factory_ensure_logger (factory); g_object_unref (factory); diff --git a/tests/dbus/account-manager.c b/tests/dbus/account-manager.c index ef46c93..f892ba2 100644 --- a/tests/dbus/account-manager.c +++ b/tests/dbus/account-manager.c @@ -54,7 +54,7 @@ account_manager_new (GDBusConnection *dbus) TpAccountManager *am; factory = tp_client_factory_new (dbus); - am = tp_client_factory_dup_account_manager (factory); + am = tp_client_factory_ensure_account_manager (factory); g_object_unref (factory); return am; diff --git a/tests/dbus/base-client.c b/tests/dbus/base-client.c index 9858ad5..b149644 100644 --- a/tests/dbus/base-client.c +++ b/tests/dbus/base-client.c @@ -1271,7 +1271,7 @@ test_present_channel (Test *test, { TpChannelDispatcher *cd; - cd = tp_client_factory_dup_channel_dispatcher (test->factory); + cd = tp_client_factory_ensure_channel_dispatcher (test->factory); tp_channel_dispatcher_present_channel_async (cd, test->text_chan, TP_USER_ACTION_TIME_CURRENT_TIME, present_channel_cb, test); diff --git a/tests/dbus/channel-dispatcher.c b/tests/dbus/channel-dispatcher.c index d1757e9..b3f75db 100644 --- a/tests/dbus/channel-dispatcher.c +++ b/tests/dbus/channel-dispatcher.c @@ -61,7 +61,7 @@ test_new (Test *test, TpClientFactory *factory; factory = tp_client_factory_new (test->dbus); - test->cd = tp_client_factory_dup_channel_dispatcher (factory); + test->cd = tp_client_factory_ensure_channel_dispatcher (factory); g_assert (test->cd != NULL); g_object_unref (factory); } -- 1.9.1