From f9a0f63338e0d2e7afd74e126ba32411680ee008 Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Thu, 12 Apr 2012 19:20:08 +0300 Subject: [PATCH] Fix the creation of a couple of GError instances A wrong error domain was used, and the error code was hardcoded to 1. Here we try to make a better guess at the error codes. --- libsignon-glib/signon-auth-session.c | 33 ++++++++-------------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/libsignon-glib/signon-auth-session.c b/libsignon-glib/signon-auth-session.c index 6f3f503..b2ea06a 100644 --- a/libsignon-glib/signon-auth-session.c +++ b/libsignon-glib/signon-auth-session.c @@ -5,7 +5,7 @@ * * Copyright (C) 2009-2010 Nokia Corporation. * - * Contact: Alberto Mardegan + * Contact: Alberto Mardegan * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -42,6 +42,7 @@ #include "signon-dbus-queue.h" #include "signon-client-glib-gen.h" #include "signon-auth-session-client-glib-gen.h" +#include "signon-errors.h" #include "signon-marshal.h" #include "signon-proxy.h" #include "signon-utils.h" @@ -108,14 +109,6 @@ typedef struct _AuthSessionProcessCbData #define SIGNON_AUTH_SESSION_GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SIGNON_TYPE_AUTH_SESSION, SignonAuthSessionPrivate)) -//TODO: remove with implementing normal error management -#define SSO_AUTH_SESSION_CONNECTION_PROBLEM_G \ - "Cannot create remote AuthSession object: check the signon daemon and authentication plugin." -#define SSO_AUTH_SESSION_BUSY_PROBLEM_G \ - "AuthSession: client is busy." -#define SSO_AUTH_SESSION_CANCELED_PROBLEM_G \ - "Challenge was canceled" - static void auth_session_state_changed_cb (DBusGProxy *proxy, gint state, gchar *message, gpointer user_data); static void auth_session_remote_object_destroyed_cb (DBusGProxy *proxy, gpointer user_data); @@ -152,17 +145,6 @@ _SSO_AuthSession_process_async_timeout (DBusGProxy *proxy, IN_sessionDataVa, G_TYPE_STRING, IN_mechanism, G_TYPE_INVALID); } -static GQuark -auth_session_errors_quark () -{ - static GQuark quark = 0; - - if (!quark) - quark = g_quark_from_static_string ("com.nokia.SingleSignOn.AuthSession.Errors"); - - return quark; -} - static GQuark auth_session_object_quark () { @@ -510,7 +492,9 @@ auth_session_get_object_path_reply (DBusGProxy *proxy, char *object_path, if (error) DEBUG ("Error message is %s", error->message); else - error = g_error_new (auth_session_errors_quark(), 1, SSO_AUTH_SESSION_CONNECTION_PROBLEM_G); + error = g_error_new (signon_error_quark(), + SIGNON_ERROR_RUNTIME, + "Cannot create remote AuthSession object"); } else { @@ -731,9 +715,10 @@ auth_session_process_ready_cb (gpointer object, const GError *error, gpointer us if (error || priv->canceled) { - GError *err = ( error ? (GError *)error : g_error_new(auth_session_errors_quark(), - 1, - SSO_AUTH_SESSION_CANCELED_PROBLEM_G) ); + GError *err = (error ? (GError *)error : + g_error_new (signon_error_quark (), + SIGNON_ERROR_SESSION_CANCELED, + "Authentication session was canceled")); DEBUG ("AuthSessionError: %s", err->message); -- 2.34.1