#include <modest-account-mgr.h>
#include <modest-account-mgr-priv.h>
#include <modest-account-mgr-helpers.h>
+#include <modest-platform.h>
/* 'private'/'protected' functions */
static void modest_account_mgr_class_init (ModestAccountMgrClass * klass);
gboolean
modest_account_mgr_add_account (ModestAccountMgr *self,
const gchar *name,
+ const gchar *display_name,
+ const gchar *user_fullname,
+ const gchar *user_email,
+ const gchar *retrieve_type,
const gchar *store_account,
const gchar *transport_account,
gboolean enabled)
modest_account_mgr_set_bool (self, name, MODEST_ACCOUNT_LEAVE_ON_SERVER, TRUE, FALSE);
modest_account_mgr_set_bool (self, name, MODEST_ACCOUNT_ENABLED, enabled,FALSE);
+ /* Fill other data */
+ modest_account_mgr_set_string (self, name,
+ MODEST_ACCOUNT_DISPLAY_NAME,
+ display_name, FALSE);
+ modest_account_mgr_set_string (self, name,
+ MODEST_ACCOUNT_FULLNAME,
+ user_fullname, FALSE);
+ modest_account_mgr_set_string (self, name,
+ MODEST_ACCOUNT_EMAIL,
+ user_email, FALSE);
+ modest_account_mgr_set_string (self, name,
+ MODEST_ACCOUNT_RETRIEVE,
+ retrieve_type, FALSE);
+
/* Notify the observers */
g_signal_emit (self, signals[ACCOUNT_INSERTED_SIGNAL], 0, name);
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;
}
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;
}
const gchar *key, ModestConfValueType list_type,
gboolean server_account)
{
- ModestAccountMgrPrivate *priv;
+ ModestAccountMgrPrivate *priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self);
const gchar *keyname;
GSList *retval;