[Evolution-hackers] Re: lockdown keys



Here's a partial patch for mail account lockdown, it does most of the
options in the list and a couple of extra's too, together with jeff's
existing work anyway.  Policy keys are currently
in /apps/evolution/lock/mail/accounts, but could be anywhere.

EAccount doesn't actually enforce the options yet - since we just set
the structure directly we need to use accessors instead (and probably
opaquify the object to make sure).  Which is just a pita ...

 Michael

Index: e-util/e-account.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-account.c,v
retrieving revision 1.6
diff -u -3 -r1.6 e-account.c
--- e-util/e-account.c	14 Jan 2004 17:29:24 -0000	1.6
+++ e-util/e-account.c	16 Mar 2004 13:40:11 -0000
@@ -32,9 +32,46 @@
 #include <libxml/tree.h>
 #include <libxml/xmlmemory.h>
 
+#include <gconf/gconf-client.h>
+
 #define PARENT_TYPE G_TYPE_OBJECT
 static GObjectClass *parent_class = NULL;
 
+/*
+lock mail accounts	Relatively difficult -- involves redesign of the XML blobs which describe accounts
+disable adding mail accounts	Simple -- can be done with just a Gconf key and some UI work to make assoc. widgets unavailable
+disable editing mail accounts	Relatively difficult -- involves redesign of the XML blobs which describe accounts
+disable removing mail accounts	
+lock default character encoding	Simple -- Gconf key + a little UI work to desensitize widgets, etc
+disable free busy publishing	
+disable specific mime types (from being viewed)	90% done already (Unknown MIME types still pose a problem)
+lock image loading preference	
+lock junk mail filtering settings	
+**  junk mail per account
+lock work week	
+lock first day of work week	
+lock working hours	
+disable forward as icalendar	
+lock color options for tasks	
+lock default contact filing format	
+* forbid signatures	Simple -- can be done with just a Gconf key and some UI work to make assoc. widgets unavailable
+* lock user to having 1 specific signature	Simple -- can be done with just a Gconf key and some UI work to make assoc. widgets unavailable
+* forbid adding/removing signatures	Simple -- can be done with just a Gconf key and some UI work to make assoc. widgets unavailable
+* lock each account to a certain signature	Relatively difficult -- involved redesign of the XML blobs which describe accounts 
+* set default folders	
+set trash emptying frequency	
+* lock displayed mail headers	Simple -- can be done with just a Gconf key and some UI work to make assoc. widgets unavailable
+* lock authentication type (for incoming mail)	Relatively difficult -- involves redesign of the XML blobs which describe accounts
+* lock authentication type (for outgoing mail)	Relatively difficult -- involves redesign of the XML blobs which describe accounts
+* lock minimum check mail on server frequency	Simple -- can be done with just a Gconf key and some UI work to make assoc. widgets unavailable
+** lock save password
+* require ssl always	Relatively difficult -- involves redesign of the XML blobs which describe accounts
+** lock imap subscribed folder option
+** lock filtering of inbox
+** lock source account/options
+** lock destination account/options
+*/
+
 static void finalize (GObject *);
 
 static void
@@ -528,7 +565,6 @@
 	return tmp;
 }
 
-
 /**
  * e_account_uid_from_xml:
  * @xml: an XML account description
@@ -558,3 +594,189 @@
 
 	return uid;
 }
+
+enum {
+	EAP_IMAP_SUBSCRIBED = 0,
+	EAP_IMAP_NAMESPACE,
+	EAP_FILTER_INBOX,
+	EAP_FILTER_JUNK,
+	EAP_FORCE_SSL,
+	EAP_LOCK_SIGNATURE,
+	EAP_LOCK_AUTH,
+	EAP_LOCK_AUTOCHECK,
+	EAP_LOCK_DEFAULT_FOLDERS,
+	EAP_LOCK_SAVE_PASSWD,
+	EAP_LOCK_SOURCE_URL,
+	EAP_LOCK_TRANSPORT_URL,
+};
+
+static struct _system_info {
+	const char *key;
+	guint32 perm;
+} system_perms[] = {
+	{ "imap_subscribed", 1<<EAP_IMAP_SUBSCRIBED },
+	{ "imap_namespace", 1<<EAP_IMAP_NAMESPACE },
+	{ "filter_inbox", 1<<EAP_FILTER_INBOX },
+	{ "filter_junk", 1<<EAP_FILTER_JUNK },
+	{ "force_ssl", 1<<EAP_FORCE_SSL },
+	{ "signature", 1<<EAP_LOCK_SIGNATURE },
+	{ "authtype", 1<<EAP_LOCK_AUTH },
+	{ "autocheck", 1<<EAP_LOCK_AUTOCHECK },
+	{ "default_folders", 1<<EAP_LOCK_DEFAULT_FOLDERS },
+	{ "save_passwd" , 1<<EAP_LOCK_SAVE_PASSWD },
+/*	{ "source_url", 1<<EAP_LOCK_SOURCE_URL },
+	{ "transport_url", 1<<EAP_LOCK_TRANSPORT_URL },*/
+};
+
+static struct {
+	guint32 perms;
+} account_perms[E_ACCOUNT_ITEM_LAST] = {
+	{ /* E_ACCOUNT_ID_NAME, */ },
+	{ /* E_ACCOUNT_ID_ADDRESS, */ },
+	{ /* E_ACCOUNT_ID_REPLY_TO, */ },
+	{ /* E_ACCOUNT_ID_ORGANIZATION */ },
+	{ /* E_ACCOUNT_ID_DEF_SIGNATURE */ 1<<EAP_LOCK_SIGNATURE },
+	{ /* E_ACCOUNT_ID_AUTO_SIGNATURE */ 1<<EAP_LOCK_SIGNATURE },
+
+	{ /* E_ACCOUNT_SOURCE_URL */ },
+	{ /* E_ACCOUNT_SOURCE_KEEP_ON_SERVER */ },
+	{ /* E_ACCOUNT_SOURCE_AUTO_CHECK */ 1<<EAP_LOCK_AUTOCHECK },
+	{ /* E_ACCOUNT_SOURCE_AUTO_CHECK_TIME */ 1<<EAP_LOCK_AUTOCHECK },
+	{ /* E_ACCOUNT_SOURCE_SAVE_PASSWD */ 1<<EAP_LOCK_SAVE_PASSWD },
+
+	{ /* E_ACCOUNT_TRANSPORT_URL */ },
+	{ /* E_ACCOUNT_TRANSPORT_SAVE_PASSWD */ 1<<EAP_LOCK_SAVE_PASSWD },
+
+	{ /* E_ACCOUNT_DRAFTS_FOLDER_URI */ 1<<EAP_LOCK_DEFAULT_FOLDERS },
+	{ /* E_ACCOUNT_SENT_FOLDER_URI */ 1<<EAP_LOCK_DEFAULT_FOLDERS },
+
+	{ /* E_ACCOUNT_CC_ALWAYS */ },
+	{ /* E_ACCOUNT_CC_ADDRS */ },
+
+	{ /* E_ACCOUNT_BCC_ALWAYS */ },
+	{ /* E_ACCOUNT_BCC_ADDRS */ },
+
+	{ /* E_ACCOUNT_PGP_KEY */ },
+	{ /* E_ACCOUNT_PGP_ENCRYPT_TO_SELF */ },
+	{ /* E_ACCOUNT_PGP_ALWAYS_SIGN */ },
+	{ /* E_ACCOUNT_PGP_NO_IMIP_SIGN */ },
+	{ /* E_ACCOUNT_PGP_ALWAYS_TRUST */ },
+
+	{ /* E_ACCOUNT_SMIME_SIGN_KEY */ },
+	{ /* E_ACCOUNT_SMIME_ENCRYPT_KEY */ },
+	{ /* E_ACCOUNT_SMIME_SIGN_DEFAULT */ },
+	{ /* E_ACCOUNT_SMIME_ENCRYPT_TO_SELF */ },
+	{ /* E_ACCOUNT_SMIME_ENCRYPE_DEFAULT */ },
+};
+
+static GHashTable *ea_option_table;
+static GHashTable *ea_system_table;
+static guint32 ea_perms;
+
+static struct _option_info {
+	char *key;
+	guint32 perms;
+} ea_option_list[] = {
+	{ "imap_use_lsub", 1<<EAP_IMAP_SUBSCRIBED },
+	{ "imap_override_namespace", 1<<EAP_IMAP_NAMESPACE },
+	{ "imap_filter", 1<<EAP_FILTER_INBOX },
+	{ "imap_filter_junk", 1<<EAP_FILTER_JUNK },
+	{ "imap_filter_junk_inbox", 1<<EAP_FILTER_JUNK },
+	{ "*_use_ssl", 1<<EAP_FORCE_SSL },
+	{ "*_auth", 1<<EAP_LOCK_AUTH },
+};
+
+#define LOCK_BASE "/apps/evolution/lock/mail/accounts"
+
+static void
+ea_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, void *crap)
+{
+	GConfValue *value;
+	char *tkey;
+	struct _system_info *info;
+
+	g_return_if_fail (gconf_entry_get_key (entry) != NULL);
+	
+	if (!(value = gconf_entry_get_value (entry)))
+		return;
+	
+	tkey = strrchr(entry->key, '/');
+	g_return_if_fail (tkey != NULL);
+
+	info = g_hash_table_lookup(ea_system_table, tkey+1);
+	if (info) {
+		if (gconf_value_get_bool(value))
+			ea_perms |= info->perm;
+		else
+			ea_perms &= ~info->perm;
+	}
+
+	printf("checking key '%s', new perms '%08x'\n", tkey+1, ea_perms);
+}
+
+static void
+ea_setting_setup(void)
+{
+	if (ea_option_table == NULL) {
+		GConfClient *gconf = gconf_client_get_default();
+		GConfEntry *entry;
+		GError *err = NULL;
+		int i;
+		char key[64];
+
+		ea_option_table = g_hash_table_new(g_str_hash, g_str_equal);
+		for (i=0;i<sizeof(ea_option_list)/sizeof(ea_option_list[0]);i++)
+			g_hash_table_insert(ea_option_table, ea_option_list[i].key, &ea_option_list[i]);
+
+		gconf_client_add_dir(gconf, LOCK_BASE, GCONF_CLIENT_PRELOAD_NONE, NULL);
+
+		ea_system_table = g_hash_table_new(g_str_hash, g_str_equal);
+		for (i=0;i<sizeof(system_perms)/sizeof(system_perms[0]);i++) {
+			g_hash_table_insert(ea_system_table, (char *)system_perms[i].key, &system_perms[i]);
+			sprintf(key, LOCK_BASE "/%s", system_perms[i].key);
+			entry = gconf_client_get_entry(gconf, key, NULL, TRUE, &err);
+			if (entry)
+				ea_setting_notify(gconf, 0, entry, NULL);
+			gconf_entry_free(entry);
+		}
+
+		if (err) {
+			g_warning("Could not load account lock settings: %s", err->message);
+			g_error_free(err);
+		}
+
+		gconf_client_notify_add(gconf, LOCK_BASE, (GConfClientNotifyFunc)ea_setting_notify, NULL, NULL, NULL);
+		g_object_unref(gconf);
+	}
+}
+
+gboolean
+e_account_writable_option(EAccount *ea, const char *protocol, const char *option)
+{
+	char *key;
+	struct _option_info *info;
+
+	ea_setting_setup();
+
+	key = alloca(strlen(protocol)+strlen(option)+2);
+	sprintf(key, "%s_%s", protocol, option);
+
+	info = g_hash_table_lookup(ea_option_table, key);
+	if (info == NULL) {
+		sprintf(key, "*_%s", option);
+		info = g_hash_table_lookup(ea_option_table, key);
+	}
+
+	printf("checking writable option '%s' perms=%08x\n", option, info?info->perms:0);
+
+	return info == NULL
+		|| (info->perms & ea_perms) == 0;
+}
+
+gboolean
+e_account_writable(EAccount *ea, e_account_item_t type)
+{
+	ea_setting_setup();
+
+	return (account_perms[type].perms & ea_perms) == 0;
+}
Index: e-util/e-account.h
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-account.h,v
retrieving revision 1.4
diff -u -3 -r1.4 e-account.h
--- e-util/e-account.h	31 Oct 2003 04:55:41 -0000	1.4
+++ e-util/e-account.h	16 Mar 2004 13:40:11 -0000
@@ -28,6 +28,51 @@
 #define E_IS_ACCOUNT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ACCOUNT))
 #define E_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_ACCOUNT))
 
+typedef enum _e_account_item_t {
+	E_ACCOUNT_ID_NAME,
+	E_ACCOUNT_ID_ADDRESS,
+	E_ACCOUNT_ID_REPLY_TO,
+	E_ACCOUNT_ID_ORGANIZATION,
+	E_ACCOUNT_ID_DEF_SIGNATURE, /* why aren't these two options the same? */
+	E_ACCOUNT_ID_AUTO_SIGNATURE,
+
+	E_ACCOUNT_SOURCE_URL,
+	E_ACCOUNT_SOURCE_KEEP_ON_SERVER,
+	E_ACCOUNT_SOURCE_AUTO_CHECK,
+	E_ACCOUNT_SOURCE_AUTO_CHECK_TIME,
+	E_ACCOUNT_SOURCE_SAVE_PASSWD,
+
+	E_ACCOUNT_TRANSPORT_URL,
+	E_ACCOUNT_TRANSPORT_SAVE_PASSWD,
+
+	E_ACCOUNT_DRAFTS_FOLDER_URI,
+	E_ACCOUNT_SENT_FOLDER_URI,
+
+	E_ACCOUNT_CC_ALWAYS,
+	E_ACCOUNT_CC_ADDRS,
+
+	E_ACCOUNT_BCC_ALWAYS,
+	E_ACCOUNT_BCC_ADDRS,
+
+	E_ACCOUNT_PGP_KEY,
+	E_ACCOUNT_PGP_ENCRYPT_TO_SELF,
+	E_ACCOUNT_PGP_ALWAYS_SIGN,
+	E_ACCOUNT_PGP_NO_IMIP_SIGN,
+	E_ACCOUNT_PGP_ALWAYS_TRUST,
+
+	E_ACCOUNT_SMIME_SIGN_KEY,
+	E_ACCOUNT_SMIME_ENCRYPT_KEY,
+	E_ACCOUNT_SMIME_SIGN_DEFAULT,
+	E_ACCOUNT_SMIME_ENCRYPT_TO_SELF,
+	E_ACCOUNT_SMIME_ENCRYPE_DEFAULT,
+
+	E_ACCOUNT_ITEM_LAST
+} e_account_item_t;
+
+typedef enum _e_account_access_t {
+	E_ACCOUNT_ACCESS_WRITE = 1<<0,
+} e_account_access_t;
+
 typedef struct {
 	char *name;
 	char *address;
@@ -46,7 +91,6 @@
 	gboolean save_passwd;
 } EAccountService;
 
-
 typedef struct {
 	GObject parent_object;
 
@@ -90,17 +134,22 @@
 EAccount *e_account_new          (void);
 
 EAccount *e_account_new_from_xml (const char *xml);
-
-gboolean  e_account_set_from_xml (EAccount   *account,
-				  const char *xml);
-
-void      e_account_import       (EAccount   *dest,
-				  EAccount   *src);
-
+gboolean  e_account_set_from_xml (EAccount   *account, const char *xml);
+void      e_account_import       (EAccount   *dest, EAccount   *src);
 char     *e_account_to_xml       (EAccount   *account);
-
-
 char     *e_account_uid_from_xml (const char *xml);
 
+#if 0
+const char *e_account_get_string(EAccount *, e_account_item_t type);
+int e_account_get_int(EAccount *, e_account_item_t type);
+gboolean e_account_get_bool(EAccount *, e_account_item_t type);
+
+void e_account_set_string(EAccount *, e_account_item_t type, const char *);
+void e_account_set_int(EAccount *, e_account_item_t type, const char *);
+void e_account_set_bool(EAccount *, e_account_item_t type, const char *);
+#endif
+
+gboolean e_account_writable(EAccount *ea, e_account_item_t type);
+gboolean e_account_writable_option(EAccount *ea, const char *protocol, const char *option);
 
 #endif /* __E_ACCOUNT__ */
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3167
diff -u -3 -r1.3167 ChangeLog
--- mail/ChangeLog	15 Mar 2004 20:09:56 -0000	1.3167
+++ mail/ChangeLog	16 Mar 2004 13:40:25 -0000
@@ -1,3 +1,10 @@
+2004-03-16  Not Zed  <NotZed Ximian com>
+
+	* mail-account-gui.c (mail_account_gui_auto_detect_extra_conf):
+	check extra conf items are writable.
+	(mail_account_gui_build_extra_conf): same.
+	(setup_service): add gui arg, and do above for auth and ssl args.
+
 2004-03-15  Jeffrey Stedfast  <fejj ximian com>
 
 	* em-utils.c (reply_to_message): If the mail_get_message() async
Index: mail/mail-account-gui.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-account-gui.c,v
retrieving revision 1.148
diff -u -3 -r1.148 mail-account-gui.c
--- mail/mail-account-gui.c	24 Feb 2004 21:31:19 -0000	1.148
+++ mail/mail-account-gui.c	16 Mar 2004 13:40:31 -0000
@@ -286,6 +286,8 @@
 		entries = service->provider->extra_conf;
 		
 		for (i = 0; entries[i].type != CAMEL_PROVIDER_CONF_END; i++) {
+			GtkWidget *enable_widget = NULL;
+
 			if (!entries[i].name)
 				continue;
 			
@@ -297,12 +299,14 @@
 			case CAMEL_PROVIDER_CONF_CHECKBOX:
 				toggle = g_hash_table_lookup (gui->extra_config, entries[i].name);
 				gtk_toggle_button_set_active (toggle, atoi (value));
+				enable_widget = (GtkWidget *)toggle;
 				break;
 				
 			case CAMEL_PROVIDER_CONF_ENTRY:
 				entry = g_hash_table_lookup (gui->extra_config, entries[i].name);
 				if (value)
 					gtk_entry_set_text (entry, value);
+				enable_widget = (GtkWidget *)entry;
 				break;
 				
 			case CAMEL_PROVIDER_CONF_CHECKSPIN:
@@ -321,11 +325,16 @@
 				g_assert (*value == ':');
 				val = strtod (++value, NULL);
 				gtk_spin_button_set_value (spin, val);
+				enable_widget = (GtkWidget *)spin;
 			}
 			break;
 			default:
 				break;
 			}
+
+			if (enable_widget)
+				gtk_widget_set_sensitive(enable_widget, e_account_writable_option(gui->account, prov->protocol, entries[i].name));
+
 		}
 		
 		g_hash_table_foreach (auto_detected, auto_detected_foreach, NULL);
@@ -811,6 +820,8 @@
 	cur_table = main_table;
 	rows = main_table->nrows;
 	for (i = 0; ; i++) {
+		GtkWidget *enable_widget = NULL;
+
 		switch (entries[i].type) {
 		case CAMEL_PROVIDER_CONF_SECTION_START:
 		{
@@ -846,10 +857,13 @@
 				
 				if (!strcmp (entries[i].name, "username")) {
 					gtk_label_set_text_with_mnemonic (GTK_LABEL (username_label), entries[i].text);
+					enable_widget = username_label;
 				} else if (!strcmp (entries[i].name, "hostname")) {
 					gtk_label_set_text_with_mnemonic (GTK_LABEL (hostname_label), entries[i].text);
+					enable_widget = hostname_label;
 				} else if (!strcmp (entries[i].name, "path")) {
 					gtk_label_set_text_with_mnemonic (GTK_LABEL (path_label), entries[i].text);
+					enable_widget = path_label;
 				} else {
 					/* make a new label */
 					label = gtk_label_new (entries[i].text);
@@ -857,6 +871,7 @@
 					gtk_table_attach (cur_table, label, 0, 2, rows, rows + 1,
 							  GTK_EXPAND | GTK_FILL, 0, 0, 0);
 					rows++;
+					enable_widget = label;
 				}
 			}
 			break;
@@ -879,6 +894,8 @@
 			g_hash_table_insert (gui->extra_config, entries[i].name, checkbox);
 			if (entries[i].depname)
 				setup_toggle (checkbox, entries[i].depname, gui);
+
+			enable_widget = checkbox;
 			break;
 		}
 		
@@ -926,7 +943,8 @@
 			}
 
 			g_hash_table_insert (gui->extra_config, entries[i].name, entry);
-						
+
+			enable_widget = entry;
 			break;
 		}
 		
@@ -990,12 +1008,17 @@
 				setup_toggle (spin, entries[i].depname, gui);
 				setup_toggle (label, entries[i].depname, gui);
 			}
+
+			enable_widget = hbox;
 			break;
 		}
 		
 		case CAMEL_PROVIDER_CONF_END:
 			goto done;
 		}
+
+		if (enable_widget)
+			gtk_widget_set_sensitive(enable_widget, e_account_writable_option(gui->account, gui->source.provider->protocol, entries[i].name));
 	}
 	
  done:
@@ -1099,7 +1122,7 @@
 }
 
 static gboolean
-setup_service (MailAccountGuiService *gsvc, EAccountService *service)
+setup_service (MailAccountGui *gui, MailAccountGuiService *gsvc, EAccountService *service)
 {
 	CamelURL *url = camel_url_new (service->url, NULL);
 	gboolean has_auth = FALSE;
@@ -1169,6 +1192,9 @@
 	camel_url_free (url);
 	
 	gtk_toggle_button_set_active (gsvc->remember, service->save_passwd);
+
+	gtk_widget_set_sensitive((GtkWidget *)gsvc->authtype, e_account_writable_option(gui->account, gsvc->provider->protocol, "auth"));
+	gtk_widget_set_sensitive((GtkWidget *)gsvc->use_ssl, e_account_writable_option(gui->account, gsvc->provider->protocol, "use_ssl"));
 	
 	return has_auth;
 }
@@ -1599,8 +1625,8 @@
 	em_folder_selection_button_set_selection((EMFolderSelectionButton *)gui->sent_folder_button, gui->sent_folder_uri);
 	
 	/* Special Folders "Reset Defaults" button */
-	button = glade_xml_get_widget (gui->xml, "default_folders_button");
-	g_signal_connect (button, "clicked", G_CALLBACK (default_folders_clicked), gui);
+	gui->restore_folders_button = glade_xml_get_widget (gui->xml, "default_folders_button");
+	g_signal_connect (gui->restore_folders_button, "clicked", G_CALLBACK (default_folders_clicked), gui);
 	
 	/* Always Cc */
 	gui->always_cc = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "always_cc"));
@@ -1663,7 +1689,7 @@
 		gtk_widget_destroy (frame);
 	}
 #endif /* HAVE_NSS */
-	
+
 	return gui;
 }
 
@@ -1677,6 +1703,8 @@
 	char *max_authname = NULL;
 	char *source_proto, *transport_proto;
 	GList *providers, *l;
