summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2010-05-10 12:36:28 +0200
committerXavier Claessens <xclaesse@gmail.com>2010-05-26 11:17:47 +0200
commitb8ff75d21c1be60e6df472a35599a9e22046a92b (patch)
treefcaa7453e65ac310e4a3c0f854bcb8b588722863
parent696bd076bbd431aad122c66cadfb6ec3f5ff1762 (diff)
downloadempathy-b8ff75d21c1be60e6df472a35599a9e22046a92b.tar.gz
Port to new EmpathyTpContactFactory API
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.c10
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c19
-rw-r--r--libempathy-gtk/empathy-contact-widget.c24
-rw-r--r--libempathy-gtk/empathy-new-call-dialog.c8
-rw-r--r--libempathy/empathy-dispatch-operation.c8
-rw-r--r--libempathy/empathy-dispatcher.c8
-rw-r--r--libempathy/empathy-ft-handler.c10
-rw-r--r--libempathy/empathy-tp-call.c7
-rw-r--r--libempathy/empathy-tp-chat.c50
-rw-r--r--libempathy/empathy-tp-contact-list.c15
-rw-r--r--src/empathy-call-window.c8
-rw-r--r--src/empathy-chat-window.c9
-rw-r--r--src/empathy-event-manager.c16
13 files changed, 60 insertions, 132 deletions
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index fed8d04cb..aaeea4b7c 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -73,17 +73,11 @@ subscription_dialog_response_cb (GtkDialog *dialog,
contact = empathy_contact_widget_get_contact (contact_widget);
if (response == GTK_RESPONSE_YES) {
- EmpathyTpContactFactory *factory;
-
- factory = empathy_tp_contact_factory_dup_singleton (
- empathy_contact_get_connection (contact));
-
empathy_contact_list_add (EMPATHY_CONTACT_LIST (manager),
contact, "");
- empathy_tp_contact_factory_set_alias (factory, contact,
- empathy_contact_widget_get_alias (contact_widget));
- g_object_unref (factory);
+ empathy_tp_contact_factory_set_alias (contact,
+ empathy_contact_widget_get_alias (contact_widget));
}
else if (response == GTK_RESPONSE_NO) {
empathy_contact_list_remove (EMPATHY_CONTACT_LIST (manager),
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index ae84e3e15..ca49daec0 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -219,7 +219,7 @@ contact_list_view_dnd_get_contact_free (DndGetContactData *data)
}
static void
-contact_list_view_drag_got_contact (EmpathyTpContactFactory *factory,
+contact_list_view_drag_got_contact (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -293,7 +293,7 @@ contact_list_view_contact_drag_received (GtkWidget *view,
{
EmpathyContactListViewPriv *priv;
TpAccountManager *account_manager;
- EmpathyTpContactFactory *factory = NULL;
+ TpConnection *connection;
TpAccount *account;
DndGetContactData *data;
GtkTreePath *source_path;
@@ -342,20 +342,15 @@ contact_list_view_contact_drag_received (GtkWidget *view,
account = tp_account_manager_ensure_account (account_manager, account_id);
}
if (account) {
- TpConnection *connection;
-
connection = tp_account_get_connection (account);
- if (connection) {
- factory = empathy_tp_contact_factory_dup_singleton (connection);
- }
}
- g_object_unref (account_manager);
- if (!factory) {
- DEBUG ("Failed to get factory for account '%s'", account_id);
+ if (!connection) {
+ DEBUG ("Failed to get connection for account '%s'", account_id);
success = FALSE;
g_free (new_group);
g_free (old_group);
+ g_object_unref (account_manager);
return FALSE;
}
@@ -366,12 +361,12 @@ contact_list_view_contact_drag_received (GtkWidget *view,
/* FIXME: We should probably wait for the cb before calling
* gtk_drag_finish */
- empathy_tp_contact_factory_get_from_id (factory, contact_id,
+ empathy_tp_contact_factory_get_from_id (connection, contact_id,
contact_list_view_drag_got_contact,
data, (GDestroyNotify) contact_list_view_dnd_get_contact_free,
G_OBJECT (view));
g_strfreev (strv);
- g_object_unref (factory);
+ g_object_unref (account_manager);
return TRUE;
}
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index f977cce1c..613188293 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -77,7 +77,6 @@
typedef struct
{
- EmpathyTpContactFactory *factory;
EmpathyContactManager *manager;
EmpathyContact *contact;
EmpathyContactWidgetFlags flags;
@@ -957,8 +956,7 @@ contact_widget_entry_alias_focus_event_cb (GtkEditable *editable,
}
else
{
- empathy_tp_contact_factory_set_alias (information->factory,
- information->contact, alias);
+ empathy_tp_contact_factory_set_alias (information->contact, alias);
}
}
@@ -1060,9 +1058,7 @@ contact_widget_remove_contact (EmpathyContactWidget *information)
contact_widget_groups_notify_cb, information);
g_object_unref (information->contact);
- g_object_unref (information->factory);
information->contact = NULL;
- information->factory = NULL;
}
}
@@ -1170,13 +1166,7 @@ contact_widget_set_contact (EmpathyContactWidget *information,
contact_widget_remove_contact (information);
if (contact)
- {
- TpConnection *connection;
-
- connection = empathy_contact_get_connection (contact);
- information->contact = g_object_ref (contact);
- information->factory = empathy_tp_contact_factory_dup_singleton (connection);
- }
+ information->contact = g_object_ref (contact);
/* set the selected account to be the account this contact came from */
if (contact && EMPATHY_IS_ACCOUNT_CHOOSER (information->widget_account)) {
@@ -1194,7 +1184,7 @@ contact_widget_set_contact (EmpathyContactWidget *information,
}
static void
-contact_widget_got_contact_cb (EmpathyTpContactFactory *factory,
+contact_widget_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -1214,7 +1204,6 @@ contact_widget_got_contact_cb (EmpathyTpContactFactory *factory,
static void
contact_widget_change_contact (EmpathyContactWidget *information)
{
- EmpathyTpContactFactory *factory;
TpConnection *connection;
connection = empathy_account_chooser_get_connection (
@@ -1222,7 +1211,6 @@ contact_widget_change_contact (EmpathyContactWidget *information)
if (!connection)
return;
- factory = empathy_tp_contact_factory_dup_singleton (connection);
if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ID)
{
const gchar *id;
@@ -1230,20 +1218,18 @@ contact_widget_change_contact (EmpathyContactWidget *information)
id = gtk_entry_get_text (GTK_ENTRY (information->widget_id));
if (!EMP_STR_EMPTY (id))
{
- empathy_tp_contact_factory_get_from_id (factory, id,
+ empathy_tp_contact_factory_get_from_id (connection, id,
contact_widget_got_contact_cb, information, NULL,
G_OBJECT (information->vbox_contact_widget));
}
}
else
{
- empathy_tp_contact_factory_get_from_handle (factory,
+ empathy_tp_contact_factory_get_from_handle (connection,
tp_connection_get_self_handle (connection),
contact_widget_got_contact_cb, information, NULL,
G_OBJECT (information->vbox_contact_widget));
}
-
- g_object_unref (factory);
}
static gboolean
diff --git a/libempathy-gtk/empathy-new-call-dialog.c b/libempathy-gtk/empathy-new-call-dialog.c
index 1a171af5a..10d34f36c 100644
--- a/libempathy-gtk/empathy-new-call-dialog.c
+++ b/libempathy-gtk/empathy-new-call-dialog.c
@@ -69,7 +69,7 @@ struct _EmpathyNewCallDialogPriv {
*/
static void
-got_contact_cb (EmpathyTpContactFactory *factory,
+got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -93,7 +93,6 @@ static void
empathy_new_call_dialog_response (GtkDialog *dialog, int response_id)
{
EmpathyNewCallDialogPriv *priv = GET_PRIV (dialog);
- EmpathyTpContactFactory *factory;
gboolean video;
TpConnection *connection;
const gchar *contact_id;
@@ -109,12 +108,9 @@ empathy_new_call_dialog_response (GtkDialog *dialog, int response_id)
* we return from this function. */
video = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_video));
- factory = empathy_tp_contact_factory_dup_singleton (connection);
- empathy_tp_contact_factory_get_from_id (factory, contact_id,
+ empathy_tp_contact_factory_get_from_id (connection, contact_id,
got_contact_cb, GUINT_TO_POINTER (video), NULL, NULL);
- g_object_unref (factory);
-
out:
gtk_widget_destroy (GTK_WIDGET (dialog));
}
diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c
index 08013889e..f6cc0d6ef 100644
--- a/libempathy/empathy-dispatch-operation.c
+++ b/libempathy/empathy-dispatch-operation.c
@@ -185,7 +185,7 @@ empathy_dispatch_operation_invalidated (TpProxy *proxy, guint domain,
}
static void
-dispatcher_operation_got_contact_cb (EmpathyTpContactFactory *factory,
+dispatcher_operation_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -219,7 +219,6 @@ dispatch_operation_connection_ready (TpConnection *connection,
{
EmpathyDispatchOperation *self = EMPATHY_DISPATCH_OPERATION (user_data);
EmpathyDispatchOperationPriv *priv = GET_PRIV (self);
- EmpathyTpContactFactory *factory;
TpHandle handle;
if (error != NULL)
@@ -231,12 +230,9 @@ dispatch_operation_connection_ready (TpConnection *connection,
handle = tp_channel_get_handle (priv->channel, NULL);
- factory = empathy_tp_contact_factory_dup_singleton (priv->connection);
-
- empathy_tp_contact_factory_get_from_handle (factory, handle,
+ empathy_tp_contact_factory_get_from_handle (priv->connection, handle,
dispatcher_operation_got_contact_cb, NULL, NULL, G_OBJECT (self));
- g_object_unref (factory);
out:
g_object_unref (self);
}
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index e476fc671..c8943c9df 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -1357,7 +1357,7 @@ typedef struct
} ChatWithContactIdData;
static void
-dispatcher_chat_with_contact_id_cb (EmpathyTpContactFactory *factory,
+dispatcher_chat_with_contact_id_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -1392,23 +1392,19 @@ empathy_dispatcher_chat_with_contact_id (TpConnection *connection,
gpointer user_data)
{
EmpathyDispatcher *self;
- EmpathyTpContactFactory *factory;
ChatWithContactIdData *data;
g_return_if_fail (TP_IS_CONNECTION (connection));
g_return_if_fail (!EMP_STR_EMPTY (contact_id));
self = empathy_dispatcher_dup_singleton ();
- factory = empathy_tp_contact_factory_dup_singleton (connection);
data = g_slice_new0 (ChatWithContactIdData);
data->dispatcher = self;
data->callback = callback;
data->user_data = user_data;
data->timestamp = timestamp;
- empathy_tp_contact_factory_get_from_id (factory, contact_id,
+ empathy_tp_contact_factory_get_from_id (connection, contact_id,
dispatcher_chat_with_contact_id_cb, data, NULL, NULL);
-
- g_object_unref (factory);
}
static void
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index bbc99f61a..0140fc3cc 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -1203,7 +1203,7 @@ out:
}
static void
-contact_factory_contact_cb (EmpathyTpContactFactory *factory,
+contact_factory_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -1238,7 +1238,6 @@ channel_get_all_properties_cb (TpProxy *proxy,
CallbacksData *cb_data = user_data;
EmpathyFTHandler *handler = EMPATHY_FT_HANDLER (weak_object);
EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
- EmpathyTpContactFactory *c_factory;
TpHandle c_handle;
if (error != NULL)
@@ -1273,14 +1272,11 @@ channel_get_all_properties_cb (TpProxy *proxy,
priv->description = g_value_dup_string (
g_hash_table_lookup (properties, "Description"));
- c_factory = empathy_tp_contact_factory_dup_singleton
- (tp_channel_borrow_connection (TP_CHANNEL (proxy)));
c_handle = tp_channel_get_handle (TP_CHANNEL (proxy), NULL);
- empathy_tp_contact_factory_get_from_handle (c_factory, c_handle,
+ empathy_tp_contact_factory_get_from_handle (
+ tp_channel_borrow_connection (TP_CHANNEL (proxy)), c_handle,
contact_factory_contact_cb, cb_data, callbacks_data_free,
G_OBJECT (handler));
-
- g_object_unref (c_factory);
}
/* public methods */
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c
index 32a09255f..78ee6d005 100644
--- a/libempathy/empathy-tp-call.c
+++ b/libempathy/empathy-tp-call.c
@@ -264,7 +264,7 @@ tp_call_request_streams_for_capabilities (EmpathyTpCall *call,
}
static void
-tp_call_got_contact_cb (EmpathyTpContactFactory *factory,
+tp_call_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -303,15 +303,12 @@ tp_call_update_status (EmpathyTpCall *call)
{
if (priv->contact == NULL && iter.element != self_handle)
{
- EmpathyTpContactFactory *factory;
TpConnection *connection;
/* We found the remote contact */
connection = tp_channel_borrow_connection (priv->channel);
- factory = empathy_tp_contact_factory_dup_singleton (connection);
- empathy_tp_contact_factory_get_from_handle (factory, iter.element,
+ empathy_tp_contact_factory_get_from_handle (connection, iter.element,
tp_call_got_contact_cb, NULL, NULL, G_OBJECT (call));
- g_object_unref (factory);
}
if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING &&
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index cad014df3..485510214 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -42,7 +42,7 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpChat)
typedef struct {
gboolean dispose_has_run;
- EmpathyTpContactFactory *factory;
+ TpConnection *connection;
EmpathyContactMonitor *contact_monitor;
EmpathyContact *user;
EmpathyContact *remote_contact;
@@ -132,14 +132,12 @@ tp_chat_add (EmpathyContactList *list,
-1, &handles, NULL, NULL, NULL, NULL, NULL);
} else if (priv->can_upgrade_to_muc) {
EmpathyDispatcher *dispatcher;
- TpConnection *connection;
GHashTable *props;
const char *object_path;
GPtrArray channels = { (gpointer *) &object_path, 1 };
const char *invitees[2] = { NULL, };
dispatcher = empathy_dispatcher_dup_singleton ();
- connection = tp_channel_borrow_connection (priv->channel);
invitees[0] = empathy_contact_get_id (contact);
object_path = tp_proxy_get_object_path (priv->channel);
@@ -159,7 +157,7 @@ tp_chat_add (EmpathyContactList *list,
/* Although this is a MUC, it's anonymous, so CreateChannel is
* valid.
* props now belongs to EmpathyDispatcher, don't free it */
- empathy_dispatcher_create_channel (dispatcher, connection,
+ empathy_dispatcher_create_channel (dispatcher, priv->connection,
props, EMPATHY_DISPATCHER_NON_USER_ACTION, NULL, NULL);
g_object_unref (dispatcher);
@@ -243,7 +241,7 @@ tp_chat_emit_queued_messages (EmpathyTpChat *chat)
}
static void
-tp_chat_got_sender_cb (EmpathyTpContactFactory *factory,
+tp_chat_got_sender_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer message,
@@ -291,7 +289,7 @@ tp_chat_build_message (EmpathyTpChat *chat,
empathy_message_set_sender (message, priv->user);
tp_chat_emit_queued_messages (chat);
} else {
- empathy_tp_contact_factory_get_from_handle (priv->factory,
+ empathy_tp_contact_factory_get_from_handle (priv->connection,
from_handle,
tp_chat_got_sender_cb,
message, NULL, G_OBJECT (chat));
@@ -412,7 +410,7 @@ typedef struct {
} StateChangedData;
static void
-tp_chat_state_changed_got_contact_cb (EmpathyTpContactFactory *factory,
+tp_chat_state_changed_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -442,7 +440,7 @@ tp_chat_state_changed_cb (TpChannel *channel,
{
EmpathyTpChatPriv *priv = GET_PRIV (chat);
- empathy_tp_contact_factory_get_from_handle (priv->factory, handle,
+ empathy_tp_contact_factory_get_from_handle (priv->connection, handle,
tp_chat_state_changed_got_contact_cb, GUINT_TO_POINTER (state),
NULL, chat);
}
@@ -758,6 +756,10 @@ tp_chat_dispose (GObject *object)
priv->dispose_has_run = TRUE;
+ if (priv->connection != NULL)
+ g_object_unref (priv->connection);
+ priv->connection = NULL;
+
if (priv->channel != NULL) {
g_signal_handlers_disconnect_by_func (priv->channel,
tp_chat_invalidated_cb, self);
@@ -769,10 +771,6 @@ tp_chat_dispose (GObject *object)
g_object_unref (priv->remote_contact);
priv->remote_contact = NULL;
- if (priv->factory != NULL)
- g_object_unref (priv->factory);
- priv->factory = NULL;
-
if (priv->user != NULL)
g_object_unref (priv->user);
priv->user = NULL;
@@ -931,7 +929,7 @@ tp_chat_update_remote_contact (EmpathyTpChat *chat)
}
static void
-tp_chat_got_added_contacts_cb (EmpathyTpContactFactory *factory,
+tp_chat_got_added_contacts_cb (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
guint n_failed,
@@ -1025,7 +1023,7 @@ contact_rename_data_free (ContactRenameData* data)
}
static void
-tp_chat_got_renamed_contacts_cb (EmpathyTpContactFactory *factory,
+tp_chat_got_renamed_contacts_cb (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
guint n_failed,
@@ -1107,7 +1105,7 @@ tp_chat_group_members_changed_cb (TpChannel *self,
old_handle = g_array_index (removed, guint, 0);
rename_data = contact_rename_data_new (old_handle, reason, message);
- empathy_tp_contact_factory_get_from_handles (priv->factory,
+ empathy_tp_contact_factory_get_from_handles (priv->connection,
added->len, (TpHandle *) added->data,
tp_chat_got_renamed_contacts_cb,
rename_data, (GDestroyNotify) contact_rename_data_free,
@@ -1141,7 +1139,7 @@ tp_chat_group_members_changed_cb (TpChannel *self,
/* Request added contacts */
if (added->len > 0) {
- empathy_tp_contact_factory_get_from_handles (priv->factory,
+ empathy_tp_contact_factory_get_from_handles (priv->connection,
added->len, (TpHandle *) added->data,
tp_chat_got_added_contacts_cb, NULL, NULL,
G_OBJECT (chat));
@@ -1155,7 +1153,7 @@ tp_chat_group_members_changed_cb (TpChannel *self,
}
static void
-tp_chat_got_remote_contact_cb (EmpathyTpContactFactory *factory,
+tp_chat_got_remote_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -1176,7 +1174,7 @@ tp_chat_got_remote_contact_cb (EmpathyTpContactFactory *factory,
}
static void
-tp_chat_got_self_contact_cb (EmpathyTpContactFactory *factory,
+tp_chat_got_self_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -1240,15 +1238,13 @@ tp_chat_constructor (GType type,
{
GObject *chat;
EmpathyTpChatPriv *priv;
- TpConnection *connection;
TpHandle handle;
chat = G_OBJECT_CLASS (empathy_tp_chat_parent_class)->constructor (type, n_props, props);
priv = GET_PRIV (chat);
- connection = tp_channel_borrow_connection (priv->channel);
- priv->factory = empathy_tp_contact_factory_dup_singleton (connection);
+ priv->connection = g_object_ref (tp_channel_borrow_connection (priv->channel));
g_signal_connect (priv->channel, "invalidated",
G_CALLBACK (tp_chat_invalidated_cb),
chat);
@@ -1260,14 +1256,14 @@ tp_chat_constructor (GType type,
/* Get self contact from the group's self handle */
handle = tp_channel_group_get_self_handle (priv->channel);
- empathy_tp_contact_factory_get_from_handle (priv->factory,
+ empathy_tp_contact_factory_get_from_handle (priv->connection,
handle, tp_chat_got_self_contact_cb,
NULL, NULL, chat);
/* Get initial member contacts */
members = tp_channel_group_get_members (priv->channel);
handles = tp_intset_to_array (members);
- empathy_tp_contact_factory_get_from_handles (priv->factory,
+ empathy_tp_contact_factory_get_from_handles (priv->connection,
handles->len, (TpHandle *) handles->data,
tp_chat_got_added_contacts_cb, NULL, NULL, chat);
@@ -1280,19 +1276,19 @@ tp_chat_constructor (GType type,
GList *list, *ptr;
/* Get the self contact from the connection's self handle */
- handle = tp_connection_get_self_handle (connection);
- empathy_tp_contact_factory_get_from_handle (priv->factory,
+ handle = tp_connection_get_self_handle (priv->connection);
+ empathy_tp_contact_factory_get_from_handle (priv->connection,
handle, tp_chat_got_self_contact_cb,
NULL, NULL, chat);
/* Get the remote contact */
handle = tp_channel_get_handle (priv->channel, NULL);
- empathy_tp_contact_factory_get_from_handle (priv->factory,
+ empathy_tp_contact_factory_get_from_handle (priv->connection,
handle, tp_chat_got_remote_contact_cb,
NULL, NULL, chat);
list = empathy_dispatcher_find_requestable_channel_classes (
- dispatcher, connection,
+ dispatcher, priv->connection,
tp_channel_get_channel_type (priv->channel),
TP_UNKNOWN_HANDLE_TYPE, NULL);
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index f8d897185..a77bb10b4 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -41,7 +41,6 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpContactList)
typedef struct {
- EmpathyTpContactFactory *factory;
TpConnection *connection;
TpChannel *publish;
@@ -372,7 +371,7 @@ tp_contact_list_group_add (EmpathyTpContactList *list,
}
static void
-got_added_members_cb (EmpathyTpContactFactory *factory,
+got_added_members_cb (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
guint n_failed,
@@ -427,7 +426,7 @@ add_to_members (EmpathyTpContactList *list,
}
if (request->len > 0) {
- empathy_tp_contact_factory_get_from_handles (priv->factory,
+ empathy_tp_contact_factory_get_from_handles (priv->connection,
request->len, (TpHandle *) request->data,
got_added_members_cb, NULL, NULL, G_OBJECT (list));
}
@@ -436,7 +435,7 @@ add_to_members (EmpathyTpContactList *list,
}
static void
-tp_contact_list_got_local_pending_cb (EmpathyTpContactFactory *factory,
+tp_contact_list_got_local_pending_cb (TpConnection *connection,
guint n_contacts,
EmpathyContact * const * contacts,
guint n_failed,
@@ -562,7 +561,7 @@ tp_contact_list_publish_group_members_changed_cb (TpChannel *channel,
/* Those contacts want our presence, auto accept those that are already
* member, otherwise add in pendings. */
if (local_pending->len > 0) {
- empathy_tp_contact_factory_get_from_handles (priv->factory,
+ empathy_tp_contact_factory_get_from_handles (priv->connection,
local_pending->len, (TpHandle *) local_pending->data,
tp_contact_list_got_local_pending_cb, NULL, NULL,
G_OBJECT (list));
@@ -726,10 +725,6 @@ tp_contact_list_finalize (GObject *object)
g_object_unref (priv->connection);
}
- if (priv->factory) {
- g_object_unref (priv->factory);
- }
-
g_hash_table_iter_init (&iter, priv->groups);
while (g_hash_table_iter_next (&iter, NULL, &channel)) {
g_signal_handlers_disconnect_by_func (channel,
@@ -920,8 +915,6 @@ tp_contact_list_constructed (GObject *list)
{
EmpathyTpContactListPriv *priv = GET_PRIV (list);
- priv->factory = empathy_tp_contact_factory_dup_singleton (priv->connection);
-
/* call GetAliasFlags */
if (tp_proxy_has_interface_by_id (priv->connection,
TP_IFACE_QUARK_CONNECTION_INTERFACE_ALIASING)) {
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 598f483ab..40c461488 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -1257,7 +1257,7 @@ contact_avatar_changed_cb (EmpathyContact *contact,
}
static void
-empathy_call_window_got_self_contact_cb (EmpathyTpContactFactory *factory,
+empathy_call_window_got_self_contact_cb (TpConnection *connection,
EmpathyContact *contact, const GError *error, gpointer user_data,
GObject *weak_object)
{
@@ -1282,7 +1282,6 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self,
if (priv->contact != NULL)
{
TpConnection *connection;
- EmpathyTpContactFactory *factory;
set_window_title (self);
@@ -1294,12 +1293,9 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self,
/* Retreiving the self avatar */
connection = empathy_contact_get_connection (priv->contact);
- factory = empathy_tp_contact_factory_dup_singleton (connection);
- empathy_tp_contact_factory_get_from_handle (factory,
+ empathy_tp_contact_factory_get_from_handle (connection,
tp_connection_get_self_handle (connection),
empathy_call_window_got_self_contact_cb, self, NULL, G_OBJECT (self));
-
- g_object_unref (factory);
}
else
{
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index d47e942f5..94717f3c8 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -856,7 +856,7 @@ chat_window_contacts_toggled_cb (GtkToggleAction *toggle_action,
}
static void
-got_contact_cb (EmpathyTpContactFactory *factory,
+got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -900,7 +900,6 @@ chat_window_invite_participant_activate_cb (GtkAction *action,
if (response == GTK_RESPONSE_ACCEPT) {
TpConnection *connection;
- EmpathyTpContactFactory *factory;
const char *id;
id = empathy_contact_selector_dialog_get_selected (
@@ -908,12 +907,8 @@ chat_window_invite_participant_activate_cb (GtkAction *action,
if (EMP_STR_EMPTY (id)) goto out;
connection = tp_channel_borrow_connection (channel);
- factory = empathy_tp_contact_factory_dup_singleton (connection);
-
- empathy_tp_contact_factory_get_from_id (factory, id,
+ empathy_tp_contact_factory_get_from_id (connection, id,
got_contact_cb, tp_chat, NULL, NULL);
-
- g_object_unref (factory);
}
out:
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index a7283594f..025eec564 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -624,7 +624,7 @@ event_room_channel_process_func (EventPriv *event)
}
static void
-event_manager_muc_invite_got_contact_cb (EmpathyTpContactFactory *factory,
+event_manager_muc_invite_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -665,7 +665,7 @@ event_manager_muc_invite_got_contact_cb (EmpathyTpContactFactory *factory,
}
static void
-event_manager_ft_got_contact_cb (EmpathyTpContactFactory *factory,
+event_manager_ft_got_contact_cb (TpConnection *connection,
EmpathyContact *contact,
const GError *error,
gpointer user_data,
@@ -730,20 +730,16 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
channel, self_handle, &inviter, NULL, NULL))
{
/* We are invited to a room */
- EmpathyTpContactFactory *factory;
TpConnection *connection;
DEBUG ("Have been invited to %s. Ask user if he wants to accept",
tp_channel_get_identifier (channel));
connection = empathy_tp_chat_get_connection (tp_chat);
- factory = empathy_tp_contact_factory_dup_singleton (connection);
-
- empathy_tp_contact_factory_get_from_handle (factory,
+ empathy_tp_contact_factory_get_from_handle (connection,
inviter, event_manager_muc_invite_got_contact_cb,
approval, NULL, G_OBJECT (manager));
- g_object_unref (factory);
return;
}
@@ -781,17 +777,13 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
TpChannel *channel;
TpConnection *connection;
TpHandle handle;
- EmpathyTpContactFactory *factory;
channel = empathy_dispatch_operation_get_channel (operation);
handle = tp_channel_get_handle (channel, NULL);
connection = tp_channel_borrow_connection (channel);
- factory = empathy_tp_contact_factory_dup_singleton (connection);
- empathy_tp_contact_factory_get_from_handle (factory, handle,
+ empathy_tp_contact_factory_get_from_handle (connection, handle,
event_manager_ft_got_contact_cb, approval, NULL, G_OBJECT (manager));
-
- g_object_unref (factory);
}
else
{