Connecting and account management



(Yes I know it's a lot text, it's pretty important I think)

Today we had a discussion on the #tinymail IRC channel about connecting
and account management. We concluded that we needed a rewrite and that
these are the requirements and the difficulties (a bit mixed together):

Please read these carefully, as they'll make it more easy for you to
understand the "full" scale of the problem domain.

  o. The TnyDevice can issue a connection_changed signal, which
     means that the accounts (all of them) must be set to offline or
     online depending on the status of the device's instance (not the
     actual device, but what the device's instance says. As it's up to
     the app developer to decide what really is and what really isn't
     "being online").

  o. Accounts can be set either online or offline

  o. Setting an account online can mean that in that thread, the
     alert_func, get_pass_func and forget_pass_func will happen. It
     would be a lot less difficult for the application developer to see
     those three functions happen in the GMainLoop in stead.

  o. Those are to be implemented by the app developer, which means that
     he can use ui code. This has a bunch of implications about
     threading that we really like to avoid as much as possible.

  o. Proposed is to bring those to the GMainLoop't thread (gtk_main()'s
     thread)

  o. While connection, accounts should not attempt to do operations.
     Such operations should either be queued in case of _async ones, in
     the TnyCamelQueue, or an error should be set

  o. The TnyCamelSendQueue and TnyCamelTransportAccount can make an
     early connection attempt for in case emails are in the outbox and
     the app developer decides to activate the sendqueue at
     initialisation of the application

  o. A connection on any account type can cause an SSL warning that MUST
     be answered by the user with yes or no. Right now this question
     happens in a thread.

  o. a connection on any account type can cause a password dialog that
     MUST be answered by the user. Right now this happens in a thread.

  o. The app developer must have the possibility to set a different
     username during the get_pass_func routine. This is an exception
     that must indeed be supported by Tinymail.

  o. It must be possible to add an account. While this account is being
     added, its initial connection status must be set to the device's
     current connection status. This means that if the device is online
     and an account is registered, that the account must go online


The attached patch attacks a few of these problems already. It also
deals with things that we'll need in future. For example letting the
connection itself happen on the individual queues of each store account
instance, in stead of in random threads.

It also makes connecting happen reliably yet in parallel with other
accounts. This improves the amount of time needed "to go online".

This means that we can't detect when ALL accounts are connected. We can
only detect when ONE account's connection state has changed.

This is why there are significant adaptations to the folder store tree
model too: the changes cope with connection state changes. The changes
assume that if a store account goes online, it's possible that new
folders will be available. Especially the first time the account is
used, will this pull-in not yet seen folders.

This means that it's not needed to have a accounts-reloaded handler
anymore. It is, however, now needed to add the created accounts manually
to the TnyGtkFolderStoreTreeModel instance, as soon as you created it.

There's also no connecting-finished signal anymore. That's quite simply
because there's no more way to know when ALL accounts are done
connecting: their request to get connected is put on their queue, and
then it's not in the hands of the session anymore. 

The accounts will of course signal when their connection-status got
changed in the connection-status-changed signal. This is a very clean
and good way to know about connectivity changes. The TnyGtkFolderStore-
TreeModel uses the same signal, by the way, to know when exactly to
start pulling new folders locally.


This indeed implies, and you read that correctly, a significant change
in for example Modest. However, if we ever want to have control over
these account initialisation and connection problems, hangs and lockups,
we'll need to do things differently. Yes we do.

The account management of Modest has its problems too, so it's not a bad
idea to review all this.

I'm not yet committing this into Tinymail as I'd like to see a patch for
Modest that gets Modest working with this before I commit. I will take a
look tomorrow, and hope that others will do the same.

I have extensively documented the code. Please read the in-code inline
comments. I will most likely make an overview on a wiki page on the
Tinymail trac too. It should be really clear and easy what will happen
now, as there's really .. really .. REALLY a lot inline comments and
documentation explaining line by line what is happening.

I'm planning and expecting to commit this next week on Monday. I hope
that some Modest people can start taking a look more early.


Note that the reason and idea is to improve stability, indeed. Although
it's a big change, I think bigger changes are needed in both Modest and
Tinymail to indeed improve the stability situation. That is precisely
what this major change is all about, yes.



* Hoping that a lot people will review this larger patch *



-- 
Philip Van Hoof, software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
http://www.pvanhoof.be/blog



Index: libtinymail-camel/tny-camel-send-queue.c
===================================================================
--- libtinymail-camel/tny-camel-send-queue.c	(revision 2503)
+++ libtinymail-camel/tny-camel-send-queue.c	(working copy)
@@ -162,7 +162,7 @@
 {
 	TnySendQueue *self = (TnySendQueue *) data;
 	TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (self);
-	TnyCamelAccountPriv *apriv = NULL;
+	/* TnyCamelAccountPriv *apriv = NULL; */
 	TnyFolder *sentbox, *outbox;
 	guint i = 0, length = 0;
 	TnyList *list;
@@ -172,9 +172,9 @@
 	priv->is_running = TRUE;
 	priv->creating_spin = FALSE;
 
-	apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (priv->trans_account);
+/*	apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (priv->trans_account);
 	if (apriv)
-		tny_session_camel_join_connecting (apriv->session);
+		tny_session_camel_join_connecting (apriv->session); */
 
 	list = tny_simple_list_new ();
 
@@ -385,9 +385,8 @@
 tny_camel_send_queue_join_worker (TnyCamelSendQueue *self)
 {
 	TnyCamelSendQueuePriv *priv = TNY_CAMEL_SEND_QUEUE_GET_PRIVATE (self);
-	TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (priv->trans_account);
 
-	if (!apriv->session->priv->conthread && priv->thread)
+	if (priv->thread)
 		g_thread_join (priv->thread);
 }
 
Index: libtinymail-camel/tny-camel-store-account-priv.h
===================================================================
--- libtinymail-camel/tny-camel-store-account-priv.h	(revision 2503)
+++ libtinymail-camel/tny-camel-store-account-priv.h	(working copy)
@@ -20,8 +20,11 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include <tny-session-camel.h>
 #include <tny-camel-store-account.h>
+
 #include "tny-camel-queue-priv.h"
+#include "tny-session-camel-priv.h"
 
 typedef struct _TnyCamelStoreAccountPriv TnyCamelStoreAccountPriv;
 
@@ -40,5 +43,6 @@
 	(G_TYPE_INSTANCE_GET_PRIVATE ((o), TNY_TYPE_CAMEL_STORE_ACCOUNT, TnyCamelStoreAccountPriv))
 
 void _tny_camel_store_account_emit_conchg_signal (TnyCamelStoreAccount *self);
+void _tny_camel_store_account_queue_going_online (TnyCamelStoreAccount *self, TnySessionCamel *session, gboolean online, go_online_error_func err_func);
 
 #endif
Index: libtinymail-camel/tny-session-camel-priv.h
===================================================================
--- libtinymail-camel/tny-session-camel-priv.h	(revision 2503)
+++ libtinymail-camel/tny-session-camel-priv.h	(working copy)
@@ -9,21 +9,25 @@
 	gpointer account_store;
 	gboolean interactive, prev_constat;
 	guint connchanged_signal;
-	GList *current_accounts;
+
+	GHashTable *current_accounts;
+	GStaticRecMutex *current_accounts_lock;
+
 	gchar *camel_dir;
 	gboolean in_auth_function, is_connecting;
-	gboolean async_connect;
 	TnyLockable *ui_lock;
-	GMutex *conlock, *queue_lock;
-	GThread *conthread;
+	GMutex *queue_lock;
+
 	gboolean stop_now, initialized;
-	gboolean is_inuse, background_thread_running;
+	gboolean is_inuse;
 	GList *regged_queues;
 };
 
-void _tny_session_camel_add_account_1 (TnySessionCamel *self, TnyCamelAccount *account);
-void _tny_session_camel_add_account_2 (TnySessionCamel *self, TnyCamelAccount *account);
-void _tny_session_camel_forget_account (TnySessionCamel *self, TnyCamelAccount *account);
+typedef void (*go_online_error_func) (TnySessionCamel *self, TnyCamelAccount *account, GError *err);
+void _tny_session_camel_register_account (TnySessionCamel *self, TnyCamelAccount *account);
+void _tny_session_camel_activate_account (TnySessionCamel *self, TnyCamelAccount *account);
+void _tny_session_camel_unregister_account (TnySessionCamel *self, TnyCamelAccount *account);
+
 void _tny_session_camel_reg_queue (TnySessionCamel *self, TnyCamelSendQueue *queue);
 void _tny_session_camel_unreg_queue (TnySessionCamel *self, TnyCamelSendQueue *queue);
 
Index: libtinymail-camel/tny-session-camel.c
===================================================================
--- libtinymail-camel/tny-session-camel.c	(revision 2503)
+++ libtinymail-camel/tny-session-camel.c	(working copy)
@@ -359,20 +359,6 @@
 	return;
 }
 
-/**
- * tny_session_camel_set_async_connecting:
- * @self: a #TnySessionCamel object
- * @enable: Whether or not to asynchronously connect
- *
- * Set connection strategy
- **/
-void 
-tny_session_camel_set_async_connecting (TnySessionCamel *self, gboolean enable)
-{
-	g_mutex_lock (self->priv->conlock);
-	self->priv->async_connect = enable;
-	g_mutex_unlock (self->priv->conlock);
-}
 
 
 static void
