[empathy] empathy_contact_selector_dialog_get_selected: allow to get the account as well



commit 9db18eddff2b697256b6fcde7bbcb57bcef5c48d
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Aug 10 16:58:45 2010 +0200

    empathy_contact_selector_dialog_get_selected: allow to get the account as well

 libempathy-gtk/empathy-contact-selector-dialog.c |   15 +++++++++++++--
 libempathy-gtk/empathy-contact-selector-dialog.h |    3 ++-
 libempathy-gtk/empathy-new-call-dialog.c         |    2 +-
 libempathy-gtk/empathy-new-message-dialog.c      |    2 +-
 src/empathy-chat-window.c                        |    2 +-
 5 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-selector-dialog.c b/libempathy-gtk/empathy-contact-selector-dialog.c
index b04e56d..47a8402 100644
--- a/libempathy-gtk/empathy-contact-selector-dialog.c
+++ b/libempathy-gtk/empathy-contact-selector-dialog.c
@@ -492,7 +492,8 @@ empathy_contact_selector_dialog_class_init (
 const gchar *
 empathy_contact_selector_dialog_get_selected (
     EmpathyContactSelectorDialog *self,
-    TpConnection **connection)
+    TpConnection **connection,
+    TpAccount **account)
 {
   EmpathyContactSelectorDialogPriv *priv;
   const char *id;
@@ -501,7 +502,7 @@ empathy_contact_selector_dialog_get_selected (
 
   priv = GET_PRIV (self);
 
-  if (connection)
+  if (connection != NULL)
     {
       if (priv->show_account_chooser)
         *connection = empathy_account_chooser_get_connection (
@@ -510,6 +511,16 @@ empathy_contact_selector_dialog_get_selected (
         *connection = NULL;
     }
 
+  if (account != NULL)
+    {
+      if (priv->show_account_chooser)
+        *account = empathy_account_chooser_get_account (
+            EMPATHY_ACCOUNT_CHOOSER (priv->account_chooser));
+      else
+        *account = NULL;
+    }
+
+
   id = gtk_entry_get_text (GTK_ENTRY (priv->entry_id));
   return id;
 }
diff --git a/libempathy-gtk/empathy-contact-selector-dialog.h b/libempathy-gtk/empathy-contact-selector-dialog.h
index 318a9bc..402f1c7 100644
--- a/libempathy-gtk/empathy-contact-selector-dialog.h
+++ b/libempathy-gtk/empathy-contact-selector-dialog.h
@@ -55,7 +55,8 @@ struct _EmpathyContactSelectorDialog {
 GType empathy_contact_selector_dialog_get_type (void);
 const gchar *empathy_contact_selector_dialog_get_selected (
     EmpathyContactSelectorDialog *self,
-    TpConnection **connection);
+    TpConnection **connection,
+    TpAccount **account);
 void empathy_contact_selector_dialog_set_show_account_chooser (
     EmpathyContactSelectorDialog *self,
     gboolean show_account_chooser);
diff --git a/libempathy-gtk/empathy-new-call-dialog.c b/libempathy-gtk/empathy-new-call-dialog.c
index 27ec3a2..b92cf50 100644
--- a/libempathy-gtk/empathy-new-call-dialog.c
+++ b/libempathy-gtk/empathy-new-call-dialog.c
@@ -107,7 +107,7 @@ empathy_new_call_dialog_response (GtkDialog *dialog, int response_id)
   if (response_id != GTK_RESPONSE_ACCEPT) goto out;
 
   contact_id = empathy_contact_selector_dialog_get_selected (
-      EMPATHY_CONTACT_SELECTOR_DIALOG (dialog), &connection);
+      EMPATHY_CONTACT_SELECTOR_DIALOG (dialog), &connection, NULL);
 
   if (EMP_STR_EMPTY (contact_id) || connection == NULL) goto out;
 
diff --git a/libempathy-gtk/empathy-new-message-dialog.c b/libempathy-gtk/empathy-new-message-dialog.c
index 5094385..21480a7 100644
--- a/libempathy-gtk/empathy-new-message-dialog.c
+++ b/libempathy-gtk/empathy-new-message-dialog.c
@@ -66,7 +66,7 @@ empathy_new_message_dialog_response (GtkDialog *dialog, int response_id)
   if (response_id != GTK_RESPONSE_ACCEPT) goto out;
 
   contact_id = empathy_contact_selector_dialog_get_selected (
-      EMPATHY_CONTACT_SELECTOR_DIALOG (dialog), &connection);
+      EMPATHY_CONTACT_SELECTOR_DIALOG (dialog), &connection, NULL);
 
   if (EMP_STR_EMPTY (contact_id) || connection == NULL) goto out;
 
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 8c2eed6..e80d382 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -934,7 +934,7 @@ chat_window_invite_participant_activate_cb (GtkAction         *action,
 		const char *id;
 
 		id = empathy_contact_selector_dialog_get_selected (
-				EMPATHY_CONTACT_SELECTOR_DIALOG (dialog), NULL);
+				EMPATHY_CONTACT_SELECTOR_DIALOG (dialog), NULL, NULL);
 		if (EMP_STR_EMPTY (id)) goto out;
 
 		connection = tp_channel_borrow_connection (channel);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]