manager: improved ESource/EClient connection flow

This commit is contained in:
Erick Pérez Castellanos
2014-12-04 17:10:40 -05:00
parent 503d0345d9
commit 6fa533ba79
+12 -13
View File
@@ -187,18 +187,18 @@ load_source (GcalManager *manager,
unit = g_new0 (GcalManagerUnit, 1); unit = g_new0 (GcalManagerUnit, 1);
g_hash_table_insert (priv->clients, source, unit); g_hash_table_insert (priv->clients, source, unit);
}
else
{
g_warning ("Skipping already loaded source: %s",
e_source_get_uid (source));
}
/* NULL: because maybe the operation cannot be really cancelled */ /* NULL: because maybe the operation cannot be really cancelled */
e_cal_client_connect (source, e_cal_client_connect (source,
E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL,
on_client_connected, on_client_connected,
manager); manager);
}
else
{
g_warning ("Skipping already loaded source: %s",
e_source_get_uid (source));
}
} }
static void static void
@@ -229,20 +229,20 @@ on_client_connected (GObject *source_object,
/* FIXME: user should be able to disable sources */ /* FIXME: user should be able to disable sources */
unit->enabled = TRUE; unit->enabled = TRUE;
g_debug ("Source %s connected", g_debug ("Source %s (%s) connected",
e_source_get_display_name (source)); e_source_get_display_name (source),
e_source_get_uid (source));
/* setting view */ /* setting view */
recreate_view (GCAL_MANAGER (user_data), unit); recreate_view (GCAL_MANAGER (user_data), unit);
} }
else else
{
if (error != NULL)
{ {
g_warning ("%s", error->message); g_warning ("%s", error->message);
/* handling error */ /* handling error */
if (g_error_matches (error, E_CLIENT_ERROR, if (g_error_matches (error,
E_CLIENT_ERROR,
E_CLIENT_ERROR_BUSY)) E_CLIENT_ERROR_BUSY))
{ {
RetryOpenData *rod; RetryOpenData *rod;
@@ -268,7 +268,6 @@ on_client_connected (GObject *source_object,
g_error_free (error); g_error_free (error);
return; return;
} }
}
} }
static gboolean static gboolean
@@ -613,7 +612,7 @@ gcal_manager_constructed (GObject *object)
return; return;
} }
sources = e_source_registry_list_sources (priv->source_registry, sources = e_source_registry_list_enabled (priv->source_registry,
E_SOURCE_EXTENSION_CALENDAR); E_SOURCE_EXTENSION_CALENDAR);
for (l = sources; l != NULL; l = l->next) for (l = sources; l != NULL; l = l->next)