@@ -385,12 +371,18 @@
 	priv->initialized = FALSE;
 	priv->stop_now = FALSE;
 	priv->regged_queues = NULL;
-	priv->background_thread_running = FALSE;
 	priv->is_inuse = FALSE;
-	priv->conlock = g_mutex_new ();
 	priv->queue_lock = g_mutex_new ();
-	priv->conthread = NULL;
-	priv->current_accounts = NULL;
+
+	/* I know it would be better to have a hashtable that does reference
+	 * counting. But then you'll get embraced references, which gobject
+	 * can't really handle (unless doing it with a weak reference) */
+
+	priv->current_accounts = g_hash_table_new_full (g_str_hash, g_direct_equal, 
+					g_free, NULL);
+
+	priv->current_accounts_lock = g_new0 (GStaticRecMutex, 1);
+	g_static_rec_mutex_init (priv->current_accounts_lock);
 	priv->prev_constat = FALSE;
 	priv->device = NULL;
 	priv->camel_dir = NULL;
@@ -398,198 +390,101 @@
 	priv->camel_dir = NULL;
 	priv->in_auth_function = FALSE;
 	priv->is_connecting = FALSE;
-	priv->async_connect = TRUE;
 
 	return;
 }
 
-typedef struct
-{
-	TnyDevice *device;
-	gboolean online, as_thread;
-	gpointer user_data;
-	TnySessionCamelPriv *priv;
-} BackgroundConnectInfo;
 
-static gboolean
-background_connect_idle (gpointer data)
+/* Happens at tny_camel_account_set_session */
+void 
+_tny_session_camel_register_account (TnySessionCamel *self, TnyCamelAccount *account)
 {
-	BackgroundConnectInfo *info = data;
-	TnySessionCamel *self = info->user_data;
+	TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (account);
 	TnySessionCamelPriv *priv = self->priv;
 
-	if (priv->account_store)
-	{
-		g_signal_emit (priv->account_store, 
-			tny_account_store_signals [TNY_ACCOUNT_STORE_ACCOUNTS_RELOADED], 0);
-		g_signal_emit (priv->account_store,
-			tny_account_store_signals [TNY_ACCOUNT_STORE_CONNECTING_FINISHED], 0);
-	}
+	if (apriv->cache_location)
+		g_free (apriv->cache_location);
+	apriv->cache_location = g_strdup (priv->camel_dir);
 
-	return FALSE;
+	return;
+
 }
 
-
-
 static void
-background_connect_destroy (gpointer data)
+on_account_connect_failed (TnySessionCamel *self, TnyCamelAccount *account, GError *err)
 {
-	BackgroundConnectInfo *info = data;
+	tny_lockable_lock (self->priv->ui_lock);
+	tny_session_camel_do_an_error (self, TNY_ACCOUNT (account), TNY_ALERT_TYPE_ERROR, FALSE, err);
+	tny_lockable_unlock (self->priv->ui_lock);
 
-	g_object_unref (G_OBJECT (info->device));
-	g_slice_free (BackgroundConnectInfo, data);
-
 	return;
 }
 
 
