aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-mt.c
diff options
context:
space:
mode:
authorPeter Williams <peterw@ximian.com>2001-07-26 03:05:08 +0800
committerPeter Williams <peterw@src.gnome.org>2001-07-26 03:05:08 +0800
commit56d33b7e476a1b2a2c4fb7e947c69e1087fa13d2 (patch)
treebd2e0d1749bd71e72db1a808e7a9bc9779e9c214 /mail/mail-mt.c
parent2061924fd02b4e7f3bed5d444d41b616f268d916 (diff)
downloadgsoc2013-evolution-56d33b7e476a1b2a2c4fb7e947c69e1087fa13d2.tar
gsoc2013-evolution-56d33b7e476a1b2a2c4fb7e947c69e1087fa13d2.tar.gz
gsoc2013-evolution-56d33b7e476a1b2a2c4fb7e947c69e1087fa13d2.tar.bz2
gsoc2013-evolution-56d33b7e476a1b2a2c4fb7e947c69e1087fa13d2.tar.lz
gsoc2013-evolution-56d33b7e476a1b2a2c4fb7e947c69e1087fa13d2.tar.xz
gsoc2013-evolution-56d33b7e476a1b2a2c4fb7e947c69e1087fa13d2.tar.zst
gsoc2013-evolution-56d33b7e476a1b2a2c4fb7e947c69e1087fa13d2.zip
Now take a CamelService parameter (as passed by Camel). Allows us to have
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. svn path=/trunk/; revision=11408
Diffstat (limited to 'mail/mail-mt.c')
-rw-r--r--mail/mail-mt.c33
1 files changed, 30 insertions, 3 deletions
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);