{
ModestAccountMgr *self = MODEST_ACCOUNT_MGR (data);
ModestAccountMgrPrivate *priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self);
-
+
/* TODO: Also store the account names, and notify one list for each account,
* if anything uses the account names. */
if (priv->changed_conf_keys) {
- gchar *default_account =
+ gchar *default_account =
modest_account_mgr_get_default_account (self);
g_signal_emit (G_OBJECT(self), signals[ACCOUNT_CHANGED_SIGNAL], 0,
static void
on_key_change (ModestConf *conf, const gchar *key, ModestConfEvent event, gpointer user_data)
{
- /* printf("DEBUG: %s: key=%s\n", __FUNCTION__, key); */
-
ModestAccountMgr *self = MODEST_ACCOUNT_MGR (user_data);
ModestAccountMgrPrivate *priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self);
/* Store the key for later notification in our timeout callback.
* Notifying for every key change would cause unnecessary work: */
- priv->changed_conf_keys = g_slist_append (NULL,
+ priv->changed_conf_keys = g_slist_append (priv->changed_conf_keys,
(gpointer) g_strdup (key));
}
}
-
-
gboolean
modest_account_mgr_add_server_account (ModestAccountMgr * self,
const gchar * name, const gchar *hostname,
if (default_account_name && (strcmp (default_account_name, name) == 0))
modest_account_mgr_unset_default_account (self);
g_free (default_account_name);
+
+ /* pick another one as the new default account */
+ modest_account_mgr_set_first_account_as_default (self);
}
-
return retval;
}
g_return_val_if_fail (name, FALSE);
keyname = _modest_account_mgr_get_account_keyname (name, NULL, server_account);
-
priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self);
retval = modest_conf_key_exists (priv->modest_conf, keyname, &err);
if (err) {
return retval;
}
-gboolean modest_account_mgr_account_with_display_name_exists (ModestAccountMgr *self,
- const gchar *display_name)
+gboolean
+modest_account_mgr_account_with_display_name_exists (ModestAccountMgr *self, const gchar *display_name)
{
GSList *account_names = NULL;
GSList *cursor = NULL;
return retval;
}
+
+gboolean
+modest_account_mgr_has_accounts (ModestAccountMgr* self, gboolean enabled)
+{
+ /* Check that at least one account exists: */
+ GSList *account_names = modest_account_mgr_account_names (self,
+ enabled);
+ gboolean accounts_exist = account_names != NULL;
+ g_slist_free (account_names);
+
+ return accounts_exist;
+}