-
-static void
-foreach_account_set_connectivity (gpointer data, gpointer udata)
+static void 
+tny_session_queue_going_online_for_account (TnySessionCamel *self, TnyCamelAccount *account, gboolean online)
 {
-	BackgroundConnectInfo *info = udata;
-	TnySessionCamel *self = info->user_data;
-	
-	if (data && TNY_IS_CAMEL_ACCOUNT (data))
-	{
-		TnyCamelAccount *account = TNY_CAMEL_ACCOUNT (data);
-		
-		GError *err = NULL;
-		TnyCamelAccountPriv *apriv = NULL;
 
-		/* We don't go online on transport accounts, yet */
-		if (TNY_IS_CAMEL_TRANSPORT_ACCOUNT (account))
-		{
-			g_signal_emit (account, 
-				tny_camel_account_signals [TNY_CAMEL_ACCOUNT_SET_ONLINE_HAPPENED], 0, info->online);
-			return;
-		}
+	/* So this is that wrapper that I talked about (see below). In case we 
+	 * are a store account, this means that we need to throw the request to
+	 * go online to the account's queue. This is implemented in a protected
+	 * method in TnyCamelStoreAccount. Go take a look! */
 
-		apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (account);
+	if (TNY_IS_CAMEL_STORE_ACCOUNT (account)) 
+	{
+		TnySessionCamelPriv *priv = self->priv;
 
-		apriv->is_connecting = TRUE;
+		_tny_camel_store_account_queue_going_online (
+			TNY_CAMEL_STORE_ACCOUNT (account), self, online, 
+			on_account_connect_failed);
+	}
 
-		_tny_camel_account_try_connect (account, FALSE /* info->online */, &err);
+	/* Else, if it's a transport account, we don't have any transport 
+	 * account implementations that actually need to go online at this 
+	 * moment yet. At the moment of transferring the first message, the
+	 * current implementations will automatically connect themselves. */
 
-		if (err == NULL)
-			_tny_camel_account_set_online (account, info->online, &err);
-
-		if (err != NULL) 
-		{
-			if (self->priv->account_store)
-			{
-				if (info->as_thread)
-					tny_lockable_lock (self->priv->ui_lock);
-
-				tny_session_camel_do_an_error (self, TNY_ACCOUNT (account), TNY_ALERT_TYPE_ERROR, FALSE, err);
-
-				if (info->as_thread)
-					tny_lockable_unlock (self->priv->ui_lock);
-			}
-			g_error_free (err);
-		}
-
-		apriv->is_connecting = FALSE;
-
+	if (TNY_IS_CAMEL_TRANSPORT_ACCOUNT (account))
+	{
+		g_signal_emit (account, 
+			tny_camel_account_signals [TNY_CAMEL_ACCOUNT_SET_ONLINE_HAPPENED], 0, online);
+		return;
 	}
 }
 
-typedef struct {
-	BackgroundConnectInfo *info;
-	TnyCamelAccount *account;
-} AccGoOnlineInfo;
+/* This happens when the password function of the account is set. It will after 
+ * registering the account for future connection-changes, already set the online
+ * state of it to the current connectivity setting of the device */
 
-static gpointer
-account_go_online (gpointer data)
+void
+_tny_session_camel_activate_account (TnySessionCamel *self, TnyCamelAccount *account)
 {
-	AccGoOnlineInfo *ainfo = (AccGoOnlineInfo *) data;
-	TnySessionCamel *self = ainfo->info->user_data;
 	TnySessionCamelPriv *priv = self->priv;
 
-	priv->is_connecting = TRUE;
+	g_static_rec_mutex_lock (priv->current_accounts_lock);
 
-	foreach_account_set_connectivity (ainfo->account, ainfo->info);
+	/* It would indeed be better to add a reference here. But then you'll
+	 * get embraced references at some point. We'll get rid of the instance
+	 * in the hashtable before the finalization of it, take a look at the
+	 * unregister stuff below. */
 
-	priv->is_connecting = FALSE;
+	g_hash_table_insert (priv->current_accounts, 
+			g_strdup (tny_account_get_id (TNY_ACCOUNT (account))),
+			account);
+	g_static_rec_mutex_unlock (priv->current_accounts_lock);
 
-	camel_object_unref (ainfo->info->user_data);
-	g_object_unref (ainfo->account);
+	tny_session_queue_going_online_for_account (self, account, 
+		tny_device_is_online (priv->device));
 
-	g_idle_add_full (G_PRIORITY_HIGH, 
-		background_connect_idle, 
-		ainfo->info, background_connect_destroy);
-
-	g_slice_free (AccGoOnlineInfo, ainfo);
-	/* ainfo->info is freed in the background_connect_destroy */
-
-	priv->conthread = NULL;
-
-	g_thread_exit (NULL);
-	return NULL;
+	return;
 }
 
 
-void 
-_tny_session_camel_add_account_1 (TnySessionCamel *self, TnyCamelAccount *account)
-{
-	TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (account);
-	TnySessionCamelPriv *priv = self->priv;
+/* This happens when an account gets finalized. We more or less simply get rid
+ * of the instance in the hashtable. */
 
-	if (apriv->cache_location)
-		g_free (apriv->cache_location);
-	apriv->cache_location = g_strdup (priv->camel_dir);
-	priv->current_accounts = g_list_prepend (priv->current_accounts, account);
-}
-
-void
-_tny_session_camel_add_account_2 (TnySessionCamel *self, TnyCamelAccount *account)
-{
-	TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (account);
-	TnySessionCamelPriv *priv = self->priv;
-	gboolean doit = FALSE;
-
-	if (priv->initialized)
-	{
-		g_mutex_lock (priv->conlock);
-		doit = (priv->conthread == NULL);
-		g_mutex_unlock (priv->conlock);
-	}
-
-	if (priv->initialized && !priv->background_thread_running && doit)
-	{
-		if (priv->device && TNY_IS_DEVICE (priv->device))
-		{
-			AccGoOnlineInfo *ainfo = g_slice_new (AccGoOnlineInfo);
-			ainfo->info = g_slice_new (BackgroundConnectInfo);
-
-			ainfo->info->online = tny_device_is_online (priv->device);
-			ainfo->info->as_thread = TRUE;
-			ainfo->info->priv = priv;
-
-			ainfo->info->device = g_object_ref (priv->device);
-			camel_object_ref (self);
-			ainfo->info->user_data = self;
-			ainfo->account = TNY_CAMEL_ACCOUNT (g_object_ref (account));
-
-			camel_session_set_online ((CamelSession *) self, TRUE); 
-
-			if (priv->account_store)
-			{
-				g_signal_emit (priv->account_store,
-					tny_account_store_signals [TNY_ACCOUNT_STORE_CONNECTING_STARTED], 0);
-			}
-
-			g_mutex_lock (priv->conlock);
-			if (priv->conthread)
-				g_thread_join (priv->conthread);
-			priv->conthread = g_thread_create (account_go_online, ainfo, TRUE, NULL);
-			g_mutex_unlock (priv->conlock);
-		}
-	}
-}
-
 void 
-_tny_session_camel_forget_account (TnySessionCamel *self, TnyCamelAccount *account)
+_tny_session_camel_unregister_account (TnySessionCamel *self, TnyCamelAccount *account)
 {
 	TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (account);
 	TnySessionCamelPriv *priv = self->priv;
@@ -598,147 +493,100 @@
 		g_free (apriv->cache_location);
 	apriv->cache_location = NULL;
 
-	priv->current_accounts = g_list_remove (priv->current_accounts, account);
+	g_static_rec_mutex_lock (priv->current_accounts_lock);
+	g_hash_table_remove (priv->current_accounts, 
+		tny_account_get_id (TNY_ACCOUNT (account)));
+	g_static_rec_mutex_unlock (priv->current_accounts_lock);
 
 	return;
 }
 
+typedef struct {
+	TnySessionCamel *self;
+	gboolean online;
+} ConChangedForEachInfo;
 
-
-
-static gpointer 
-background_connect_thread (gpointer data)
+static void 
+tny_session_camel_connection_changed_for_each (gpointer key, gpointer value, gpointer user_data)
 {
-	BackgroundConnectInfo *info = data;
-	TnySessionCamel *self = info->user_data;
-	TnySessionCamelPriv *priv = self->priv;
+	ConChangedForEachInfo *info = (ConChangedForEachInfo *) user_data;
 
-	if (priv->background_thread_running) {
-		g_thread_exit (NULL);
-		return NULL;
-	}
+	/* For each registered account, we'll set its online state. Throwing it
+	 * in its queue is implemented in the TnyCamelStoreAccount btw. For now,
+	 * because it's shared with the account registration, this is a wrapper */
 
-	priv->background_thread_running = TRUE;
+	tny_session_queue_going_online_for_account (info->self, 
+		TNY_CAMEL_ACCOUNT (value), info->online);
 
-	if (priv->stop_now) 
-		goto stop_now;
-
-	priv->is_connecting = TRUE;
-
-	if (priv->current_accounts && priv->prev_constat != info->online && priv->account_store) 
-	{
-		GList *copy = priv->current_accounts;
-		while (copy)
-		{
-			if (priv->stop_now) 
-				goto stop_now;
-			foreach_account_set_connectivity (copy->data, info);
-			if (priv->stop_now) 
-				goto stop_now;
-			copy = g_list_next (copy);
-		}
-	}
-
-stop_now:
-
-	priv->is_connecting = FALSE;
-
-	g_idle_add_full (G_PRIORITY_HIGH, 
-		background_connect_idle, 
-		info, background_connect_destroy);
-
-	priv->prev_constat = info->online;
-
-	priv->conthread = NULL;
-	priv->background_thread_running = FALSE;
-
-	priv->stop_now = FALSE;
-
-	g_thread_exit (NULL);
-	return NULL;
+	return;
 }
 
-static gboolean
-do_background_connect_thread (gpointer data)
-{
-	BackgroundConnectInfo *info = data;
-	TnySessionCamel *self = info->user_data;
-	TnySessionCamelPriv *priv = self->priv;
+/* In case our TnyDevice's connection_changed event happened. We'll set all
+ * registered accounts to the proper online state here. Because these accounts
+ * all register their connecting on their own queue, it's not detectable when
+ * connecting got finished. They also all start doing their connecting stuff
+ * in parallel. Quite difficult to know when all are finished with that. 
+ *
+ * In stead we provide components, like the TnyGtkFolderStoreTreeModel, that can
+ * cope with connection changes. For example: they'll load-in new folders as 
+ * soon as it's known that the account went online. No more accounts-reloaded
+ * things as it's far more fine grained this way ... */
 
-	/* g_mutex_lock (info->priv->conlock); */
-	info->priv->conthread = g_thread_create (background_connect_thread, data, TRUE, NULL);
-	/* g_mutex_unlock (info->priv->conlock); */
-
-	return FALSE;
-}
-
 static void
 tny_session_camel_connection_changed (TnyDevice *device, gboolean online, gpointer user_data)
 {
 	TnySessionCamel *self = user_data;
 	TnySessionCamelPriv *priv = self->priv;
-	BackgroundConnectInfo *info;
-	gboolean inf;
+	ConChangedForEachInfo *info = NULL;
 
-	inf = priv->in_auth_function;
-	if (inf) return;
 
-	info = g_slice_new (BackgroundConnectInfo);
+	/* Maybe we can remove this check after Rob is finished with throwing  
+	 * the questions in the GMainLoop. I'm leaving it here for now ... */
 
-	info->device = g_object_ref (G_OBJECT (device));
+	if (priv->in_auth_function)
+		return;
+
+	info = g_slice_new (ConChangedForEachInfo);
+
 	info->online = online;
-	info->user_data = user_data;
-	info->priv = priv;
+	info->self = self;
 
+
+	/* This Camel API exists, I haven't yet figured out what exactly it does
+	 * or change in terms of behaviour. */
+
 	camel_session_set_online ((CamelSession *) self, online); 
 
+
+	/* As said, we can issue this signal. We can't issue when connecting 
+	 * actually finished: that's because all accounts register getting 
+	 * connected on their own queues. So it'll all happen in parallel and
+	 * a little bit less in control as when we would dedicate a thread to it,
+	 * and in a serialized way get all accounts connected (the old way) */
+
 	if (priv->account_store)
-	{
 		g_signal_emit (priv->account_store,
 			tny_account_store_signals [TNY_ACCOUNT_STORE_CONNECTING_STARTED], 0);
-	}
 
+	g_static_rec_mutex_lock (priv->current_accounts_lock);
+	/* So let's look above, at that for_each function ... */
+	g_hash_table_foreach (priv->current_accounts, 
+		tny_session_camel_connection_changed_for_each, info);
+	g_static_rec_mutex_unlock (priv->current_accounts_lock);
 
-	if (priv->async_connect) 
-	{
-		gboolean doit = FALSE;
+	g_slice_free (ConChangedForEachInfo, info);
 
-		info->as_thread = TRUE;
-
-		if (!priv->conthread)
-			do_background_connect_thread (info);
-
-	} else {
-		info->as_thread = FALSE;
-		background_connect_thread (info);
-	}
-
 	return;
 }
 
-/**
- * tny_session_camel_join_connecting
- * @self: a #TnySessionCamel object
- * 
- * Join the connection thread
- **/ 
-void 
-tny_session_camel_join_connecting (TnySessionCamel *self)
-{
-	TnySessionCamelPriv *priv = self->priv;
 
-	g_mutex_lock (priv->conlock);
-	if (priv->conthread)
-		g_thread_join (priv->conthread);
-	g_mutex_unlock (priv->conlock);
-}
-
 /**
  * tny_session_camel_set_initialized:
  * @self: the #TnySessionCamel instance
  *
- * This method must be called one the initial accounts are created in your
- * #TnyAccountStore implementation.
+ * This method must be called once the initial accounts are created in your
+ * #TnyAccountStore implementation and should indicate that the initialization
+ * of your initial accounts is completed.
  **/
 void 
 tny_session_camel_set_initialized (TnySessionCamel *self)
@@ -788,6 +636,7 @@
 			priv->connchanged_signal);
 	}
 
+	/* TNY TODO: proper reference counting here please */
 	priv->device = device;
 
 	return;
@@ -882,6 +731,10 @@
 	TnySessionCamel *self = (TnySessionCamel*)object;
 	TnySessionCamelPriv *priv = self->priv;
 
+	g_static_rec_mutex_lock (priv->current_accounts_lock);
+	g_hash_table_destroy (priv->current_accounts);
+	g_static_rec_mutex_unlock (priv->current_accounts_lock);
+
 	g_mutex_lock (priv->queue_lock);
 	g_list_free (priv->regged_queues);
 	priv->regged_queues = NULL;
@@ -899,8 +752,8 @@
 	if (priv->camel_dir)
 		g_free (priv->camel_dir);
 
-	g_mutex_free (priv->conlock);
 	g_mutex_free (priv->queue_lock);
+	g_static_rec_mutex_free (priv->current_accounts_lock);
 
 	g_slice_free (TnySessionCamelPriv, self->priv);
 
Index: libtinymail-camel/tny-camel-store-account.c
===================================================================
--- libtinymail-camel/tny-camel-store-account.c	(revision 2503)
+++ libtinymail-camel/tny-camel-store-account.c	(working copy)
@@ -83,10 +83,10 @@
 	{
 		TnyFolderStoreObserver *observer = TNY_FOLDER_STORE_OBSERVER (tny_iterator_get_current (iter));
 		tny_folder_store_observer_update (observer, change);
-		g_object_unref (G_OBJECT (observer));
+		g_object_unref (observer);
 		tny_iterator_next (iter);
 	}
