Commit 6992bd4b authored by Corentin Noël's avatar Corentin Noël

Remove unused signon-utils

parent f20528cb
Pipeline #29788258 passed with stages
in 18 minutes and 14 seconds
......@@ -11,7 +11,6 @@ libsignon_glib_public_headers = files(
libsignon_glib_private_headers = files(
'signon-internals.h',
'signon-proxy.h',
'signon-utils.h',
'sso-auth-service.h',
)
......@@ -25,7 +24,6 @@ libsignon_glib_public_sources = files(
libsignon_glib_sources = libsignon_glib_public_sources + files(
'signon-proxy.c',
'signon-utils.c',
'sso-auth-service.c',
)
......
......@@ -43,7 +43,6 @@
#include "signon-errors.h"
#include "signon-marshal.h"
#include "signon-proxy.h"
#include "signon-utils.h"
#include "sso-auth-service.h"
#include "sso-auth-session-gen.h"
......@@ -542,7 +541,13 @@ auth_session_get_object_path_reply (GObject *object, GAsyncResult *res,
&object_path,
res,
&error);
SIGNON_RETURN_IF_CANCELLED (error);
if (error != NULL &&
error->domain == G_IO_ERROR &&
error->code == G_IO_ERROR_CANCELLED)
{
g_error_free (error);
return;
}
g_return_if_fail (SIGNON_IS_AUTH_SESSION (userdata));
SignonAuthSession *self = SIGNON_AUTH_SESSION (userdata);
......
......@@ -34,7 +34,6 @@
#include "signon-identity-info.h"
#include "signon-internals.h"
#include "signon-utils.h"
G_DEFINE_BOXED_TYPE (SignonIdentityInfo, signon_identity_info,
(GBoxedCopyFunc)signon_identity_info_copy,
......
......@@ -35,11 +35,19 @@
#include "signon-auth-session.h"
#include "signon-internals.h"
#include "signon-proxy.h"
#include "signon-utils.h"
#include "signon-errors.h"
#include "sso-auth-service.h"
#include "sso-identity-gen.h"
#define SIGNON_RETURN_IF_CANCELLED(error) \
if (error != NULL && \
error->domain == G_IO_ERROR && \
error->code == G_IO_ERROR_CANCELLED) \
{ \
g_error_free (error); \
return; \
}
static void signon_identity_proxy_if_init (SignonProxyInterface *iface);
static void signon_identity_set_id (SignonIdentity *identity, guint32 id);
......
/* vi: set et sw=4 ts=4 cino=t0,(0: */
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of libsignon-glib
*
* Copyright (C) 2009-2010 Nokia Corporation.
* Copyright (C) 2012-2016 Canonical Ltd.
*
* Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "signon-utils.h"
#include <gio/gio.h>
static const GVariantType *
signon_gtype_to_variant_type (GType type)
{
switch (type)
{
case G_TYPE_STRING: return G_VARIANT_TYPE_STRING;
case G_TYPE_BOOLEAN: return G_VARIANT_TYPE_BOOLEAN;
case G_TYPE_UCHAR: return G_VARIANT_TYPE_BYTE;
case G_TYPE_INT: return G_VARIANT_TYPE_INT32;
case G_TYPE_UINT: return G_VARIANT_TYPE_UINT32;
case G_TYPE_INT64: return G_VARIANT_TYPE_INT64;
case G_TYPE_UINT64: return G_VARIANT_TYPE_UINT64;
case G_TYPE_DOUBLE: return G_VARIANT_TYPE_DOUBLE;
default:
if (type == G_TYPE_STRV) return G_VARIANT_TYPE_STRING_ARRAY;
g_critical ("Unsupported type %s", g_type_name (type));
return NULL;
}
}
GValue *
signon_gvalue_new (GType type)
{
GValue *value = g_slice_new0 (GValue);
g_value_init (value, type);
return value;
}
void signon_gvalue_free (gpointer val)
{
g_return_if_fail (G_IS_VALUE(val));
GValue *value = (GValue*)val;
g_value_unset (value);
g_slice_free (GValue, value);
}
GHashTable *signon_hash_table_from_variant (GVariant *variant)
{
GHashTable *hash_table;
GVariantIter iter;
GVariant *value;
gchar *key;
if (variant == NULL) return NULL;
hash_table = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
signon_gvalue_free);
g_variant_iter_init (&iter, variant);
while (g_variant_iter_next (&iter, "{sv}", &key, &value))
{
GValue *val = g_slice_new0 (GValue);
g_dbus_gvariant_to_gvalue (value, val);
g_variant_unref (value);
g_hash_table_insert (hash_table, key, val);
}
return hash_table;
}
GVariant *signon_hash_table_to_variant (const GHashTable *hash_table)
{
GVariantBuilder builder;
GHashTableIter iter;
const gchar *key;
const GValue *value;
if (hash_table == NULL) return NULL;
g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
g_hash_table_iter_init (&iter, (GHashTable *)hash_table);
while (g_hash_table_iter_next (&iter, (gpointer)&key, (gpointer)&value))
{
GVariant *val;
if (G_VALUE_TYPE (value) == G_TYPE_VARIANT)
{
val = g_value_dup_variant (value);
}
else
{
const GVariantType *type;
type = signon_gtype_to_variant_type (G_VALUE_TYPE (value));
val = g_dbus_gvalue_to_gvariant (value, type);
}
g_variant_builder_add (&builder, "{sv}", key, val);
g_variant_unref (val);
}
return g_variant_builder_end (&builder);
}
/* vi: set et sw=4 ts=4 cino=t0,(0: */
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of libsignon-glib
*
* Copyright (C) 2009-2010 Nokia Corporation.
* Copyright (C) 2012-2016 Canonical Ltd.
*
* Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef _SIGNON_UTILS_H_
#define _SIGNON_UTILS_H_
#include <glib-object.h>
#define SIGNON_RETURN_IF_CANCELLED(error) \
if (error != NULL && \
error->domain == G_IO_ERROR && \
error->code == G_IO_ERROR_CANCELLED) \
{ \
g_error_free (error); \
return; \
}
G_GNUC_INTERNAL
GValue *signon_gvalue_new (GType type);
G_GNUC_INTERNAL
void signon_gvalue_free (gpointer val);
G_GNUC_INTERNAL
GHashTable *signon_hash_table_from_variant (GVariant *variant);
G_GNUC_INTERNAL
GVariant *signon_hash_table_to_variant (const GHashTable *hash_table);
#endif //_SIGNON_UTILS_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment