diff options
-rw-r--r-- | mail/ChangeLog | 53 | ||||
-rw-r--r-- | mail/Makefile.am | 3 | ||||
-rw-r--r-- | mail/component-factory.c | 3 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 4 | ||||
-rw-r--r-- | mail/folder-browser.c | 1 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 1 | ||||
-rw-r--r-- | mail/mail-callbacks.h | 79 | ||||
-rw-r--r-- | mail/mail-crypto.c | 15 | ||||
-rw-r--r-- | mail/mail-crypto.h | 50 | ||||
-rw-r--r-- | mail/mail-format.c | 3 | ||||
-rw-r--r-- | mail/mail-session.h | 47 | ||||
-rw-r--r-- | mail/mail-view.c | 1 | ||||
-rw-r--r-- | mail/mail.h | 65 | ||||
-rw-r--r-- | mail/message-list.c | 47 | ||||
-rw-r--r-- | mail/session.c | 14 |
15 files changed, 274 insertions, 112 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 63b69ca6e2..ab8c48f2f1 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,39 @@ +2000-11-03 Jeffrey Stedfast <fejj@helixcode.com> + + * Makefile.am: Added new header files. + + * component-factory.c (owner_set_cb): + s/session_init/mail_session_init + + * session.c: Renamed public functions to mail_session_*. + FIXME: Rename session.c to mail-session.c + + * folder-browser-factory.c: #include "mail-callbacks.h", #include + "mail-session.h" and replace forget_passwords with + mail_session_forget_passwords + + * mail.h: Move session prototypes to mail-session.h, Move + mail-crypto prototypes to mail-crypto.h, Move mail-callback + prototypes to mail-callbacks.h + + * mail-session.h: New header file containing public prototypes + for session.c + + * mail-format.c: #include "mail-crypto.h" + + * mail-view.c: + * folder-browser.c: #include "mail-callbacks.h" + + * mail-crypto.h: New header file containing public prototypes + for mail-crypto.c + + * mail-callbacks.h: New header file containing public prototypes + for mail-callbacks.c + + * message-list.c (message_list_get_layout): Set useful defaults. + (message_list_setup_etable): Don't set the Outbox defaults on a + folder just because it doesn't have a corresponding saved file. + 2000-11-03 Dan Winship <danw@helixcode.com> * mail-config-gui.c (service_page_item_new): url_flags are now on @@ -54,19 +90,20 @@ list is sorted in mailbox order, not reverse mailbox order. * message-list.c (free_tree_ids): Fix a merge foo. - (remove_node_diff): Removed unused row argument. Fixed callers/prototype. + (remove_node_diff): Removed unused row argument. Fixed + callers/prototype. (clear_tree): pre_change on the removal of the root node. (build_flat): Only perform pre_change if we are rebuilding the whole lot. For incremental change let etable do its thing. (build_tree): Likewise for building the tree view. If making incremental updates, do them as we build it. - (vfolder_subject): - (vfolder_sender): - (vfolder_recipient): - (filter_subject): - (filter_sender): - (filter_recipient): - (filter_mlist): + (vfolder_subject): + (vfolder_sender): + (vfolder_recipient): + (filter_subject): + (filter_sender): + (filter_recipient): + (filter_mlist): (on_right_click): Moved to folder-browser.c, where they belong. (message_list_init): Dont connect to right_click anymore. (message_list_toggle_threads): Moved to folder-browser.c, renamed. diff --git a/mail/Makefile.am b/mail/Makefile.am index f1e00ef3ff..4f8a9e3dfa 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -50,11 +50,13 @@ evolution_mail_SOURCES = \ mail-autofilter.c \ mail-autofilter.h \ mail-callbacks.c \ + mail-callbacks.h \ mail-config.c \ mail-config.h \ mail-config-gui.c \ mail-config-gui.h \ mail-crypto.c \ + mail-crypto.h \ mail-display.c \ mail-display.h \ mail-format.c \ @@ -85,6 +87,7 @@ evolution_mail_SOURCES = \ message-thread.c \ message-thread.h \ session.c \ + mail-session.h \ subscribe-dialog.c \ subscribe-dialog.h \ mail.h diff --git a/mail/component-factory.c b/mail/component-factory.c index dbff4b8c5c..acd635e5c6 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -38,6 +38,7 @@ #include "mail.h" /* YUCK FIXME */ #include "mail-tools.h" #include "mail-ops.h" +#include "mail-session.h" #include <gal/widgets/e-gui-utils.h> #include "mail-local-storage.h" @@ -122,7 +123,7 @@ owner_set_cb (EvolutionShellComponent *shell_component, g_print ("evolution-mail: Yeeeh! We have an owner!\n"); /* FIXME */ evolution_dir = g_strdup (evolution_homedir); - session_init (); + mail_session_init (); mail_config_init (); mail_do_setup_folder ("Drafts", &drafts_folder); diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index edcf4b7235..26806a8da4 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -24,9 +24,11 @@ #include "folder-browser.h" #include "mail.h" +#include "mail-callbacks.h" #include "shell/Evolution.h" #include "mail-config.h" #include "mail-ops.h" +#include "mail-session.h" /* The FolderBrowser BonoboControls we have. */ static GList *control_list = NULL; @@ -47,7 +49,7 @@ BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("SetVFolder", vfolder_edit_vfolders), BONOBO_UI_UNSAFE_VERB ("SetMailConfig", providers_config), BONOBO_UI_UNSAFE_VERB ("SetSubscribe", manage_subscriptions), - BONOBO_UI_UNSAFE_VERB ("SetForgetPwd", forget_passwords), + BONOBO_UI_UNSAFE_VERB ("SetForgetPwd", mail_session_forget_passwords), /* Message Menu */ BONOBO_UI_UNSAFE_VERB ("MessageOpenNewWnd", view_message), diff --git a/mail/folder-browser.c b/mail/folder-browser.c index b5bed7f9af..d72ea18a53 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -13,6 +13,7 @@ #include "e-util/e-sexp.h" #include "folder-browser.h" #include "mail.h" +#include "mail-callbacks.h" #include "mail-tools.h" #include "message-list.h" #include "mail-threads.h" diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index db13ea39b0..e283a02d5c 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -31,6 +31,7 @@ #include <libgnomeprint/gnome-print-master.h> #include <libgnomeprint/gnome-print-master-preview.h> #include "mail.h" +#include "mail-callbacks.h" #include "mail-config.h" #include "mail-threads.h" #include "mail-tools.h" diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h new file mode 100644 index 0000000000..31f548f629 --- /dev/null +++ b/mail/mail-callbacks.h @@ -0,0 +1,79 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast <fejj@helixcode.com> + * + * Copyright 2000 Helix Code, Inc. (www.helixcode.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_CALLBACKS_H +#define MAIL_CALLBACKS_H + +#include <gnome.h> +#include <camel/camel.h> +#include "composer/e-msg-composer.h" +#include "mail-types.h" + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus }*/ + +void fetch_mail (GtkWidget *widget, gpointer user_data); +void send_queued_mail (GtkWidget *widget, gpointer user_data); +void send_receieve_mail (GtkWidget *widget, gpointer user_data); + +void compose_msg (GtkWidget *widget, gpointer user_data); +void send_to_url (const char *url); +void forward_msg (GtkWidget *widget, gpointer user_data); +void reply_to_sender (GtkWidget *widget, gpointer user_data); +void reply_to_all (GtkWidget *widget, gpointer user_data); +void delete_msg (GtkWidget *widget, gpointer user_data); +void move_msg (GtkWidget *widget, gpointer user_data); +void copy_msg (GtkWidget *widget, gpointer user_data); +void apply_filters (GtkWidget *widget, gpointer user_data); +void print_msg (GtkWidget *widget, gpointer user_data); +void print_preview_msg (GtkWidget *widget, gpointer user_data); +void edit_msg (GtkWidget *widget, gpointer user_data); +void view_msg (GtkWidget *widget, gpointer user_data); + +void select_all (BonoboUIComponent *uih, void *user_data, const char *path); +void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path); +void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path); +void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path); +void edit_message (BonoboUIComponent *uih, void *user_data, const char *path); +void view_message (BonoboUIComponent *uih, void *user_data, const char *path); +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); + +void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, gboolean to_all); +void composer_send_cb (EMsgComposer *composer, gpointer data); +void composer_postpone_cb (EMsgComposer *composer, gpointer data); + +void mail_print_preview_msg (MailDisplay *md); +void mail_print_msg (MailDisplay *md); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ! MAIL_CALLBACKS_H */ diff --git a/mail/mail-crypto.c b/mail/mail-crypto.c index 5d97b7d46a..00428a5b29 100644 --- a/mail/mail-crypto.c +++ b/mail/mail-crypto.c @@ -1,7 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * mail-crypto.h: OpenPGP en/decryption & signature code + * mail-crypto.c: OpenPGP en/decryption & signature code * * FIXME FIXME FIXME: This should be in its own library or component */ @@ -37,10 +37,9 @@ #ifdef PGP_PROGRAM #include <stdlib.h> #include <string.h> -#include <glib.h> -#include <gnome.h> -#include "mail.h" +#include "mail-crypto.h" +#include "mail-session.h" #include <dirent.h> #include <errno.h> @@ -341,7 +340,7 @@ mail_crypto_openpgp_decrypt (const char *ciphertext, CamelException *ex) int passwd_fds[2]; char passwd_fd[32]; - passphrase = mail_request_dialog ( + passphrase = mail_session_request_dialog ( _("Please enter your PGP/GPG passphrase."), TRUE, "pgp", FALSE); if (!passphrase) { @@ -437,7 +436,7 @@ mail_crypto_openpgp_encrypt (const char *plaintext, if (sign) { /* we only need the passphrase if we plan to sign */ - passphrase = mail_request_dialog ( + passphrase = mail_session_request_dialog ( _("Please enter your PGP/GPG passphrase."), TRUE, "pgp", FALSE); if (!passphrase) { @@ -601,8 +600,8 @@ mail_crypto_openpgp_clearsign (const char *plaintext, const char *userid, return NULL; #endif - passphrase = mail_request_dialog (_("Please enter your PGP/GPG passphrase."), - TRUE, "pgp", FALSE); + passphrase = mail_session_request_dialog (_("Please enter your PGP/GPG passphrase."), + TRUE, "pgp", FALSE); if (!passphrase) { camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, diff --git a/mail/mail-crypto.h b/mail/mail-crypto.h new file mode 100644 index 0000000000..8ea9999809 --- /dev/null +++ b/mail/mail-crypto.h @@ -0,0 +1,50 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast <fejj@helixcode.com> + * + * Copyright 2000 Helix Code, Inc. (www.helixcode.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_CRYPTO_H +#define MAIL_CRYPTO_H + +#include <gnome.h> +#include <camel/camel.h> + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus }*/ + +char *mail_crypto_openpgp_decrypt (const char *ciphertext, + CamelException *ex); + +char *mail_crypto_openpgp_encrypt (const char *plaintext, + const GPtrArray *recipients, + gboolean sign, + CamelException *ex); + +char *mail_crypto_openpgp_clearsign (const char *plaintext, + const char *userid, + CamelException *ex); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ! MAIL_CRYPTO_H */ diff --git a/mail/mail-format.c b/mail/mail-format.c index a7e46f272f..bd9aee294b 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -24,9 +24,10 @@ */ #include <config.h> +#include "mail.h" #include "mail-tools.h" #include "mail-display.h" -#include "mail.h" +#include "mail-crypto.h" #include "shell/e-setup.h" #include "e-util/e-html-utils.h" #include <camel/camel-mime-utils.h> diff --git a/mail/mail-session.h b/mail/mail-session.h new file mode 100644 index 0000000000..da0ca15ff3 --- /dev/null +++ b/mail/mail-session.h @@ -0,0 +1,47 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: Jeffrey Stedfast <fejj@helixcode.com> + * + * Copyright 2000 Helix Code, Inc. (www.helixcode.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_SESSION_H +#define MAIL_SESSION_H + +#include <gnome.h> +#include <bonobo.h> +#include <camel/camel.h> + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus }*/ + +void mail_session_init (void); +char *mail_session_request_dialog (const char *prompt, gboolean secret, + const char *key, gboolean async); +void mail_session_forget_passwords (BonoboUIComponent *uih, void *user_data, + const char *path); + +extern CamelSession *session; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ! MAIL_SESSION_H */ diff --git a/mail/mail-view.c b/mail/mail-view.c index c45f7dbaf4..2d95fb4f24 100644 --- a/mail/mail-view.c +++ b/mail/mail-view.c @@ -25,6 +25,7 @@ #include "mail-ops.h" #include "camel/camel.h" #include "mail-display.h" +#include "mail-callbacks.h" typedef struct mail_view_data_s { CamelFolder *source; diff --git a/mail/mail.h b/mail/mail.h index 1c96a368b5..481c031585 100644 --- a/mail/mail.h +++ b/mail/mail.h @@ -23,27 +23,16 @@ #include <libgnomevfs/gnome-vfs-mime-handlers.h> #include "camel/camel.h" #include "composer/e-msg-composer.h" +#include "mail-callbacks.h" #include "mail-config.h" #include "mail-config-gui.h" /*#include "folder-browser.h"*/ +#include "mail-session.h" #include "mail-types.h" #include "shell/evolution-storage.h" extern char *evolution_dir; -/* mail-crypto */ -char *mail_crypto_openpgp_decrypt (const char *ciphertext, - CamelException *ex); - -char *mail_crypto_openpgp_encrypt (const char *plaintext, - const GPtrArray *recipients, - gboolean sign, - CamelException *ex); - -char *mail_crypto_openpgp_clearsign (const char *plaintext, - const char *userid, - CamelException *ex); - /* mail-format */ void mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md); @@ -70,46 +59,6 @@ char *mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, /* mail-identify */ char *mail_identify_mime_part (CamelMimePart *part); -/* mail-callbacks */ -void fetch_mail (GtkWidget *widget, gpointer user_data); -void send_queued_mail (GtkWidget *widget, gpointer user_data); -void send_receieve_mail (GtkWidget *widget, gpointer user_data); - -void compose_msg (GtkWidget *widget, gpointer user_data); -void send_to_url (const char *url); -void forward_msg (GtkWidget *widget, gpointer user_data); -void reply_to_sender (GtkWidget *widget, gpointer user_data); -void reply_to_all (GtkWidget *widget, gpointer user_data); -void delete_msg (GtkWidget *widget, gpointer user_data); -void move_msg (GtkWidget *widget, gpointer user_data); -void copy_msg (GtkWidget *widget, gpointer user_data); -void apply_filters (GtkWidget *widget, gpointer user_data); -void print_msg (GtkWidget *widget, gpointer user_data); -void print_preview_msg (GtkWidget *widget, gpointer user_data); -void edit_msg (GtkWidget *widget, gpointer user_data); -void view_msg (GtkWidget *widget, gpointer user_data); - -void select_all (BonoboUIComponent *uih, void *user_data, const char *path); -void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path); -void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path); -void edit_message (BonoboUIComponent *uih, void *user_data, const char *path); -void view_message (BonoboUIComponent *uih, void *user_data, const char *path); -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); - -void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, gboolean to_all); -void composer_send_cb (EMsgComposer *composer, gpointer data); -void composer_postpone_cb (EMsgComposer *composer, gpointer data); - -void mail_print_preview_msg (MailDisplay *md); -void mail_print_msg (MailDisplay *md); - /* mail view */ GtkWidget *mail_view_create (CamelFolder *source, const char *uid, CamelMimeMessage *msg); @@ -118,13 +67,3 @@ GtkWidget *mail_view_create (CamelFolder *source, const char *uid, CamelMimeMess void mail_load_storages (Evolution_Shell corba_shell, GSList *sources); /* used in the subscribe dialog code */ EvolutionStorage *mail_lookup_storage (CamelStore *store); - -/* session */ -void session_init (void); -char *mail_request_dialog (const char *prompt, gboolean secret, - const char *key, gboolean async); -void forget_passwords (BonoboUIComponent *uih, void *user_data, - const char *path); -extern CamelSession *session; - - diff --git a/mail/message-list.c b/mail/message-list.c index 8076d8c3fa..768d3f6fdf 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -359,8 +359,8 @@ message_list_drag_data_get (ETable *table, char *url; switch (info) { - case DND_TARGET_TYPE_URI_LIST: - dirname = mkdtemp (dirname); + case DND_TARGET_LIST_TYPE_URI: + mktemp (dirname); filename = g_strdup_printf ("%s.eml", info->subject); url = g_strdup_printf ("file:%s", dirname); @@ -382,7 +382,6 @@ message_list_drag_data_get (ETable *table, default: break; } - e_table_drag_source_set (table, GDK_BUTTON1_MASK, drag_types, num_drag_types, GDK_ACTION_MOVE); } #endif @@ -904,7 +903,7 @@ save_header_state(MessageList *ml) static char * message_list_get_layout (MessageList *message_list) { - /* Message status, From, Subject, Sent Date */ + /* Default: Status, Attachments, Priority, From, Subject, Date */ return g_strdup ("<ETableSpecification cursor-mode=\"line\" draw-grid=\"true\">" "<ETableColumn model_col= \"0\" pixbuf=\"status\" expansion=\"0.0\" minimum_width=\"18\" resizable=\"false\" cell=\"render_message_status\" compare=\"integer\" sortable=\"false\"/>" "<ETableColumn model_col= \"1\" pixbuf=\"flagged\" expansion=\"0.0\" minimum_width=\"20\" resizable=\"false\" cell=\"render_flagged\" compare=\"integer\"/>" @@ -916,8 +915,8 @@ message_list_get_layout (MessageList *message_list) "<ETableColumn model_col= \"7\" _title=\"Received\" expansion=\"20.0\" minimum_width=\"32\" resizable=\"true\" cell=\"render_date\" compare=\"integer\"/>" "<ETableColumn model_col= \"8\" _title=\"To\" expansion=\"24.0\" minimum_width=\"32\" resizable=\"true\" cell=\"render_text\" compare=\"address_compare\"/>" "<ETableColumn model_col= \"9\" _title=\"Size\" expansion=\"6.0\" minimum_width=\"32\" resizable=\"true\" cell=\"render_text\" compare=\"string\"/>" - "<ETableState> <column source=\"0\"/> <column source=\"1\"/> <column source=\"4\"/>" - "<column source=\"5\"/> <column source=\"6\"/>" + "<ETableState> <column source=\"0\"/> <column source=\"3\"/> <column source=\"1\"/>" + "<column source=\"4\"/> <column source=\"5\"/> <column source=\"6\"/>" "<grouping> </grouping> </ETableState>" "</ETableSpecification>"); } @@ -925,32 +924,32 @@ message_list_get_layout (MessageList *message_list) static void message_list_setup_etable(MessageList *message_list) { - char *state = "<ETableState>" - "<column source=\"0\"/> <column source=\"1\"/> " - "<column source=\"8\"/> <column source=\"5\"/> " - "<column source=\"6\"/> <grouping> </grouping> </ETableState>"; - /* build the spec based on the folder, and possibly from a saved file */ /* otherwise, leave default */ if (message_list->folder) { - char *name; char *path; + char *name; struct stat st; - path = mail_config_folder_to_cachename(message_list->folder, "et-header-"); - if (path && stat(path, &st) == 0 && st.st_size > 0 && S_ISREG(st.st_mode)) { - e_table_scrolled_load_state(E_TABLE_SCROLLED (message_list->etable), path); - } else { - /* I wonder if there's a better way to do this ...? */ - name = camel_service_get_name(CAMEL_SERVICE(message_list->folder->parent_store), TRUE); - printf ("folder name is '%s'\n", name); - if (strstr (name, "/Drafts") != NULL - || strstr (name, "/Outbox") != NULL - || strstr (name, "/Sent") != NULL) { - e_table_scrolled_set_state(E_TABLE_SCROLLED(message_list->etable), state); - } + name = camel_service_get_name (CAMEL_SERVICE (message_list->folder->parent_store), TRUE); + printf ("folder name is '%s'\n", name); + path = mail_config_folder_to_cachename (message_list->folder, "et-header-"); + + if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) { + /* build based on saved file */ + e_table_scrolled_load_state (E_TABLE_SCROLLED (message_list->etable), path); + } else if (strstr (name, "/Drafts") || strstr (name, "/Outbox") || strstr (name, "/Sent")) { + /* these folders have special defaults */ + char *state = "<ETableState>" + "<column source=\"0\"/> <column source=\"1\"/> " + "<column source=\"8\"/> <column source=\"5\"/> " + "<column source=\"6\"/> <grouping> </grouping> </ETableState>"; + + e_table_scrolled_set_state (E_TABLE_SCROLLED (message_list->etable), state); } + g_free (path); + g_free (name); } } diff --git a/mail/session.c b/mail/session.c index 54243bc731..6bcfc96404 100644 --- a/mail/session.c +++ b/mail/session.c @@ -1,5 +1,5 @@ /* - * session.c: handles the session information and resource manipulation + * mail-session.c: handles the session information and resource manipulation * * Author: * Miguel de Icaza (miguel@gnu.org) @@ -9,6 +9,7 @@ #include <config.h> #include <gnome.h> #include "mail.h" +#include "mail-session.h" #include "mail-threads.h" CamelSession *session; @@ -26,8 +27,8 @@ request_callback (gchar *string, gpointer data) } char * -mail_request_dialog (const char *prompt, gboolean secret, const char *key, - gboolean async) +mail_session_request_dialog (const char *prompt, gboolean secret, const char *key, + gboolean async) { GtkWidget *dialog; @@ -90,7 +91,7 @@ auth_callback (CamelAuthCallbackMode mode, char *data, gboolean secret, return NULL; } - ans = mail_request_dialog (data, secret, key, TRUE); + ans = mail_session_request_dialog (data, secret, key, TRUE); g_free (key); if (!ans) { @@ -187,7 +188,7 @@ remove_callback (guint handle) /* ******************** */ void -session_init (void) +mail_session_init (void) { char *camel_dir; @@ -208,7 +209,8 @@ free_entry (gpointer key, gpointer value, gpointer user_data) } void -forget_passwords (BonoboUIComponent *uih, void *user_data, const char *path) +mail_session_forget_passwords (BonoboUIComponent *uih, void *user_data, + const char *path) { g_hash_table_foreach_remove (passwords, free_entry, NULL); } |