diff options
-rw-r--r-- | mail/ChangeLog | 38 | ||||
-rw-r--r-- | mail/mail-config.c | 107 |
2 files changed, 67 insertions, 78 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 4c59922da5..9f048cffe2 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,9 +1,20 @@ +2001-07-03 Jeffrey Stedfast <fejj@ximian.com> + + * mail-config.c (mail_config_get_show_preview): Use a better + GHashTable technique that will hopefully solve some bugs and also + use _with_default bonobo-config call. + (mail_config_set_show_preview): No sense in removing the entry + from the hash table and then re-inserting it. Just reset the + value. + (mail_config_get_thread_list): Use the same logic. + (mail_config_set_thread_list): And again here. + 2001-07-03 Peter Williams <peterw@ximian.com> - * mail-folder-cache.c (make_folder_name, make_folder_status): Split - make_string into these. - (update_idle): Use (name and status) instead of (wide and thin) for - the text. + * mail-folder-cache.c (make_folder_name, make_folder_status): + Split make_string into these. + (update_idle): Use (name and status) instead of (wide and thin) + for the text. 2001-07-03 Jason Leach <jleach@ximian.com> @@ -17,20 +28,20 @@ 2001-07-03 Peter Williams <peterw@ximian.com> Prevent folders from appearing to have -1 new messages. Prevent - nonactive folders from updating the title bar. Make the title - bar update when switching to an already-opened folder. + nonactive folders from updating the title bar. Make the title bar + update when switching to an already-opened folder. - * mail-folder-cache.c (update_message_counts): Ignore the value for - 'unread' if it is -1. + * mail-folder-cache.c (update_message_counts): Ignore the value + for 'unread' if it is -1. (get_mail_info_receive): Same (mail_folder_cache_note_folderinfo): Same. (get_folder_info): Initialize 'fb' to NULL. (mail_folder_info): Add 'fb' member. (mail_folder_cache_note_fb): Change note_message_list to this. - (update_idle): Only update the ShellView if the active folder browser - is the same as the one that the MFI references. - (mail_folder_cache_set_folder_browser): New function. Use it to set - the active folder browser. NULL is okay. + (update_idle): Only update the ShellView if the active folder + browser is the same as the one that the MFI references. + (mail_folder_cache_set_folder_browser): New function. Use it to + set the active folder browser. NULL is okay. (check_for_fb_match): Called from the above. If the MFI has the new folder browser as its view, queue an update. @@ -41,7 +52,8 @@ * folder-browser.c (got_folder): Change to use note_fb instead of note_messge_list. - * folder-browser-factory.c (control_activate): Set the folder browser + * folder-browser-factory.c (control_activate): Set the folder + browser (control_deactivate): Clear it here. (fb_get_svi): Kill some inappropriately cut-n-pasted code. diff --git a/mail/mail-config.c b/mail/mail-config.c index 913c4ca940..6a60a4855e 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -287,13 +287,12 @@ config_read (void) account = g_new0 (MailConfigAccount, 1); path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i); - account->name = bonobo_config_get_string (config->db, path, - NULL); + account->name = bonobo_config_get_string (config->db, path, NULL); g_free (path); path = g_strdup_printf ("/Mail/Accounts/account_is_default_%d", i); account->default_account = bonobo_config_get_boolean (config->db, path, NULL) && !have_default; - + if (account->default_account) have_default = TRUE; g_free (path); @@ -435,8 +434,7 @@ config_read (void) g_free (val); path = g_strdup_printf ("/Mail/Accounts/transport_save_passwd_%d", i); - transport->save_passwd = bonobo_config_get_boolean - (config->db, path, NULL); + transport->save_passwd = bonobo_config_get_boolean (config->db, path, NULL); g_free (path); account->id = id; @@ -881,40 +879,32 @@ mail_config_set_empty_trash_on_exit (gboolean value) config->empty_trash_on_exit = value; } +gboolean mail_config_get_show_preview (const char *uri) { if (uri) { - char *key; - gboolean value = FALSE; + gpointer key, val; + char *dbkey; + + dbkey = uri_to_key (uri); - key = uri_to_key (uri); - if (!config->preview_hash) config->preview_hash = g_hash_table_new (g_str_hash, g_str_equal); - else - value = GPOINTER_TO_INT (g_hash_table_lookup (config->preview_hash, key)); - if (!value) { - CORBA_Environment ev; + if (!g_hash_table_lookup_extended (config->preview_hash, dbkey, &key, &val)) { + gboolean value; char *str; - CORBA_exception_init (&ev); - str = g_strdup_printf ("/Mail/Preview/%s", key); - value = bonobo_config_get_boolean - (config->db, str, &ev); + str = g_strdup_printf ("/Mail/Preview/%s", dbkey); + value = bonobo_config_get_boolean_with_default (config->db, str, TRUE, NULL); g_free (str); - if (!BONOBO_EX (&ev)) { - g_hash_table_insert (config->preview_hash, - g_strdup (key), - GINT_TO_POINTER (value)); - } - - CORBA_exception_free (&ev); - g_free (key); + g_hash_table_insert (config->preview_hash, dbkey, + GINT_TO_POINTER (value)); + return value; } else - return value; + return GPOINTER_TO_INT (val); } /* return the default value */ @@ -930,17 +920,15 @@ mail_config_set_show_preview (const char *uri, gboolean value) gpointer key, val; if (!config->preview_hash) - config->preview_hash = g_hash_table_new (g_str_hash, - g_str_equal); + config->preview_hash = g_hash_table_new (g_str_hash, g_str_equal); - if (g_hash_table_lookup_extended (config->preview_hash, dbkey, - &key, &val)) { - g_hash_table_remove (config->preview_hash, dbkey); - g_free (key); + if (g_hash_table_lookup_extended (config->preview_hash, dbkey, &key, &val)) { + val = GINT_TO_POINTER (value); + g_free (dbkey); + } else { + g_hash_table_insert (config->preview_hash, dbkey, + GINT_TO_POINTER (value)); } - - g_hash_table_insert (config->preview_hash, dbkey, - GINT_TO_POINTER (value)); } else config->show_preview = value; } @@ -949,37 +937,28 @@ gboolean mail_config_get_thread_list (const char *uri) { if (uri) { - char *key; - gboolean value = FALSE; + gpointer key, val; + char *dbkey; + + dbkey = uri_to_key (uri); - key = uri_to_key (uri); - if (!config->threaded_hash) config->threaded_hash = g_hash_table_new (g_str_hash, g_str_equal); - else - value = GPOINTER_TO_INT (g_hash_table_lookup (config->threaded_hash, key)); - if (!value) { - CORBA_Environment ev; + if (!g_hash_table_lookup_extended (config->threaded_hash, dbkey, &key, &val)) { + gboolean value; char *str; - CORBA_exception_init (&ev); - str = g_strdup_printf ("/Mail/Threads/%s", key); - value = bonobo_config_get_boolean (config->db , str, - &ev); + str = g_strdup_printf ("/Mail/Threads/%s", dbkey); + value = bonobo_config_get_boolean_with_default (config->db, str, FALSE, NULL); g_free (str); - if (!BONOBO_EX (&ev)) { - g_hash_table_insert (config->threaded_hash, - g_strdup (key), - GINT_TO_POINTER (value)); - } - - CORBA_exception_free (&ev); - g_free (key); + g_hash_table_insert (config->threaded_hash, dbkey, + GINT_TO_POINTER (value)); + return value; } else - return value; + return GPOINTER_TO_INT (val); } /* return the default value */ @@ -995,17 +974,15 @@ mail_config_set_thread_list (const char *uri, gboolean value) gpointer key, val; if (!config->threaded_hash) - config->threaded_hash = g_hash_table_new (g_str_hash, - g_str_equal); + 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_remove (config->threaded_hash, dbkey); - g_free (key); + if (g_hash_table_lookup_extended (config->threaded_hash, dbkey, &key, &val)) { + val = GINT_TO_POINTER (value); + g_free (dbkey); + } else { + g_hash_table_insert (config->threaded_hash, dbkey, + GINT_TO_POINTER (value)); } - - g_hash_table_insert (config->threaded_hash, dbkey, - GINT_TO_POINTER (value)); } else config->thread_list = value; } |