[empathy: 7/10] chat: save room passwords in the keyring if requested



commit 935d2f62ebc72edfe86ccf4449b7d95ef758bb74
Author: Jonny Lamb <jonnylamb gnome org>
Date:   Fri Jan 28 16:44:56 2011 +0000

    chat: save room passwords in the keyring if requested
    
    Signed-off-by: Jonny Lamb <jonnylamb gnome org>

 libempathy-gtk/empathy-chat.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 455fb0e..eb73253 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -2973,6 +2973,7 @@ typedef struct
 	GtkWidget *label;
 	GtkWidget *entry;
 	GtkWidget *spinner;
+	gchar *password;
 } PasswordData;
 
 static void
@@ -2994,12 +2995,18 @@ remember_password_infobar_response_cb (GtkWidget *info_bar,
 				       gint response_id,
 				       PasswordData *data)
 {
+	EmpathyChatPriv *priv = GET_PRIV (data->self);
+
 	if (response_id == GTK_RESPONSE_OK) {
 		DEBUG ("Saving room password");
-		/* TODO: implement this */
+		empathy_keyring_set_room_password_async (priv->account,
+							 empathy_tp_chat_get_id (priv->tp_chat),
+							 data->password,
+							 NULL, NULL);
 	}
 
 	gtk_widget_destroy (info_bar);
+	g_free (data->password);
 	g_slice_free (PasswordData, data);
 }
 
@@ -3014,6 +3021,9 @@ chat_prompt_to_save_password (EmpathyChat *self,
 	GtkWidget *alig;
 	GtkWidget *button;
 
+	/* save the password in case it needs to be saved */
+	data->password = g_strdup (gtk_entry_get_text (GTK_ENTRY (data->entry)));
+
 	/* Remove all previous widgets */
 	content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (data->info_bar));
 	gtk_container_forall (GTK_CONTAINER (content_area),



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