diff options
author | Dan Winship <danw@src.gnome.org> | 2002-09-28 02:38:21 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2002-09-28 02:38:21 +0800 |
commit | 1fafe625b126101a140a81a402bc8d71df13d625 (patch) | |
tree | c263d611f61a600d4928e822d94e9d5b1499d33e | |
parent | 54a46029d2ebcd7f226b69216ae7bd97ef65fec8 (diff) | |
download | gsoc2013-evolution-1fafe625b126101a140a81a402bc8d71df13d625.tar.gz gsoc2013-evolution-1fafe625b126101a140a81a402bc8d71df13d625.tar.zst gsoc2013-evolution-1fafe625b126101a140a81a402bc8d71df13d625.zip |
Set a timeout to call mail_config_write() in 2 seconds. Otherwise changes
* mail-config.c (impl_GNOME_Evolution_MailConfig_addAccount,
impl_GNOME_Evolution_MailConfig_removeAccount): Set a timeout to
call mail_config_write() in 2 seconds. Otherwise changes made by
this interface would not be saved to disk unless the user also
changed some other preference.
(mail_config_write_on_exit): If there's a config_write_timeout
pending, call mail_config_write() too.
svn path=/trunk/; revision=18245
-rw-r--r-- | mail/ChangeLog | 10 | ||||
-rw-r--r-- | mail/mail-config.c | 27 |
2 files changed, 37 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index eb32df9718..3920b075c2 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2002-09-26 Dan Winship <danw@ximian.com> + + * mail-config.c (impl_GNOME_Evolution_MailConfig_addAccount, + impl_GNOME_Evolution_MailConfig_removeAccount): Set a timeout to + call mail_config_write() in 2 seconds. Otherwise changes made by + this interface would not be saved to disk unless the user also + changed some other preference. + (mail_config_write_on_exit): If there's a config_write_timeout + pending, call mail_config_write() too. + 2002-09-25 Dan Winship <danw@ximian.com> * mail-display.c (mail_display_render): Add a margin around the diff --git a/mail/mail-config.c b/mail/mail-config.c index 1985a504be..a019519738 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -141,6 +141,7 @@ typedef struct { } MailConfig; static MailConfig *config = NULL; +static guint config_write_timeout = 0; #define MAIL_CONFIG_IID "OAFIID:GNOME_Evolution_MailConfig_Factory" @@ -1207,6 +1208,12 @@ mail_config_write_on_exit (void) char *path, *p; int i; + if (config_write_timeout) { + g_source_remove (config_write_timeout); + config_write_timeout = 0; + mail_config_write (); + } + /* Show Messages Threaded */ bonobo_config_set_boolean (config->db, "/Mail/Display/thread_list", config->thread_list, NULL); @@ -2769,6 +2776,14 @@ struct _EvolutionMailConfigClass { POA_GNOME_Evolution_MailConfig__epv epv; }; +static gboolean +do_config_write (gpointer data) +{ + config_write_timeout = 0; + mail_config_write (); + return FALSE; +} + static void impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant, const GNOME_Evolution_MailConfig_Account *account, @@ -2833,6 +2848,12 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant, /* Add new account */ mail_config_add_account (mail_account); + + /* Don't write out the config right away in case the remote + * component is creating or removing multiple accounts. + */ + if (!config_write_timeout) + config_write_timeout = g_timeout_add (2000, do_config_write, NULL); } static void @@ -2845,6 +2866,12 @@ impl_GNOME_Evolution_MailConfig_removeAccount (PortableServer_Servant servant, account = (MailConfigAccount *)mail_config_get_account_by_name (name); if (account) mail_config_remove_account (account); + + /* Don't write out the config right away in case the remote + * component is creating or removing multiple accounts. + */ + if (!config_write_timeout) + config_write_timeout = g_timeout_add (2000, do_config_write, NULL); } static void |