manager: defer adding client to the internal hash
Wait until the client is opened and connected to add it to the internal hash, so GcalManager::get_sources work properly.
This commit is contained in:
+3
-8
@@ -208,12 +208,6 @@ load_source (GcalManager *manager,
|
||||
|
||||
if (g_hash_table_lookup (priv->clients, source) == NULL)
|
||||
{
|
||||
GcalManagerUnit *unit;
|
||||
|
||||
unit = g_new0 (GcalManagerUnit, 1);
|
||||
|
||||
g_hash_table_insert (priv->clients, source, unit);
|
||||
|
||||
/* NULL: because maybe the operation cannot be really cancelled */
|
||||
e_cal_client_connect (source,
|
||||
E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL,
|
||||
@@ -248,14 +242,15 @@ on_client_connected (GObject *source_object,
|
||||
client = E_CAL_CLIENT (e_cal_client_connect_finish (result, &error));
|
||||
if (error == NULL)
|
||||
{
|
||||
unit = (GcalManagerUnit*) g_hash_table_lookup (priv->clients,
|
||||
source);
|
||||
unit = g_new0 (GcalManagerUnit, 1);
|
||||
unit->connected = TRUE;
|
||||
unit->client = client;
|
||||
|
||||
/* FIXME: user should be able to disable sources */
|
||||
unit->enabled = TRUE;
|
||||
|
||||
g_hash_table_insert (priv->clients, source, unit);
|
||||
|
||||
g_debug ("Source %s (%s) connected",
|
||||
e_source_get_display_name (source),
|
||||
e_source_get_uid (source));
|
||||
|
||||
Reference in New Issue
Block a user