#include <tny-camel-pop-store-account.h>
#include <tny-folder-stats.h>
#include <string.h>
-#ifdef MODEST_HILDON_VERSION_0
+#ifdef MODEST_HAVE_HILDON0_WIDGETS
#include <hildon-widgets/hildon-file-system-info.h>
#else
#include <hildon/hildon-file-system-info.h>
/* FIXME: for debugging.
* Let's keep this because it is very useful for debugging. */
url = tny_account_get_url_string (TNY_ACCOUNT(tny_account));
- printf ("DEBUG %s:\n account-url: %s\n", __FUNCTION__, url);
+
+ printf ("DEBUG %s:\n account-url: %s\n", __FUNCTION__, url);
+
g_free (url);
/***********************/
-
+
return tny_account;
}
TnyAccount *result = modest_tny_account_new_from_server_account (
account_mgr, account_data);
-
+
modest_account_mgr_free_server_account_data (account_mgr, account_data);
return result;
tny_account_set_pass_func (tny_account,
get_pass_func ? get_pass_func: get_pass_dummy);
- /* 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);
+ /* 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);
+ }
return tny_account;
}
folder = TNY_FOLDER (tny_iterator_get_current (iter));
stats = tny_folder_get_stats (folder);
- /* initially, we sometimes get -1 from tinymail; ignore that */
- if (helper->function && helper->function (stats) > 0)
- helper->sum += helper->function (stats);
+ if (stats) {
+ /* initially, we sometimes get -1 from tinymail; ignore that */
+ if (helper->function && helper->function (stats) > 0)
+ helper->sum += helper->function (stats);
- if (TNY_IS_FOLDER_STORE (folder)) {
- recurse_folders (TNY_FOLDER_STORE (folder), query, helper);
- }
-
+ if (TNY_IS_FOLDER_STORE (folder)) {
+ recurse_folders (TNY_FOLDER_STORE (folder), query, helper);
+ }
+ g_object_unref (stats);
+ }
g_object_unref (folder);
- g_object_unref (stats);
tny_iterator_next (iter);
}
g_object_unref (G_OBJECT (iter));
void modest_tny_account_set_parent_modest_account_name_for_server_account (TnyAccount *self, const gchar* parent_modest_acount_name)
{
g_object_set_data_full (G_OBJECT(self), "modest_account",
- (gpointer*) g_strdup (parent_modest_acount_name), g_free);
+ (gpointer) g_strdup (parent_modest_acount_name), g_free);
}