aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-08-30 12:31:52 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-08-30 12:31:52 +0800
commit5c9634578c184e4981b2d0d91aad695492e16bcc (patch)
tree800353bb95d41641a918fbd68eb1cf5f87bea5a3
parentb7b81ffedd5dddd0ae0cade43f13722379c29d6c (diff)
downloadgsoc2013-evolution-5c9634578c184e4981b2d0d91aad695492e16bcc.tar
gsoc2013-evolution-5c9634578c184e4981b2d0d91aad695492e16bcc.tar.gz
gsoc2013-evolution-5c9634578c184e4981b2d0d91aad695492e16bcc.tar.bz2
gsoc2013-evolution-5c9634578c184e4981b2d0d91aad695492e16bcc.tar.lz
gsoc2013-evolution-5c9634578c184e4981b2d0d91aad695492e16bcc.tar.xz
gsoc2013-evolution-5c9634578c184e4981b2d0d91aad695492e16bcc.tar.zst
gsoc2013-evolution-5c9634578c184e4981b2d0d91aad695492e16bcc.zip
return cancelled if we're in an offline state.
2004-08-27 Not Zed <NotZed@Ximian.com> * e-passwords.c (e_passwords_ask_password): return cancelled if we're in an offline state. svn path=/trunk/; revision=27074
-rw-r--r--e-util/ChangeLog5
-rw-r--r--e-util/e-passwords.c21
-rw-r--r--e-util/e-passwords.h2
3 files changed, 28 insertions, 0 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index d757fabec2..80d2665544 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,8 @@
+2004-08-27 Not Zed <NotZed@Ximian.com>
+
+ * e-passwords.c (e_passwords_ask_password): return cancelled if
+ we're in an offline state.
+
2004-08-26 Rodrigo Moya <rodrigo@novell.com>
* eggtrayicon.[ch]: updated from libegg.
diff --git a/e-util/e-passwords.c b/e-util/e-passwords.c
index 3798819f22..d64f7a33dc 100644
--- a/e-util/e-passwords.c
+++ b/e-util/e-passwords.c
@@ -102,6 +102,7 @@ static GHashTable *passwords = NULL;
static GtkDialog *password_dialog;
static EDList request_list = E_DLIST_INITIALISER(request_list);
static int idle_id;
+static int ep_online_state = TRUE;
static char *decode_base64 (char *base64);
static int base64_encode_close(unsigned char *in, int inlen, gboolean break_lines, unsigned char *out, int *state, int *save);
@@ -538,6 +539,23 @@ e_passwords_shutdown (void)
}
/**
+ * e_passwords_set_online:
+ * @state:
+ *
+ * Set the offline-state of the application. This is a work-around
+ * for having the backends fully offline aware, and returns a
+ * cancellation response instead of prompting for passwords.
+ *
+ * FIXME: This is not a permanent api, review post 2.0.
+ **/
+void
+e_passwords_set_online(int state)
+{
+ ep_online_state = state;
+ /* TODO: we could check that a request is open and close it, or maybe who cares */
+}
+
+/**
* e_passwords_forget_passwords:
*
* Forgets all cached passwords, in memory and on disk.
@@ -698,6 +716,9 @@ e_passwords_ask_password (const char *title, const char *component_name,
char *passwd;
EPassMsg *msg = ep_msg_new(ep_ask_password);
+ if ((type & E_PASSWORDS_ONLINE) && !ep_online_state)
+ return NULL;
+
msg->title = title;
msg->component = component_name;
msg->key = key;
diff --git a/e-util/e-passwords.h b/e-util/e-passwords.h
index d68cf6aa6c..2bed97f95d 100644
--- a/e-util/e-passwords.h
+++ b/e-util/e-passwords.h
@@ -39,6 +39,7 @@ void e_passwords_init (void);
void e_passwords_shutdown (void);
void e_passwords_cancel(void);
+void e_passwords_set_online(int state);
void e_passwords_remember_password (const char *component, const char *key);
void e_passwords_add_password (const char *key, const char *passwd);
char *e_passwords_get_password (const char *component, const char *key);
@@ -55,6 +56,7 @@ typedef enum {
/* option bits */
E_PASSWORDS_SECRET = 1<<8,
E_PASSWORDS_REPROMPT = 1<<9,
+ E_PASSWORDS_ONLINE = 1<<10, /* only ask if we're online */
} EPasswordsRememberType;
char * e_passwords_ask_password (const char *title,