From 3056501c514ec496c89a77d3b50869cbd6cb2878 Mon Sep 17 00:00:00 2001 From: Jussi Laako Date: Fri, 31 Jan 2014 17:03:38 +0200 Subject: [PATCH] auth-session: simplify and reduce amount of identical code --- libgsignon-glib/signon-auth-session.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/libgsignon-glib/signon-auth-session.c b/libgsignon-glib/signon-auth-session.c index cc3065d..9696e21 100644 --- a/libgsignon-glib/signon-auth-session.c +++ b/libgsignon-glib/signon-auth-session.c @@ -423,25 +423,12 @@ signon_auth_session_new (gint id, SignonIdentity *identity = (id == 0) ? signon_identity_new () : signon_identity_new_from_db (id); + g_return_val_if_fail (identity, NULL); - SignonAuthSession *self = SIGNON_AUTH_SESSION(g_object_new ( - SIGNON_TYPE_AUTH_SESSION, - "identity", identity, - NULL)); - g_return_val_if_fail (self != NULL, NULL); - /* This will not destroy the identity, as long as it's used by the - * SignonAuthSession. */ + SignonAuthSession *self = + signon_auth_session_new_for_identity (identity, method_name, err); g_object_unref (identity); - if (!auth_session_priv_init(self, method_name, err)) - { - if (*err) - g_warning ("%s returned error: %s", G_STRFUNC, (*err)->message); - - g_object_unref (self); - return NULL; - } - return self; } -- 2.7.4