Bug 751206 - correct trust prompt for collection sources

This enables trust prompts for collection sources. Note the changes from the
above cited bug are needed to have this fully and properly working.

https://bugzilla.gnome.org/show_bug.cgi?id=751206
This commit is contained in:
Milan Crha
2015-06-20 23:04:10 -03:00
committed by Georges Basile Stavracas Neto
parent 3e97490e1d
commit 6a39614e38
+54 -2
View File
@@ -646,6 +646,45 @@ source_credentials_required_cb (ESourceRegistry *registry,
}
}
static void
source_get_last_credentials_required_arguments_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
GcalManager *manager = user_data;
ESource *source;
ESourceCredentialsReason reason = E_SOURCE_CREDENTIALS_REASON_UNKNOWN;
gchar *certificate_pem = NULL;
GTlsCertificateFlags certificate_errors = 0;
GError *op_error = NULL;
GError *error = NULL;
g_return_if_fail (E_IS_SOURCE (source_object));
source = E_SOURCE (source_object);
if (!e_source_get_last_credentials_required_arguments_finish (source, result, &reason,
&certificate_pem, &certificate_errors, &op_error, &error))
{
/* Can be cancelled only if the manager is disposing/disposed */
if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
show_source_error (G_STRFUNC, "Failed to get last credentials required arguments for", source, error);
}
g_clear_error (&error);
return;
}
g_return_if_fail (GCAL_IS_MANAGER (manager));
if (reason != E_SOURCE_CREDENTIALS_REASON_UNKNOWN)
source_credentials_required_cb (NULL, source, reason, certificate_pem, certificate_errors, op_error, manager);
g_free (certificate_pem);
g_clear_error (&op_error);
}
static void
gcal_manager_class_init (GcalManagerClass *klass)
{
@@ -771,8 +810,12 @@ gcal_manager_constructed (GObject *object)
ESource *source = E_SOURCE (l->data);
/* Mark for skip also currently disabled sources */
if (!e_source_has_extension (source, E_SOURCE_EXTENSION_CALENDAR))
if (!e_source_has_extension (source, E_SOURCE_EXTENSION_CALENDAR) &&
!e_source_has_extension (source, E_SOURCE_EXTENSION_COLLECTION))
e_credentials_prompter_set_auto_prompt_disabled_for (priv->credentials_prompter, source, TRUE);
else
e_source_get_last_credentials_required_arguments (source, NULL,
source_get_last_credentials_required_arguments_cb, object);
}
g_list_free_full (sources, g_object_unref);
@@ -789,7 +832,16 @@ gcal_manager_constructed (GObject *object)
cred_source = e_source_credentials_provider_ref_credentials_source (credentials_provider, source);
if (cred_source && !e_source_equal (source, cred_source))
e_credentials_prompter_set_auto_prompt_disabled_for (priv->credentials_prompter, cred_source, FALSE);
{
e_credentials_prompter_set_auto_prompt_disabled_for (priv->credentials_prompter, cred_source, FALSE);
if (e_source_get_connection_status (cred_source) == E_SOURCE_CONNECTION_STATUS_SSL_FAILED)
{
e_source_get_last_credentials_required_arguments (cred_source, NULL,
source_get_last_credentials_required_arguments_cb, object);
}
}
g_clear_object (&cred_source);
}