- modest_tny_account_set_parent_modest_account_name_for_server_account (tny_account, account_name);
-
- modest_account_mgr_free_account_data (account_mgr, account_data);
+ /* This name is what shows up in the folder view -- so for some POP/IMAP/... server
+ * account, we set its name to the account of which it is part. */
+
+ if (account_data->display_name)
+ tny_account_set_name (tny_account, account_data->display_name);
+
+ modest_tny_account_set_parent_modest_account_name_for_server_account (tny_account, account_name);
+
+ modest_account_mgr_free_account_data (account_mgr, account_data);
+
+ 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);
+ }