-	g_object_unref (G_OBJECT (iter));
+	g_object_unref (iter);
 }
 
 static gboolean
@@ -97,7 +97,7 @@
 
 	g_signal_emit (G_OBJECT (self), 
 		tny_account_signals [TNY_ACCOUNT_CONNECTION_STATUS_CHANGED], 
-		0, apriv->status);
+			0, apriv->status);
 
 	return FALSE;
 }
@@ -1524,6 +1524,102 @@
 	return retval;
 }
 
+
+
+typedef struct {
+	TnySessionCamel *session;
+	TnyCamelStoreAccount *self;
+	gboolean online;
+	go_online_error_func err_func;
+} GoingOnlineInfo;
+
+static gpointer 
+tny_camel_store_account_queue_going_online_thread (gpointer thr_user_data)
+{
+	GoingOnlineInfo *info = (GoingOnlineInfo*) thr_user_data;
+	TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (info->self);
+	GError *err = NULL;
+
+	/* So this happens in the queue thread. There's only one such thread
+	 * for each TnyCamelStoreAccount active at any given moment in time. 
+	 * This means that operations on the queue, while this is happening,
+	 * must wait. */
+
+	/* The info->err_func points to on_account_connect_failed in the 
+	 * TnySessionCamel implementation. Go take a look! */
+
+	apriv->is_connecting = TRUE;
+
+	/* This is one of those functions that our hero, Rob, is going to 
+	 * refactor/rename to something that does make sense :-). Isn't that
+	 * true Rob? */
+
+	_tny_camel_account_try_connect (TNY_CAMEL_ACCOUNT (info->self), 
+			FALSE, &err);
+
+	if (err) {
+		info->err_func (info->session, TNY_CAMEL_ACCOUNT (info->self), err);
+		g_error_free (err);
+	} else {
+
+		/* This one actually sets the account to online. Although Rob 
+		 * is probably going to improve all this. Right *poke*? */
+
+		_tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (info->self), 
+			info->online, &err);
+
+		if (err) {
+			info->err_func (info->session, 
+				TNY_CAMEL_ACCOUNT (info->self), err);
+			g_error_free (err);
+		}
+	}
+
+	apriv->is_connecting = FALSE;
+
+	/* Thread reference */
+	camel_object_unref (info->session);
+	g_object_unref (info->self);
+
+	return NULL;
+}
+
+/* This is that protected implementation that will request to go online, on the
+ * queue of this account @self. Each TnyCamelStoreAccount has two queues: One 
+ * queue is dedicated to getting messages. The other, the default queue, is
+ * dedicated to any other operation. Including getting itself connected with an 
+ * actual server (that can be both a POP or an IMAP server, depending on the 
+ * url-string and/or proto setting of @self). */
+
+void
+_tny_camel_store_account_queue_going_online (TnyCamelStoreAccount *self, TnySessionCamel *session, gboolean online, go_online_error_func err_func)
+{
+	GoingOnlineInfo *info = NULL;
+	GError *err = NULL;
+	TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self);
+	TnyCamelStoreAccountPriv *priv = TNY_CAMEL_STORE_ACCOUNT_GET_PRIVATE (self);
+
+	/* Idle info for the callbacks */
+	info = g_slice_new0 (GoingOnlineInfo);
+
+	info->session = session;
+	info->self = self;
+	info->err_func = err_func;
+	info->online = online;
+
+	/* thread reference */
+	g_object_ref (info->self);
+	camel_object_ref (info->session);
+
+
+	/* It's indeed a very typical queue operation */
+
+	_tny_camel_queue_launch (priv->queue, 
+		tny_camel_store_account_queue_going_online_thread, info);
+
+	return;
+}
+
 static void
 tny_folder_store_init (gpointer g, gpointer iface_data)
 {
Index: libtinymail-camel/tny-session-camel.h
===================================================================
--- libtinymail-camel/tny-session-camel.h	(revision 2503)
+++ libtinymail-camel/tny-session-camel.h	(working copy)
@@ -51,8 +51,6 @@
 void tny_session_camel_set_account_store (TnySessionCamel *self, TnyAccountStore *account_store);
 void tny_session_camel_set_device (TnySessionCamel *self, TnyDevice *device);
 void tny_session_camel_set_ui_locker (TnySessionCamel *self, TnyLockable *ui_lock);
-void tny_session_camel_join_connecting (TnySessionCamel *self);
-void tny_session_camel_set_async_connecting (TnySessionCamel *self, gboolean enable);
 
 void tny_session_camel_set_initialized (TnySessionCamel *self);
 
Index: libtinymail-camel/tny-camel-account.c
===================================================================
--- libtinymail-camel/tny-camel-account.c	(revision 2503)
+++ libtinymail-camel/tny-camel-account.c	(working copy)
@@ -696,7 +696,7 @@
 	camel_object_ref (session);
 	priv->session = session;
 
-	_tny_session_camel_add_account_1 (session, self);
+	_tny_session_camel_register_account (session, self);
 
 	TNY_CAMEL_ACCOUNT_GET_CLASS (self)->prepare_func (self, FALSE, FALSE);
 
@@ -886,7 +886,7 @@
 		reconf_if, TRUE);
 
 	if (priv->session)
-		_tny_session_camel_add_account_2 (priv->session, TNY_CAMEL_ACCOUNT (self));
+		_tny_session_camel_activate_account (priv->session, TNY_CAMEL_ACCOUNT (self));
 
 	g_static_rec_mutex_unlock (priv->service_lock);
 
@@ -1387,7 +1387,7 @@
 	}
 
 	if (priv->session) {
-		_tny_session_camel_forget_account (priv->session, (TnyCamelAccount*) object);    
+		_tny_session_camel_unregister_account (priv->session, (TnyCamelAccount*) object);    
 		camel_object_unref (priv->session);
 	}
 	_tny_camel_account_start_camel_operation (self, NULL, NULL, NULL);
Index: libtinymailui-gtk/tny-gtk-folder-store-tree-model.h
===================================================================
--- libtinymailui-gtk/tny-gtk-folder-store-tree-model.h	(revision 2503)
+++ libtinymailui-gtk/tny-gtk-folder-store-tree-model.h	(working copy)
@@ -59,7 +59,6 @@
 	GtkTreeStore parent;
 	GList *first;
 	GMutex *iterator_lock;
-	gboolean is_async;
 	TnyFolderStoreQuery *query;
 	GList *store_observables, *folder_observables;
 };
@@ -71,7 +70,7 @@
 
 GType tny_gtk_folder_store_tree_model_get_type (void);
 GType tny_gtk_folder_store_tree_model_column_get_type (void);
-GtkTreeModel* tny_gtk_folder_store_tree_model_new (gboolean async, TnyFolderStoreQuery *query);
+GtkTreeModel* tny_gtk_folder_store_tree_model_new (TnyFolderStoreQuery *query);
 
 void tny_gtk_folder_store_tree_model_prepend (TnyGtkFolderStoreTreeModel *self, TnyFolderStore* item, const gchar *root_name);
 void tny_gtk_folder_store_tree_model_append (TnyGtkFolderStoreTreeModel *self, TnyFolderStore* item, const gchar *root_name);
Index: libtinymailui-gtk/tny-gtk-folder-store-tree-model.c
===================================================================
--- libtinymailui-gtk/tny-gtk-folder-store-tree-model.c	(revision 2503)
+++ libtinymailui-gtk/tny-gtk-folder-store-tree-model.c	(working copy)
@@ -29,6 +29,7 @@
 #include <tny-folder-store.h>
 #include <tny-simple-list.h>
 
+#include <tny-store-account.h>
 #include <tny-folder-store-change.h>
 #include <tny-folder-store-observer.h>
 #include <tny-folder-change.h>
@@ -39,86 +40,10 @@
 #include "tny-gtk-folder-store-tree-model-iterator-priv.h"
 
 static GObjectClass *parent_class = NULL;
-static void recurse_folders_async (TnyGtkFolderStoreTreeModel *self, TnyFolderStore *store, GtkTreeIter *parent_tree_iter);
 
 typedef void (*treeaddfunc) (GtkTreeStore *tree_store, GtkTreeIter *iter, GtkTreeIter *parent);
 
-
-typedef struct {
-	GtkTreeIter *parent_tree_iter;
-	TnyGtkFolderStoreTreeModel *self;
-} AsyncHelpr;
-
 static void
