aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2010-05-10 18:36:28 +0800
committerXavier Claessens <xclaesse@gmail.com>2010-05-26 17:17:47 +0800
commitb8ff75d21c1be60e6df472a35599a9e22046a92b (patch)
treefcaa7453e65ac310e4a3c0f854bcb8b588722863 /libempathy-gtk
parent696bd076bbd431aad122c66cadfb6ec3f5ff1762 (diff)
downloadgsoc2013-empathy-b8ff75d21c1be60e6df472a35599a9e22046a92b.tar
gsoc2013-empathy-b8ff75d21c1be60e6df472a35599a9e22046a92b.tar.gz
gsoc2013-empathy-b8ff75d21c1be60e6df472a35599a9e22046a92b.tar.bz2
gsoc2013-empathy-b8ff75d21c1be60e6df472a35599a9e22046a92b.tar.lz
gsoc2013-empathy-b8ff75d21c1be60e6df472a35599a9e22046a92b.tar.xz
gsoc2013-empathy-b8ff75d21c1be60e6df472a35599a9e22046a92b.tar.zst
gsoc2013-empathy-b8ff75d21c1be60e6df472a35599a9e22046a92b.zip
Port to new EmpathyTpContactFactory API
Diffstat (limited to 'libempathy-gtk')
-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
4 files changed, 16 insertions, 45 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));
}