diff options
-rw-r--r-- | mail/ChangeLog | 14 | ||||
-rw-r--r-- | mail/folder-browser-ui.c | 9 | ||||
-rw-r--r-- | mail/folder-browser.c | 13 | ||||
-rw-r--r-- | mail/mail-config.c | 99 | ||||
-rw-r--r-- | mail/mail-config.h | 3 |
5 files changed, 27 insertions, 111 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 89a2085755..81213658e3 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,17 @@ +2003-01-22 Jeffrey Stedfast <fejj@ximian.com> + + * mail-config.c (mail_config_get_thread_list): Removed. + (mail_config_set_thread_list): Removed. + (mail_config_uri_renamed): No longer needs to change threaded + state for each url either. + (mail_config_write_on_exit): Updated. + + * folder-browser-ui.c (folder_browser_ui_add_list): Get the + threaded state via gconf. + + * folder-browser.c (folder_browser_toggle_threads): Save the + threaded state. + 2003-01-22 Ettore Perazzoli <ettore@ximian.com> * folder-browser-ui.c (folder_browser_ui_setup_view_menus): Use diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c index 9ce54a16b3..24916b59bf 100644 --- a/mail/folder-browser-ui.c +++ b/mail/folder-browser-ui.c @@ -577,12 +577,13 @@ folder_browser_ui_add_list (FolderBrowser *fb) fbui_sensitise_item (fb, "HideDeleted", FALSE); /* Threaded toggle */ - state = mail_config_get_thread_list (FOLDER_BROWSER (fb)->uri); + state = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_list", NULL); bonobo_ui_component_set_prop (uic, "/commands/ViewThreaded", "state", state ? "1" : "0", NULL); bonobo_ui_component_add_listener (uic, "ViewThreaded", folder_browser_toggle_threads, fb); - /* FIXME: this kind of bypasses bonobo but seems the only way when we change components */ - folder_browser_toggle_threads (uic, "", Bonobo_UIComponent_STATE_CHANGED, - state ? "1" : "0", fb); + message_list_set_threaded (fb->message_list, state); + state = fb->selection_state; + fb->selection_state = FB_SELSTATE_UNDEFINED; + folder_browser_ui_set_selection_state (fb, state); /* Property menu */ folder_browser_setup_property_menu (fb, fb->uicomp); diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 386789b2b8..2f9c287fad 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -3,7 +3,7 @@ * Authors: Miguel De Icaza <miguel@ximian.com> * Jeffrey Stedfast <fejj@ximian.com> * - * Copyright 2000,2001 Ximian, Inc. (www.ximian.com) + * Copyright 2000-2003 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 @@ -1319,18 +1319,21 @@ folder_browser_toggle_threads (BonoboUIComponent *component, gpointer user_data) { FolderBrowser *fb = user_data; + GConfClient *gconf; int prev_state; - if (type != Bonobo_UIComponent_STATE_CHANGED - || fb->message_list == NULL) + if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL) return; - mail_config_set_thread_list (fb->uri, atoi (state)); + gconf = gconf_client_get_default (); + gconf_client_set_bool (gconf, "/apps/evolution/mail/display/thread_list", + atoi (state), NULL); + message_list_set_threaded (fb->message_list, atoi (state)); prev_state = fb->selection_state; fb->selection_state = FB_SELSTATE_UNDEFINED; - folder_browser_ui_set_selection_state (fb, prev_state); + folder_browser_ui_set_selection_state (fb, prev_state); } void diff --git a/mail/mail-config.c b/mail/mail-config.c index a6be7afa8d..ee3e5121e6 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -80,8 +80,6 @@ typedef struct { EAccountList *accounts; guint accounts_notify_id; - GHashTable *threaded_hash; - GSList *signatures; int sig_nextid; @@ -418,24 +416,6 @@ mail_config_write (void) gconf_client_suggest_sync (config->gconf, NULL); } -static gboolean -hash_save_state (gpointer key, gpointer value, gpointer user_data) -{ - char *path; - gboolean bool = GPOINTER_TO_INT (value); - -#warning "need to rewrite hash_save_state(), probably shouldn't use gconf tho" -#if 0 - path = g_strconcat ("/apps/Evolution/Mail/", (char *)user_data, "/", (char *)key, - NULL); - e_config_listener_set_boolean (config->db, path, bool); - g_free (path); - g_free (key); -#endif - - return TRUE; -} - void mail_config_write_on_exit (void) { @@ -450,10 +430,6 @@ mail_config_write_on_exit (void) mail_config_write (); } - /* Message Threading */ - if (config->threaded_hash) - g_hash_table_foreach_remove (config->threaded_hash, hash_save_state, "Threads"); - /* Passwords */ /* then we make sure the ones we want to remember are in the @@ -534,65 +510,6 @@ uri_to_key (const char *uri) return rval; } -gboolean -mail_config_get_thread_list (const char *uri) -{ -#warning "FIXME: need to rework how we save state, probably shouldn't use gconf" -#if 0 - if (uri && *uri) { - gpointer key, val; - char *dbkey; - - dbkey = uri_to_key (uri); - - if (!config->threaded_hash) - config->threaded_hash = g_hash_table_new (g_str_hash, g_str_equal); - - if (!g_hash_table_lookup_extended (config->threaded_hash, dbkey, &key, &val)) { - gboolean value; - char *str; - - str = g_strdup_printf ("/apps/Evolution/Mail/Threads/%s", dbkey); - value = e_config_listener_get_boolean_with_default (config->db, str, FALSE, NULL); - g_free (str); - - g_hash_table_insert (config->threaded_hash, dbkey, - GINT_TO_POINTER (value)); - - return value; - } else { - g_free(dbkey); - return GPOINTER_TO_INT (val); - } - } -#endif - - /* return the default value */ - - return gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/thread_list", NULL); -} - -void -mail_config_set_thread_list (const char *uri, gboolean value) -{ - if (uri && *uri) { - char *dbkey = uri_to_key (uri); - gpointer key, val; - - if (!config->threaded_hash) - config->threaded_hash = g_hash_table_new (g_str_hash, g_str_equal); - - if (g_hash_table_lookup_extended (config->threaded_hash, dbkey, &key, &val)) { - g_hash_table_insert (config->threaded_hash, dbkey, - GINT_TO_POINTER (value)); - g_free (dbkey); - } else { - g_hash_table_insert (config->threaded_hash, dbkey, - GINT_TO_POINTER (value)); - } - } -} - const char * mail_config_get_label_name (int label) { @@ -982,7 +899,6 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new) EAccount *account; EIterator *iter; int i, work = 0; - gpointer oldkey, newkey, hashkey; gpointer val; char *oldname, *newname; char *cachenames[] = { "config/hidestate-", @@ -1013,21 +929,6 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new) g_object_unref (iter); - oldkey = uri_to_key (old); - newkey = uri_to_key (new); - - /* call this to load the hash table and the key */ - mail_config_get_thread_list (old); - if (g_hash_table_lookup_extended (config->threaded_hash, oldkey, &hashkey, &val)) { - /*printf ("changing key in threaded_hash\n");*/ - g_hash_table_remove (config->threaded_hash, hashkey); - g_hash_table_insert (config->threaded_hash, g_strdup (newkey), val); - work = 2; - } - - g_free (oldkey); - g_free (newkey); - /* ignore return values or if the files exist or * not, doesn't matter */ diff --git a/mail/mail-config.h b/mail/mail-config.h index 6f990b7a6d..ba253cccdb 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -103,9 +103,6 @@ void mail_config_write_on_exit (void); gboolean mail_config_is_configured (void); gboolean mail_config_is_corrupt (void); -gboolean mail_config_get_thread_list (const char *uri); -void mail_config_set_thread_list (const char *uri, gboolean value); - const char *mail_config_get_label_name (int label); void mail_config_set_label_name (int label, const char *name); guint32 mail_config_get_label_color (int label); |