aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog20
-rw-r--r--mail/mail-config.c7
-rw-r--r--mail/mail-config.h2
-rw-r--r--mail/mail-mt.c33
-rw-r--r--mail/mail-mt.h2
-rw-r--r--mail/mail-session.c2
6 files changed, 61 insertions, 5 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 83f5042dae..0efb8d7bc5 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,23 @@
+2001-07-25 Peter Williams <peterw@ximian.com>
+
+ * mail-mt.c (mail_get_password): Now take a CamelService parameter
+ (as passed by Camel). Allows us to have a "remember password"
+ checkbox that is set correctly and whose settings can be
+ propagated back to the proper MailConfigService.
+ (do_get_pass): Add a checkbutton allowing the user to change
+ whether the password is remembered or not.
+ (pass_got): Apply the setting of the "remember password"
+ checkbutton (if not cancelled.)
+
+ * mail-mt.h: Update the prototype here.
+
+ * mail-config.c (mail_config_service_set_save_passwd): New function,
+ pretty bland.
+
+ * mail-config.h: Prototype our bland new function. (Get it? It's a pun!)
+
+ * mail-session.c (get_password): Pass the service as well.
+
2001-07-25 Jeffrey Stedfast <fejj@ximian.com>
* mail-account-gui.c (build_auth_menu): Now takes a
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 9448b3372c..0694878022 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1449,6 +1449,13 @@ mail_config_get_sources (void)
return sources;
}
+void
+mail_config_service_set_save_passwd (MailConfigService *service, gboolean save_passwd)
+{
+ service->save_passwd = save_passwd;
+ mail_config_write (); /*bleah*/
+}
+
char *
mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
{
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 551d6a81ff..d73e5004c5 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -162,6 +162,8 @@ void mail_config_set_message_display_style (MailConfigDisplayS
const char *mail_config_get_default_charset (void);
void mail_config_set_default_charset (const char *charset);
+void mail_config_service_set_save_passwd (MailConfigService *service, gboolean save_passwd);
+
const MailConfigAccount *mail_config_get_default_account (void);
gint mail_config_get_default_account_num (void);
const MailConfigAccount *mail_config_get_account_by_name (const char *account_name);
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 7dc47a37bc..84029cba5e 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -11,6 +11,7 @@
#include <gtk/gtkentry.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkwidget.h>
+#include <gtk/gtkcheckbutton.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-dialog.h>
@@ -25,6 +26,8 @@
#include "evolution-activity-client.h"
+#include "mail-config.h"
+#include "camel/camel-url.h"
#include "mail-mt.h"
/*#define MALLOC_CHECK*/
@@ -387,6 +390,8 @@ struct _pass_msg {
const char *prompt;
int secret;
char *result;
+ char *service_url;
+ GtkWidget *tb;
};
/* libgnomeui's idea of an api/gui is very weird ... hence this dumb hack */
@@ -400,8 +405,15 @@ static void pass_got(char *string, void *data)
{
struct _pass_msg *m = data;
- if (string)
+ if (string) {
+ MailConfigAccount *mca;
+
m->result = g_strdup (string);
+
+ mca = mail_config_get_account_by_source_url (m->service_url);
+ mail_config_service_set_save_passwd (mca->source,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (m->tb)));
+ }
}
static void
@@ -409,10 +421,22 @@ do_get_pass(struct _mail_msg *mm)
{
struct _pass_msg *m = (struct _pass_msg *)mm;
GtkWidget *dialogue;
+ GtkWidget *tb;
+ MailConfigAccount *mca;
/* this api is just awful ... hence the hacks */
dialogue = gnome_request_dialog(m->secret, m->prompt, NULL,
0, pass_got, m, NULL);
+
+ /* Remember the password? */
+ mca = mail_config_get_account_by_source_url (m->service_url);
+ tb = gtk_check_button_new_with_label (_("Remember this password"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tb), mca->source->save_passwd);
+ gtk_widget_show (tb);
+ gtk_box_pack_end (GTK_BOX (GNOME_DIALOG (dialogue)->vbox),
+ tb, TRUE, FALSE, 0);
+ m->tb = tb;
+
e_container_foreach_leaf((GtkContainer *)dialogue, focus_on_entry, NULL);
/* hrm, we can't run this async since the gui_port from which we're called
@@ -439,7 +463,7 @@ struct _mail_msg_op get_pass_op = {
/* returns the password, or NULL if cancelled */
char *
-mail_get_password(const char *prompt, gboolean secret)
+mail_get_password(CamelService *service, const char *prompt, gboolean secret)
{
char *ret;
struct _pass_msg *m, *r;
@@ -451,6 +475,8 @@ mail_get_password(const char *prompt, gboolean secret)
m->prompt = prompt;
m->secret = secret;
+ m->service_url = camel_url_to_string (service->url,
+ CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS);
if (pthread_self() == mail_gui_thread) {
do_get_pass((struct _mail_msg *)m);
@@ -469,7 +495,8 @@ mail_get_password(const char *prompt, gboolean secret)
g_assert(r == m);
ret = m->result;
-
+
+ g_free (m->service_url);
mail_msg_free(m);
e_msgport_destroy(pass_reply);
diff --git a/mail/mail-mt.h b/mail/mail-mt.h
index 81e6fe9869..e24a359b27 100644
--- a/mail/mail-mt.h
+++ b/mail/mail-mt.h
@@ -58,7 +58,7 @@ void mail_msg_cancel(unsigned int msgid);
void mail_msg_wait(unsigned int msgid);
/* request a string/password */
-char *mail_get_password (const char *prompt, gboolean secret);
+char *mail_get_password (CamelService *service, const char *prompt, gboolean secret);
/* present information and get an ok (or possibly cancel)
* "type" is as for gnome_message_box_new();
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 9a3e519d5e..62dc8e25a8 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -164,7 +164,7 @@ get_password (CamelSession *session, const char *prompt, gboolean secret,
}
if (!mail_session->interaction_enabled ||
- !(ans = mail_get_password (prompt, secret))) {
+ !(ans = mail_get_password (service, prompt, secret))) {
g_free (key);
camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
_("User canceled operation."));