-recurse_get_folders_callback (TnyFolderStore *self, TnyList *folders, GError **err, gpointer user_data)
-{
-	AsyncHelpr *hlrp = user_data;
-	TnyIterator *iter = tny_list_create_iterator (folders);
-	TnyGtkFolderStoreTreeModel *me = (TnyGtkFolderStoreTreeModel*) self;
-
-	while (!tny_iterator_is_done (iter))
-	{
-		GtkTreeStore *model = GTK_TREE_STORE (hlrp->self);
-		TnyFolderStore *folder = (TnyFolderStore*) tny_iterator_get_current (iter);
-		GtkTreeIter *tree_iter = gtk_tree_iter_copy (hlrp->parent_tree_iter);
-
-		tny_folder_add_observer (TNY_FOLDER (folder), TNY_FOLDER_OBSERVER (self));
-		tny_folder_store_add_observer (TNY_FOLDER_STORE (folder), TNY_FOLDER_STORE_OBSERVER (self));
-		me->folder_observables = g_list_prepend (me->folder_observables, folder);
-		me->store_observables = g_list_prepend (me->store_observables, folder);
-
-		gtk_tree_store_append (model, tree_iter, hlrp->parent_tree_iter);
-
-		/* This adds a reference count to folder too. When it gets removed, that
-		   reference count is decreased automatically by the gtktreestore infra-
-		   structure. */
-
-		gtk_tree_store_set (model, tree_iter,
-			TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN, 
-			tny_folder_get_name (TNY_FOLDER (folder)),
-			TNY_GTK_FOLDER_STORE_TREE_MODEL_UNREAD_COLUMN, 
-			tny_folder_get_unread_count (TNY_FOLDER (folder)),
-			TNY_GTK_FOLDER_STORE_TREE_MODEL_ALL_COLUMN, 
-			tny_folder_get_all_count (TNY_FOLDER (folder)),
-			TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN,
-			tny_folder_get_folder_type (TNY_FOLDER (folder)),
-			TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,
-			folder, -1);
-
-		/* TODO: This causes a memory peak at the application's startup.
-	 	*Also look at tny-camel-folder:c:2818... for more information */
-
-		tny_folder_poke_status (TNY_FOLDER (folder));
-
-		recurse_folders_async (hlrp->self, folder, tree_iter);
-
-		g_object_unref (G_OBJECT (folder));
-
-		tny_iterator_next (iter);
-	}
-
-	g_object_unref (G_OBJECT (iter));
-	g_object_unref (G_OBJECT (folders));
-
-	gtk_tree_iter_free (hlrp->parent_tree_iter);
-	g_slice_free (AsyncHelpr, hlrp);
-
-}
-
-
-static void
-recurse_folders_async (TnyGtkFolderStoreTreeModel *self, TnyFolderStore *store, GtkTreeIter *parent_tree_iter)
-{
-	AsyncHelpr *hlrp = g_slice_new0 (AsyncHelpr);
-	TnyList *folders = tny_simple_list_new ();
-
-	hlrp->self = self;
-	hlrp->parent_tree_iter = parent_tree_iter;
-
-	tny_folder_store_get_folders_async (store, folders, recurse_get_folders_callback, self->query, NULL, hlrp);
-}
-
-static void
 recurse_folders_sync (TnyGtkFolderStoreTreeModel *self, TnyFolderStore *store, GtkTreeIter *parent_tree_iter)
 {
 	TnyIterator *iter;
@@ -131,73 +56,118 @@
 
 	while (!tny_iterator_is_done (iter))
 	{
+		GtkTreeModel *mmodel = (GtkTreeModel *) self;
 		GtkTreeStore *model = GTK_TREE_STORE (self);
 		GObject *instance = G_OBJECT (tny_iterator_get_current (iter));
 		GtkTreeIter tree_iter;
-
-		gtk_tree_store_append (model, &tree_iter, parent_tree_iter);
-
 		TnyFolder *folder = NULL;
 		TnyFolderStore *folder_store = NULL;
-		
+		GtkTreeIter miter;
+		gboolean found = FALSE;
+
 		if (TNY_IS_FOLDER (instance))
 			folder = TNY_FOLDER (instance);
-		
+
 		if (TNY_IS_FOLDER_STORE (folder))
 			folder_store =  TNY_FOLDER_STORE (instance);
-			
-		if (folder)
-		{
-			tny_folder_add_observer (folder, TNY_FOLDER_OBSERVER (self));
-			me->folder_observables = g_list_prepend (me->folder_observables, folder);
-		}
 
-		if (folder_store)
-		{
-			tny_folder_store_add_observer (folder_store, TNY_FOLDER_STORE_OBSERVER (self));
-			me->store_observables = g_list_prepend (me->store_observables, folder);
-		}
+		/* We check whether we have this folder already in the tree, or 
+		 * whether it's a brand new one. If it's a new one, we'll add
+		 * it, of course */
 
+		if (gtk_tree_model_iter_children (mmodel, &miter, parent_tree_iter))
+		  do
+		  {
+			GObject *citem = NULL;
+			gtk_tree_model_get (mmodel, &miter, 
+				TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, 
+				&citem, -1);
+			if (citem == instance)
+			{
+				found = TRUE;
+				break;
+			}
+			if (citem)
+				g_object_unref (citem);
+		  } while (gtk_tree_model_iter_next (mmodel, &miter));
 
-		/* This adds a reference count to folder too. When it gets removed, that
-		   reference count is decreased automatically by the gtktreestore infra-
-		   structure. */
-		if (folder)
+		/* It was not found, so let's start adding it to the model! */
+
+		if (!found)
 		{
-			TnyFolder *folder = TNY_FOLDER (instance);
-			
-			gtk_tree_store_set (model, &tree_iter,
-				TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN, 
-				tny_folder_get_name (TNY_FOLDER (folder)),
-				TNY_GTK_FOLDER_STORE_TREE_MODEL_UNREAD_COLUMN, 
-				tny_folder_get_unread_count (TNY_FOLDER (folder)),
-				TNY_GTK_FOLDER_STORE_TREE_MODEL_ALL_COLUMN, 
-				tny_folder_get_all_count (TNY_FOLDER (folder)),
-				TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN,
-				tny_folder_get_folder_type (TNY_FOLDER (folder)),
-				TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,
-				folder, -1);
-		}
+			gtk_tree_store_append (model, &tree_iter, parent_tree_iter);
 
-		if (folder_store)
-			recurse_folders_sync (self, folder_store, &tree_iter);
+			/* Making self both a folder-store as a folder observer
+			 * of this folder. This way we'll get notified when 
+			 * both a removal and a creation happens. Also when a 
+			 * rename happens: that's a removal and a creation. */
 
+			if (folder)
+			{
+				tny_folder_add_observer (folder, TNY_FOLDER_OBSERVER (self));
+				me->folder_observables = g_list_prepend (me->folder_observables, folder);
+			}
 
-		/* TODO: This causes a memory peak at the application's startup.
-	 	*Also look at tny-camel-folder:c:2818... for more information */
+			if (folder_store)
+			{
+				tny_folder_store_add_observer (folder_store, TNY_FOLDER_STORE_OBSERVER (self));
+				me->store_observables = g_list_prepend (me->store_observables, folder);
+			}
 
-		if (folder)
-			tny_folder_poke_status (TNY_FOLDER (folder));
 
-		g_object_unref (G_OBJECT (instance));
+			/* This adds a reference count to folder too. When it gets removed, that
+			   reference count is decreased automatically by the gtktreestore infra-
+			   structure. */
 
+			if (folder)
+			{
+				TnyFolder *folder = TNY_FOLDER (instance);
+				
+				gtk_tree_store_set (model, &tree_iter,
+					TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN, 
+					tny_folder_get_name (TNY_FOLDER (folder)),
+					TNY_GTK_FOLDER_STORE_TREE_MODEL_UNREAD_COLUMN, 
+					tny_folder_get_unread_count (TNY_FOLDER (folder)),
+					TNY_GTK_FOLDER_STORE_TREE_MODEL_ALL_COLUMN, 
+					tny_folder_get_all_count (TNY_FOLDER (folder)),
+					TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN,
+					tny_folder_get_folder_type (TNY_FOLDER (folder)),
+					TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,
+					folder, -1);
+			}
+
+			/* it's a store by itself, so keep on recursing */
+			if (folder_store)
+				recurse_folders_sync (self, folder_store, &tree_iter);
+
+			/* We're a folder, we'll request a status, since we've
+			 * set self to be a folder observers of folder, we'll 
+			 * receive the status update. This makes it possible to
+			 * instantly get the unread and total counts, of course.
+			 * 
+			 * Note that the initial value is read from the cache in
+			 * case the account is set offline, in TnyCamelFolder. 
+			 * In case the account is online a STAT for POP or a 
+			 * STATUS for IMAP is asked during the poke-status impl.
+			 *
+			 * This means that no priv->folder must be loaded, no
+			 * memory peak will happen, few data must be transmitted
+			 * in case we're online. Which is perfect! */
+
+			if (folder)
+				tny_folder_poke_status (TNY_FOLDER (folder));
+		}
+
+		g_object_unref (instance);
+
 		tny_iterator_next (iter);
 	}
 
-	g_object_unref (G_OBJECT (iter));
-	g_object_unref (G_OBJECT (folders));
+	g_object_unref (iter);
+	g_object_unref (folders);
 }
 
+
 static const gchar*
 get_root_name (TnyFolderStore *folder_store)
 {
@@ -209,6 +179,57 @@
 	return root_name;
 }
 