+
+	printf("account gui setup\n");
 	
 	if (gui->account->source && gui->account->source->url) {
 		source_proto = gui->account->source->url;
@@ -1834,7 +1862,7 @@
 	}
 	
 	if (source_proto) {
-		setup_service (&gui->source, gui->account->source);
+		setup_service (gui, &gui->source, gui->account->source);
 		gui->source.provider_type = CAMEL_PROVIDER_STORE;
 		g_free (source_proto);
 		if (gui->account->source->auto_check) {
@@ -1845,11 +1873,32 @@
 	}
 	
 	if (transport_proto) {
-		if (setup_service (&gui->transport, gui->account->transport))
+		if (setup_service (gui, &gui->transport, gui->account->transport))
 			gtk_toggle_button_set_active (gui->transport_needs_auth, TRUE);
 		gui->transport.provider_type = CAMEL_PROVIDER_TRANSPORT;
 		g_free (transport_proto);
 	}
+
+	/* FIXME: drive by table?? */
+	if (gui->source.provider) {
+		gtk_widget_set_sensitive((GtkWidget *)gui->source.authtype, e_account_writable_option(gui->account, gui->source.provider->protocol, "auth"));
+		gtk_widget_set_sensitive((GtkWidget *)gui->source.use_ssl, e_account_writable_option(gui->account, gui->source.provider->protocol, "use_ssl"));
+	}
+	if (gui->transport.provider) {
+		gtk_widget_set_sensitive((GtkWidget *)gui->transport.authtype, e_account_writable_option(gui->account, gui->transport.provider->protocol, "auth"));
+		gtk_widget_set_sensitive((GtkWidget *)gui->transport.use_ssl, e_account_writable_option(gui->account, gui->transport.provider->protocol, "use_ssl"));
+	}
+
+	gtk_widget_set_sensitive((GtkWidget *)gui->drafts_folder_button, e_account_writable(gui->account, E_ACCOUNT_DRAFTS_FOLDER_URI));
+	gtk_widget_set_sensitive((GtkWidget *)gui->sent_folder_button, e_account_writable(gui->account, E_ACCOUNT_SENT_FOLDER_URI));
+	gtk_widget_set_sensitive((GtkWidget *)gui->restore_folders_button,
+				 e_account_writable(gui->account, E_ACCOUNT_SENT_FOLDER_URI)
+				 || e_account_writable(gui->account, E_ACCOUNT_DRAFTS_FOLDER_URI));
+	gtk_widget_set_sensitive((GtkWidget *)gui->source.remember, e_account_writable(gui->account, E_ACCOUNT_SOURCE_SAVE_PASSWD));
+	gtk_widget_set_sensitive((GtkWidget *)gui->transport.remember, e_account_writable(gui->account, E_ACCOUNT_TRANSPORT_SAVE_PASSWD));
+	gtk_widget_set_sensitive((GtkWidget *)gui->sig_option_menu, e_account_writable(gui->account, E_ACCOUNT_ID_DEF_SIGNATURE));
+	gtk_widget_set_sensitive((GtkWidget *)gui->source_auto_check, e_account_writable(gui->account, E_ACCOUNT_SOURCE_AUTO_CHECK));
+	gtk_widget_set_sensitive((GtkWidget *)gui->source_auto_check_min, e_account_writable(gui->account, E_ACCOUNT_SOURCE_AUTO_CHECK_TIME));
 }
 
 static void
Index: mail/mail-account-gui.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-account-gui.h,v
retrieving revision 1.26
diff -u -3 -r1.26 mail-account-gui.h
--- mail/mail-account-gui.h	31 Oct 2003 04:56:46 -0000	1.26
+++ mail/mail-account-gui.h	16 Mar 2004 13:40:31 -0000
@@ -95,7 +95,8 @@
 	char *drafts_folder_uri;
 	GtkButton *sent_folder_button;
 	char *sent_folder_uri;
-	
+	GtkButton *restore_folders_button;
+
 	/* always cc/bcc */
 	GtkToggleButton *always_cc;
 	GtkEntry *cc_addrs;


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