X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-account-mgr.c;h=c3e12dc296f5ecd5ea036cf6f2762be4e853f46e;hb=3918e2e76687b7390de87ff386f9bc310a7d297f;hp=2a8e77ccccb3e8fe1689daad14ff0f07b1be4032;hpb=627c4af6ac85444cc3256fa568baf4a8d62178ae;p=modest diff --git a/src/modest-account-mgr.c b/src/modest-account-mgr.c index 2a8e77c..c3e12dc 100644 --- a/src/modest-account-mgr.c +++ b/src/modest-account-mgr.c @@ -219,9 +219,8 @@ modest_account_mgr_finalize (GObject * obj) MODEST_ACCOUNT_MGR_GET_PRIVATE (obj); if (priv->notification_id_accounts) { - /* TODO: forget dirs */ - g_hash_table_destroy (priv->notification_id_accounts); + priv->notification_id_accounts = NULL; } if (priv->modest_conf) { @@ -243,6 +242,12 @@ modest_account_mgr_finalize (GObject * obj) priv->account_key_hash = NULL; } + if (priv->busy_accounts) { + g_slist_foreach (priv->busy_accounts, (GFunc) g_free, NULL); + g_slist_free (priv->busy_accounts); + priv->busy_accounts = NULL; + } + G_OBJECT_CLASS(parent_class)->finalize (obj); } @@ -763,9 +768,11 @@ modest_account_mgr_account_names (ModestAccountMgr * self, gboolean only_enabled /* Unescape the keys to get the account names: */ GSList *iter = accounts; while (iter) { - if (!(iter->data)) + if (!(iter->data)) { + iter = iter->next; continue; - + } + const gchar* account_name_key = (const gchar*)iter->data; gchar* unescaped_name = account_name_key ? modest_conf_key_unescape (account_name_key) @@ -951,7 +958,7 @@ modest_account_mgr_get_list (ModestAccountMgr *self, const gchar *name, g_printerr ("modest: error getting list '%s': %s\n", keyname, err->message); g_error_free (err); - retval = FALSE; + retval = NULL; } return retval; } @@ -1127,6 +1134,7 @@ modest_account_mgr_account_with_display_name_exists (ModestAccountMgr *self, ModestAccountSettings *settings = modest_account_mgr_load_account_settings (self, account_name); if (!settings) { g_printerr ("modest: failed to get account data for %s\n", account_name); + cursor = cursor->next; continue; } @@ -1205,6 +1213,7 @@ modest_account_mgr_check_already_configured_account (ModestAccountMgr *self, from_mgr_settings = modest_account_mgr_load_account_settings (self, account_name); if (!settings) { g_printerr ("modest: failed to get account data for %s\n", account_name); + cursor = cursor->next; continue; } @@ -1524,8 +1533,8 @@ modest_account_mgr_notify_account_update (ModestAccountMgr* self, proto_name = modest_account_mgr_get_string (self, server_account_name, MODEST_ACCOUNT_PROTO, TRUE); if (!proto_name) { - g_free (proto_name); g_return_if_reached (); + return; } proto = modest_protocol_get_type_id (modest_protocol_registry_get_protocol_by_name (protocol_registry, MODEST_PROTOCOL_REGISTRY_TRANSPORT_STORE_PROTOCOLS, @@ -1586,7 +1595,6 @@ modest_account_mgr_get_default_account (ModestAccountMgr *self) g_printerr ("modest: failed to get '%s': %s\n", MODEST_CONF_DEFAULT_ACCOUNT, err->message); g_error_free (err); - g_free (account); return NULL; } @@ -1646,3 +1654,28 @@ modest_account_mgr_set_display_name (ModestAccountMgr *self, if (notify) g_signal_emit (self, signals[DISPLAY_NAME_CHANGED_SIGNAL], 0, account_name); } + +gboolean +modest_account_mgr_singleton_protocol_exists (ModestAccountMgr *mgr, + ModestProtocolType protocol_type) +{ + GSList *account_names, *node; + gboolean found = FALSE; + + g_return_val_if_fail (MODEST_IS_ACCOUNT_MGR (mgr), FALSE); + account_names = modest_account_mgr_account_names (mgr, TRUE); + + for (node = account_names; node != NULL; node = g_slist_next (node)) { + ModestProtocolType current_protocol; + + current_protocol = modest_account_mgr_get_store_protocol (mgr, (gchar *) node->data); + if (current_protocol == protocol_type) { + found = TRUE; + break; + } + } + + modest_account_mgr_free_account_names (account_names); + + return found; +}