+
+static void 
+tny_gtk_folder_store_tree_model_on_constatus_changed (TnyAccount *account, TnyConnectionStatus status, TnyGtkFolderStoreTreeModel *self)
+{
+	GtkTreeModel *model = GTK_TREE_MODEL (self);
+	GtkTreeIter iter;
+	GtkTreeIter name_iter;
+	gboolean found = FALSE;
+
+	/* This callback handler deals with connection status changes. In case
+	 * we got connected, we can expect that, at least sometimes, new folders
+	 * might have arrived. We'll need to scan for those, so we'll recursively
+	 * start asking the account about its folders. */
+
+	if (status != TNY_CONNECTION_STATUS_CONNECTED)
+		return;
+
+	/* Note that the very first time, this core will pull all folder info.
+	 * Note that when it runs, you'll see LIST commands happen on the IMAP
+	 * socket. Especially the first time. You'll also see STATUS commands 
+	 * happen. This is, indeed, normal behaviour when this component is used.*/
+
+	/* But first, let's find-back that damn account so that we have the
+	 * actual iter behind it in the model. */
+
+	if (gtk_tree_model_get_iter_first (model, &iter))
+	  do 
+	  {
+		GObject *citem;
+
+		gtk_tree_model_get (model, &iter, 
+			TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, 
+			&citem, -1);
+		if (citem == (GObject *) account)
+		{
+			name_iter = iter;
+			found = TRUE;
+			break;
+		}
+		g_object_unref (G_OBJECT (citem));
+
+	  } while (gtk_tree_model_iter_next (model, &iter));
+
+	/* We found it, so we'll now just recursively start asking for all its
+	 * folders and subfolders. The recurse_folders_sync can indeed cope with
+	 * folders that already exist (it wont add them a second time). */
+
+	if (found)
+		recurse_folders_sync (self, TNY_FOLDER_STORE (account), &name_iter);
+}
+
 static void
 tny_gtk_folder_store_tree_model_add_i (TnyGtkFolderStoreTreeModel *self, TnyFolderStore *folder_store, treeaddfunc func, const gchar *root_name)
 {
@@ -226,9 +247,20 @@
 		TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,
 		folder_store, -1);
 
+	/* In case we added a store account, it's possible that the account 
+	 * will have "the account just got connected" events happening. Accounts
+	 * that just got connected might have new folders for us to know about.
+	 * That's why we'll handle connection changes. */
+
+	if (TNY_IS_STORE_ACCOUNT (folder_store))
+		g_signal_connect (folder_store, "connection-status-changed",
+			G_CALLBACK (tny_gtk_folder_store_tree_model_on_constatus_changed), self);
+
 	recurse_folders_sync (self, TNY_FOLDER_STORE (folder_store), &name_iter);
 
-	/* Add an observer for the root folder store */
+	/* Add an observer for the root folder store, so that we can observe 
+	 * the actual account too. */
+
 	tny_folder_store_add_observer (folder_store, TNY_FOLDER_STORE_OBSERVER (self));
 	self->store_observables = g_list_prepend (self->store_observables, folder_store);
 
@@ -237,43 +269,9 @@
 	return;
 }
 
-static void
-tny_gtk_folder_store_tree_model_add_async_i (TnyGtkFolderStoreTreeModel *self, TnyFolderStore *folder_store, treeaddfunc func, const gchar *root_name)
-{
-	GtkTreeStore *model = GTK_TREE_STORE (self);
-	GtkTreeIter first, *name_iter;
-	gboolean need_add = TRUE;
 
-	if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self), &first))
-	{
-		func (model, &first, NULL);
-		need_add = FALSE;
-	}
-
-	name_iter = gtk_tree_iter_copy (&first);
-
-	if (need_add)
-		func (model, name_iter, NULL);
-
-	/* This adds a reference count to folder_store too. When it gets removed,
-	   that reference count is decreased automatically by the gtktreestore
-	   infrastructure. */
-
-	gtk_tree_store_set (model, name_iter,
-		TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN, root_name,
-		TNY_GTK_FOLDER_STORE_TREE_MODEL_UNREAD_COLUMN, 0,
-		TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, TNY_FOLDER_TYPE_ROOT,
-		TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,
-		folder_store, -1);
-
-	recurse_folders_async (self, TNY_FOLDER_STORE (folder_store), name_iter);
-
-	return;
-}
-
 /**
  * tny_gtk_folder_store_tree_model_new:
- * @async: Whether or not this component should attempt to asynchronously fill the tree
  * @query: the #TnyFolderStoreQuery that will be used to retrieve the folders of each folder_store
  *
  * Create a new #GtkTreeModel instance suitable for showing  
@@ -283,11 +281,13 @@
  * #TnyFolderStore instances
  **/
 GtkTreeModel*
-tny_gtk_folder_store_tree_model_new (gboolean async, TnyFolderStoreQuery *query)
+tny_gtk_folder_store_tree_model_new (TnyFolderStoreQuery *query)
 {
 	TnyGtkFolderStoreTreeModel *self = g_object_new (TNY_TYPE_GTK_FOLDER_STORE_TREE_MODEL, NULL);
-	self->is_async = FALSE;
-	if (query) self->query = g_object_ref (G_OBJECT (query));
+
+	if (query) 
+		self->query = g_object_ref (G_OBJECT (query));
+
 	return GTK_TREE_MODEL (self);
 }
 
@@ -342,7 +342,7 @@
 	me->iterator_lock = NULL;
 
 	if (me->query)
-		g_object_unref (G_OBJECT (me->query));
+		g_object_unref (me->query);
 
 	(*parent_class->finalize) (object);
 }
@@ -406,15 +406,11 @@
 	g_mutex_lock (me->iterator_lock);
 
 	/* Prepend something to the list */
-	g_object_ref (G_OBJECT (item));
+	g_object_ref (item);
 	me->first = g_list_prepend (me->first, item);
 
-	if (me->is_async)
-		tny_gtk_folder_store_tree_model_add_async_i (me, TNY_FOLDER_STORE (item), 
-			gtk_tree_store_prepend, root_name);
-	else
-		tny_gtk_folder_store_tree_model_add_i (me, TNY_FOLDER_STORE (item), 
-			gtk_tree_store_prepend, root_name);
+	tny_gtk_folder_store_tree_model_add_i (me, TNY_FOLDER_STORE (item), 
+		gtk_tree_store_prepend, root_name);
 
 	g_mutex_unlock (me->iterator_lock);
 }
@@ -428,16 +424,12 @@
 	g_mutex_lock (me->iterator_lock);
 
 	/* Prepend something to the list */
-	g_object_ref (G_OBJECT (item));
+	g_object_ref (item);
 	me->first = g_list_prepend (me->first, item);
 
-	if (me->is_async)
-		tny_gtk_folder_store_tree_model_add_async_i (me, TNY_FOLDER_STORE (item), 
-			gtk_tree_store_prepend, get_root_name (TNY_FOLDER_STORE (item)));
-	else
-		tny_gtk_folder_store_tree_model_add_i (me, TNY_FOLDER_STORE (item), 
-			gtk_tree_store_prepend, get_root_name (TNY_FOLDER_STORE (item)));
-	
+	tny_gtk_folder_store_tree_model_add_i (me, TNY_FOLDER_STORE (item), 
+		gtk_tree_store_prepend, get_root_name (TNY_FOLDER_STORE (item)));
+
 	g_mutex_unlock (me->iterator_lock);
 }
 
@@ -457,15 +449,11 @@
 	g_mutex_lock (me->iterator_lock);
 
 	/* Append something to the list */
-	g_object_ref (G_OBJECT (item));
+	g_object_ref (item);
 	me->first = g_list_append (me->first, item);
 
-	if (me->is_async)
-		tny_gtk_folder_store_tree_model_add_async_i (me, TNY_FOLDER_STORE (item), 
-			gtk_tree_store_append, root_name);
-	else
-		tny_gtk_folder_store_tree_model_add_i (me, TNY_FOLDER_STORE (item), 
-			gtk_tree_store_append, root_name);
+	tny_gtk_folder_store_tree_model_add_i (me, TNY_FOLDER_STORE (item), 
+		gtk_tree_store_append, root_name);
 
 	g_mutex_unlock (me->iterator_lock);
 }
@@ -478,15 +466,11 @@
 	g_mutex_lock (me->iterator_lock);
 
 	/* Append something to the list */
-	g_object_ref (G_OBJECT (item));
+	g_object_ref (item);
 	me->first = g_list_append (me->first, item);
 
-	if (me->is_async)
-		tny_gtk_folder_store_tree_model_add_async_i (me, TNY_FOLDER_STORE (item), 
-			gtk_tree_store_append, get_root_name (TNY_FOLDER_STORE (item)));
-	else
-		tny_gtk_folder_store_tree_model_add_i (me, TNY_FOLDER_STORE (item), 
-			gtk_tree_store_append, get_root_name (TNY_FOLDER_STORE (item)));
+	tny_gtk_folder_store_tree_model_add_i (me, TNY_FOLDER_STORE (item), 
+		gtk_tree_store_append, get_root_name (TNY_FOLDER_STORE (item)));
 
 	g_mutex_unlock (me->iterator_lock);
 }
@@ -526,14 +510,12 @@
 	   actually really part of the list. */
 
 	if (gtk_tree_model_get_iter_first (model, &iter))
-	  while (gtk_tree_model_iter_next (model, &iter))
+	  do 
 	  {
-		GObject *citem;
-
+		GObject *citem = NULL;
 		gtk_tree_model_get (model, &iter, 
 			TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, 
 			&citem, -1);
-
 		if (citem == item)
 		{
 			/* This removes a reference count */
@@ -541,9 +523,11 @@
 			g_object_unref (G_OBJECT (item));
 			break;
 		}
-		g_object_unref (G_OBJECT (citem));
-	  }
+		if (citem)
+			g_object_unref (G_OBJECT (citem));
 
+	  } while (gtk_tree_model_iter_next (model, &iter));
+
 	g_mutex_unlock (me->iterator_lock);
 }
 
@@ -593,6 +577,10 @@
 	TnyFolder *changed_folder = tny_folder_change_get_folder (change);
 	TnyFolderChangeChanged changed = tny_folder_change_get_changed (change);
 
