aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-chat-window.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-06 18:46:37 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-18 21:40:09 +0800
commit08ba02749235ae95a586fa930690f921e74bda35 (patch)
tree7f9d29596090ce127566119479066a69bdfed010 /src/empathy-chat-window.c
parent9999bf6834a4c2e592a39dcbc9b8dffc5bee9bd5 (diff)
downloadgsoc2013-empathy-08ba02749235ae95a586fa930690f921e74bda35.tar
gsoc2013-empathy-08ba02749235ae95a586fa930690f921e74bda35.tar.gz
gsoc2013-empathy-08ba02749235ae95a586fa930690f921e74bda35.tar.bz2
gsoc2013-empathy-08ba02749235ae95a586fa930690f921e74bda35.tar.lz
gsoc2013-empathy-08ba02749235ae95a586fa930690f921e74bda35.tar.xz
gsoc2013-empathy-08ba02749235ae95a586fa930690f921e74bda35.tar.zst
gsoc2013-empathy-08ba02749235ae95a586fa930690f921e74bda35.zip
invite-dialog: display a individual view rather than forcing user to type the full ID of the contact (#646705)
Diffstat (limited to 'src/empathy-chat-window.c')
-rw-r--r--src/empathy-chat-window.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index d8a75cb0c..e96be3831 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -976,24 +976,6 @@ chat_window_contacts_toggled_cb (GtkToggleAction *toggle_action,
}
static void
-got_contact_cb (TpConnection *connection,
- EmpathyContact *contact,
- const GError *error,
- gpointer user_data,
- GObject *object)
-{
- EmpathyTpChat *tp_chat = EMPATHY_TP_CHAT (user_data);
-
- if (error != NULL) {
- DEBUG ("Failed: %s", error->message);
- return;
- } else {
- empathy_contact_list_add (EMPATHY_CONTACT_LIST (tp_chat),
- contact, _("Inviting you to this room"));
- }
-}
-
-static void
chat_window_invite_participant_activate_cb (GtkAction *action,
EmpathyChatWindow *window)
{
@@ -1013,22 +995,25 @@ chat_window_invite_participant_activate_cb (GtkAction *action,
account = empathy_chat_get_account (priv->current_chat);
dialog = empathy_invite_participant_dialog_new (
- GTK_WINDOW (priv->dialog), account);
+ GTK_WINDOW (priv->dialog), tp_chat);
gtk_widget_show (dialog);
response = gtk_dialog_run (GTK_DIALOG (dialog));
if (response == GTK_RESPONSE_ACCEPT) {
- TpConnection *connection;
- const char *id;
+ TpContact *tp_contact;
+ EmpathyContact *contact;
+
+ tp_contact = empathy_invite_participant_dialog_get_selected (
+ EMPATHY_INVITE_PARTICIPANT_DIALOG (dialog));
+ if (tp_contact == NULL) goto out;
- id = empathy_contact_selector_dialog_get_selected (
- EMPATHY_CONTACT_SELECTOR_DIALOG (dialog), NULL, NULL);
- if (EMP_STR_EMPTY (id)) goto out;
+ contact = empathy_contact_dup_from_tp_contact (tp_contact);
+
+ empathy_contact_list_add (EMPATHY_CONTACT_LIST (tp_chat),
+ contact, _("Inviting you to this room"));
- connection = tp_channel_borrow_connection (channel);
- empathy_tp_contact_factory_get_from_id (connection, id,
- got_contact_cb, tp_chat, NULL, NULL);
+ g_object_unref (contact);
}
out: