From 3217aa5bed08977aae64ad8f1db4298fc7cd8e88 Mon Sep 17 00:00:00 2001 From: Philip Van Hoof Date: Tue, 26 Jun 2007 16:41:14 +0000 Subject: [PATCH 1/1] Bugfix when creating an account pmo-trunk-r2438 --- src/modest-runtime.c | 3 ++- src/modest-tny-account.c | 18 ++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/modest-runtime.c b/src/modest-runtime.c index 9e843c0..f39b5c2 100644 --- a/src/modest-runtime.c +++ b/src/modest-runtime.c @@ -103,7 +103,8 @@ modest_runtime_get_email_clipboard (void) ModestTnyAccountStore* modest_runtime_get_account_store (void) { - g_return_val_if_fail (_singletons, NULL); + if (!_singletons) + return NULL; return modest_singletons_get_account_store (_singletons); } diff --git a/src/modest-tny-account.c b/src/modest-tny-account.c index 975caf3..640094b 100644 --- a/src/modest-tny-account.c +++ b/src/modest-tny-account.c @@ -421,27 +421,17 @@ modest_tny_account_new_from_account (ModestAccountMgr *account_mgr, const gchar modest_account_mgr_free_account_data (account_mgr, account_data); - - static gboolean first_time = TRUE; - - /* The first time we are creating the initial accounts. They will be set online by other - * code that comes later. After the first time, this only happens when a new account is - * created in the wizard. That account needs to be set online if the device is online. */ - - if (!first_time) - { - TnyAccountStore *astore = (TnyAccountStore *) modest_runtime_get_account_store (); - if (astore) { + TnyAccountStore *astore = (TnyAccountStore *) modest_runtime_get_account_store (); + if (astore) { TnyDevice *device = tny_account_store_get_device (astore); GError *err = NULL; + g_object_set_data (G_OBJECT(tny_account), "account_store", (gpointer)astore); tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (tny_account), tny_device_is_online (device), &err); if (err) g_print ("Error connecting: %s\n", err->message); g_object_unref (device); - } - } - first_time = FALSE; + } return tny_account; } -- 1.7.9.5