+	/* This updater will get the folder out of the model, compare with 
+	 * the changed_folder pointer, and if there's a match it will update
+	 * the values of the model with the values from the folder. */
+
 	gtk_tree_model_get (model, iter, 
 		TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, 
 		&type, -1);
@@ -628,14 +616,13 @@
 				TNY_GTK_FOLDER_STORE_TREE_MODEL_UNREAD_COLUMN, 
 				unread,
 				TNY_GTK_FOLDER_STORE_TREE_MODEL_ALL_COLUMN, 
-				total,
-				-1);
+				total, -1);
 		}
 
-		g_object_unref (G_OBJECT (folder));
+		g_object_unref (folder);
 	}
 
-	g_object_unref (G_OBJECT (changed_folder));
+	g_object_unref (changed_folder);
 
 	return FALSE;
 }
@@ -648,13 +635,17 @@
 	TnyFolderType type = TNY_FOLDER_TYPE_UNKNOWN;
 	GObject *folder = user_data1;
 
+	/* The deleter will compare all folders in the model with the deleted 
+	 * folder @folder, and if there's a match it will delete the folder's
+	 * row from the model. */
+
 	gtk_tree_model_get (model, iter, 
 		TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, 
 		&type, -1);
 
 	if (type != TNY_FOLDER_TYPE_ROOT) 
 	{
-		GObject *fol;
+		GObject *fol = NULL;
 
 		gtk_tree_model_get (model, iter, 
 			TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, 
@@ -665,7 +656,8 @@
 			retval = TRUE;
 		}
 
-		g_object_unref (G_OBJECT (fol));
+		if (fol)
+			g_object_unref (fol);
 	}
 
 	return retval;
@@ -675,6 +667,8 @@
 static gboolean
 find_store_iter (GtkTreeModel *model, GtkTreeIter *iter, GtkTreeIter *f, gpointer user_data)
 {
+	/* Finding the iter for a given folder */
+
 	do
 	{
 		GtkTreeIter child;
@@ -687,14 +681,14 @@
 			&type, -1);
 
 		gtk_tree_model_get (model, iter, 
-				    TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, 
-				    &fol, -1);
+			TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, 
+			&fol, -1);
 		
 		if (fol == user_data)
 			found = TRUE;
 		
-		if (fol != NULL)
-			g_object_unref (G_OBJECT (fol));
+		if (fol)
+			g_object_unref (fol);
 
 		if (found) {
 			*f = *iter;
@@ -798,7 +792,8 @@
 				GtkTreeIter newiter;
 				TnyFolder *folder = TNY_FOLDER (tny_iterator_get_current (miter));
 
-				/* See early added below! 
+				/* See early added below! (#CCUX)
+
 				tny_folder_add_observer (TNY_FOLDER (folder), TNY_FOLDER_OBSERVER (self));
 				tny_folder_store_add_observer (TNY_FOLDER_STORE (folder), TNY_FOLDER_STORE_OBSERVER (self));*/
 
@@ -823,11 +818,11 @@
 					TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,
 					folder, -1);
 
-				g_object_unref (G_OBJECT (folder));
+				g_object_unref (folder);
 				tny_iterator_next (miter);
 			}
-			g_object_unref (G_OBJECT (miter));
-			g_object_unref (G_OBJECT (created));
+			g_object_unref (miter);
+			g_object_unref (created);
 		}
 		g_object_unref (G_OBJECT (parentstore));
 	}
@@ -844,11 +839,11 @@
 		{
 			TnyFolder *folder = TNY_FOLDER (tny_iterator_get_current (miter));
 			gtk_tree_model_foreach (model, deleter, folder);
-			g_object_unref (G_OBJECT (folder));
+			g_object_unref (folder);
 			tny_iterator_next (miter);
 		}
-		g_object_unref (G_OBJECT (miter));
-		g_object_unref (G_OBJECT (removed));
+		g_object_unref (miter);
+		g_object_unref (removed);
 	}
 
 
@@ -888,7 +883,7 @@
 		{
 			TnyFolder *folder = TNY_FOLDER (tny_iterator_get_current (miter));
 
-			/* Already added! 
+			/* Already added! (#CCUX)
 			 * We can't add these in the idle because the thread might
 			 * be added subfolders right now! (the idle would register
 			 * self as an observer too late!) 
@@ -899,11 +894,11 @@
 			tny_folder_add_observer (TNY_FOLDER (folder), TNY_FOLDER_OBSERVER (self));
 			tny_folder_store_add_observer (TNY_FOLDER_STORE (folder), TNY_FOLDER_STORE_OBSERVER (self));
 
-			g_object_unref (G_OBJECT (folder));
+			g_object_unref (folder);
 			tny_iterator_next (miter);
 		}
-		g_object_unref (G_OBJECT (miter));
-		g_object_unref (G_OBJECT (created));
+		g_object_unref (miter);
+		g_object_unref (created);
 	}
 
 	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
Index: tests/c-demo/tny-demoui-summary-view.c
===================================================================
--- tests/c-demo/tny-demoui-summary-view.c	(revision 2503)
+++ tests/c-demo/tny-demoui-summary-view.c	(working copy)
@@ -93,7 +93,6 @@
  	GtkComboBox *account_view;
 	GtkTreeView *mailbox_view, *header_view;
 	TnyMsgView *msg_view;
-	guint accounts_reloaded_signal;
 	GtkWidget *status, *progress, *online_button, *poke_button, *sync_button;
 	guint status_id;
 	gulong mailbox_select_sid;
@@ -276,7 +275,7 @@
 }
 
 static void 
-reload_accounts_first (TnySummaryView *self, gboolean first_time)
+load_accounts (TnySummaryView *self, gboolean first_time)
 {
 	TnyDemouiSummaryViewPriv *priv = TNY_DEMOUI_SUMMARY_VIEW_GET_PRIVATE (self);
 	TnyAccountStore *account_store = priv->account_store;
@@ -290,11 +289,7 @@
 
 	/* TnyGtkFolderStoreTreeModel is also a TnyList (it simply implements both the
 	   TnyList and the GtkTreeModel interfaces) */
-#if PLATFORM==1
-	mailbox_model = tny_gtk_folder_store_tree_model_new (TRUE, NULL);
-#else
-	mailbox_model = tny_gtk_folder_store_tree_model_new (FALSE, NULL);
-#endif
+	mailbox_model = tny_gtk_folder_store_tree_model_new (NULL);
 
 	g_object_unref (G_OBJECT (query));
 
@@ -370,19 +365,7 @@
 	return;
 }
 
-static void 
-reload_accounts (TnySummaryView *self)
-{
-	reload_accounts_first (self, FALSE);
-}
 
-static void
-accounts_reloaded (TnyAccountStore *store, gpointer user_data)
-{
-	reload_accounts ((TnySummaryView *)user_data);
-	return;
-}
-
 static void 
 online_button_toggled (GtkToggleButton *togglebutton, gpointer user_data)
 {
@@ -494,16 +477,11 @@
 		TnyDevice *odevice = tny_account_store_get_device (priv->account_store);
 
 		if (g_signal_handler_is_connected (G_OBJECT (odevice), priv->connchanged_signal))
-		{
 			g_signal_handler_disconnect (G_OBJECT (odevice), 
 				priv->connchanged_signal);
-		}
 
-		g_signal_handler_disconnect (G_OBJECT (priv->account_store),
-			priv->accounts_reloaded_signal);
-
-		g_object_unref (G_OBJECT (priv->account_store));
-		g_object_unref (G_OBJECT (odevice));
+		g_object_unref (priv->account_store);
+		g_object_unref (odevice);
 	}
 
 	g_object_ref (G_OBJECT (account_store));
@@ -514,12 +492,8 @@
 
 	priv->account_store = account_store;
 
-	priv->accounts_reloaded_signal = g_signal_connect (
-		G_OBJECT (account_store), "accounts_reloaded",
-		G_CALLBACK (accounts_reloaded), self);
+	load_accounts ((TnySummaryView *) self, TRUE);
 
-	reload_accounts_first ((TnySummaryView *) self, TRUE);
-
 	g_object_unref (G_OBJECT (device));
 
 	return;
@@ -1935,16 +1909,11 @@
 	TnyDemouiSummaryViewPriv *priv = TNY_DEMOUI_SUMMARY_VIEW_GET_PRIVATE (self);
 
 	if (priv->current_accounts)
-		g_object_unref (G_OBJECT (priv->current_accounts));
+		g_object_unref (priv->current_accounts);
 
-	if (G_LIKELY (priv->account_store))
-	{
-		g_signal_handler_disconnect (G_OBJECT (priv->account_store),
-			priv->accounts_reloaded_signal);
+	if (priv->account_store)
+		g_object_unref (priv->account_store);
 
-		g_object_unref (G_OBJECT (priv->account_store));
-	}
-
 	g_mutex_lock (priv->monitor_lock);
 	if (priv->monitor)
 	{
Index: libtinymail-gnome-desktop/tny-gnome-account-store.c
===================================================================
--- libtinymail-gnome-desktop/tny-gnome-account-store.c	(revision 2503)
+++ libtinymail-gnome-desktop/tny-gnome-account-store.c	(working copy)
@@ -153,13 +153,8 @@
 	gchar *key = g_strdup (entry->key);
 	gchar *ptr = strrchr (key, '/'); ptr++;
 
-
 	if (!strcmp (ptr, "count"))
-	{
 		kill_stored_accounts (priv);
-		g_signal_emit (self, 
-			tny_account_store_signals [TNY_ACCOUNT_STORE_ACCOUNTS_RELOADED], 0);
-	}
 
 	g_free (key);
 
@@ -489,44 +484,7 @@
 	return;
 }
 
