X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-account-mgr.c;h=d37c498237016ad8eb559a5a3f2225ac55a89311;hp=d8866b3b0eb272793b673a5fa729e285ecd1872f;hb=3b5cac93a4d81e187edca49db15816a800cd5e82;hpb=c7758f8aba3886a826b045e773986268bdf008b1 diff --git a/src/modest-account-mgr.c b/src/modest-account-mgr.c index d8866b3..d37c498 100644 --- a/src/modest-account-mgr.c +++ b/src/modest-account-mgr.c @@ -33,6 +33,7 @@ #include #include #include +#include /* 'private'/'protected' functions */ static void modest_account_mgr_class_init (ModestAccountMgrClass * klass); @@ -358,7 +359,11 @@ modest_account_mgr_add_account (ModestAccountMgr *self, if (!default_account) modest_account_mgr_set_default_account (self, name); g_free (default_account); - + + /* (re)set the automatic account update */ + modest_platform_set_update_interval + (modest_conf_get_int (priv->modest_conf, MODEST_CONF_UPDATE_INTERVAL, NULL)); + return TRUE; } @@ -594,6 +599,14 @@ modest_account_mgr_remove_account (ModestAccountMgr * self, will retrieve also the deleted account */ g_signal_emit (G_OBJECT(self), signals[ACCOUNT_REMOVED_SIGNAL], 0, name); + /* if this was the last account, stop any auto-updating */ + /* (re)set the automatic account update */ + GSList *acc_names = modest_account_mgr_account_names (self, TRUE); + if (!acc_names) + modest_platform_set_update_interval (0); + else + modest_account_mgr_free_account_names (acc_names); + return TRUE; } @@ -812,7 +825,7 @@ modest_account_mgr_get_list (ModestAccountMgr *self, const gchar *name, const gchar *key, ModestConfValueType list_type, gboolean server_account) { - ModestAccountMgrPrivate *priv; + ModestAccountMgrPrivate *priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self); const gchar *keyname; GSList *retval; @@ -1232,9 +1245,13 @@ modest_account_mgr_set_account_busy(ModestAccountMgr* self, const gchar* account_name, gboolean busy) { - ModestAccountMgrPrivate* priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self); - if (busy) - { + ModestAccountMgrPrivate* priv; + + g_return_if_fail (MODEST_IS_ACCOUNT_MGR(self)); + g_return_if_fail (account_name); + + priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self); + if (busy) { GSList *account_names = modest_account_mgr_account_names (self, TRUE); GSList* account = g_slist_find_custom(account_names, account_name, (GCompareFunc) compare_account_name); @@ -1260,11 +1277,17 @@ modest_account_mgr_set_account_busy(ModestAccountMgr* self, } gboolean -modest_account_mgr_account_is_busy(ModestAccountMgr* self, const gchar* account_name) +modest_account_mgr_account_is_busy (ModestAccountMgr* self, const gchar* account_name) { - ModestAccountMgrPrivate* priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self); + ModestAccountMgrPrivate* priv; + + g_return_val_if_fail (MODEST_IS_ACCOUNT_MGR(self), FALSE); + g_return_val_if_fail (account_name, FALSE); + + priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self); + return (g_slist_find_custom(priv->busy_accounts, account_name, (GCompareFunc) compare_account_name) - != NULL); + != NULL); } void