From 491b3c3c779ba32dfeba25d5ffcab064e842c910 Mon Sep 17 00:00:00 2001 From: Jeremy Wise Date: Wed, 9 Aug 2000 02:06:20 +0000 Subject: Value for threaded list view is now saved via gnome-config. This means that you can FINALLY shut off the threaded view once and for all :) svn path=/trunk/; revision=4621 --- mail/ChangeLog | 4 ++++ mail/folder-browser-factory.c | 3 ++- mail/mail-config.c | 32 ++++++++++++++++++++++++++++++++ mail/mail-config.h | 5 ++++- mail/main.c | 2 ++ mail/message-list.c | 8 +++----- 6 files changed, 47 insertions(+), 7 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index e2802b2814..e807608d8e 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,7 @@ +2000-08-08 Jeremy Wise + * mail-config.[ch], main.c, folder-browser-factory.c: State of the + threaded list toggle is now saved via gnome_config + 2000-08-08 Dan Winship * mail-config-gui.c (service_page_item_new): Attach a signal diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 9453ea7aaa..dc5fd25ca5 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -18,6 +18,7 @@ #include "folder-browser.h" #include "mail.h" #include "shell/Evolution.h" +#include "mail-config.h" static GnomeUIInfo gnome_toolbar [] = { GNOMEUIINFO_ITEM_STOCK (N_("Get mail"), N_("Check for new mail"), fetch_mail, GNOME_STOCK_PIXMAP_MAIL_RCV), @@ -60,7 +61,7 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih, _("_Threaded Message List"), NULL, -1, 0, 0, NULL, NULL); bonobo_ui_handler_menu_set_toggle_state (uih, "/View/Threaded", - threaded_view); + mail_config_thread_list()); bonobo_ui_handler_menu_set_callback (uih, "/View/Threaded", message_list_toggle_threads, FOLDER_BROWSER (folder_browser)->message_list, diff --git a/mail/mail-config.c b/mail/mail-config.c index 3427080cff..a62abfee5c 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -243,6 +243,12 @@ mail_config_read () evolution_dir); config->send_html = gnome_config_get_bool (str); g_free (str); + + /* Show Messages Threaded */ + str = g_strdup_printf ("=%s/config/Mail=/Display/thread_list", + evolution_dir); + config->thread_list = gnome_config_get_bool (str); + g_free (str); gnome_config_sync (); } @@ -339,6 +345,20 @@ mail_config_write () evolution_dir); gnome_config_set_bool (str, config->send_html); g_free (str); + + gnome_config_sync (); +} + +void +mail_config_write_on_exit () +{ + gchar *str; + + /* Show Messages Threaded */ + str = g_strdup_printf ("=%s/config/Mail=/Display/thread_list", + evolution_dir); + gnome_config_set_bool (str, config->thread_list); + g_free (str); gnome_config_sync (); } @@ -380,6 +400,18 @@ mail_config_send_html () return config->send_html; } +gboolean +mail_config_thread_list () +{ + return config->thread_list; +} + +void +mail_config_set_thread_list (gboolean value) +{ + config->thread_list = value; +} + MailConfig * mail_config_fetch (void) { diff --git a/mail/mail-config.h b/mail/mail-config.h index 033bf18337..18921b20c4 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -45,6 +45,7 @@ typedef struct GSList *news; MailConfigService *transport; gboolean send_html; + gboolean thread_list; } MailConfig; /* Identities */ @@ -62,6 +63,7 @@ void mail_config_init (void); void mail_config_clear (void); void mail_config_read (void); void mail_config_write (void); +void mail_config_write_on_exit (void); /* Accessor functions */ gboolean mail_config_is_configured (); @@ -69,7 +71,8 @@ MailConfigIdentity *mail_config_get_default_identity (void); MailConfigService *mail_config_get_default_source (void); MailConfigService *mail_config_get_transport (void); gboolean mail_config_send_html (); - +gboolean mail_config_thread_list (); +void mail_config_set_thread_list (gboolean value); MailConfig *mail_config_fetch (void); #endif diff --git a/mail/main.c b/mail/main.c index 32572dd064..8ad567da21 100644 --- a/mail/main.c +++ b/mail/main.c @@ -67,5 +67,7 @@ main (int argc, char *argv []) GDK_THREADS_LEAVE (); #endif + mail_config_write_on_exit (); + return 0; } diff --git a/mail/message-list.c b/mail/message-list.c index eb6a163bcc..c20534541e 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -19,6 +19,7 @@ #include #include "message-list.h" #include "message-thread.h" +#include "mail-config.h" #include "mail.h" #include "Mail.h" #include "widgets/e-table/e-table-header-item.h" @@ -848,7 +849,7 @@ message_list_regenerate (MessageList *message_list, const char *search) e_tree_model_node_insert(etm, NULL, 0, message_list); e_tree_model_node_set_expanded (etm, message_list->tree_root, TRUE); - if (threaded_view) { + if (mail_config_thread_list()) { struct _container *head; head = thread_messages (message_list->folder, uids); @@ -1031,14 +1032,11 @@ message_list_foreach (MessageList *message_list, mlfe_callback, &mlfe_data); } -gboolean threaded_view = TRUE; - void message_list_toggle_threads (BonoboUIHandler *uih, void *user_data, const char *path) { MessageList *ml = user_data; - - threaded_view = bonobo_ui_handler_menu_get_toggle_state (uih, path); + mail_config_set_thread_list(bonobo_ui_handler_menu_get_toggle_state (uih, path)); message_list_regenerate (ml, ml->search); } -- cgit