-/**
- * tny_gnome_account_store_add_store_account:
- * @self: a #TnyGnomeAccountStore instance
- * @account: a #TnyStoreAccount instance to add
- * 
- * Add @account to @self
- **/
-void
-tny_gnome_account_store_add_store_account (TnyGnomeAccountStore *self, TnyStoreAccount *account)
-{
-	tny_gnome_account_store_notify_remove (TNY_ACCOUNT_STORE (self));
-	tny_gnome_account_store_add_account (TNY_ACCOUNT_STORE (self), TNY_ACCOUNT (account), "store");
-	tny_gnome_account_store_notify_add (TNY_ACCOUNT_STORE (self));
 
-	g_signal_emit (self, tny_account_store_signals [TNY_ACCOUNT_STORE_ACCOUNT_INSERTED], 0, account);
-
-	return;
-}
-
-/**
- * tny_gnome_account_store_add_transport_account:
- * @self: a #TnyGnomeAccountStore instance
- * @account: a #TnyTransportAccount instance to add
- * 
- * Add @account to @self
- **/
-void
-tny_gnome_account_store_add_transport_account (TnyGnomeAccountStore *self, TnyTransportAccount *account)
-{
-	tny_gnome_account_store_notify_remove (TNY_ACCOUNT_STORE (self));
-	tny_gnome_account_store_add_account (TNY_ACCOUNT_STORE (self), TNY_ACCOUNT (account), "transport");
-	tny_gnome_account_store_notify_add (TNY_ACCOUNT_STORE (self));
-
-	g_signal_emit (self, tny_account_store_signals [TNY_ACCOUNT_STORE_ACCOUNT_INSERTED], 0, account);
-
-	return;
-}
-
 static TnyDevice*
 tny_gnome_account_store_get_device (TnyAccountStore *self)
 {
Index: libtinymail-gnome-desktop/tny-gnome-account-store.h
===================================================================
--- libtinymail-gnome-desktop/tny-gnome-account-store.h	(revision 2503)
+++ libtinymail-gnome-desktop/tny-gnome-account-store.h	(working copy)
@@ -52,8 +52,6 @@
 TnyAccountStore* tny_gnome_account_store_new (void);
 TnySessionCamel* tny_gnome_account_store_get_session (TnyGnomeAccountStore *self);
 
-void tny_gnome_account_store_add_store_account (TnyGnomeAccountStore *self, TnyStoreAccount *account);
-void tny_gnome_account_store_add_transport_account (TnyGnomeAccountStore *self, TnyTransportAccount *account);
 
 G_END_DECLS
 
Index: libtinymail/tny-account-store.c
===================================================================
--- libtinymail/tny-account-store.c	(revision 2503)
+++ libtinymail/tny-account-store.c	(working copy)
@@ -374,82 +374,6 @@
 	if (!tny_account_store_initialized) 
 	{
 /**
- * TnyAccountStore::account-changed
- * @self: the object on which the signal is emitted
- * @arg1: the #TnyAccount of the account that changed
- * @user_data: user data set when the signal handler was connected
- *
- * API WARNING: This API might change
- *
- * Emitted when an account in the store changed
- */
-		tny_account_store_signals[TNY_ACCOUNT_STORE_ACCOUNT_CHANGED] =
-		   g_signal_new ("account_changed",
-			TNY_TYPE_ACCOUNT_STORE,
-			G_SIGNAL_RUN_FIRST,
-			G_STRUCT_OFFSET (TnyAccountStoreIface, account_changed),
-			NULL, NULL,
-			g_cclosure_marshal_VOID__POINTER,
-			G_TYPE_NONE, 1, TNY_TYPE_ACCOUNT);
-
-/**
- * TnyAccountStore::account-inserted
- * @self: the object on which the signal is emitted
- * @arg1: the #TnyAccount of the account that got inserted
- * @user_data: user data set when the signal handler was connected.
- *
- * API WARNING: This API might change
- *
- * Emitted when an account is added to the store
- */
-		tny_account_store_signals[TNY_ACCOUNT_STORE_ACCOUNT_INSERTED] =
-		   g_signal_new ("account_inserted",
-			TNY_TYPE_ACCOUNT_STORE,
-			G_SIGNAL_RUN_FIRST,
-			G_STRUCT_OFFSET (TnyAccountStoreIface, account_inserted),
-			NULL, NULL,
-			g_cclosure_marshal_VOID__POINTER,
-			G_TYPE_NONE, 1, TNY_TYPE_ACCOUNT);
-
-/**
- * TnyAccountStore::account-removed
- * @self: the object on which the signal is emitted
- * @arg1: the #TnyAccount of the account that got removed
- * @user_data: user data set when the signal handler was connected.
- *
- * API WARNING: This API might change
- *
- * Emitted when an account is removed from the store
- */
-		tny_account_store_signals[TNY_ACCOUNT_STORE_ACCOUNT_REMOVED] =
-		   g_signal_new ("account_removed",
-			TNY_TYPE_ACCOUNT_STORE,
-			G_SIGNAL_RUN_FIRST,
-			G_STRUCT_OFFSET (TnyAccountStoreIface, account_removed),
-			NULL, NULL,
-			g_cclosure_marshal_VOID__POINTER,
-			G_TYPE_NONE, 1, TNY_TYPE_ACCOUNT);
-
-/**
- * TnyAccountStore::accounts-reloaded
- * @self: the object on which the signal is emitted
- *
- * API WARNING: This API might change
- *
- * Emitted when the store reloads the accounts
- */
-		tny_account_store_signals[TNY_ACCOUNT_STORE_ACCOUNTS_RELOADED] =
-		   g_signal_new ("accounts_reloaded",
-			TNY_TYPE_ACCOUNT_STORE,
-			G_SIGNAL_RUN_FIRST,
-			G_STRUCT_OFFSET (TnyAccountStoreIface, accounts_reloaded),
-			NULL, NULL,
-			g_cclosure_marshal_VOID__VOID,
-			G_TYPE_NONE, 0);
-
-
-
-/**
  * TnyAccountStore::connecting-started
  * @self: the object on which the signal is emitted
  * @user_data: user data set when the signal handler was connected.
@@ -465,23 +389,6 @@
 		g_cclosure_marshal_VOID__VOID, 
 		G_TYPE_NONE, 0);
 
-
-/**
- * TnyAccountStore::connecting-finished
- * @self: the object on which the signal is emitted
- * @user_data: user data set when the signal handler was connected.
- *
- * Emitted when the store finished trying to connect the accounts
- */
-	tny_account_store_signals[TNY_ACCOUNT_STORE_CONNECTING_FINISHED] =
-	   g_signal_new ("connecting_finished",
-		TNY_TYPE_ACCOUNT_STORE,
-		G_SIGNAL_RUN_FIRST,
-		G_STRUCT_OFFSET (TnyAccountStoreIface, connecting_finished),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__VOID, 
-		G_TYPE_NONE, 0);
-
 		tny_account_store_initialized = TRUE;
 	}
 	return;
@@ -584,12 +491,7 @@
   static GType etype = 0;
   if (etype == 0) {
     static const GEnumValue values[] = {
-      { TNY_ACCOUNT_STORE_ACCOUNT_CHANGED, "TNY_ACCOUNT_STORE_ACCOUNT_CHANGED", "changed" },
-      { TNY_ACCOUNT_STORE_ACCOUNT_INSERTED, "TNY_ACCOUNT_STORE_ACCOUNT_INSERTED", "inserted" },
-      { TNY_ACCOUNT_STORE_ACCOUNT_REMOVED, "TNY_ACCOUNT_STORE_ACCOUNT_REMOVED", "removed" },
-      { TNY_ACCOUNT_STORE_ACCOUNTS_RELOADED, "TNY_ACCOUNT_STORE_ACCOUNTS_RELOADED", "reloaded" },
       { TNY_ACCOUNT_STORE_CONNECTING_STARTED, "TNY_ACCOUNT_STORE_CONNECTING_STARTED", "started" },
-      { TNY_ACCOUNT_STORE_CONNECTING_FINISHED, "TNY_ACCOUNT_STORE_CONNECTING_FINISHED", "finished" },
       { TNY_ACCOUNT_STORE_LAST_SIGNAL,  "TNY_ACCOUNT_STORE_LAST_SIGNAL", "last-signal" },
       { 0, NULL, NULL }
     };
Index: libtinymail/tny-account-store.h
===================================================================
--- libtinymail/tny-account-store.h	(revision 2503)
+++ libtinymail/tny-account-store.h	(working copy)
@@ -35,12 +35,7 @@
 
 enum _TnyAccountStoreSignal
 {
-	TNY_ACCOUNT_STORE_ACCOUNT_CHANGED,
-	TNY_ACCOUNT_STORE_ACCOUNT_INSERTED,
-	TNY_ACCOUNT_STORE_ACCOUNT_REMOVED,
-	TNY_ACCOUNT_STORE_ACCOUNTS_RELOADED,
 	TNY_ACCOUNT_STORE_CONNECTING_STARTED,
-	TNY_ACCOUNT_STORE_CONNECTING_FINISHED,
 	TNY_ACCOUNT_STORE_LAST_SIGNAL
 };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]