From dafc74eeaf244b39d1fd0f8498d50d2535ca8bd9 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 3 Jul 2001 01:45:41 +0000 Subject: Setup the Empty Trash On Exit widgets. 2001-07-02 Jeffrey Stedfast * mail-accounts.c (construct): Setup the Empty Trash On Exit widgets. * mail-config.c (config_read): Option to emtpy trash on exit. (mail_config_write_on_exit): Same. (mail_config_set_empty_trash_on_exit): Set the option. (mail_config_get_empty_trash_on_exit): Get the option. * component-factory.c (owner_unset_cb): Empty the trash folders if the user set the "empty trash on exit" option. svn path=/trunk/; revision=10711 --- mail/ChangeLog | 45 ++++++++++++++++++++++++++++++++------------- mail/component-factory.c | 3 +++ mail/mail-accounts.c | 11 +++++++++++ mail/mail-accounts.h | 5 ++++- mail/mail-config.c | 26 ++++++++++++++++++++++++++ mail/mail-config.h | 7 +++++-- 6 files changed, 81 insertions(+), 16 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 67ad37d278..3da62b9f80 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,16 @@ +2001-07-02 Jeffrey Stedfast + + * mail-accounts.c (construct): Setup the Empty Trash On Exit + widgets. + + * mail-config.c (config_read): Option to emtpy trash on exit. + (mail_config_write_on_exit): Same. + (mail_config_set_empty_trash_on_exit): Set the option. + (mail_config_get_empty_trash_on_exit): Get the option. + + * component-factory.c (owner_unset_cb): Empty the trash folders if + the user set the "empty trash on exit" option. + 2001-07-02 Jeffrey Stedfast * mail-callbacks.c (transfer_msg): Updated for the @@ -34,34 +47,40 @@ 2001-07-02 Peter Williams - * mail-folder-cache.h: New file. Protoypes for the Mail Folder Cache, which - provides a place for all the disparate pieces of the mailer to save bits of - information about a folder. Centralizes the information display code. + * mail-folder-cache.h: New file. Protoypes for the Mail Folder + Cache, which provides a place for all the disparate pieces of the + mailer to save bits of information about a folder. Centralizes the + information display code. * mail-folder-cache.c: New file. Implements the Mail Folder Cache. - * Makefile.am (evolution_mail_SOURCES): Add the mail-folder-cache.{c,h} + * Makefile.am (evolution_mail_SOURCES): Add the + mail-folder-cache.{c,h} - * folder-browser-factory.c (fb_get_svi): Copy of that absurdly long-named - function in mail-display.c that gets the GNOME_Evolution_ShellView. + * folder-browser-factory.c (fb_get_svi): Copy of that absurdly + long-named function in mail-display.c that gets the + GNOME_Evolution_ShellView. (control_activate): Set the ShellView for the folder cache. - * folder-browser.c (got_folder): Tell the folder browser about this folder. + * folder-browser.c (got_folder): Tell the folder browser about + this folder. - * mail-callbacks.c (create_folders): Tell the folder cache about the new - folders. + * mail-callbacks.c (create_folders): Tell the folder cache about + the new folders. * mail-local.c (reconfigure_folder_reconfigure): Don't unhook our events as we no longer hook them up. (register_folder_registered): Tell the folder cache about this folder's place in the local storage. - (register_folder_register): No longer hook events; the Folder Cache - will do this. - (local_folder_changed, local_folder_changed_proxy): Move to mail-folder-cache.c + (register_folder_register): No longer hook events; the Folder + Cache will do this. + (local_folder_changed, local_folder_changed_proxy): Move to + mail-folder-cache.c (free_local_folder): No longer unhook events. * mail-ops.c (do_update_subfolders_rec): Instead of setting the - folder status ourselves, inform the Folder Cache about the changes. + folder status ourselves, inform the Folder Cache about the + changes. * mail-tools.c (mail_tool_uri_to_folder): Replace danw's cache with the new Mail Folder Cache. diff --git a/mail/component-factory.c b/mail/component-factory.c index 149159faf6..10588c50cc 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -578,6 +578,9 @@ idle_quit (gpointer user_data) static void owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data) { + if (mail_config_get_empty_trash_on_exit ()) + empty_trash (NULL, NULL, NULL); + unref_standard_folders (); mail_importer_uninit (); diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index 47d53a8b62..0be25756f0 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -601,6 +601,12 @@ images_radio_toggled (GtkWidget *radio, gpointer data) mail_config_set_http_mode (MAIL_CONFIG_HTTP_NEVER); } +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 forward_style_activated (GtkWidget *item, gpointer data) { @@ -751,6 +757,11 @@ construct (MailAccountsDialog *dialog) 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); + /* now to fill in the clists */ dialog->accounts_row = -1; dialog->accounts = mail_config_get_accounts (); diff --git a/mail/mail-accounts.h b/mail/mail-accounts.h index 62b73ec6f0..ebc67b3dec 100644 --- a/mail/mail-accounts.h +++ b/mail/mail-accounts.h @@ -82,7 +82,10 @@ struct _MailAccountsDialog { GtkToggleButton *send_html; GtkOptionMenu *forward_style; GtkOptionMenu *charset; - + + /* Other page */ + GtkToggleButton *empty_trash; + /* PGP page */ GnomeFileEntry *pgp_path; }; diff --git a/mail/mail-config.c b/mail/mail-config.c index c1b6f884f4..0a7fb4fbb5 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -61,6 +61,7 @@ typedef struct { gboolean prompt_empty_subject; gboolean prompt_only_bcc; gint seen_timeout; + gboolean empty_trash_on_exit; GSList *accounts; GSList *news; @@ -563,6 +564,14 @@ config_read (void) config->default_charset = g_strdup (config->default_charset); } + /* Trash folders */ + str = g_strdup_printf ("=%s/config/Mail=/Trash/empty_on_exit", + evolution_dir); + config->empty_trash_on_exit = gnome_config_get_bool_with_default (str, &def); + if (def) + config->empty_trash_on_exit = FALSE; + g_free (str); + gnome_config_sync (); } @@ -807,6 +816,11 @@ mail_config_write_on_exit (void) gnome_config_set_string (str, config->default_charset); g_free (str); + /* Trash folders */ + str = g_strdup_printf ("=%s/config/Mail=/Trash/empty_on_exit", evolution_dir); + gnome_config_set_bool (str, config->empty_trash_on_exit); + g_free (str); + /* Passwords */ gnome_config_private_clean_section ("/Evolution/Passwords"); sources = mail_config_get_sources (); @@ -846,6 +860,18 @@ mail_config_is_configured (void) return config->accounts != NULL; } +gboolean +mail_config_get_empty_trash_on_exit (void) +{ + return config->empty_trash_on_exit; +} + +void +mail_config_set_empty_trash_on_exit (gboolean value) +{ + config->empty_trash_on_exit = value; +} + gboolean mail_config_get_show_preview (const char *uri) { diff --git a/mail/mail-config.h b/mail/mail-config.h index d65ced4f7d..4a3167f6b9 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -106,14 +106,17 @@ void mail_config_write_on_exit (void); /* General Accessor functions */ gboolean mail_config_is_configured (void); +gboolean mail_config_get_empty_trash_on_exit (void); +void mail_config_set_empty_trash_on_exit (gboolean value); + gboolean mail_config_get_thread_list (const char *uri); void mail_config_set_thread_list (const char *uri, gboolean value); gboolean mail_config_get_show_preview (const char *uri); void mail_config_set_show_preview (const char *uri, gboolean value); -gboolean mail_config_get_hide_deleted (void); -void mail_config_set_hide_deleted (gboolean value); +gboolean mail_config_get_hide_deleted (void); +void mail_config_set_hide_deleted (gboolean value); gint mail_config_get_paned_size (void); void mail_config_set_paned_size (gint size); -- cgit v1.2.3