From 3cdefcba37d640670c9bb6e290bc6f55229fac7a Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 26 Mar 2002 22:51:26 +0000 Subject: Sync with yet-another-mail-config branch. 2002-03-26 Jeffrey Stedfast Sync with yet-another-mail-config branch. * mail-composer-prefs.c: Updated to get the right widgets and whatnot. Also updated to tell the evolution-config-control that stuff has changed. * mail-preferences.c: Updated to get the right widgets and whatnot. Also updated to tell the evolution-config-control that stuff has changed. * mail-accounts.etspec: New file needed by mail-accounts.c svn path=/trunk/; revision=16257 --- mail/ChangeLog | 90 +- mail/GNOME_Evolution_Mail.oaf.in | 374 ++++++-- mail/Makefile.am | 8 +- mail/component-factory.c | 2 + mail/folder-browser-ui.c | 1 - mail/folder-browser.c | 8 +- mail/mail-account-editor.c | 4 +- mail/mail-account-editor.h | 6 +- mail/mail-account-gui.c | 6 +- mail/mail-account-gui.h | 4 +- mail/mail-accounts.c | 1558 +++++-------------------------- mail/mail-accounts.etspec | 12 + mail/mail-accounts.h | 170 ++-- mail/mail-callbacks.c | 32 +- mail/mail-callbacks.h | 2 - mail/mail-composer-prefs.c | 267 ++++++ mail/mail-composer-prefs.h | 104 +++ mail/mail-config-factory.c | 127 +++ mail/mail-config-factory.h | 42 + mail/mail-config.c | 23 + mail/mail-config.glade | 1887 +++++++++++++++++++++++++++++++++++++- mail/mail-config.h | 9 + mail/mail-preferences.c | 374 ++++++++ mail/mail-preferences.h | 118 +++ 24 files changed, 3629 insertions(+), 1599 deletions(-) create mode 100644 mail/mail-accounts.etspec create mode 100644 mail/mail-composer-prefs.c create mode 100644 mail/mail-composer-prefs.h create mode 100644 mail/mail-config-factory.c create mode 100644 mail/mail-config-factory.h create mode 100644 mail/mail-preferences.c create mode 100644 mail/mail-preferences.h diff --git a/mail/ChangeLog b/mail/ChangeLog index 96cc14e7d9..bbfb8ae06f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,17 @@ +2002-03-26 Jeffrey Stedfast + + Sync with yet-another-mail-config branch. + + * mail-composer-prefs.c: Updated to get the right widgets and + whatnot. Also updated to tell the evolution-config-control that + stuff has changed. + + * mail-preferences.c: Updated to get the right widgets and + whatnot. Also updated to tell the evolution-config-control that + stuff has changed. + + * mail-accounts.etspec: New file needed by mail-accounts.c + 2002-03-26 Not Zed * mail-callbacks.c (addrbook_sender): Changed to get the address @@ -46,25 +60,76 @@ 2002-03-20 Ettore Perazzoli - * component-factory.c (send_receive_cb): New, callback for the - "send_receive" signal on the EvolutionShellComponent. - (create_component): Connect. + * folder-browser.c: Reorder folder_browser_search_menu_items + according to #16246. - * folder-browser-ui.c: Remove verb "MailGetSend". - - * mail-callbacks.c (send_receive_mail): Removed. +2002-03-24 Ettore Perazzoli * mail-send-recv.c: Remove member current_folder from struct _send_data. - (free_send_data): No need to unref here. - (build_dialogue): Removed arg @current_folder. + (build_dialogue): Remove arg @current_folder. (mail_send_receive): Likewise. + (free_send_data): No need to refresh the current folder here. + [Well, hopefully, at least.] -2002-03-20 Ettore Perazzoli + * component-factory.c (send_receive_callback): New. + (create_component): Connect. - * folder-browser.c: Reorder folder_browser_search_menu_items - according to #16246. + * mail-callbacks.c (send_receive_mail): Removed. + + * folder-browser-ui.c: Remove "MailGetSend" verb. + +2002-03-22 Jeffrey Stedfast + + * GNOME_Evolution_Mail.oaf.in: Add info about the new config + controls. + + * mail-config-factory.c: New file to handle the creation/etc of + the config controls. + + * mail-accounts.c: + + * mail-preferences.c: + + * mail-composer-prefs.c: No longer handle their own bonobo control + creation. + +2002-03-22 Jeffrey Stedfast + + * mail-account-gui.c (sig_new_text): Temporarily #if 0 this + function out. + (sig_new_html): Same. + + * mail-config.c (config_read): Read in the default reply style + setting. + (mail_config_write_on_exit): Same the default reply style. + (mail_config_get_default_reply_style): New function to get the + default reply style. + (mail_config_set_default_reply_style): New function to set the + default reply style. + + * folder-browser-ui.c: There is no longer a Tools/Mail Settings + menu item. + + * mail-account-gui.c: Updated the widget types for the + MailAccountsDialog->MailAccountsTab change. + + * mail_account_editor.c: Same. + + * mail-callbacks.c (providers_config): Removed. + + * mail-composer-prefs.c: New file that implements the composer + preferences tab of anna's new config design. + +2002-03-21 Jeffrey Stedfast + + * mail-accounts.c: Reimplemented. This time we only have to worry + about accounts. Also this now implements Annas config gui changes. + + * mail-preferences.c: Implements the mailer's Preferences tab in + Anna's new config GUI. +>>>>>>> 1.2089.2.5 2002-03-19 Larry Ewing * mail-display.c: add missing NULL closure data to popup menu @@ -171,7 +236,8 @@ * mail-display.c (on_link_clicked): Handle digest: urls. - * mail-format.c (setup_mime_tables): Add a handler for multipart/digest. + * mail-format.c (setup_mime_tables): Add a handler for + multipart/digest. (handle_multipart_digest): Handle multipart/digest parts. 2002-03-12 Jeffrey Stedfast diff --git a/mail/GNOME_Evolution_Mail.oaf.in b/mail/GNOME_Evolution_Mail.oaf.in index b693e8863d..8875ebf336 100644 --- a/mail/GNOME_Evolution_Mail.oaf.in +++ b/mail/GNOME_Evolution_Mail.oaf.in @@ -1,141 +1,333 @@ - + - - - + + - - + + + + - + + - - - - + + - - + + + - + + - - - + - + - - + + + - + - - - + + - - + - + - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + - + - - + + + + + + + + _value="Configuration control for the Evolution Mail Accounts."/> + - + - + - - + - - - + + + + _value="Configuration control for the Evolution Mailer."/> + - + - + - - + - - - - + - - + + + - diff --git a/mail/Makefile.am b/mail/Makefile.am index fca0b38dcd..5cc3e03c59 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -67,10 +67,14 @@ evolution_mail_SOURCES = \ mail-autofilter.h \ mail-callbacks.c \ mail-callbacks.h \ + mail-composer-prefs.c \ + mail-composer-prefs.h \ mail-config.c \ mail-config.h \ mail-config-druid.c \ mail-config-druid.h \ + mail-config-factory.c \ + mail-config-factory.h \ mail-crypto.c \ mail-crypto.h \ mail-display.c \ @@ -89,6 +93,8 @@ evolution_mail_SOURCES = \ mail-offline-handler.h \ mail-ops.c \ mail-ops.h \ + mail-preferences.c \ + mail-preferences.h \ mail-search.c \ mail-search.h \ mail-search-dialogue.c \ @@ -147,7 +153,7 @@ gladedir = $(datadir)/evolution/glade glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade message-tags.glade etspecdir = $(datadir)/evolution/etspec/ -etspec_DATA = message-list.etspec subscribe-dialog.etspec +etspec_DATA = mail-accounts.etspec message-list.etspec subscribe-dialog.etspec iconsdir = $(datadir)/images/evolution buttonsdir = $(datadir)/images/evolution/buttons diff --git a/mail/component-factory.c b/mail/component-factory.c index 452cff2c47..4be91c720c 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -756,6 +756,8 @@ owner_set_cb (EvolutionShellComponent *shell_component, rule_context_load (search_context, system, user); } + mail_config_register_factory (corba_shell); + if (mail_config_is_corrupt ()) { GtkWidget *dialog; diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c index 6400f6eb35..896355683c 100644 --- a/mail/folder-browser-ui.c +++ b/mail/folder-browser-ui.c @@ -110,7 +110,6 @@ static BonoboUIVerb global_verbs [] = { BONOBO_UI_UNSAFE_VERB ("MailCompose", compose_msg), BONOBO_UI_UNSAFE_VERB ("MailStop", stop_threads), BONOBO_UI_UNSAFE_VERB ("ToolsFilters", filter_edit), - BONOBO_UI_UNSAFE_VERB ("ToolsSettings", providers_config), BONOBO_UI_UNSAFE_VERB ("ToolsSubscriptions", manage_subscriptions), BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", vfolder_edit_vfolders), /* ViewPreview is a toggle */ diff --git a/mail/folder-browser.c b/mail/folder-browser.c index afa530b11a..17136f2bc8 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -882,7 +882,7 @@ folder_browser_set_folder (FolderBrowser *fb, CamelFolder *folder, const char *u fb->uri = g_strdup (uri); gtk_object_ref (GTK_OBJECT (fb)); - got_folder (uri, folder, fb); + got_folder (NULL, folder, fb); } void @@ -1964,14 +1964,16 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event } setup_popup_icons (); - + for (i=0;isource; @@ -182,7 +182,7 @@ construct (MailAccountEditor *editor, MailConfigAccount *account, MailAccountsDi } MailAccountEditor * -mail_account_editor_new (MailConfigAccount *account, GtkWindow *parent, MailAccountsDialog *dialog) +mail_account_editor_new (MailConfigAccount *account, GtkWindow *parent, MailAccountsTab *dialog) { MailAccountEditor *new; diff --git a/mail/mail-account-editor.h b/mail/mail-account-editor.h index d4225e324c..84b183b65d 100644 --- a/mail/mail-account-editor.h +++ b/mail/mail-account-editor.h @@ -43,8 +43,8 @@ extern "C" { struct _MailAccountEditor { GnomeDialog parent; - MailAccountGui *gui; - GtkNotebook *notebook; + MailAccountGui *gui; + GtkNotebook *notebook; }; typedef struct _MailAccountEditor MailAccountEditor; @@ -58,7 +58,7 @@ typedef struct { GtkType mail_account_editor_get_type (void); -MailAccountEditor *mail_account_editor_new (MailConfigAccount *account, GtkWindow *parent, MailAccountsDialog *dialog); +MailAccountEditor *mail_account_editor_new (MailConfigAccount *account, GtkWindow *parent, MailAccountsTab *dialog); #ifdef __cplusplus } diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 9f0abb48bc..8eb305ca9e 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -1146,6 +1146,7 @@ sig_set_and_write (MailAccountGui *gui) static void sig_new_text (GtkWidget *w, MailAccountGui *gui) { +#if 0 if (!gui->dialog) return; @@ -1158,11 +1159,13 @@ sig_new_text (GtkWidget *w, MailAccountGui *gui) sig_set_and_write (gui); gtk_widget_set_sensitive (gui->sig_edit_text, TRUE); +#endif } static void sig_new_html (GtkWidget *w, MailAccountGui *gui) { +#if 0 if (!gui->dialog) return; @@ -1175,6 +1178,7 @@ sig_new_html (GtkWidget *w, MailAccountGui *gui) sig_set_and_write (gui); gtk_widget_set_sensitive (gui->sig_edit_html, TRUE); +#endif } static void @@ -1357,7 +1361,7 @@ prepare_signatures (MailAccountGui *gui) } MailAccountGui * -mail_account_gui_new (MailConfigAccount *account, MailAccountsDialog *dialog) +mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog) { MailAccountGui *gui; diff --git a/mail/mail-account-gui.h b/mail/mail-account-gui.h index e7bd203caf..b62d9a1966 100644 --- a/mail/mail-account-gui.h +++ b/mail/mail-account-gui.h @@ -64,7 +64,7 @@ typedef struct { typedef struct { GtkWidget *top; MailConfigAccount *account; - MailAccountsDialog *dialog; + MailAccountsTab *dialog; GladeXML *xml; /* identity */ @@ -122,7 +122,7 @@ typedef struct { } MailAccountGui; -MailAccountGui *mail_account_gui_new (MailConfigAccount *account, MailAccountsDialog *dialog); +MailAccountGui *mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog); void mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top); gboolean mail_account_gui_save (MailAccountGui *gui); void mail_account_gui_destroy (MailAccountGui *gui); diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index c5a1c208b0..9667be98b6 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -2,305 +2,189 @@ /* * Authors: Jeffrey Stedfast * - * Copyright 2001 Ximian, Inc. (www.ximian.com) + * Copyright 2002 Ximian, Inc. (www.ximian.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ + #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include +#include "mail-accounts.h" + #include #include -#include -#include - -#include +#include +#include #include -#include +#include -#include "widgets/misc/e-charset-picker.h" +#include #include "mail.h" -#include "mail-accounts.h" #include "mail-config.h" #include "mail-config-druid.h" #include "mail-account-editor.h" -#ifdef ENABLE_NNTP -#include "mail-account-editor-news.h" -#endif #include "mail-send-recv.h" -#include "mail-session.h" -#include "mail-signature-editor.h" #include "art/mark.xpm" -static void mail_accounts_dialog_class_init (MailAccountsDialogClass *class); -static void mail_accounts_dialog_init (MailAccountsDialog *dialog); -static void mail_accounts_dialog_finalise (GtkObject *obj); -static void mail_unselect (GtkCList *clist, int row, int column, GdkEventButton *event, gpointer data); -static void mail_able (GtkButton *button, gpointer data); +static void mail_accounts_tab_class_init (MailAccountsTabClass *class); +static void mail_accounts_tab_init (MailAccountsTab *prefs); +static void mail_accounts_tab_finalise (GtkObject *obj); +static void mail_accounts_load (MailAccountsTab *tab); +static GdkPixbuf *pixbuf = NULL; -static MailConfigDruid *druid = NULL; -static MailAccountEditor *editor = NULL; -#ifdef ENABLE_NNTP -static MailAccountEditorNews *news_editor = NULL; -#endif +static GtkVBoxClass *parent_class = NULL; -static GnomeDialogClass *parent_class; GtkType -mail_accounts_dialog_get_type () +mail_accounts_tab_get_type (void) { static GtkType type = 0; if (!type) { GtkTypeInfo type_info = { - "MailAccountsDialog", - sizeof (MailAccountsDialog), - sizeof (MailAccountsDialogClass), - (GtkClassInitFunc) mail_accounts_dialog_class_init, - (GtkObjectInitFunc) mail_accounts_dialog_init, + "MailAccountsTab", + sizeof (MailAccountsTab), + sizeof (MailAccountsTabClass), + (GtkClassInitFunc) mail_accounts_tab_class_init, + (GtkObjectInitFunc) mail_accounts_tab_init, (GtkArgSetFunc) NULL, (GtkArgGetFunc) NULL }; - type = gtk_type_unique (gnome_dialog_get_type (), &type_info); + type = gtk_type_unique (gtk_vbox_get_type (), &type_info); } return type; } static void -mail_accounts_dialog_class_init (MailAccountsDialogClass *class) +mail_accounts_tab_class_init (MailAccountsTabClass *klass) { GtkObjectClass *object_class; - object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (gnome_dialog_get_type ()); + object_class = (GtkObjectClass *) klass; + parent_class = gtk_type_class (gtk_vbox_get_type ()); - object_class->finalize = mail_accounts_dialog_finalise; + object_class->finalize = mail_accounts_tab_finalise; /* override methods */ -} - -static void -mail_accounts_dialog_init (MailAccountsDialog *o) -{ - GdkPixbuf *pixbuf; - - pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mark_xpm); - gdk_pixbuf_render_pixmap_and_mask (pixbuf, &(o->mark_pixmap), &(o->mark_bitmap), 128); - gdk_pixbuf_unref (pixbuf); -} - -static void -mail_accounts_dialog_finalise (GtkObject *obj) -{ - MailAccountsDialog *dialog = (MailAccountsDialog *) obj; - - gtk_object_unref (GTK_OBJECT (dialog->gui)); - gdk_pixmap_unref (dialog->mark_pixmap); - gdk_bitmap_unref (dialog->mark_bitmap); - - ((GtkObjectClass *)(parent_class))->finalize (obj); -} - -static void -load_accounts (MailAccountsDialog *dialog) -{ - const MailConfigAccount *account, *default_account; - const GSList *node = dialog->accounts; - int i = 0; - - gtk_clist_freeze (dialog->mail_accounts); - - gtk_clist_clear (dialog->mail_accounts); - - default_account = mail_config_get_default_account (); - while (node) { - CamelURL *url; - char *text[3]; - - account = node->data; - - if (account->source && account->source->url) - url = camel_url_new (account->source->url, NULL); - else - url = NULL; - - text[0] = ""; - text[1] = e_utf8_to_gtk_string (GTK_WIDGET (dialog->mail_accounts), account->name); - text[2] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"), - (account == default_account) ? _(" (default)") : ""); - - if (url) - camel_url_free (url); - - gtk_clist_append (dialog->mail_accounts, text); - g_free (text[1]); - g_free (text[2]); - - if (account->source->enabled) - gtk_clist_set_pixmap (dialog->mail_accounts, i, 0, - dialog->mark_pixmap, - dialog->mark_bitmap); - - /* set the account on the row */ - gtk_clist_set_row_data (dialog->mail_accounts, i, (gpointer) account); - - node = node->next; - i++; - } - - gtk_clist_thaw (dialog->mail_accounts); - - /* - * The selection gets cleared when we rebuild the clist, but no - * unselect event is emitted. So we simulate it here. - * I hate the clist. - */ - mail_unselect (dialog->mail_accounts, 0, 0, NULL, dialog); + /* setup static data */ + pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mark_xpm); } - -/* mail callbacks */ static void -mail_select (GtkCList *clist, int row, int column, GdkEventButton *event, gpointer data) +mail_accounts_tab_init (MailAccountsTab *prefs) { - MailAccountsDialog *dialog = data; - MailConfigAccount *account = gtk_clist_get_row_data (clist, row); - - dialog->accounts_row = row; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), TRUE); - if (account->source && account->source->enabled) - gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Disable")); - else - gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Enable")); - - /* column 0 is the pixmap column */ - if (column == 0) - mail_able (dialog->mail_able, data); + prefs->druid = NULL; + prefs->editor = NULL; } static void -mail_unselect (GtkCList *clist, int row, int column, GdkEventButton *event, gpointer data) +mail_accounts_tab_finalise (GtkObject *obj) { - MailAccountsDialog *dialog = data; + MailAccountsTab *prefs = (MailAccountsTab *) obj; - dialog->accounts_row = -1; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE); + gtk_object_unref (GTK_OBJECT (prefs->gui)); - /* column 0 is the pixmap column */ - if (column == 0) - mail_able (dialog->mail_able, data); - - /* - * If an insensitive button in a button box has the focus, and if you hit tab, - * there is a segfault. I think that this might be a gtk bug. Anyway, this - * is a workaround. - */ - gtk_widget_grab_focus (GTK_WIDGET (dialog->mail_add)); + ((GtkObjectClass *)(parent_class))->finalize (obj); } static void -mail_add_finished (GtkWidget *widget, gpointer data) +account_add_finished (GtkWidget *widget, gpointer user_data) { /* Either Cancel or Finished was clicked in the druid so reload the accounts */ - MailAccountsDialog *dialog = data; + MailAccountsTab *prefs = user_data; - dialog->accounts = mail_config_get_accounts (); - load_accounts (dialog); - druid = NULL; + prefs->druid = NULL; + mail_accounts_load (prefs); } static void -mail_add (GtkButton *button, gpointer data) +account_add_clicked (GtkButton *button, gpointer user_data) { - MailAccountsDialog *dialog = data; + MailAccountsTab *prefs = (MailAccountsTab *) user_data; - if (druid == NULL) { - druid = mail_config_druid_new (dialog->shell); - gtk_signal_connect (GTK_OBJECT (druid), "destroy", - GTK_SIGNAL_FUNC (mail_add_finished), dialog); + if (prefs->druid == NULL) { + prefs->druid = (GtkWidget *) mail_config_druid_new (prefs->shell); + gtk_signal_connect (GTK_OBJECT (prefs->druid), "destroy", + GTK_SIGNAL_FUNC (account_add_finished), prefs); - gtk_widget_show (GTK_WIDGET (druid)); + gtk_widget_show (prefs->druid); } else { - gdk_window_raise (GTK_WIDGET (druid)->window); + gdk_window_raise (prefs->druid->window); } } static void -mail_editor_destroyed (GtkWidget *widget, gpointer data) +account_edit_finished (GtkWidget *widget, gpointer user_data) { - load_accounts (MAIL_ACCOUNTS_DIALOG (data)); - editor = NULL; + MailAccountsTab *prefs = user_data; + + prefs->editor = NULL; + mail_accounts_load (prefs); } static void -mail_edit (GtkButton *button, gpointer data) +account_edit_clicked (GtkButton *button, gpointer user_data) { - MailAccountsDialog *dialog = data; + MailAccountsTab *prefs = (MailAccountsTab *) user_data; - if (editor == NULL) { - if (dialog->accounts_row >= 0) { + if (prefs->editor == NULL) { + int row; + + row = e_table_get_cursor_row (prefs->table); + if (row >= 0) { MailConfigAccount *account; + GtkWidget *window; + + window = gtk_widget_get_ancestor (GTK_WIDGET (prefs), GTK_TYPE_WINDOW); - account = gtk_clist_get_row_data (dialog->mail_accounts, dialog->accounts_row); - editor = mail_account_editor_new (account, GTK_WINDOW (dialog), dialog); - gtk_signal_connect (GTK_OBJECT (editor), "destroy", - GTK_SIGNAL_FUNC (mail_editor_destroyed), - dialog); - gtk_widget_show (GTK_WIDGET (editor)); + account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row); + prefs->editor = (GtkWidget *) mail_account_editor_new (account, GTK_WINDOW (window), prefs); + gtk_signal_connect (GTK_OBJECT (prefs->editor), "destroy", + GTK_SIGNAL_FUNC (account_edit_finished), + prefs); + gtk_widget_show (prefs->editor); } } else { - gdk_window_raise (GTK_WIDGET (editor)->window); + gdk_window_raise (prefs->editor->window); } } static void -mail_double_click (GtkWidget *widget, GdkEventButton *event, gpointer data) -{ - if (event->type == GDK_2BUTTON_PRESS) - mail_edit (NULL, data); -} - -static void -mail_delete (GtkButton *button, gpointer data) +account_delete_clicked (GtkButton *button, gpointer user_data) { - MailAccountsDialog *dialog = data; - MailConfigAccount *account; + MailAccountsTab *prefs = user_data; + const MailConfigAccount *account; GnomeDialog *confirm; - int ans; + const GSList *list; + int row, ans; + + row = e_table_get_cursor_row (prefs->table); /* make sure we have a valid account selected and that we aren't editing anything... */ - if (dialog->accounts_row < 0 || editor != NULL) + if (row < 0 || prefs->editor != NULL) return; confirm = GNOME_DIALOG (gnome_message_box_new (_("Are you sure you want to delete this account?"), @@ -311,1239 +195,255 @@ mail_delete (GtkButton *button, gpointer data) gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE); gtk_window_set_modal (GTK_WINDOW (confirm), TRUE); gtk_window_set_title (GTK_WINDOW (confirm), _("Really delete account?")); - gnome_dialog_set_parent (confirm, GTK_WINDOW (dialog)); + gnome_dialog_set_parent (confirm, GTK_WINDOW (prefs)); ans = gnome_dialog_run_and_close (confirm); if (ans == 0) { - int sel, row, len; - - sel = dialog->accounts_row; + int select, len; - account = gtk_clist_get_row_data (dialog->mail_accounts, sel); + account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row); /* remove it from the folder-tree in the shell */ if (account->source && account->source->url && account->source->enabled) mail_remove_storage_by_uri (account->source->url); /* remove it from the config file */ - dialog->accounts = mail_config_remove_account (account); + list = mail_config_remove_account ((MailConfigAccount *) account); + mail_config_write (); + mail_autoreceive_setup (); - gtk_clist_remove (dialog->mail_accounts, sel); + e_table_memory_store_remove (E_TABLE_MEMORY_STORE (prefs->model), row); - len = dialog->accounts ? g_slist_length ((GSList *) dialog->accounts) : 0; + len = list ? g_slist_length ((GSList *) list) : 0; if (len > 0) { - row = sel >= len ? len - 1 : sel; - load_accounts (dialog); - gtk_clist_select_row (dialog->mail_accounts, row, 1); + select = row >= len ? len - 1 : row; + e_table_set_cursor_row (prefs->table, select); } else { - dialog->accounts_row = -1; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), FALSE); } } } static void -mail_default (GtkButton *button, gpointer data) +account_default_clicked (GtkButton *button, gpointer user_data) { - MailAccountsDialog *dialog = data; + MailAccountsTab *prefs = user_data; const MailConfigAccount *account; + int row; - if (dialog->accounts_row >= 0) { - int row; + row = e_table_get_cursor_row (prefs->table); + + if (row >= 0) { + account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row); - row = dialog->accounts_row; - account = gtk_clist_get_row_data (dialog->mail_accounts, row); mail_config_set_default_account (account); + mail_config_write (); - load_accounts (dialog); - gtk_clist_select_row (dialog->mail_accounts, row, 1); + + mail_accounts_load (prefs); } } static void -mail_able (GtkButton *button, gpointer data) +account_able_clicked (GtkButton *button, gpointer user_data) { - MailAccountsDialog *dialog = data; + MailAccountsTab *prefs = user_data; const MailConfigAccount *account; + int row; - if (dialog->accounts_row >= 0) { - int row; - - row = dialog->accounts_row; - account = gtk_clist_get_row_data (dialog->mail_accounts, row); + row = e_table_get_cursor_row (prefs->table); + + if (row >= 0) { + account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row); account->source->enabled = !account->source->enabled; if (account->source && account->source->url) { if (account->source->enabled) - mail_load_storage_by_uri (dialog->shell, account->source->url, account->name); + mail_load_storage_by_uri (prefs->shell, account->source->url, account->name); else mail_remove_storage_by_uri (account->source->url); } mail_autoreceive_setup (); + mail_config_write (); - load_accounts (dialog); - gtk_clist_select_row (dialog->mail_accounts, row, 1); + + mail_accounts_load (prefs); } } - -#ifdef ENABLE_NNTP static void -load_news (MailAccountsDialog *dialog) +account_cursor_change (ETable *table, int row, gpointer user_data) { - const MailConfigService *service; - const GSList *node = dialog->news; - int i = 0; - - gtk_clist_freeze (dialog->news_accounts); + MailAccountsTab *prefs = user_data; - gtk_clist_clear (dialog->news_accounts); - - while (node) { - CamelURL *url; - gchar *text[1]; + if (row >= 0) { + const MailConfigAccount *account; - service = node->data; - - if (service->url) - url = camel_url_new (service->url, NULL); + account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row); + if (account->source && account->source->enabled) + gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->mail_able)->child), _("Disable")); else - url = NULL; - - text[0] = g_strdup_printf ("%s", url && url->host ? url->host : _("None")); + gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->mail_able)->child), _("Enable")); - if (url) - camel_url_free (url); - - gtk_clist_append (dialog->news_accounts, text); - g_free (text[0]); - - /* set the account on the row */ - gtk_clist_set_row_data (dialog->news_accounts, i, (gpointer) service); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), TRUE); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), TRUE); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), TRUE); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), TRUE); + } else { + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), FALSE); - node = node->next; - i++; + gtk_widget_grab_focus (GTK_WIDGET (prefs->mail_add)); } - - gtk_clist_thaw (dialog->news_accounts); } - -/* news callbacks */ static void -news_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data) +account_double_click (ETable *table, int row, int col, GdkEvent *event, gpointer user_data) { - MailAccountsDialog *dialog = data; - - dialog->news_row = row; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), TRUE); + account_edit_clicked (NULL, user_data); } static void -news_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data) +mail_accounts_load (MailAccountsTab *prefs) { - MailAccountsDialog *dialog = data; + const GSList *node; + int row = 0; - dialog->news_row = -1; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE); -} - -static void -news_editor_destroyed (GtkWidget *widget, gpointer data) -{ - load_news (MAIL_ACCOUNTS_DIALOG (data)); - news_editor = NULL; -} - -static void -news_edit (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; + e_table_memory_freeze (E_TABLE_MEMORY (prefs->model)); - if (news_editor == NULL) { - if (dialog->news_row >= 0) { - MailConfigService *service; - - service = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row); - news_editor = mail_account_editor_news_new (service); - gtk_signal_connect (GTK_OBJECT (news_editor), "destroy", - GTK_SIGNAL_FUNC (news_editor_destroyed), - dialog); - gtk_widget_show (GTK_WIDGET (news_editor)); - } - } else { - gdk_window_raise (GTK_WIDGET (news_editor)->window); - } -} - -static void -news_add_destroyed (GtkWidget *widget, gpointer data) -{ - gpointer *send = data; - MailAccountsDialog *dialog; - MailConfigService *service; - - service = send[0]; - dialog = send[1]; - g_free(send); - - dialog->news = mail_config_get_news (); - load_news (dialog); - - mail_load_storage_by_uri(dialog->shell, service->url, NULL); + e_table_memory_store_clear (E_TABLE_MEMORY_STORE (prefs->model)); - dialog->news = mail_config_get_news (); - load_news (dialog); - -} - -static void -news_add (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; - MailConfigService *service; - gpointer *send; - - if (news_editor == NULL) { - send = g_new (gpointer, 2); - - service = g_new0 (MailConfigService, 1); - service->url = NULL; + node = mail_config_get_accounts (); + while (node) { + const MailConfigAccount *account; + CamelURL *url; - news_editor = mail_account_editor_news_new (service); - send[0] = service; - send[1] = dialog; - gtk_signal_connect (GTK_OBJECT (news_editor), "destroy", - GTK_SIGNAL_FUNC (news_add_destroyed), - send); - gtk_widget_show (GTK_WIDGET (news_editor)); - } else { - gdk_window_raise (GTK_WIDGET (news_editor)->window); - } -} - -static void -news_delete (GtkButton *button, gpointer data) -{ - MailAccountsDialog *dialog = data; - MailConfigService *server; - GnomeDialog *confirm; - GtkWidget *label; - int ans; - - /* don't allow user to delete an account if he might be editing it */ - if (dialog->news_row < 0 || news_editor != NULL) - return; - - confirm = GNOME_DIALOG (gnome_dialog_new (_("Are you sure you want to delete this news account?"), - GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL)); - gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE); - gtk_window_set_modal (GTK_WINDOW (confirm), TRUE); - label = gtk_label_new (_("Are you sure you want to delete this news account?")); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_box_pack_start (GTK_BOX (confirm->vbox), label, TRUE, TRUE, 0); - gtk_widget_show (label); - gnome_dialog_set_parent (confirm, GTK_WINDOW (dialog)); - ans = gnome_dialog_run_and_close (confirm); - - if (ans == 0) { - int row, len; + account = node->data; - server = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row); + url = account->source && account->source->url ? camel_url_new (account->source->url, NULL) : NULL; - /* remove it from the folder-tree in the shell */ - if (server && server->url) { - CamelProvider *prov; - CamelException ex; - - camel_exception_init (&ex); - prov = camel_session_get_provider (session, server->url, &ex); - if (prov != NULL && prov->flags & CAMEL_PROVIDER_IS_STORAGE && - prov->flags & CAMEL_PROVIDER_IS_REMOTE) { - CamelService *store; - - store = camel_session_get_service (session, server->url, - CAMEL_PROVIDER_STORE, &ex); - if (store != NULL) { - g_warning ("removing news storage: %s", server->url); - mail_remove_storage (CAMEL_STORE (store)); - camel_object_unref (CAMEL_OBJECT (store)); - } - } else - g_warning ("%s is not a remote news storage.", server->url); - camel_exception_clear (&ex); - } + e_table_memory_store_insert_list (E_TABLE_MEMORY_STORE (prefs->model), + row, GINT_TO_POINTER (account->source->enabled), + account->name, + url && url->protocol ? url->protocol : U_("None")); - /* remove it from the config file */ - dialog->news = mail_config_remove_news (server); - mail_config_write (); + if (url) + camel_url_free (url); - gtk_clist_remove (dialog->news_accounts, dialog->news_row); + e_table_memory_set_data (E_TABLE_MEMORY (prefs->model), row, (gpointer) account); - len = dialog->news ? g_slist_length ((GSList *) dialog->news) : 0; - if (len > 0) { - row = dialog->news_row; - row = row >= len ? len - 1 : row; - gtk_clist_select_row (dialog->news_accounts, row, 0); - } else { - dialog->news_row = -1; - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE); - } - } -} -#endif /* ENABLE_NNTP */ - -/* temp widget callbacks */ -static void -send_html_toggled (GtkToggleButton *button, gpointer data) -{ - mail_config_set_send_html (gtk_toggle_button_get_active (button)); -} - -static void -citation_highlight_toggled (GtkToggleButton *button, gpointer data) -{ - mail_config_set_citation_highlight (gtk_toggle_button_get_active (button)); -} - -static void -timeout_toggled (GtkToggleButton *button, gpointer data) -{ - mail_config_set_do_seen_timeout (gtk_toggle_button_get_active (button)); -} - -static void -citation_color_set (GnomeColorPicker *cp, guint r, guint g, guint b, guint a) -{ - guint32 rgb; - - rgb = r >> 8; - rgb <<= 8; - rgb |= g >> 8; - rgb <<= 8; - rgb |= b >> 8; - - mail_config_set_citation_color (rgb); -} - -static void -label_name_changed (GtkEntry *entry, gpointer user_data) -{ - MailAccountsDialog *dialog = user_data; - char *label_name; - int label; - - for (label = 0; label < 5; label++) { - if (entry == dialog->labels[label].name) - break; - } - - g_assert (label < 5); - - label_name = e_utf8_gtk_entry_get_text (entry); - mail_config_set_label_name (label, label_name); - g_free (label_name); -} - -static void -label_color_set (GnomeColorPicker *cp, guint r, guint g, guint b, guint a, gpointer user_data) -{ - MailAccountsDialog *dialog = user_data; - guint32 rgb = 0; - int label; - - for (label = 0; label < 5; label++) { - if (cp == dialog->labels[label].color) - break; - } - - g_assert (label < 5); - - rgb = r >> 8; - rgb <<= 8; - rgb |= g >> 8; - rgb <<= 8; - rgb |= b >> 8; - - mail_config_set_label_color (label, rgb); -} - -static void -set_color (GnomeColorPicker *cp, guint32 rgb) -{ - gnome_color_picker_set_i8 (cp, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff); -} - -static void -restore_labels_clicked (GtkButton *button, gpointer user_data) -{ - MailAccountsDialog *dialog = user_data; - int i; - - for (i = 0; i < 5; i++) { - e_utf8_gtk_entry_set_text (dialog->labels[i].name, U_(label_defaults[i].name)); - set_color (dialog->labels[i].color, label_defaults[i].color); - mail_config_set_label_color (i, label_defaults[i].color); + node = node->next; + row++; } -} - -/* FIXME: */ - -static void -timeout_changed (GtkEntry *entry, gpointer data) -{ - MailAccountsDialog *dialog = data; - gint val; - - val = (gint) (gtk_spin_button_get_value_as_float (dialog->timeout) * 1000); - - mail_config_set_mark_as_seen_timeout (val); -} - -static void -pgp_path_changed (GtkEntry *entry, gpointer data) -{ - CamelPgpType type; - const char *path; - - path = gtk_entry_get_text (entry); - - type = mail_config_pgp_type_detect_from_path (path); - mail_config_set_pgp_path (path && *path ? path : NULL); - mail_config_set_pgp_type (type); + e_table_memory_thaw (E_TABLE_MEMORY (prefs->model)); } -static void -filter_log_path_changed (GtkEntry *entry, gpointer data) -{ - const char *path; - - path = gtk_entry_get_text (entry); - - mail_config_set_filter_log_path (path && *path ? path : NULL); -} -static void -images_radio_toggled (GtkWidget *radio, gpointer data) -{ - MailAccountsDialog *dialog = data; - - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio))) - return; - - if (radio == (GtkWidget *)dialog->images_always) - mail_config_set_http_mode (MAIL_CONFIG_HTTP_ALWAYS); - else if (radio == (GtkWidget *)dialog->images_sometimes) - mail_config_set_http_mode (MAIL_CONFIG_HTTP_SOMETIMES); - else - mail_config_set_http_mode (MAIL_CONFIG_HTTP_NEVER); -} +GtkWidget *mail_accounts_etable_new (char *widget_name, char *string1, char *string2, + int int1, int int2); -static void -notify_radio_toggled (GtkWidget *radio, gpointer data) +GtkWidget * +mail_accounts_etable_new (char *widget_name, char *string1, char *string2, int int1, int int2) { - MailAccountsDialog *dialog = data; + ETable *etable; + ETableModel *model; + ETableExtras *extras; + GdkPixbuf *images[2]; + ETableMemoryStoreColumnInfo columns[] = { + E_TABLE_MEMORY_STORE_INTEGER, + E_TABLE_MEMORY_STORE_STRING, + E_TABLE_MEMORY_STORE_STRING, + E_TABLE_MEMORY_STORE_TERMINATOR, + }; - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio))) - return; + extras = e_table_extras_new (); - if (radio == (GtkWidget *) dialog->notify_not) - mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_NOT); - else if (radio == (GtkWidget *) dialog->notify_beep) - mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_BEEP); - else - mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_PLAY_SOUND); -} - -static void -notify_sound_file_changed (GtkWidget *entry, gpointer data) -{ - char *filename; + images[0] = NULL; /* disabled */ + images[1] = pixbuf; /* enabled */ + e_table_extras_add_cell (extras, "render_able", e_cell_toggle_new (0, 2, images)); - filename = gtk_entry_get_text (GTK_ENTRY (entry)); - mail_config_set_new_mail_notify_sound_file (filename); -} - -static void -empty_trash_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_empty_trash_on_exit (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -prompt_empty_subject_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_prompt_empty_subject (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -prompt_bcc_only_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_prompt_only_bcc (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -prompt_unwanted_html_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_confirm_unwanted_html (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -#if 0 -/* Note: Please see construct() for a reason as to why these 2 options are disabled */ -static void -thread_list_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_thread_list (NULL, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -show_preview_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_show_preview (NULL, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} -#endif - -static void -filter_log_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_filter_log (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -confirm_expunge_toggled (GtkWidget *toggle, gpointer data) -{ - mail_config_set_confirm_expunge (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); -} - -static void -forward_style_activated (GtkWidget *item, gpointer data) -{ - int style = GPOINTER_TO_INT (data); - - mail_config_set_default_forward_style (style); -} - -static void -attach_forward_style_signal (GtkWidget *item, gpointer data) -{ - int *num = data; - - gtk_signal_connect (GTK_OBJECT (item), "activate", - forward_style_activated, GINT_TO_POINTER (*num)); - (*num)++; -} - -static void -charset_menu_deactivate (GtkWidget *menu, gpointer data) -{ - char *charset; - - charset = e_charset_picker_get_charset (menu); - if (charset) { - mail_config_set_default_charset (charset); - g_free (charset); - } -} - -static void sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailAccountsDialog *dialog); - -static void -dialog_destroy (GtkWidget *dialog, gpointer user_data) -{ - if (druid) - gtk_widget_destroy (GTK_WIDGET (druid)); + model = e_table_memory_store_new (columns); - if (editor) - gtk_widget_destroy (GTK_WIDGET (editor)); + etable = (ETable *) e_table_new_from_spec_file (model, extras, EVOLUTION_ETSPECDIR "/mail-accounts.etspec", NULL); -#ifdef ENABLE_NNTP - if (news_editor) - gtk_widget_destroy (GTK_WIDGET (news_editor)); -#endif - mail_config_signature_unregister_client ((MailConfigSignatureClient) sig_event_client, dialog); - gtk_widget_unref (((MailAccountsDialog *) dialog)->sig_advanced_button); - gtk_widget_unref (((MailAccountsDialog *) dialog)->sig_simple_button); -} - -/* Signatures */ - -static void -run_script (gchar *script) -{ - struct stat s; - - if (stat (script, &s)) - return; - - if (!S_ISREG (s.st_mode) || !(s.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR))) - return; - - mail_config_signature_run_script (script); -} - -static void -sig_load_preview (MailAccountsDialog *dialog, MailConfigSignature *sig) -{ - gchar *str; - - if (!sig) { - gtk_html_load_from_string (GTK_HTML (dialog->sig_gtk_html), " ", 1); - return; - } - - str = e_msg_composer_get_sig_file_content (sig->filename, sig->html); - if (!str) - str = g_strdup (" "); - - /* printf ("HTML: %s\n", str); */ - if (sig->html) - gtk_html_load_from_string (GTK_HTML (dialog->sig_gtk_html), str, strlen (str)); - else { - GtkHTMLStream *stream; - gint len; - - len = strlen (str); - stream = gtk_html_begin (GTK_HTML (dialog->sig_gtk_html)); - gtk_html_write (GTK_HTML (dialog->sig_gtk_html), stream, "
", 5);
-		if (len)
-			gtk_html_write (GTK_HTML (dialog->sig_gtk_html), stream, str, len);
-		gtk_html_write (GTK_HTML (dialog->sig_gtk_html), stream, "
", 6); - gtk_html_end (GTK_HTML (dialog->sig_gtk_html), stream, GTK_HTML_STREAM_OK); - } - - g_free (str); -} - -static inline void -sig_write_and_update_preview (MailAccountsDialog *dialog, MailConfigSignature *sig) -{ - sig_load_preview (dialog, sig); - mail_config_signature_write (sig); -} - -static MailConfigSignature * -sig_current_sig (MailAccountsDialog *dialog) -{ - return gtk_clist_get_row_data (GTK_CLIST (dialog->sig_clist), dialog->sig_row); -} - -static void -sig_script_activate (GtkWidget *w, MailAccountsDialog *dialog) -{ - MailConfigSignature *sig = sig_current_sig (dialog); - - if (sig && sig->script && *sig->script) { - run_script (sig->script); - sig_write_and_update_preview (dialog, sig); - } -} - -static void -sig_edit (GtkWidget *w, MailAccountsDialog *dialog) -{ - MailConfigSignature *sig = sig_current_sig (dialog); - - if (sig->filename && *sig->filename) - mail_signature_editor (sig); - else - e_notice (GTK_WINDOW (dialog), GNOME_MESSAGE_BOX_ERROR, - _("Please specify signature filename\nin Andvanced section of signature settings.")); -} - -MailConfigSignature * -mail_accounts_dialog_new_signature (MailAccountsDialog *dialog, gboolean html) -{ - MailConfigSignature *sig; - gchar *name [1]; - gint row; - - sig = mail_config_signature_add (html); - - name [0] = sig->name; - row = gtk_clist_append (GTK_CLIST (dialog->sig_clist), name); - gtk_clist_set_row_data (GTK_CLIST (dialog->sig_clist), row, sig); - gtk_clist_select_row (GTK_CLIST (dialog->sig_clist), row, 0); - gtk_widget_grab_focus (dialog->sig_name); - - sig_edit (NULL, dialog); - - return sig; -} - -static void sig_row_unselect (GtkWidget *w, gint row, gint col, GdkEvent *event, MailAccountsDialog *dialog); - -static void -sig_delete (GtkWidget *w, MailAccountsDialog *dialog) -{ - MailConfigSignature *sig = sig_current_sig (dialog); - - gtk_clist_remove (GTK_CLIST (dialog->sig_clist), dialog->sig_row); - mail_config_signature_delete (sig); - if (dialog->sig_row < GTK_CLIST (dialog->sig_clist)->rows) - gtk_clist_select_row (GTK_CLIST (dialog->sig_clist), dialog->sig_row, 0); - else if (dialog->sig_row) - gtk_clist_select_row (GTK_CLIST (dialog->sig_clist), dialog->sig_row - 1, 0); - else - sig_row_unselect (dialog->sig_clist, dialog->sig_row, 0, NULL, dialog); -} - -static void -sig_add (GtkWidget *w, MailAccountsDialog *dialog) -{ - mail_accounts_dialog_new_signature (dialog, FALSE); -} - -static void -sig_level (GtkWidget *w, MailAccountsDialog *dialog) -{ - GtkWidget *button; - gboolean level; - - if (!GTK_WIDGET_VISIBLE (w)) - return; - - level = w == dialog->sig_advanced_button; - - button = level ? dialog->sig_simple_button : dialog->sig_advanced_button; - gtk_widget_hide (w); - gtk_container_remove (GTK_CONTAINER (dialog->sig_level_bbox), w); - gtk_box_pack_start (GTK_BOX (dialog->sig_level_bbox), button, FALSE, 0, FALSE); - gtk_widget_show (button); - - level ? gtk_widget_hide (dialog->sig_preview) : gtk_widget_show (dialog->sig_preview); - level ? gtk_widget_show (dialog->sig_advanced_table) : gtk_widget_hide (dialog->sig_advanced_table); -} - -static void -sig_row_select (GtkWidget *w, gint row, gint col, GdkEvent *event, MailAccountsDialog *dialog) -{ - MailConfigSignature *sig; - - printf ("sig_row_select\n"); - gtk_widget_set_sensitive (dialog->sig_add, TRUE); - gtk_widget_set_sensitive (dialog->sig_delete, TRUE); - gtk_widget_set_sensitive (dialog->sig_edit, TRUE); - gtk_widget_set_sensitive (dialog->sig_name, TRUE); - gtk_widget_set_sensitive (dialog->sig_random, TRUE); - gtk_widget_set_sensitive (dialog->sig_filename, TRUE); - gtk_widget_set_sensitive (dialog->sig_script, TRUE); - gtk_widget_set_sensitive (dialog->sig_html, TRUE); - - dialog->sig_switch = TRUE; - sig = gtk_clist_get_row_data (GTK_CLIST (dialog->sig_clist), row); - if (sig) { - if (sig->name) - e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->sig_name), sig->name); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->sig_random), sig->random); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->sig_html), sig->html); - if (sig->filename) - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry - (GNOME_FILE_ENTRY (dialog->sig_filename))), - sig->filename); - if (sig->script) - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry - (GNOME_FILE_ENTRY (dialog->sig_script))), - sig->script); - } - dialog->sig_switch = FALSE; - dialog->sig_row = row; - - sig_load_preview (dialog, sig); + return (GtkWidget *) etable; } static void -sig_row_unselect (GtkWidget *w, gint row, gint col, GdkEvent *event, MailAccountsDialog *dialog) -{ - printf ("sig_row_unselect\n"); - gtk_widget_set_sensitive (dialog->sig_add, FALSE); - gtk_widget_set_sensitive (dialog->sig_delete, FALSE); - gtk_widget_set_sensitive (dialog->sig_edit, FALSE); - gtk_widget_set_sensitive (dialog->sig_name, FALSE); - gtk_widget_set_sensitive (dialog->sig_random, FALSE); - gtk_widget_set_sensitive (dialog->sig_filename, FALSE); - gtk_widget_set_sensitive (dialog->sig_script, FALSE); - - dialog->sig_switch = TRUE; - gtk_entry_set_text (GTK_ENTRY (dialog->sig_name), ""); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->sig_random), FALSE); - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (dialog->sig_filename))), ""); - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (dialog->sig_script))), ""); - dialog->sig_switch = FALSE; -} - -static void -sig_fill_clist (GtkWidget *clist) -{ - GList *l; - gchar *name [1]; - gint row; - - gtk_clist_freeze (GTK_CLIST (clist)); - for (l = mail_config_get_signature_list (); l; l = l->next) { - name [0] = ((MailConfigSignature *) l->data)->name; - row = gtk_clist_append (GTK_CLIST (clist), name); - gtk_clist_set_row_data (GTK_CLIST (clist), row, l->data); - } - gtk_clist_thaw (GTK_CLIST (clist)); -} - -static void -sig_name_changed (GtkWidget *w, MailAccountsDialog *dialog) -{ - MailConfigSignature *sig = sig_current_sig (dialog); - - if (dialog->sig_switch) - return; - - mail_config_signature_set_name (sig, e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->sig_name))); - gtk_clist_set_text (GTK_CLIST (dialog->sig_clist), dialog->sig_row, 0, sig->name); - - sig_write_and_update_preview (dialog, sig); -} - -static void -sig_random_toggled (GtkWidget *w, MailAccountsDialog *dialog) -{ - MailConfigSignature *sig = sig_current_sig (dialog); - - if (dialog->sig_switch) - return; - - mail_config_signature_set_random (sig, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->sig_random))); - - sig_write_and_update_preview (dialog, sig); -} - -static void -sig_html_toggled (GtkWidget *w, MailAccountsDialog *dialog) -{ - MailConfigSignature *sig = sig_current_sig (dialog); - - if (dialog->sig_switch) - return; - - sig->html = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->sig_html)); - - sig_write_and_update_preview (dialog, sig); -} - -static void -sig_filename_changed (GtkWidget *w, MailAccountsDialog *dialog) -{ - MailConfigSignature *sig = sig_current_sig (dialog); - - if (dialog->sig_switch) - return; - - mail_config_signature_set_filename (sig, gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (dialog->sig_filename), - FALSE)); - sig_write_and_update_preview (dialog, sig); -} - -static void -sig_script_changed (GtkWidget *w, MailAccountsDialog *dialog) -{ - MailConfigSignature *sig = sig_current_sig (dialog); - - if (dialog->sig_switch) - return; - - g_free (sig->script); - sig->script = g_strdup (gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (dialog->sig_script), FALSE)); - - sig_write_and_update_preview (dialog, sig); -} - -static void -url_requested (GtkHTML *html, const gchar *url, GtkHTMLStream *handle) -{ - GtkHTMLStreamStatus status; - gint fd; - - if (!strncmp (url, "file:", 5)) - url += 5; - - fd = open (url, O_RDONLY); - status = GTK_HTML_STREAM_OK; - if (fd != -1) { - ssize_t size; - void *buf = alloca (1 << 7); - while ((size = read (fd, buf, 1 << 7))) { - if (size == -1) { - status = GTK_HTML_STREAM_ERROR; - break; - } else - gtk_html_write (html, handle, (const gchar *) buf, size); - } - } else - status = GTK_HTML_STREAM_ERROR; - gtk_html_end (html, handle, status); -} - -static void -sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailAccountsDialog *dialog) -{ - switch (event) { - case MAIL_CONFIG_SIG_EVENT_NAME_CHANGED: - printf ("accounts NAME CHANGED\n"); - gtk_clist_set_text (GTK_CLIST (dialog->sig_clist), sig->id, 0, sig->name); - if (sig == sig_current_sig (dialog)) { - dialog->sig_switch = TRUE; - e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->sig_name), sig->name); - dialog->sig_switch = FALSE; - } - break; - case MAIL_CONFIG_SIG_EVENT_CONTENT_CHANGED: - printf ("accounts CONTENT CHANGED\n"); - if (sig == sig_current_sig (dialog)) - sig_load_preview (dialog, sig); - break; - case MAIL_CONFIG_SIG_EVENT_HTML_CHANGED: - printf ("accounts HTML CHANGED\n"); - if (sig == sig_current_sig (dialog)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->sig_html), sig->html); - break; - default: - ; - } -} - -static void -signatures_page_construct (MailAccountsDialog *dialog, GladeXML *gui) -{ - dialog->sig_add = glade_xml_get_widget (gui, "button-sig-add"); - gtk_signal_connect (GTK_OBJECT (dialog->sig_add), "clicked", GTK_SIGNAL_FUNC (sig_add), dialog); - - dialog->sig_delete = glade_xml_get_widget (gui, "button-sig-delete"); - gtk_signal_connect (GTK_OBJECT (dialog->sig_delete), "clicked", GTK_SIGNAL_FUNC (sig_delete), dialog); - - dialog->sig_edit = glade_xml_get_widget (gui, "button-sig-edit"); - gtk_signal_connect (GTK_OBJECT (dialog->sig_edit), "clicked", GTK_SIGNAL_FUNC (sig_edit), dialog); - - dialog->sig_advanced_button = glade_xml_get_widget (gui, "button-sig-advanced"); - gtk_signal_connect (GTK_OBJECT (dialog->sig_advanced_button), "clicked", GTK_SIGNAL_FUNC (sig_level), dialog); - - dialog->sig_simple_button = glade_xml_get_widget (gui, "button-sig-simple"); - gtk_signal_connect (GTK_OBJECT (dialog->sig_simple_button), "clicked", GTK_SIGNAL_FUNC (sig_level), dialog); - dialog->sig_level_bbox = glade_xml_get_widget (gui, "vbbox-sig-level"); - - gtk_widget_ref (dialog->sig_advanced_button); - gtk_widget_ref (dialog->sig_simple_button); - gtk_widget_hide (dialog->sig_simple_button); - gtk_container_remove (GTK_CONTAINER (dialog->sig_level_bbox), dialog->sig_simple_button); - - dialog->sig_clist = glade_xml_get_widget (gui, "clist-sig"); - sig_fill_clist (dialog->sig_clist); - gtk_signal_connect (GTK_OBJECT (dialog->sig_clist), "select_row", GTK_SIGNAL_FUNC (sig_row_select), dialog); - gtk_signal_connect (GTK_OBJECT (dialog->sig_clist), "unselect_row", GTK_SIGNAL_FUNC (sig_row_unselect), dialog); - - dialog->sig_name = glade_xml_get_widget (gui, "entry-sig-name"); - gtk_signal_connect (GTK_OBJECT (dialog->sig_name), "changed", GTK_SIGNAL_FUNC (sig_name_changed), dialog); - - dialog->sig_html = glade_xml_get_widget (gui, "check-sig-html"); - gtk_signal_connect (GTK_OBJECT (dialog->sig_html), "toggled", GTK_SIGNAL_FUNC (sig_html_toggled), dialog); - - dialog->sig_random = glade_xml_get_widget (gui, "check-sig-random"); - gtk_signal_connect (GTK_OBJECT (dialog->sig_random), "toggled", GTK_SIGNAL_FUNC (sig_random_toggled), dialog); - - dialog->sig_filename = glade_xml_get_widget (gui, "file-sig-filename"); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (dialog->sig_filename))), - "changed", GTK_SIGNAL_FUNC (sig_filename_changed), dialog); - - dialog->sig_script = glade_xml_get_widget (gui, "file-sig-script"); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (dialog->sig_script))), - "changed", GTK_SIGNAL_FUNC (sig_script_changed), dialog); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (dialog->sig_script))), - "activate", GTK_SIGNAL_FUNC (sig_script_activate), dialog); - - dialog->sig_advanced_table = glade_xml_get_widget (gui, "table-sig-advanced"); - dialog->sig_preview = glade_xml_get_widget (gui, "frame-sig-preview"); - - /* preview GtkHTML widget */ - dialog->sig_scrolled = glade_xml_get_widget (gui, "scrolled-sig"); - dialog->sig_gtk_html = gtk_html_new (); - gtk_signal_connect (GTK_OBJECT (dialog->sig_gtk_html), "url_requested", GTK_SIGNAL_FUNC (url_requested), NULL); - gtk_widget_show (dialog->sig_gtk_html); - gtk_container_add (GTK_CONTAINER (dialog->sig_scrolled), dialog->sig_gtk_html); - - if (GTK_CLIST (dialog->sig_clist)->rows) - gtk_clist_select_row (GTK_CLIST (dialog->sig_clist), 0, 0); - - mail_config_signature_register_client ((MailConfigSignatureClient) sig_event_client, dialog); -} - -static void -construct (MailAccountsDialog *dialog) +mail_accounts_tab_construct (MailAccountsTab *prefs) { + GtkWidget *toplevel; GladeXML *gui; - GtkWidget *notebook, *menu; - char *widget_name; - const char *text; - int i, num; - gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); - dialog->gui = gui; + gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "accounts_tab"); + prefs->gui = gui; /* get our toplevel widget */ - notebook = glade_xml_get_widget (gui, "notebook"); + toplevel = glade_xml_get_widget (gui, "toplevel"); /* reparent */ - gtk_widget_reparent (notebook, GNOME_DIALOG (dialog)->vbox); - - /* give our dialog an Close button and title */ - gtk_window_set_title (GTK_WINDOW (dialog), _("Mail Settings")); - gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, TRUE); - gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300); - gnome_dialog_append_button (GNOME_DIALOG (dialog), GNOME_STOCK_BUTTON_OK); - - gtk_signal_connect (GTK_OBJECT (dialog), "destroy", - GTK_SIGNAL_FUNC (dialog_destroy), dialog); - - dialog->mail_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistAccounts")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "select-row", - GTK_SIGNAL_FUNC (mail_select), dialog); - gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "unselect-row", - GTK_SIGNAL_FUNC (mail_unselect), dialog); - gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "button_press_event", - mail_double_click, dialog); - dialog->mail_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailAdd")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_add), "clicked", - GTK_SIGNAL_FUNC (mail_add), dialog); - dialog->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailEdit")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_edit), "clicked", - GTK_SIGNAL_FUNC (mail_edit), dialog); - dialog->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailDelete")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_delete), "clicked", - GTK_SIGNAL_FUNC (mail_delete), dialog); - dialog->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailDefault")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_default), "clicked", - GTK_SIGNAL_FUNC (mail_default), dialog); - dialog->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailAble")); - gtk_signal_connect (GTK_OBJECT (dialog->mail_able), "clicked", - GTK_SIGNAL_FUNC (mail_able), dialog); - -#ifdef ENABLE_NNTP - dialog->news_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistNews")); - gtk_signal_connect (GTK_OBJECT (dialog->news_accounts), "select-row", - GTK_SIGNAL_FUNC (news_select), dialog); - gtk_signal_connect (GTK_OBJECT (dialog->news_accounts), "unselect-row", - GTK_SIGNAL_FUNC (news_unselect), dialog); - dialog->news_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsAdd")); - gtk_signal_connect (GTK_OBJECT (dialog->news_add), "clicked", - GTK_SIGNAL_FUNC (news_add), dialog); - dialog->news_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsEdit")); - gtk_signal_connect (GTK_OBJECT (dialog->news_edit), "clicked", - GTK_SIGNAL_FUNC (news_edit), dialog); - dialog->news_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsDelete")); - gtk_signal_connect (GTK_OBJECT (dialog->news_delete), "clicked", - GTK_SIGNAL_FUNC (news_delete), dialog); -#else - /* remove the news tab since we don't support nntp */ - gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), 1); -#endif + gtk_widget_ref (toplevel); + gtk_widget_unparent (toplevel); + gtk_widget_set_parent (toplevel, GTK_WIDGET (prefs)); + gtk_widget_unref (toplevel); - /* Display page */ - dialog->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chckHighlightCitations")); - gtk_toggle_button_set_active (dialog->citation_highlight, mail_config_get_citation_highlight ()); - gtk_signal_connect (GTK_OBJECT (dialog->citation_highlight), "toggled", - GTK_SIGNAL_FUNC (citation_highlight_toggled), dialog); - dialog->citation_color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerCitations")); - set_color (dialog->citation_color, mail_config_get_citation_color ()); - gtk_signal_connect (GTK_OBJECT (dialog->citation_color), "color_set", - GTK_SIGNAL_FUNC (citation_color_set), dialog); + prefs->table = E_TABLE (glade_xml_get_widget (gui, "etableMailAccounts")); + prefs->model = prefs->table->model; - dialog->timeout_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "checkMarkTimeout")); - gtk_toggle_button_set_active (dialog->timeout_toggle, mail_config_get_do_seen_timeout ()); - gtk_signal_connect (GTK_OBJECT (dialog->timeout_toggle), "toggled", - GTK_SIGNAL_FUNC (timeout_toggled), dialog); + gtk_signal_connect (GTK_OBJECT (prefs->table), "cursor_change", + account_cursor_change, prefs); - dialog->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout")); - gtk_spin_button_set_value (dialog->timeout, (1.0 * mail_config_get_mark_as_seen_timeout ()) / 1000.0); - gtk_signal_connect (GTK_OBJECT (dialog->timeout), "changed", - GTK_SIGNAL_FUNC (timeout_changed), dialog); + gtk_signal_connect (GTK_OBJECT (prefs->table), "double_click", + account_double_click, prefs); - dialog->images_never = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesNever")); - gtk_toggle_button_set_active (dialog->images_never, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_NEVER); - gtk_signal_connect (GTK_OBJECT (dialog->images_never), "toggled", - GTK_SIGNAL_FUNC (images_radio_toggled), dialog); - dialog->images_sometimes = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesSometimes")); - gtk_toggle_button_set_active (dialog->images_sometimes, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES); - gtk_signal_connect (GTK_OBJECT (dialog->images_sometimes), "toggled", - GTK_SIGNAL_FUNC (images_radio_toggled), dialog); - dialog->images_always = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesAlways")); - gtk_toggle_button_set_active (dialog->images_always, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS); - gtk_signal_connect (GTK_OBJECT (dialog->images_always), "toggled", - GTK_SIGNAL_FUNC (images_radio_toggled), dialog); + mail_accounts_load (prefs); -#if 0 - /* These options are disabled because they are completely non-intuitive and evil */ - dialog->thread_list = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkThreadedList")); - gtk_toggle_button_set_active (dialog->thread_list, mail_config_get_thread_list (NULL)); - gtk_signal_connect (GTK_OBJECT (dialog->thread_list), "toggled", - GTK_SIGNAL_FUNC (thread_list_toggled), dialog); + prefs->mail_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAdd")); + gtk_signal_connect (GTK_OBJECT (prefs->mail_add), "clicked", + account_add_clicked, prefs); - dialog->show_preview = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkShowPreview")); - gtk_toggle_button_set_active (dialog->show_preview, mail_config_get_show_preview (NULL)); - gtk_signal_connect (GTK_OBJECT (dialog->show_preview), "toggled", - GTK_SIGNAL_FUNC (show_preview_toggled), dialog); -#endif - - /* Composer page */ - dialog->send_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkSendHTML")); - gtk_toggle_button_set_active (dialog->send_html, mail_config_get_send_html ()); - gtk_signal_connect (GTK_OBJECT (dialog->send_html), "toggled", - GTK_SIGNAL_FUNC (send_html_toggled), dialog); - - dialog->forward_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuForwardStyle")); - gtk_option_menu_set_history (dialog->forward_style, mail_config_get_default_forward_style ()); - /* Hm. This sucks... */ - num = 0; - gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (dialog->forward_style)), - attach_forward_style_signal, &num); - - dialog->prompt_empty_subject = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptEmptySubject")); - gtk_toggle_button_set_active (dialog->prompt_empty_subject, mail_config_get_prompt_empty_subject ()); - gtk_signal_connect (GTK_OBJECT (dialog->prompt_empty_subject), "toggled", - GTK_SIGNAL_FUNC (prompt_empty_subject_toggled), dialog); - - dialog->prompt_bcc_only = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptBccOnly")); - gtk_toggle_button_set_active (dialog->prompt_bcc_only, mail_config_get_prompt_only_bcc ()); - gtk_signal_connect (GTK_OBJECT (dialog->prompt_bcc_only), "toggled", - GTK_SIGNAL_FUNC (prompt_bcc_only_toggled), dialog); - - dialog->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML")); - gtk_toggle_button_set_active (dialog->prompt_unwanted_html, mail_config_get_confirm_unwanted_html ()); - gtk_signal_connect (GTK_OBJECT (dialog->prompt_unwanted_html), "toggled", - GTK_SIGNAL_FUNC (prompt_unwanted_html_toggled), dialog); - - /* Signatures page */ - signatures_page_construct (dialog, gui); - - /* Other page */ - dialog->pgp_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "filePgpPath")); - text = mail_config_get_pgp_path (); - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->pgp_path)), - text ? text : ""); - gnome_file_entry_set_default_path (dialog->pgp_path, mail_config_get_pgp_path ()); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->pgp_path)), - "changed", GTK_SIGNAL_FUNC (pgp_path_changed), dialog); - - dialog->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); - menu = e_charset_picker_new (mail_config_get_default_charset ()); - gtk_option_menu_set_menu (dialog->charset, GTK_WIDGET (menu)); - gtk_signal_connect (GTK_OBJECT (menu), "deactivate", - GTK_SIGNAL_FUNC (charset_menu_deactivate), NULL); - - dialog->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit")); - gtk_toggle_button_set_active (dialog->empty_trash, mail_config_get_empty_trash_on_exit ()); - gtk_signal_connect (GTK_OBJECT (dialog->empty_trash), "toggled", - GTK_SIGNAL_FUNC (empty_trash_toggled), dialog); - - dialog->filter_log = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkFilterLog")); - gtk_toggle_button_set_active (dialog->filter_log, mail_config_get_filter_log ()); - gtk_signal_connect (GTK_OBJECT (dialog->filter_log), "toggled", - GTK_SIGNAL_FUNC (filter_log_toggled), dialog); - - dialog->filter_log_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileFilterLog")); - text = mail_config_get_filter_log_path (); - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->filter_log_path)), - text ? text : ""); - gnome_file_entry_set_default_path (dialog->filter_log_path, mail_config_get_filter_log_path ()); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->filter_log_path)), - "changed", GTK_SIGNAL_FUNC (filter_log_path_changed), dialog); - - dialog->confirm_expunge = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkConfirmExpunge")); - gtk_toggle_button_set_active (dialog->confirm_expunge, mail_config_get_confirm_expunge ()); - gtk_signal_connect (GTK_OBJECT (dialog->confirm_expunge), "toggled", - GTK_SIGNAL_FUNC (confirm_expunge_toggled), dialog); - - dialog->notify_not = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioNotifyNot")); - gtk_toggle_button_set_active (dialog->notify_not, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_NOT); - gtk_signal_connect (GTK_OBJECT (dialog->notify_not), "toggled", - GTK_SIGNAL_FUNC (notify_radio_toggled), dialog); - - dialog->notify_beep = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioNotifyBeep")); - gtk_toggle_button_set_active (dialog->notify_beep, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_BEEP); - gtk_signal_connect (GTK_OBJECT (dialog->notify_beep), "toggled", - GTK_SIGNAL_FUNC (notify_radio_toggled), dialog); + prefs->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountEdit")); + gtk_signal_connect (GTK_OBJECT (prefs->mail_edit), "clicked", + account_edit_clicked, prefs); - dialog->notify_play_sound = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioNotifyPlaySound")); - gtk_toggle_button_set_active (dialog->notify_play_sound, - mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_PLAY_SOUND); - gtk_signal_connect (GTK_OBJECT (dialog->notify_play_sound), "toggled", - GTK_SIGNAL_FUNC (notify_radio_toggled), dialog); + prefs->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDelete")); + gtk_signal_connect (GTK_OBJECT (prefs->mail_delete), "clicked", + account_delete_clicked, prefs); - dialog->notify_sound_file = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileNotifyPlaySound")); - text = mail_config_get_new_mail_notify_sound_file (); - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->notify_sound_file)), - text ? text : ""); - gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->notify_sound_file)), - "changed", GTK_SIGNAL_FUNC (notify_sound_file_changed), dialog); + prefs->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDefault")); + gtk_signal_connect (GTK_OBJECT (prefs->mail_default), "clicked", + account_default_clicked, prefs); - for (i = 0; i < 5; i++) { - widget_name = g_strdup_printf ("txtLabel%d", i); - dialog->labels[i].name = GTK_ENTRY (glade_xml_get_widget (gui, widget_name)); - g_free (widget_name); - text = mail_config_get_label_name (i); - e_utf8_gtk_entry_set_text (dialog->labels[i].name, text ? text : ""); - gtk_signal_connect (GTK_OBJECT (dialog->labels[i].name), "changed", - GTK_SIGNAL_FUNC (label_name_changed), dialog); - - widget_name = g_strdup_printf ("colorLabel%d", i); - dialog->labels[i].color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, widget_name)); - g_free (widget_name); - set_color (dialog->labels[i].color, mail_config_get_label_color (i)); - gtk_signal_connect (GTK_OBJECT (dialog->labels[i].color), "color_set", - GTK_SIGNAL_FUNC (label_color_set), dialog); - } - dialog->restore_labels = GTK_BUTTON (glade_xml_get_widget (gui, "cmdRestoreLabels")); - gtk_signal_connect (GTK_OBJECT (dialog->restore_labels), "clicked", - GTK_SIGNAL_FUNC (restore_labels_clicked), dialog); - - - /* now to fill in the clists */ - dialog->accounts_row = -1; - dialog->accounts = mail_config_get_accounts (); - if (dialog->accounts) { - load_accounts (dialog); - gtk_clist_select_row (dialog->mail_accounts, 0, 1); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE); - } - -#ifdef ENABLE_NNTP - dialog->news_row = -1; - dialog->news = mail_config_get_news (); - if (dialog->news) { - load_news (dialog); - gtk_clist_select_row (dialog->news_accounts, 0, 0); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE); - } -#endif /* ENABLE_NNTP */ + prefs->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAble")); + gtk_signal_connect (GTK_OBJECT (prefs->mail_able), "clicked", + account_able_clicked, prefs); } -MailAccountsDialog * -mail_accounts_dialog_new (GNOME_Evolution_Shell shell) + +GtkWidget * +mail_accounts_tab_new (GNOME_Evolution_Shell shell) { - MailAccountsDialog *new; + MailAccountsTab *new; - new = (MailAccountsDialog *) gtk_type_new (mail_accounts_dialog_get_type ()); - construct (new); + new = (MailAccountsTab *) gtk_type_new (mail_accounts_tab_get_type ()); + mail_accounts_tab_construct (new); new->shell = shell; - return new; + return (GtkWidget *) new; +} + + +void +mail_accounts_tab_apply (MailAccountsTab *prefs) +{ + /* nothing to do here... */ } diff --git a/mail/mail-accounts.etspec b/mail/mail-accounts.etspec new file mode 100644 index 0000000000..22c09370b1 --- /dev/null +++ b/mail/mail-accounts.etspec @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/mail/mail-accounts.h b/mail/mail-accounts.h index a294e0d86b..85fad77a2f 100644 --- a/mail/mail-accounts.h +++ b/mail/mail-accounts.h @@ -2,156 +2,92 @@ /* * Authors: Jeffrey Stedfast * - * Copyright 2001 Ximian, Inc. (www.ximian.com) + * Copyright 2002 Ximian, Inc. (www.ximian.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * */ -#ifndef MAIL_ACCOUNTS_H -#define MAIL_ACCOUNTS_H + +#ifndef __MAIL_ACCOUNTS_TAB_H__ +#define __MAIL_ACCOUNTS_TAB_H__ #ifdef __cplusplus extern "C" { #pragma } -#endif /* __cplusplus */ - -#include -#include -#include -#include -#include -#include -#include +#endif + +#include +#include #include + +#include + +#include "evolution-config-control.h" + #include -#define MAIL_ACCOUNTS_DIALOG_TYPE (mail_accounts_dialog_get_type ()) -#define MAIL_ACCOUNTS_DIALOG(o) (GTK_CHECK_CAST ((o), MAIL_ACCOUNTS_DIALOG_TYPE, MailAccountsDialog)) -#define MAIL_ACCOUNTS_DIALOG_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_ACCOUNTS_DIALOG_TYPE, MailAccountsDialogClass)) -#define IS_MAIL_ACCOUNTS_DIALOG(o) (GTK_CHECK_TYPE ((o), MAIL_ACCOUNTS_DIALOG_TYPE)) -#define IS_MAIL_ACCOUNTS_DIALOG_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_ACCOUNTS_DIALOG_TYPE)) -struct _MailAccountsDialog { - GnomeDialog parent; +#define MAIL_ACCOUNTS_TAB_TYPE (mail_accounts_tab_get_type ()) +#define MAIL_ACCOUNTS_TAB(o) (GTK_CHECK_CAST ((o), MAIL_ACCOUNTS_TAB_TYPE, MailAccountsTab)) +#define MAIL_ACCOUNTS_TAB_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_ACCOUNTS_TAB_TYPE, MailAccountsTabClass)) +#define IS_MAIL_ACCOUNTS_TAB(o) (GTK_CHECK_TYPE ((o), MAIL_ACCOUNTS_TAB_TYPE)) +#define IS_MAIL_ACCOUNTS_TAB_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_ACCOUNTS_TAB_TYPE)) + +typedef struct _MailAccountsTab MailAccountsTab; +typedef struct _MailAccountsTabClass MailAccountsTabClass; + +struct _MailAccountsTab { + GtkVBox parent_object; GNOME_Evolution_Shell shell; GladeXML *gui; - const GSList *accounts; - int accounts_row; + GtkWidget *druid; + GtkWidget *editor; + + ETable *table; + ETableModel *model; - /* Accounts page */ - GtkCList *mail_accounts; GtkButton *mail_add; GtkButton *mail_edit; GtkButton *mail_delete; GtkButton *mail_default; GtkButton *mail_able; - - const GSList *news; - int news_row; - - /* News page */ - GtkCList *news_accounts; - GtkButton *news_add; - GtkButton *news_edit; - GtkButton *news_delete; - - /* Display page */ - GtkToggleButton *citation_highlight; - GnomeColorPicker *citation_color; - GtkToggleButton *timeout_toggle; - GtkSpinButton *timeout; - GtkToggleButton *images_always, *images_sometimes, *images_never; - /*GtkToggleButton *thread_list;*/ - /*GtkToggleButton *show_preview;*/ - - /* Composer page */ - GtkToggleButton *send_html; - GtkOptionMenu *forward_style; - GtkOptionMenu *charset; - GtkToggleButton *prompt_empty_subject; - GtkToggleButton *prompt_bcc_only; - GtkToggleButton *prompt_unwanted_html; - - /* Signatures page */ - GtkWidget *sig_clist; - - GtkWidget *sig_name; - GtkWidget *sig_random; - GtkWidget *sig_filename; - GtkWidget *sig_script; - GtkWidget *sig_html; - GtkWidget *sig_scrolled; - GtkWidget *sig_gtk_html; - GtkWidget *sig_preview; - - GtkWidget *sig_add; - GtkWidget *sig_delete; - GtkWidget *sig_edit; - - GtkWidget *sig_simple_button; - GtkWidget *sig_advanced_button; - GtkWidget *sig_level_bbox; - GtkWidget *sig_advanced_table; - gboolean sig_switch; - int sig_row; - - /* Other page */ - GtkToggleButton *empty_trash; - GtkToggleButton *filter_log; - GnomeFileEntry *filter_log_path; - GtkToggleButton *confirm_expunge; - GtkToggleButton *notify_not; - GtkToggleButton *notify_beep; - GtkToggleButton *notify_play_sound; - GnomeFileEntry *notify_sound_file; - - /* Colors/Labels */ - struct { - GtkEntry *name; - GnomeColorPicker *color; - } labels[5]; - GtkButton *restore_labels; - - /* PGP page */ - GnomeFileEntry *pgp_path; - - /* Pixmaps for the clist */ - GdkPixmap *mark_pixmap; - GdkBitmap *mark_bitmap; }; -typedef struct _MailAccountsDialog MailAccountsDialog; - -typedef struct { - GnomeDialogClass parent_class; +struct _MailAccountsTabClass { + GtkVBoxClass parent_class; /* signals */ -} MailAccountsDialogClass; +}; + + +GtkType mail_accounts_tab_get_type (void); + +GtkWidget *mail_accounts_tab_new (GNOME_Evolution_Shell shell); -GtkType mail_accounts_dialog_get_type (void); +void mail_accounts_tab_apply (MailAccountsTab *accounts); -MailAccountsDialog *mail_accounts_dialog_new (GNOME_Evolution_Shell shell); -MailConfigSignature *mail_accounts_dialog_new_signature (MailAccountsDialog *dialog, gboolean html); +/* needed by global config */ +#define MAIL_ACCOUNTS_CONTROL_ID "OAFIID:GNOME_Evolution_Mail_Accounts_ConfigControl" #ifdef __cplusplus } -#endif /* __cplusplus */ +#endif -#endif /* MAIL_ACCOUNTS_H */ +#endif /* __MAIL_ACCOUNTS_TAB_H__ */ diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 736002c915..d1c25930d7 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -130,7 +130,7 @@ check_send_configuration (FolderBrowser *fb) /* Check general */ if (!mail_config_is_configured () && !configure_mail (fb)) - return FALSE; + return FALSE; /* Get the default account */ account = mail_config_get_default_account (); @@ -2712,36 +2712,6 @@ vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path } -static MailAccountsDialog *accounts_dialog = NULL; - -static void -accounts_dialog_close (GtkWidget *widget, gpointer user_data) -{ - accounts_dialog = NULL; -} - -void -providers_config (BonoboUIComponent *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - - if (FOLDER_BROWSER_IS_DESTROYED (fb)) - return; - - if (!accounts_dialog) { - accounts_dialog = mail_accounts_dialog_new (fb->shell); - gtk_widget_set_parent_window (GTK_WIDGET (accounts_dialog), - GTK_WIDGET (FB_WINDOW (fb))->window); - gtk_signal_connect (GTK_OBJECT (accounts_dialog), "destroy", - accounts_dialog_close, NULL); - gnome_dialog_set_close (GNOME_DIALOG (accounts_dialog), TRUE); - gtk_widget_show (GTK_WIDGET (accounts_dialog)); - } else { - gdk_window_raise (GTK_WIDGET (accounts_dialog)->window); - gtk_widget_grab_focus (GTK_WIDGET (accounts_dialog)); - } -} - /* static void header_print_cb (GtkHTML *html, GnomePrintContext *print_context, double x, double y, double width, double height, gpointer user_data) diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h index f160c257c9..3c453623e0 100644 --- a/mail/mail-callbacks.h +++ b/mail/mail-callbacks.h @@ -45,7 +45,6 @@ void enumerate_msg (MessageList *ml, const char *uid, gpointer data); void fetch_mail (GtkWidget *widget, gpointer user_data); void send_queued_mail (GtkWidget *widget, gpointer user_data); -void send_receive_mail (GtkWidget *widget, gpointer user_data); void compose_msg (GtkWidget *widget, gpointer user_data); void send_to_url (const char *url); @@ -112,7 +111,6 @@ void open_message (BonoboUIComponent *uih, void *user_data, const char void expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path); void filter_edit (BonoboUIComponent *uih, void *user_data, const char *path); void vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path); -void providers_config (BonoboUIComponent *uih, void *user_data, const char *path); void manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char *path); void configure_folder (BonoboUIComponent *uih, void *user_data, const char *path); diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c new file mode 100644 index 0000000000..ef8afb3d4d --- /dev/null +++ b/mail/mail-composer-prefs.c @@ -0,0 +1,267 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast + * + * Copyright 2002 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "mail-composer-prefs.h" + +#include + +#include "widgets/misc/e-charset-picker.h" + +#include "mail-config.h" + +static void mail_composer_prefs_class_init (MailComposerPrefsClass *class); +static void mail_composer_prefs_init (MailComposerPrefs *dialog); +static void mail_composer_prefs_finalise (GtkObject *obj); + +static GtkVBoxClass *parent_class = NULL; + + +GtkType +mail_composer_prefs_get_type (void) +{ + static GtkType type = 0; + + if (!type) { + GtkTypeInfo type_info = { + "MailComposerPrefs", + sizeof (MailComposerPrefs), + sizeof (MailComposerPrefsClass), + (GtkClassInitFunc) mail_composer_prefs_class_init, + (GtkObjectInitFunc) mail_composer_prefs_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL + }; + + type = gtk_type_unique (gtk_vbox_get_type (), &type_info); + } + + return type; +} + +static void +mail_composer_prefs_class_init (MailComposerPrefsClass *klass) +{ + GtkObjectClass *object_class; + + object_class = (GtkObjectClass *) klass; + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = mail_composer_prefs_finalise; + /* override methods */ + +} + +static void +mail_composer_prefs_init (MailComposerPrefs *composer_prefs) +{ + ; +} + +static void +mail_composer_prefs_finalise (GtkObject *obj) +{ + MailComposerPrefs *composer_prefs = (MailComposerPrefs *) obj; + + gtk_object_unref (GTK_OBJECT (composer_prefs->gui)); + + ((GtkObjectClass *)(parent_class))->finalize (obj); +} + + +static void +colorpicker_set_color (GnomeColorPicker *color, guint32 rgb) +{ + gnome_color_picker_set_i8 (color, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff); +} + +static guint32 +colorpicker_get_color (GnomeColorPicker *color) +{ + guint8 r, g, b, a; + guint32 rgb = 0; + + gnome_color_picker_get_i8 (color, &r, &g, &b, &a); + + rgb = r >> 8; + rgb <<= 8; + rgb |= g >> 8; + rgb <<= 8; + rgb |= b >> 8; + + return rgb; +} + +static void +attach_style_info (GtkWidget *item, gpointer user_data) +{ + int *style = user_data; + + gtk_object_set_data (GTK_OBJECT (item), "style", GINT_TO_POINTER (*style)); + + (*style)++; +} + +static void +toggle_button_toggled (GtkWidget *widget, gpointer user_data) +{ + MailComposerPrefs *prefs = (MailComposerPrefs *) user_data; + + if (prefs->control) + evolution_config_control_changed (prefs->control); +} + +static void +menu_changed (GtkWidget *widget, gpointer user_data) +{ + MailComposerPrefs *prefs = (MailComposerPrefs *) user_data; + + if (prefs->control) + evolution_config_control_changed (prefs->control); +} + +static void +mail_composer_prefs_construct (MailComposerPrefs *prefs) +{ + GtkWidget *toplevel, *menu; + GladeXML *gui; + int style; + + gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "composer_tab"); + prefs->gui = gui; + + /* get our toplevel widget */ + toplevel = glade_xml_get_widget (gui, "toplevel"); + + /* reparent */ + gtk_widget_ref (toplevel); + gtk_widget_unparent (toplevel); + gtk_widget_set_parent (toplevel, GTK_WIDGET (prefs)); + gtk_widget_unref (toplevel); + + /* General tab */ + + /* Default Behavior */ + prefs->send_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkSendHTML")); + gtk_toggle_button_set_active (prefs->send_html, mail_config_get_send_html ()); + gtk_signal_connect (GTK_OBJECT (prefs->send_html), "toggled", + toggle_button_toggled, prefs); + + prefs->prompt_empty_subject = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptEmptySubject")); + gtk_toggle_button_set_active (prefs->prompt_empty_subject, mail_config_get_prompt_empty_subject ()); + gtk_signal_connect (GTK_OBJECT (prefs->prompt_empty_subject), "toggled", + toggle_button_toggled, prefs); + + prefs->prompt_bcc_only = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptBccOnly")); + gtk_toggle_button_set_active (prefs->prompt_bcc_only, mail_config_get_prompt_only_bcc ()); + gtk_signal_connect (GTK_OBJECT (prefs->prompt_bcc_only), "toggled", + toggle_button_toggled, prefs); + + prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); + menu = e_charset_picker_new (mail_config_get_default_charset ()); + gtk_option_menu_set_menu (prefs->charset, GTK_WIDGET (menu)); + gtk_signal_connect (GTK_OBJECT (prefs->charset), "clicked", + menu_changed, prefs); + + /* Spell Checking */ + prefs->spell_check = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEnableSpellChecking")); + prefs->colour = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerSpellCheckColor")); + prefs->language = GTK_COMBO (glade_xml_get_widget (gui, "cmboSpellCheckLanguage")); + + /* Forwards and Replies */ + prefs->forward_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuForwardStyle")); + gtk_option_menu_set_history (prefs->forward_style, mail_config_get_default_forward_style ()); + style = 0; + gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (prefs->forward_style)), + attach_style_info, &style); + gtk_signal_connect (GTK_OBJECT (prefs->forward_style), "clicked", + menu_changed, prefs); + + prefs->reply_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuReplyStyle")); + gtk_option_menu_set_history (prefs->reply_style, mail_config_get_default_reply_style ()); + style = 0; + gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (prefs->reply_style)), + attach_style_info, &style); + gtk_signal_connect (GTK_OBJECT (prefs->reply_style), "clicked", + menu_changed, prefs); + + /* FIXME: do the other tabs... */ +} + + +GtkWidget * +mail_composer_prefs_new (void) +{ + MailComposerPrefs *new; + + new = (MailComposerPrefs *) gtk_type_new (mail_composer_prefs_get_type ()); + mail_composer_prefs_construct (new); + + return (GtkWidget *) new; +} + + +void +mail_composer_prefs_apply (MailComposerPrefs *prefs) +{ + GtkWidget *menu, *item; + char *string; + int val; + + /* General tab */ + + /* Default Behavior */ + mail_config_set_send_html (gtk_toggle_button_get_active (prefs->send_html)); + mail_config_set_prompt_empty_subject (gtk_toggle_button_get_active (prefs->prompt_empty_subject)); + mail_config_set_prompt_only_bcc (gtk_toggle_button_get_active (prefs->prompt_bcc_only)); + + menu = gtk_option_menu_get_menu (prefs->charset); + string = e_charset_picker_get_charset (menu); + if (string) { + mail_config_set_default_charset (string); + g_free (string); + } + + /* Spell CHecking */ + /* FIXME: implement me */ + + /* Forwards and Replies */ + menu = gtk_option_menu_get_menu (prefs->forward_style); + item = gtk_menu_get_active (GTK_MENU (menu)); + val = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (item), "style")); + mail_config_set_default_forward_style (val); + + menu = gtk_option_menu_get_menu (prefs->reply_style); + item = gtk_menu_get_active (GTK_MENU (menu)); + val = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (item), "style")); + mail_config_set_default_reply_style (val); + + /* Keyboard Shortcuts */ + /* FIXME: implement me */ + + /* Signatures */ + /* FIXME: implement me */ +} diff --git a/mail/mail-composer-prefs.h b/mail/mail-composer-prefs.h new file mode 100644 index 0000000000..567540143a --- /dev/null +++ b/mail/mail-composer-prefs.h @@ -0,0 +1,104 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast + * + * Copyright 2002 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifndef __MAIL_COMPOSER_PREFS_H__ +#define __MAIL_COMPOSER_PREFS_H__ + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif + +#include +#include +#include +#include +#include + +#include "evolution-config-control.h" + +#include + +#define MAIL_COMPOSER_PREFS_TYPE (mail_composer_prefs_get_type ()) +#define MAIL_COMPOSER_PREFS(o) (GTK_CHECK_CAST ((o), MAIL_COMPOSER_PREFS_TYPE, MailComposerPrefs)) +#define MAIL_COMPOSER_PREFS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_COMPOSER_PREFS_TYPE, MailComposerPrefsClass)) +#define IS_MAIL_COMPOSER_PREFS(o) (GTK_CHECK_TYPE ((o), MAIL_COMPOSER_PREFS_TYPE)) +#define IS_MAIL_COMPOSER_PREFS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_COMPOSER_PREFS_TYPE)) + +typedef struct _MailComposerPrefs MailComposerPrefs; +typedef struct _MailComposerPrefsClass MailComposerPrefsClass; + +struct _MailComposerPrefs { + GtkVBox parent_object; + + EvolutionConfigControl *control; + + GladeXML *gui; + + /* General tab */ + + /* Default Behavior */ + GtkToggleButton *send_html; + GtkToggleButton *prompt_empty_subject; + GtkToggleButton *prompt_bcc_only; + GtkOptionMenu *charset; + + /* Spell Checking */ + GtkToggleButton *spell_check; + GnomeColorPicker *colour; + GtkCombo *language; + + /* Forwards and Replies */ + GtkOptionMenu *forward_style; + GtkOptionMenu *reply_style; + + /* Keyboard Shortcuts */ + GtkOptionMenu *shortcuts_type; + GtkCList *keybindings; + + /* Signatures */ + +}; + +struct _MailComposerPrefsClass { + GtkVBoxClass parent_class; + + /* signals */ + +}; + + +GtkType mail_composer_prefs_get_type (void); + +GtkWidget *mail_composer_prefs_new (void); + +void mail_composer_prefs_apply (MailComposerPrefs *prefs); + +/* needed by global config */ +#define MAIL_COMPOSER_PREFS_CONTROL_ID "OAFIID:GNOME_Evolution_Mail_ComposerPrefs_ConfigControl" + +#ifdef __cplusplus +} +#endif + +#endif /* __MAIL_COMPOSER_PREFS_H__ */ diff --git a/mail/mail-config-factory.c b/mail/mail-config-factory.c new file mode 100644 index 0000000000..17b75ed2e6 --- /dev/null +++ b/mail/mail-config-factory.c @@ -0,0 +1,127 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast + * + * Copyright 2002 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "mail-accounts.h" +#include "mail-preferences.h" +#include "mail-composer-prefs.h" + +#include "mail-config-factory.h" + +#include + +#define CONFIG_CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ConfigControlFactory" + +static BonoboGenericFactory *factory = NULL; + + +typedef void (*ApplyFunc) (GtkWidget *prefs); + +struct _config_data { + GtkWidget *prefs; + ApplyFunc apply; +}; + +static void +config_control_destroy_callback (EvolutionConfigControl *config_control, void *user_data) +{ + struct _config_data *data = user_data; + + gtk_widget_unref (data->prefs); + g_free (data); +} + +static void +config_control_apply_callback (EvolutionConfigControl *config_control, void *user_data) +{ + struct _config_data *data = user_data; + + data->apply (data->prefs); +} + + +static BonoboObject * +config_control_factory_cb (BonoboGenericFactory *factory, const char *component_id, void *user_data) +{ + GNOME_Evolution_Shell shell = (GNOME_Evolution_Shell) user_data; + EvolutionConfigControl *control; + struct _config_data *data; + GtkWidget *prefs = NULL; + + data = g_new (struct _config_data, 1); + + if (!strcmp (component_id, MAIL_ACCOUNTS_CONTROL_ID)) { + prefs = mail_accounts_tab_new (shell); + data->apply = (ApplyFunc) mail_accounts_tab_apply; + } else if (!strcmp (component_id, MAIL_PREFERENCES_CONTROL_ID)) { + prefs = mail_preferences_new (); + data->apply = (ApplyFunc) mail_preferences_apply; + } else if (!strcmp (component_id, MAIL_COMPOSER_PREFS_CONTROL_ID)) { + prefs = mail_composer_prefs_new (); + data->apply = (ApplyFunc) mail_composer_prefs_apply; + } else { + g_assert_not_reached (); + } + + data->prefs = prefs; + gtk_widget_show_all (prefs); + + control = evolution_config_control_new (prefs); + + if (!strcmp (component_id, MAIL_ACCOUNTS_CONTROL_ID)) { + /* nothing to do here... */ + } else if (!strcmp (component_id, MAIL_PREFERENCES_CONTROL_ID)) { + MAIL_PREFERENCES (prefs)->control = control; + } else if (!strcmp (component_id, MAIL_COMPOSER_PREFS_CONTROL_ID)) { + MAIL_COMPOSER_PREFS (prefs)->control = control; + } else { + g_assert_not_reached (); + } + + gtk_signal_connect (GTK_OBJECT (control), "apply", + GTK_SIGNAL_FUNC (config_control_apply_callback), data); + gtk_signal_connect (GTK_OBJECT (control), "destroy", + GTK_SIGNAL_FUNC (config_control_destroy_callback), data); + + return BONOBO_OBJECT (control); +} + +gboolean +mail_config_register_factory (GNOME_Evolution_Shell shell) +{ + g_return_val_if_fail (shell != CORBA_OBJECT_NIL, FALSE); + + factory = bonobo_generic_factory_new_multi (CONFIG_CONTROL_FACTORY_ID, + config_control_factory_cb, + shell); + + if (factory != NULL) { + return TRUE; + } else { + g_warning ("Cannot register factory %s", CONFIG_CONTROL_FACTORY_ID); + return FALSE; + } +} diff --git a/mail/mail-config-factory.h b/mail/mail-config-factory.h new file mode 100644 index 0000000000..09e6d72611 --- /dev/null +++ b/mail/mail-config-factory.h @@ -0,0 +1,42 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast + * + * Copyright 2002 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifndef __MAIL_CONFIG_FACTORY_H__ +#define __MAIL_CONFIG_FACTORY_H__ + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif + +#include "evolution-config-control.h" + +#include + +gboolean mail_config_register_factory (GNOME_Evolution_Shell shell); + +#ifdef __cplusplus +} +#endif + +#endif /* __MAIL_CONFIG_FACTORY_H__ */ diff --git a/mail/mail-config.c b/mail/mail-config.c index e6396ab7cf..145f70868f 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -110,6 +110,7 @@ typedef struct { MailConfigHTTPMode http_mode; MailConfigForwardStyle default_forward_style; + MailConfigReplyStyle default_reply_style; MailConfigDisplayStyle message_display_style; char *default_charset; @@ -923,6 +924,11 @@ config_read (void) config->db, "/Mail/Format/default_forward_style", MAIL_CONFIG_FORWARD_ATTACHED, NULL); + /* Replying */ + config->default_reply_style = bonobo_config_get_long_with_default ( + config->db, "/Mail/Format/default_reply_style", + MAIL_CONFIG_REPLY_QUOTED, NULL); + /* Message Display */ config->message_display_style = bonobo_config_get_long_with_default ( config->db, "/Mail/Format/message_display_style", @@ -1302,6 +1308,11 @@ mail_config_write_on_exit (void) "/Mail/Format/default_forward_style", config->default_forward_style, NULL); + /* Replying */ + bonobo_config_set_long (config->db, + "/Mail/Format/default_reply_style", + config->default_reply_style, NULL); + /* Message Display */ bonobo_config_set_long (config->db, "/Mail/Format/message_display_style", @@ -2089,6 +2100,18 @@ mail_config_set_default_forward_style (MailConfigForwardStyle style) config->default_forward_style = style; } +MailConfigReplyStyle +mail_config_get_default_reply_style (void) +{ + return config->default_reply_style; +} + +void +mail_config_set_default_reply_style (MailConfigReplyStyle style) +{ + config->default_reply_style = style; +} + MailConfigDisplayStyle mail_config_get_message_display_style (void) { diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 5e94edb7b3..068844239b 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -17,7 +17,7 @@ GtkWindow - druid_window + account_druid False window1 GTK_WINDOW_TOPLEVEL @@ -203,7 +203,7 @@ Click "Finish" to save your settings. GtkWindow - account_editor_window + account_editor False window1 GTK_WINDOW_TOPLEVEL @@ -2408,7 +2408,7 @@ Kerberos GtkWindow - news_editor_window + news_editor False newswindow1 GTK_WINDOW_TOPLEVEL @@ -2521,7 +2521,7 @@ Kerberos GtkWindow - mail_accounts_window + mail_accounts_deprecated False Mail Settings GTK_WINDOW_TOPLEVEL @@ -4302,4 +4302,1883 @@ Quoted + + GtkWindow + accounts_tab + False + Email Accounts + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + + + GtkHBox + toplevel + False + 0 + + + GtkScrolledWindow + scrolledwindow44 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkViewport + viewport1 + GTK_SHADOW_IN + + + Custom + etableMailAccounts + mail_accounts_etable_new + 0 + 0 + Thu, 21 Mar 2002 19:16:13 GMT + + + + + + GtkVBox + vbox + False + 0 + + 0 + False + True + + + + GtkLabel + label420 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkVButtonBox + vbuttonbox1 + GTK_BUTTONBOX_START + 0 + 85 + 27 + 7 + 0 + + 0 + False + False + + + + GtkButton + cmdAccountAdd + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + cmdAccountEdit + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + cmdAccountDelete + True + True + + GTK_RELIEF_NORMAL + + + + + GtkLabel + label421 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkVButtonBox + vbuttonbox2 + GTK_BUTTONBOX_START + 0 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + cmdAccountDefault + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + cmdAccountAble + True + True + + GTK_RELIEF_NORMAL + + + + + + + + GtkWindow + preferences_tab + False + Mail Preferences + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + + + GtkNotebook + toplevel + True + True + True + GTK_POS_TOP + False + 2 + 2 + False + + + GtkVBox + vboxGeneral + 3 + False + 3 + + + GtkFrame + frameMessageDisplay + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + + + + GtkVBox + vboxMessageDisplay + 3 + False + 3 + + + GtkHBox + hboxReadTimeout + False + 3 + + 0 + True + True + + + + GtkCheckButton + chkMarkTimeout + True + + False + True + + 0 + False + False + + + + + GtkSpinButton + spinMarkTimeout + True + 1 + 1 + True + GTK_UPDATE_IF_VALID + False + False + 1.5 + 0 + 10 + 1 + 1 + 1 + + 0 + False + False + + + + + GtkLabel + lblSeconds + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + + GtkHBox + hboxDefaultCharset + False + 3 + + 0 + True + True + + + + GtkLabel + lblDefaultCharset + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkOptionMenu + omenuCharset + True + Baltic (IS0-8859-13) +Baltic (ISO-8859-4) + + 0 + + 0 + False + False + + + + + + GtkHBox + hboxHighlightColor + False + 3 + + 0 + True + True + + + + GtkCheckButton + chkHighlightCitations + True + + True + True + + 0 + False + False + + + + + GnomeColorPicker + colorpickerHighlightCitations + True + True + False + Pick a color + + 0 + False + False + + + + + GtkLabel + lblColor + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + + + + GtkFrame + frameDeletingMail + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + + + + GtkVBox + vboxDeletingMail + 3 + False + 3 + + + GtkVBox + vbox146 + False + 0 + + 0 + False + False + + + + GtkCheckButton + chkEmptyTrashOnExit + True + + False + True + + 0 + False + False + + + + + GtkCheckButton + chkConfirmExpunge + True + + False + True + + 0 + False + False + + + + + + + + GtkFrame + frameNewMailNotify + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + True + True + + + + GtkVBox + vboxNewMailNotify + False + 0 + + + GtkRadioButton + radNotifyNot + True + + True + True + new_mail_notify + + 0 + False + False + + + + + GtkRadioButton + radNotifyBeep + True + + False + True + new_mail_notify + + 0 + False + False + + + + + GtkRadioButton + radNotifyPlaySound + True + + False + True + new_mail_notify + + 0 + False + False + + + + + GtkHBox + hbox154 + 3 + False + 3 + + 0 + False + False + + + + GtkLabel + lblNotifyFilename + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GnomeFileEntry + fileNotifyPlaySound + 10 + Execute Command... + False + False + + 0 + True + True + + + + GtkEntry + GnomeEntry:entry + txtNotifyPlaySound + True + True + True + 0 + + + + + + + + + + GtkLabel + Notebook:tab + lblGeneral + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkVBox + vboxHtmlMail + 3 + False + 3 + + + GtkFrame + frameLoadingImages + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + + + + GtkVBox + vboxLoadingImages + False + 3 + + + GtkRadioButton + radImagesNever + True + + True + True + images + + 0 + False + False + + + + + GtkRadioButton + radImagesSometimes + True + + False + True + images + + 0 + False + False + + + + + GtkRadioButton + radImagesAlways + True + + False + True + images + + 0 + False + False + + + + + + + GtkCheckButton + chkShowAnimatedImages + True + + False + True + + 0 + False + False + + + + + GtkCheckButton + chkAutoDetectLinks + True + + False + True + + 0 + False + False + + + + + GtkCheckButton + chkPromptWantHTML + True + + False + True + + 0 + False + False + + + + + + GtkLabel + Notebook:tab + lblHtmlMail + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkVBox + vboxSecurity + False + 0 + + + GtkHBox + hboxPgpPath + 4 + False + 4 + + 0 + False + True + + + + GtkLabel + lblPgpPath + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + combo-entry1 + + 0 + False + False + + + + + GnomeFileEntry + filePgpPath + 4 + Select PGP program + False + True + + 0 + True + True + + + + GtkEntry + GnomeEntry:entry + combo-entry1 + True + True + True + 0 + + + + + + + + GtkLabel + Notebook:tab + lblSecurity + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + GtkWindow + composer_tab + False + Message Composer + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + + + GtkNotebook + toplevel + True + True + True + GTK_POS_TOP + False + 2 + 2 + False + + + GtkVBox + vboxGeneral + 3 + False + 3 + + + GtkFrame + frameBehavior + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + + + + GtkVBox + vboxBehavior + 3 + False + 3 + + + GtkCheckButton + chkSendHTML + True + + False + True + + 0 + False + False + + + + + GtkCheckButton + chkPromptEmptySubject + True + + False + True + + 0 + False + False + + + + + GtkCheckButton + chkPromptBccOnly + True + + False + True + + 0 + False + False + + + + + GtkHBox + hboxCharset + False + 3 + + 0 + False + False + + + + GtkLabel + lblCharset + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkOptionMenu + omenuCharset + True + Baltic (IS0-8859-13) +Baltic (ISO-8859-4) + + 0 + + 0 + False + False + + + + + + + + GtkFrame + frameSpellChecking + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + + + + GtkVBox + vboxSpellChecking + False + 0 + + + GtkCheckButton + chkEnableSpellChecking + True + + True + True + + 0 + False + False + + + + + GtkHBox + hboxSpellCheckColor + 3 + False + 3 + + 0 + False + False + + + + GtkLabel + lblSpellCheckColor + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GnomeColorPicker + colorpickerSpellCheckColor + True + True + False + Pick a color + + 0 + False + False + + + + + + GtkHBox + hboxSpellCheckLanguage + 3 + False + 3 + + 0 + False + False + + + + GtkLabel + lblSpellCheckLanguage + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkCombo + cmboSpellCheckLanguage + True + False + False + True + False + Hulu +Dari +Afrikaans +Arabic + + + 0 + False + False + + + + GtkEntry + GtkCombo:entry + entry30 + True + True + True + 0 + Hulu + + + + + + + + GtkFrame + frameForwardsReplies + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + True + + + + GtkTable + tableForwardsReplies + 3 + 2 + 2 + False + 3 + 3 + + + GtkLabel + lblForwardStyle + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + lblReplyStyle + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkAlignment + alignment25 + 7.45058e-09 + 0.5 + 0 + 1 + + 1 + 2 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + GtkHBox + hboxReplyStyle + False + 0 + + + GtkOptionMenu + omenuReplyStyle + True + Quote original message +Do not quote original message +Attach original message + + 0 + + 0 + False + False + + + + + + + GtkHBox + hboxForwardStyle + False + 0 + + 1 + 2 + 0 + 1 + 0 + 0 + False + False + False + False + True + True + + + + GtkOptionMenu + omenuForwardStyle + True + Attachment +Inline +Quoted + + 0 + + 0 + False + False + + + + + + + + + GtkLabel + Notebook:tab + lblGeneral + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkVBox + vbox154 + False + 0 + + + GtkHBox + hbox159 + 3 + False + 3 + + 0 + False + False + + + + GtkLabel + label438 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkOptionMenu + optionmenu36 + True + Emacs +XEmacs +Microsoft + + 0 + + 0 + False + False + + + + + + GtkHBox + hbox160 + False + 0 + + 0 + True + True + + + + GtkScrolledWindow + scrolledwindow45 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkCList + clistKeybindings + True + 2 + 80,80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN + + + GtkLabel + CList:title + label439 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + label440 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + GtkVBox + vbox155 + False + 0 + + 0 + False + False + + + + GtkLabel + label441 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkVButtonBox + vbuttonbox24 + GTK_BUTTONBOX_START + 0 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + button222 + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + button223 + True + True + + GTK_RELIEF_NORMAL + + + + + + + GtkHButtonBox + hbuttonbox22 + GTK_BUTTONBOX_END + 0 + 85 + 27 + 7 + 0 + + 0 + False + False + + + + GtkButton + button224 + True + True + GNOME_STOCK_BUTTON_OK + GTK_RELIEF_NORMAL + + + + GtkButton + button225 + True + True + GNOME_STOCK_BUTTON_APPLY + GTK_RELIEF_NORMAL + + + + GtkButton + button226 + True + True + GNOME_STOCK_BUTTON_CLOSE + GTK_RELIEF_NORMAL + + + + + + GtkLabel + Notebook:tab + lblKeyboardShortcuts + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkVBox + vboxSignatures + 3 + False + 3 + + + GtkHBox + hbox161 + 3 + False + 3 + + 0 + True + True + + + + GtkScrolledWindow + scrolledwindow46 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkCList + clist-sig + True + 2 + 189,80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN + + + GtkLabel + CList:title + label443 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + label444 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + GtkVBox + vbox157 + 3 + False + 3 + + 0 + False + False + + + + GtkLabel + label445 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkVButtonBox + vbuttonbox25 + GTK_BUTTONBOX_START + 0 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + button-sig-add + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + button-sig-edit + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + button-sig-delete + True + True + + GTK_RELIEF_NORMAL + + + + + GtkVButtonBox + vbuttonbox26 + GTK_BUTTONBOX_DEFAULT_STYLE + 10 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + button-sig-randomize + True + True + + GTK_RELIEF_NORMAL + + + + + + + GtkHBox + hbox162 + 3 + False + 3 + + 0 + True + True + + + + GtkFrame + frame-sig-preview + 0 + GTK_SHADOW_IN + + 0 + True + True + + + + Placeholder + + + + + + GtkCheckButton + check-sig-advanced + True + + False + True + + 0 + False + False + + + + + GtkFrame + frameAdvancedOptions + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + + + + GtkTable + tableAdvancedOptions + 3 + 3 + 2 + False + 3 + 3 + + + GtkLabel + lblSignatureFilename + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-sig-filename + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GnomeFileEntry + file-sig-filename + sig-filename + 10 + Select a signature file + False + False + + 1 + 2 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + + + GtkEntry + GnomeEntry:entry + entry-sig-filename + True + True + True + 0 + + + + + + GnomeFileEntry + file-sig-script + sig-script + 10 + Select a signature script + False + False + + 1 + 2 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + + + GtkEntry + GnomeEntry:entry + entry-sig-script + True + True + True + 0 + + + + + + GtkLabel + lblSignatureScript + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + entry-sig-script + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkCheckButton + check-sig-html + True + + False + True + + 0 + 2 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + + + + GtkLabel + Notebook:tab + lblSignatures + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + diff --git a/mail/mail-config.h b/mail/mail-config.h index beb4ce2815..2556dadd6f 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -96,6 +96,12 @@ typedef enum { MAIL_CONFIG_FORWARD_QUOTED } MailConfigForwardStyle; +typedef enum { + MAIL_CONFIG_REPLY_QUOTED, + MAIL_CONFIG_REPLY_DO_NOT_QUOTE, + MAIL_CONFIG_REPLY_ATTACH +} MailConfigReplyStyle; + typedef enum { MAIL_CONFIG_DISPLAY_NORMAL, MAIL_CONFIG_DISPLAY_FULL_HEADERS, @@ -218,6 +224,9 @@ void mail_config_set_http_mode (MailConfigHTTPMode); MailConfigForwardStyle mail_config_get_default_forward_style (void); void mail_config_set_default_forward_style (MailConfigForwardStyle style); +MailConfigReplyStyle mail_config_get_default_reply_style (void); +void mail_config_set_default_reply_style (MailConfigReplyStyle style); + MailConfigDisplayStyle mail_config_get_message_display_style (void); void mail_config_set_message_display_style (MailConfigDisplayStyle style); diff --git a/mail/mail-preferences.c b/mail/mail-preferences.c new file mode 100644 index 0000000000..51c6bbb500 --- /dev/null +++ b/mail/mail-preferences.c @@ -0,0 +1,374 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast + * + * Copyright 2002 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "mail-preferences.h" + +#include +#include "widgets/misc/e-charset-picker.h" + +#include + +#include + +#include "mail-config.h" + + +static void mail_preferences_class_init (MailPreferencesClass *class); +static void mail_preferences_init (MailPreferences *dialog); +static void mail_preferences_finalise (GtkObject *obj); + +static GtkVBoxClass *parent_class = NULL; + + +GtkType +mail_preferences_get_type (void) +{ + static GtkType type = 0; + + if (!type) { + GtkTypeInfo type_info = { + "MailPreferences", + sizeof (MailPreferences), + sizeof (MailPreferencesClass), + (GtkClassInitFunc) mail_preferences_class_init, + (GtkObjectInitFunc) mail_preferences_init, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL + }; + + type = gtk_type_unique (gtk_vbox_get_type (), &type_info); + } + + return type; +} + +static void +mail_preferences_class_init (MailPreferencesClass *klass) +{ + GtkObjectClass *object_class; + + object_class = (GtkObjectClass *) klass; + parent_class = gtk_type_class (gtk_vbox_get_type ()); + + object_class->finalize = mail_preferences_finalise; + /* override methods */ + +} + +static void +mail_preferences_init (MailPreferences *preferences) +{ + preferences->gconf = gconf_client_get_default (); +} + +static void +mail_preferences_finalise (GtkObject *obj) +{ + MailPreferences *prefs = (MailPreferences *) obj; + + gtk_object_unref (GTK_OBJECT (prefs->gui)); + gtk_object_unref (GTK_OBJECT (prefs->gconf)); + + ((GtkObjectClass *)(parent_class))->finalize (obj); +} + + +static void +colorpicker_set_color (GnomeColorPicker *color, guint32 rgb) +{ + gnome_color_picker_set_i8 (color, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff); +} + +static guint32 +colorpicker_get_color (GnomeColorPicker *color) +{ + guint8 r, g, b, a; + guint32 rgb = 0; + + gnome_color_picker_get_i8 (color, &r, &g, &b, &a); + + rgb = r >> 8; + rgb <<= 8; + rgb |= g >> 8; + rgb <<= 8; + rgb |= b >> 8; + + return rgb; +} + +static void +toggle_button_toggled (GtkWidget *widget, gpointer user_data) +{ + MailPreferences *prefs = (MailPreferences *) user_data; + + if (prefs->control) + evolution_config_control_changed (prefs->control); +} + +static void +entry_changed (GtkWidget *widget, gpointer user_data) +{ + MailPreferences *prefs = (MailPreferences *) user_data; + + if (prefs->control) + evolution_config_control_changed (prefs->control); +} + +static void +color_set (GtkWidget *widget, guint r, guint g, guint b, guint a, gpointer user_data) +{ + MailPreferences *prefs = (MailPreferences *) user_data; + + if (prefs->control) + evolution_config_control_changed (prefs->control); +} + +static void +menu_changed (GtkWidget *widget, gpointer user_data) +{ + MailPreferences *prefs = (MailPreferences *) user_data; + + if (prefs->control) + evolution_config_control_changed (prefs->control); +} + +static void +mail_preferences_construct (MailPreferences *prefs) +{ + GtkWidget *toplevel, *menu; + const char *text; + GladeXML *gui; + + gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "preferences_tab"); + prefs->gui = gui; + + /* get our toplevel widget */ + toplevel = glade_xml_get_widget (gui, "toplevel"); + + /* reparent */ + gtk_widget_ref (toplevel); + gtk_widget_unparent (toplevel); + gtk_widget_set_parent (toplevel, GTK_WIDGET (prefs)); + gtk_widget_unref (toplevel); + + /* General tab */ + + /* Message Display */ + prefs->timeout_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkMarkTimeout")); + gtk_toggle_button_set_active (prefs->timeout_toggle, mail_config_get_do_seen_timeout ()); + gtk_signal_connect (GTK_OBJECT (prefs->timeout_toggle), "toggled", + toggle_button_toggled, prefs); + + prefs->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout")); + gtk_spin_button_set_value (prefs->timeout, (1.0 * mail_config_get_mark_as_seen_timeout ()) / 1000.0); + gtk_signal_connect (GTK_OBJECT (prefs->timeout), "changed", + entry_changed, prefs); + + prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); + menu = e_charset_picker_new (mail_config_get_default_charset ()); + gtk_option_menu_set_menu (prefs->charset, GTK_WIDGET (menu)); + gtk_signal_connect (GTK_OBJECT (prefs->charset), "clicked", + menu_changed, prefs); + + prefs->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkHighlightCitations")); + gtk_toggle_button_set_active (prefs->citation_highlight, mail_config_get_citation_highlight ()); + gtk_signal_connect (GTK_OBJECT (prefs->citation_highlight), "toggled", + toggle_button_toggled, prefs); + + prefs->citation_color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerHighlightCitations")); + colorpicker_set_color (prefs->citation_color, mail_config_get_citation_color ()); + gtk_signal_connect (GTK_OBJECT (prefs->citation_color), "color-set", + color_set, prefs); + + /* Deleting Mail */ + prefs->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit")); + gtk_toggle_button_set_active (prefs->empty_trash, mail_config_get_empty_trash_on_exit ()); + gtk_signal_connect (GTK_OBJECT (prefs->empty_trash), "toggled", + toggle_button_toggled, prefs); + + prefs->confirm_expunge = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkConfirmExpunge")); + gtk_toggle_button_set_active (prefs->confirm_expunge, mail_config_get_confirm_expunge ()); + gtk_signal_connect (GTK_OBJECT (prefs->confirm_expunge), "toggled", + toggle_button_toggled, prefs); + + /* New Mail Notification */ + prefs->notify_not = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyNot")); + gtk_toggle_button_set_active (prefs->notify_not, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_NOT); + gtk_signal_connect (GTK_OBJECT (prefs->notify_not), "toggled", + toggle_button_toggled, prefs); + + prefs->notify_beep = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyBeep")); + gtk_toggle_button_set_active (prefs->notify_beep, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_BEEP); + gtk_signal_connect (GTK_OBJECT (prefs->notify_beep), "toggled", + toggle_button_toggled, prefs); + + prefs->notify_play_sound = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyPlaySound")); + gtk_toggle_button_set_active (prefs->notify_play_sound, + mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_PLAY_SOUND); + gtk_signal_connect (GTK_OBJECT (prefs->notify_play_sound), "toggled", + toggle_button_toggled, prefs); + + prefs->notify_sound_file = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileNotifyPlaySound")); + text = mail_config_get_new_mail_notify_sound_file (); + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)), + text ? text : ""); + gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (prefs->notify_sound_file)), "changed", + entry_changed, prefs); + + /* HTML Mail tab */ + + /* Loading Images */ + prefs->images_never = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesNever")); + gtk_toggle_button_set_active (prefs->images_never, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_NEVER); + gtk_signal_connect (GTK_OBJECT (prefs->images_never), "toggled", + toggle_button_toggled, prefs); + + prefs->images_sometimes = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesSometimes")); + gtk_toggle_button_set_active (prefs->images_sometimes, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES); + gtk_signal_connect (GTK_OBJECT (prefs->images_sometimes), "toggled", + toggle_button_toggled, prefs); + + prefs->images_always = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesAlways")); + gtk_toggle_button_set_active (prefs->images_always, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS); + gtk_signal_connect (GTK_OBJECT (prefs->images_always), "toggled", + toggle_button_toggled, prefs); + + /* ... */ + /* FIXME: use the gtkhtml interfaces for these settings when lewing gets around to adding them */ + prefs->show_animated = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkShowAnimatedImages")); + gtk_toggle_button_set_active (prefs->show_animated, + gconf_client_get_bool (prefs->gconf, GTK_HTML_GCONF_DIR "/animations", NULL)); + gtk_signal_connect (GTK_OBJECT (prefs->show_animated), "toggled", + toggle_button_toggled, prefs); + + prefs->autodetect_links = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkAutoDetectLinks")); + gtk_toggle_button_set_active (prefs->autodetect_links, + gconf_client_get_bool (prefs->gconf, GTK_HTML_GCONF_DIR "/magic_links", NULL)); + gtk_signal_connect (GTK_OBJECT (prefs->autodetect_links), "toggled", + toggle_button_toggled, prefs); + + prefs->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML")); + gtk_toggle_button_set_active (prefs->prompt_unwanted_html, mail_config_get_confirm_unwanted_html ()); + gtk_signal_connect (GTK_OBJECT (prefs->prompt_unwanted_html), "toggled", + toggle_button_toggled, prefs); + + /* Security tab */ + + /* Pretty Good Privacy */ + prefs->pgp_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "filePgpPath")); + text = mail_config_get_pgp_path (); + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->pgp_path)), text ? text : ""); + gnome_file_entry_set_default_path (prefs->pgp_path, mail_config_get_pgp_path ()); + gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (prefs->pgp_path)), "changed", + entry_changed, prefs); + + /* FIXME: what about a label colour tab? */ +} + + +GtkWidget * +mail_preferences_new (void) +{ + MailPreferences *new; + + new = (MailPreferences *) gtk_type_new (mail_preferences_get_type ()); + mail_preferences_construct (new); + + return (GtkWidget *) new; +} + + +void +mail_preferences_apply (MailPreferences *prefs) +{ + GtkWidget *entry, *menu; + CamelPgpType type; + char *string; + guint32 rgb; + int val; + + /* General tab */ + + /* Message Display */ + mail_config_set_do_seen_timeout (gtk_toggle_button_get_active (prefs->timeout_toggle)); + + val = (int) (gtk_spin_button_get_value_as_float (prefs->timeout) * 1000); + mail_config_set_mark_as_seen_timeout (val); + + menu = gtk_option_menu_get_menu (prefs->charset); + string = e_charset_picker_get_charset (menu); + if (string) { + mail_config_set_default_charset (string); + g_free (string); + } + + mail_config_set_citation_highlight (gtk_toggle_button_get_active (prefs->citation_highlight)); + + rgb = colorpicker_get_color (prefs->citation_color); + mail_config_set_citation_color (rgb); + + /* Deleting Mail */ + mail_config_set_empty_trash_on_exit (gtk_toggle_button_get_active (prefs->empty_trash)); + + mail_config_set_confirm_expunge (gtk_toggle_button_get_active (prefs->confirm_expunge)); + + /* New Mail Notification */ + if (gtk_toggle_button_get_active (prefs->notify_not)) + mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_NOT); + else if (gtk_toggle_button_get_active (prefs->notify_beep)) + mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_BEEP); + else + mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_PLAY_SOUND); + + entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (prefs->notify_sound_file)); + string = gtk_entry_get_text (GTK_ENTRY (entry)); + mail_config_set_new_mail_notify_sound_file (string); + + /* HTML Mail */ + if (gtk_toggle_button_get_active (prefs->images_always)) + mail_config_set_http_mode (MAIL_CONFIG_HTTP_ALWAYS); + else if (gtk_toggle_button_get_active (prefs->images_sometimes)) + mail_config_set_http_mode (MAIL_CONFIG_HTTP_SOMETIMES); + else + mail_config_set_http_mode (MAIL_CONFIG_HTTP_NEVER); + + gconf_client_set_bool (prefs->gconf, GTK_HTML_GCONF_DIR "/animations", + gtk_toggle_button_get_active (prefs->show_animated), NULL); + + gconf_client_set_bool (prefs->gconf, GTK_HTML_GCONF_DIR "/magic_links", + gtk_toggle_button_get_active (prefs->autodetect_links), NULL); + + mail_config_set_confirm_unwanted_html (gtk_toggle_button_get_active (prefs->prompt_unwanted_html)); + + /* Security */ + entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (prefs->notify_sound_file)); + string = gtk_entry_get_text (GTK_ENTRY (entry)); + + type = string && *string ? mail_config_pgp_type_detect_from_path (string) : CAMEL_PGP_TYPE_NONE; + mail_config_set_pgp_path (string && *string ? string : NULL); + mail_config_set_pgp_type (type); +} diff --git a/mail/mail-preferences.h b/mail/mail-preferences.h new file mode 100644 index 0000000000..916fcb4d1f --- /dev/null +++ b/mail/mail-preferences.h @@ -0,0 +1,118 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast + * + * Copyright 2002 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + + +#ifndef __MAIL_PREFERENCES_H__ +#define __MAIL_PREFERENCES_H__ + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif + +#include +#include +#include +#include +#include + +#include + +#include "evolution-config-control.h" + +#include + +#define MAIL_PREFERENCES_TYPE (mail_preferences_get_type ()) +#define MAIL_PREFERENCES(o) (GTK_CHECK_CAST ((o), MAIL_PREFERENCES_TYPE, MailPreferences)) +#define MAIL_PREFERENCES_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_PREFERENCES_TYPE, MailPreferencesClass)) +#define IS_MAIL_PREFERENCES(o) (GTK_CHECK_TYPE ((o), MAIL_PREFERENCES_TYPE)) +#define IS_MAIL_PREFERENCES_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_PREFERENCES_TYPE)) + +typedef struct _MailPreferences MailPreferences; +typedef struct _MailPreferencesClass MailPreferencesClass; + +struct _MailPreferences { + GtkVBox parent_object; + + GNOME_Evolution_Shell shell; + + EvolutionConfigControl *control; + + GladeXML *gui; + GConfClient *gconf; + + /* General tab */ + + /* Message Display */ + GtkToggleButton *timeout_toggle; + GtkSpinButton *timeout; + GtkOptionMenu *charset; + GtkToggleButton *citation_highlight; + GnomeColorPicker *citation_color; + + /* Deleting Mail */ + GtkToggleButton *empty_trash; + GtkToggleButton *confirm_expunge; + + /* New Mail Notification */ + GtkToggleButton *notify_not; + GtkToggleButton *notify_beep; + GtkToggleButton *notify_play_sound; + GnomeFileEntry *notify_sound_file; + + /* HTML Mail tab */ + + /* Loading Images */ + GtkToggleButton *images_always; + GtkToggleButton *images_sometimes; + GtkToggleButton *images_never; + + GtkToggleButton *show_animated; + GtkToggleButton *autodetect_links; + GtkToggleButton *prompt_unwanted_html; + + /* Security tab */ + GnomeFileEntry *pgp_path; +}; + +struct _MailPreferencesClass { + GtkVBoxClass parent_class; + + /* signals */ + +}; + + +GtkType mail_preferences_get_type (void); + +GtkWidget *mail_preferences_new (void); + +void mail_preferences_apply (MailPreferences *prefs); + +/* needed by global config */ +#define MAIL_PREFERENCES_CONTROL_ID "OAFIID:GNOME_Evolution_Mail_Preferences_ConfigControl" + +#ifdef __cplusplus +} +#endif + +#endif /* __MAIL_PREFERENCES_H__ */ -- cgit