Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / libedataserverui / e-passwords.h
1 /*
2  * e-passwords.h
3  *
4  * Copyright (C) 2001 Ximian, Inc.
5  */
6
7 /*
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of version 2 of the GNU Lesser General Public
10  * License as published by the Free Software Foundation.
11  * 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Lesser General Public License for more details.
16  * 
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
20  * USA.
21  */
22
23 #ifndef _E_PASSWORD_H_
24 #define _E_PASSWORD_H_
25
26 #include <glib.h>
27 #include <gtk/gtkwindow.h>
28
29 G_BEGIN_DECLS
30
31 /*
32   initialization is now implicit when you call any of the functions
33   below, although this is only correct if the functions are called
34   from the main thread.
35
36   e_passwords_shutdown should be called at exit time to synch the
37   password on-disk storage, and to free up in-memory storage. */
38 void e_passwords_init (void);
39
40 void        e_passwords_shutdown          (void);
41 void        e_passwords_cancel(void);
42 void        e_passwords_set_online(int state);
43 void        e_passwords_remember_password (const char *component, const char *key);
44 void        e_passwords_add_password      (const char *key, const char *passwd);
45 char       *e_passwords_get_password      (const char *component, const char *key);
46 void        e_passwords_forget_password   (const char *component, const char *key);
47 void        e_passwords_forget_passwords  (void);
48 void        e_passwords_clear_passwords (const char *component);
49
50 typedef enum {
51         E_PASSWORDS_REMEMBER_NEVER,
52         E_PASSWORDS_REMEMBER_SESSION,
53         E_PASSWORDS_REMEMBER_FOREVER,
54         E_PASSWORDS_REMEMBER_MASK = 0xf,
55
56         /* option bits */
57         E_PASSWORDS_SECRET = 1<<8,
58         E_PASSWORDS_REPROMPT = 1<<9,
59         E_PASSWORDS_ONLINE = 1<<10, /* only ask if we're online */
60         E_PASSWORDS_DISABLE_REMEMBER = 1<<11, /* disable the 'remember password' checkbox */
61         E_PASSWORDS_PASSPHRASE = 1<<12, /* We are asking a passphrase */
62 } EPasswordsRememberType;
63
64 char *      e_passwords_ask_password      (const char *title, 
65                                            const char*component_name, const char *key,
66                                            const char *prompt,
67                                            EPasswordsRememberType remember_type,
68                                            gboolean *remember,
69                                            GtkWindow *parent);
70
71 G_END_DECLS
72
73 #endif /* _E_PASSWORD_H_ */