diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 14 | ||||
-rw-r--r-- | mail/mail-account-editor.c | 290 | ||||
-rw-r--r-- | mail/mail-account-editor.h | 10 | ||||
-rw-r--r-- | mail/mail-accounts.c | 4 | ||||
-rw-r--r-- | mail/mail-config-druid.glade | 100 | ||||
-rw-r--r-- | mail/mail-config-druid.glade.h | 4 |
6 files changed, 316 insertions, 106 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index b70745125f..ae1b471224 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,12 +1,18 @@ +2001-01-06 Jeffrey Stedfast <fejj@helixcode.com> + + * mail-account-editor.c: Coded a bunch of the methods. + 2001-01-04 Iain Holmes <iain@helixcode.com> - * mail-summary.c (idle_check): Check if the HTML for the current summary - has been created, and if not then keep trying until it has. + * mail-summary.c (idle_check): Check if the HTML for the current + summary has been created, and if not then keep trying until it + has. (new_folder_cb) (removed_folder_cb) - (create_summary_view): Use the idle_check function to generate the + (create_summary_view): Use the idle_check function to generate the summary. - (create_summary_view): Don't set the HTML here. Set it via the pipe. + (create_summary_view): Don't set the HTML here. Set it via the + pipe. 2001-01-05 Jeffrey Stedfast <fejj@helixcode.com> diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c index bb2de76318..1146485758 100644 --- a/mail/mail-account-editor.c +++ b/mail/mail-account-editor.c @@ -21,4 +21,294 @@ */ #include "mail-account-editor.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <camel/camel-url.h> + +static void mail_account_editor_class_init (MailAccountEditorClass *class); +static void mail_account_editor_init (MailAccountEditor *editor); +static void mail_account_editor_finalise (GtkObject *obj); + +static GnomeDialogClass *parent_class; + + +GtkType +mail_account_editor_get_type () +{ + static GtkType type = 0; + + if (!type) { + GtkTypeInfo type_info = { + "MailAccountEditor", + sizeof (MailAccountEditor), + sizeof (MailAccountEditorClass), + (GtkClassInitFunc) mail_account_editor_class_init, + (GtkObjectInitFunc) mail_account_editor_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL + }; + + type = gtk_type_unique (gnome_dialog_get_type (), &type_info); + } + + return type; +} + +static void +mail_account_editor_class_init (MailAccountEditorClass *class) +{ + GtkObjectClass *object_class; + + object_class = (GtkObjectClass *) class; + parent_class = gtk_type_class (gnome_dialog_get_type ()); + + object_class->finalize = mail_account_editor_finalise; + /* override methods */ + +} + +static void +mail_account_editor_init (MailAccountEditor *o) +{ + ; +} + +static void +mail_account_editor_finalise (GtkObject *obj) +{ + MailAccountEditor *editor = (MailAccountEditor *) obj; + + gtk_object_unref (GTK_OBJECT (editor->gui)); + + ((GtkObjectClass *)(parent_class))->finalize (obj); +} + +static void +source_auth_type_changed (GtkWidget *widget, gpointer user_data) +{ + MailAccountEditor *editor = user_data; + CamelServiceAuthType *authtype; + gboolean sensitive; + + authtype = gtk_object_get_data (GTK_OBJECT (widget), "authtype"); + + gtk_object_set_data (GTK_OBJECT (editor), "source_authmech", authtype->authproto); + + if (authtype->need_password) + sensitive = TRUE; + else + sensitive = FALSE; + + gtk_widget_set_sensitive (GTK_WIDGET (editor->source_passwd), sensitive); + gtk_widget_set_sensitive (GTK_WIDGET (editor->save_passwd), sensitive); +} + +static void +source_auth_init (MailAccountEditor *editor, CamelURL *url) +{ + GtkWidget *menu, *item, *authmech = NULL; + CamelServiceAuthType *authtype; + GList *authtypes = NULL; + + menu = gtk_menu_new (); + gtk_option_menu_set_menu (editor->source_auth, menu); + + /* If we can't connect, don't let them continue. */ + if (!check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) { + return; + } + + if (authtypes) { + GList *l; + + menu = gtk_menu_new (); + l = authtypes; + while (l) { + authtype = l->data; + + item = gtk_menu_item_new_with_label (authtype->name); + gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype); + gtk_signal_connect (GTK_OBJECT (item), "activate", + GTK_SIGNAL_FUNC (source_auth_type_changed), + editor); + + gtk_menu_append (GTK_MENU (menu), item); + + if (!g_strcasecmp (authtype->authproto, url->authmech)) + authmech = item; + } + + if (authmech) + gtk_signal_emit_by_name (GTK_OBJECT (authmech), "activate", editor); + } +} + +static void +transport_type_changed (GtkWidget *widget, gpointer user_data) +{ + MailAccountEditor *editor = user_data; + CamelProvider *provider; + + provider = gtk_object_get_data (GTK_OBJECT (widget), "provider"); + editor->transport = provider; + + /* hostname */ + if (provider->url_flags & CAMEL_URL_ALLOW_HOST) + gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_host), TRUE); + else + gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_host), FALSE); + + /* auth */ + if (provider->url_flags & CAMEL_URL_ALLOW_AUTH) + gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_auth_type), TRUE); + else + gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_auth_type), FALSE); + + /* FIXME: regen the auth list */ +} + +static void +transport_type_init (MailAccountEditor *editor, CamelURL *url) +{ + GtkWidget *menu, *xport = NULL; + GList *providers, *l; + + menu = gtk_menu_new (); + providers = camel_session_list_providers (session, FALSE); + l = providers; + while (l) { + CamelProvider *provider = l->data; + + if (strcmp (provider->domain, "mail")) { + l = l->next; + continue; + } + + if (provider->object_types[CAMEL_PROVIDER_TRANSPORT]) { + GtkWidget *item; + + item = gtk_menu_item_new_with_label (provider->name); + gtk_object_set_data (GTK_OBJECT (item), "provider", provider); + gtk_signal_connect (GTK_OBJECT (item), "activate", + GTK_SIGNAL_FUNC (transport_type_changed), + editor); + + gtk_menu_append (GTK_MENU (menu), item); + + if (!g_strcasecmp (provider->protocol, url->protocol)) + xport = item; + } + + l = l->next; + } + + gtk_option_menu_set_menu (editor->transport_type, menu); + + if (xport) + gtk_signal_emit_by_name (GTK_OBJECT (xport), "activate", editor); +} + +static void +transport_auth_init (MailAccountEditor *editor, CamelURL *url) +{ + /* FIXME: look through the options and select the prefered authmech */ + ; +} + +static void +construct (MailAccountEditor *editor, const MailConfigAccount *account) +{ + GladeXML *gui; + GtkWidget *notebook, *entry; + CamelURL *url; + + gui = glade_xml_new (EVOLUTION_DATA_DIR "/mail-config-druid.glade", "mail-account-editor"); + editor->gui = gui; + + /* get our toplevel widget */ + notebook = glade_xml_get_widget (gui, "notebook"); + + /* reparent */ + gtk_widget_reparent (widget, GTK_WIDGET (editor)); + + /* give our dialog an OK button and title */ + gnome_dialog_construct (GNOME_DIALOG (editor), _("Evolution Account Editor"), + GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_APPLY, + GNOME_STOCK_BUTTON_CANCEL); + + /* General */ + editor->account_name = GTK_ENTRY (glade_xml_get_widget (gui, "txtAccountName")); + gtk_entry_set_text (editor->account_name, account->name); + editor->name = GTK_ENTRY (glade_xml_get_widget (gui, "txtName")); + gtk_entry_set_text (editor->name, account->id->name); + editor->email = GTK_ENTRY (glade_xml_get_widget (gui, "txtEMail")); + gtk_entry_set_text (editor->email, account->id->address); + editor->reply_to = GTK_ENTRY (glade_xml_get_widget (gui, "txtReplyTo")); + gtk_entry_set_text (editor->reply_to, account->id->reply_to); + editor->organization = GTK_ENTRY (glade_xml_get_widget (gui, "txtOrganization")); + gtk_entry_set_text (editor->organization, account->id->organization); + editor->signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileSignature")); + entry = gnome_file_entry_gtk_entry (editor->signature); + gtk_entry_set_text (GTK_ENTRY (entry), account->id->signature); + + /* Servers */ + url = camel_url_new (account->source->url, NULL); + editor->source_type = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourceType")); + gtk_entry_set_text (editor->source_type, url->protocol); + editor->source_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourceHost")); + gtk_entry_set_text (editor->source_host, url->host); + if (url->port) { + char port[10]; + + g_snprintf (port, 9, ":%d", port); + gtk_entry_append_text (editor->source_host, port); + } + editor->source_user = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourceUser")); + gtk_entry_set_text (editor->source_user, url->user); + editor->source_passwd = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourcePasswd")); + gtk_entry_set_text (editor->source_passwd, url->passwd); + editor->save_passwd = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkSavePasswd")); + gtk_check_button_set_active (GTK_TOGGLE_BUTTON (editor->save_passwd), account->source->save_passwd); + editor->source_auth = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuSourceAuth")); + editor->source_ssl = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkSourceSSL")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_ssl), account->source->use_ssl); + editor->keep_on_server = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkKeepMailOnServer")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->keep_on_server), account->source->keep_on_server); + source_auth_init (editor, url); + camel_url_free (url); + + /* Transport */ + url = camel_url_new (account->transport->url, NULL); + editor->transport_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportType")); + gtk_entry_set_text (editor->transport_type, url->protocol); + editor->transport_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportHost")); + gtk_entry_set_text (editor->transport_host, url->host); + if (url->port) { + char port[10]; + + g_snprintf (port, 9, ":%d", port); + gtk_entry_append_text (editor->transport_host, port); + } + editor->transport_auth = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportAuth")); + transport_auth_init (editor); + editor->transport_ssl = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkTransportSSL")); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->transport_ssl), account->transport->use_ssl); + transport_type_init (editor, url); + transport_auth_init (editor, url); + camel_url_free (url); + + editor->account = account; +} + +MailAccountEditor * +mail_account_editor_new (const MailConfigAccount *account) +{ + MailAccountsDialog *new; + + new = (MailAccountEditor *) gtk_type_new (mail_account_editor_get_type ()); + construct (new, account); + + return new; +} diff --git a/mail/mail-account-editor.h b/mail/mail-account-editor.h index bb84c86eb0..f439275901 100644 --- a/mail/mail-account-editor.h +++ b/mail/mail-account-editor.h @@ -57,17 +57,17 @@ struct _MailAccountEditor { GtkEntry *source_host; GtkEntry *source_user; GtkEntry *source_passwd; - GtkCheckBox *save_passwd; + GtkCheckButton *save_passwd; GtkOptionMenu *source_auth; - GtkCheckBox *source_ssl; + GtkCheckButton *source_ssl; GtkOptionMenu *transport_type; GtkEntry *transport_host; GtkOptionMenu *transport_auth; - GtkCheckBox *transport_ssl; + GtkCheckButton *transport_ssl; GtkSpinButton *auto_mail_check; - GtkCheckBox *keep_on_server; + GtkCheckButton *keep_on_server; const CamelProvider *transport; }; @@ -83,7 +83,7 @@ typedef struct { GtkType mail_account_editor_get_type (void); -MailAccountEditor *mail_account_editor_new (void); +MailAccountEditor *mail_account_editor_new (const MailConfigAccount *account); #ifdef __cplusplus } diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index 832e0173bc..62ebb01556 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -55,7 +55,7 @@ mail_accounts_dialog_get_type () } static void -mail_accounts_dialog_class_init (MailConfigDruidClass *class) +mail_accounts_dialog_class_init (MailAccountsDialogClass *class) { GtkObjectClass *object_class; @@ -76,7 +76,7 @@ mail_accounts_dialog_init (MailAccountsDialog *o) static void mail_accounts_dialog_finalise (GtkObject *obj) { - MailAccountsDialog *dialog = (MailConfigDruid *) obj; + MailAccountsDialog *dialog = (MailAccountsDialog *) obj; gtk_object_unref (GTK_OBJECT (dialog->gui)); diff --git a/mail/mail-config-druid.glade b/mail/mail-config-druid.glade index 03762ca4f4..694e2aefea 100644 --- a/mail/mail-config-druid.glade +++ b/mail/mail-config-druid.glade @@ -2220,7 +2220,7 @@ DIGEST-MD5 <widget> <class>GtkEntry</class> - <name>txtSourceUsername</name> + <name>txtSourceUser</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -2244,7 +2244,7 @@ DIGEST-MD5 <widget> <class>GtkEntry</class> - <name>txtSourcePassword</name> + <name>txtSourcePasswd</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -2357,7 +2357,7 @@ DIGEST-MD5 <widget> <class>GtkCheckButton</class> - <name>chkOutgoingSSL</name> + <name>chkTransportSSL</name> <sensitive>False</sensitive> <can_focus>True</can_focus> <label>This server requires a secure connection (SSL)</label> @@ -2381,7 +2381,7 @@ DIGEST-MD5 <widget> <class>GtkOptionMenu</class> - <name>omenuOutgoingAuth</name> + <name>omenuTransportAuth</name> <can_focus>True</can_focus> <items>None CRAM-MD5 @@ -2483,7 +2483,7 @@ CRAM-MD5 <widget> <class>GtkEntry</class> - <name>txtOutgoingServer</name> + <name>txtTransportHost</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -2554,7 +2554,7 @@ SMTP <widget> <class>GtkTable</class> <name>tableServerTimeouts</name> - <rows>3</rows> + <rows>2</rows> <columns>10</columns> <homogeneous>True</homogeneous> <row_spacing>0</row_spacing> @@ -2587,8 +2587,8 @@ SMTP <widget> <class>GtkLabel</class> - <name>lblServerTimeouts</name> - <label>Server Timeouts</label> + <name>lblMisc</name> + <label>Miscellaneous</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> <xalign>0.5</xalign> @@ -2623,90 +2623,6 @@ SMTP <child> <left_attach>1</left_attach> <right_attach>10</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblAutoCheckMail</name> - <label>Automatically check mail every </label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>6</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>spinAutoCheckMinutes</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>True</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>0</value> - <lower>0</lower> - <upper>100</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - <child> - <left_attach>6</left_attach> - <right_attach>7</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>lblMinutes</name> - <label>minute(s)</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>7</left_attach> - <right_attach>10</right_attach> <top_attach>1</top_attach> <bottom_attach>2</bottom_attach> <xpad>0</xpad> diff --git a/mail/mail-config-druid.glade.h b/mail/mail-config-druid.glade.h index 6438c79349..364b2e1b81 100644 --- a/mail/mail-config-druid.glade.h +++ b/mail/mail-config-druid.glade.h @@ -81,10 +81,8 @@ gchar *s = N_("Sendmail\n" "SMTP\n" ""); gchar *s = N_("Servers"); -gchar *s = N_("Server Timeouts"); +gchar *s = N_("Miscellaneous"); gchar *s = N_("Keep mail on server"); -gchar *s = N_("Automatically check mail every "); -gchar *s = N_("minute(s)"); gchar *s = N_("Advanced"); gchar *s = N_("Evolution Mail Configuration"); gchar *s = N_("Account"); |