Remove dependency on dbus-glib
authorAlberto Mardegan <alberto.mardegan@canonical.com>
Thu, 2 Aug 2012 10:20:55 +0000 (13:20 +0300)
committerAlberto Mardegan <alberto.mardegan@canonical.com>
Thu, 2 Aug 2012 10:25:48 +0000 (13:25 +0300)
configure.ac
libsignon-glib/Makefile.am
libsignon-glib/signon-errors.c
libsignon-glib/signon-identity-info.c
libsignon-glib/signon-internals.h
libsignon-glib/signon-marshal.list
libsignon-glib/signon-proxy.c [deleted file]
libsignon-glib/signon-proxy.h [deleted file]
tests/check_signon.c

index c513e5e5b912cf55e24fa4460ea742f206b10faf..fae8e3b7bdf1e4a0f08011e983c0f694b9b0a943 100644 (file)
@@ -15,9 +15,7 @@ PKG_CHECK_MODULES(
        gio-unix-2.0
        glib-2.0 >= 2.32
        gobject-2.0
-        dbus-1
-        dbus-glib-1
-        signond >= 8.40);
+       signond >= 8.40);
 AC_SUBST(DEPS_CFLAGS)
 AC_SUBST(DEPS_LIBS)
 
index 5483b21e5461b48b6f707d023dcaa73ab23c5651..6783003a6f4880562da45bc12397d7a84c07665a 100644 (file)
@@ -45,8 +45,6 @@ libsignon_glib_la_SOURCES = \
        signon-auth-session.c \
        signon-errors.h \
        signon-errors.c \
-       signon-proxy.h \
-       signon-proxy.c \
        signon-utils.h \
        signon-utils.c \
        sso-auth-service.c \
index 622e2d6ecf864d8a80209174bc6d4b21fc9410ba..6ecde09242e0e33fbb54a221c4ecacd4af4252e3 100644 (file)
@@ -27,7 +27,6 @@
 #include "signon-enum-types.h"
 #include "signon-internals.h"
 #include "signoncommon.h"
-#include <dbus/dbus-glib.h>
 #include <gio/gio.h>
 
 /**
@@ -51,39 +50,3 @@ GQuark signon_error_quark (void)
                                         G_N_ELEMENTS (signon_error_entries));
     return (GQuark) quark;
 }
-
-GError *
-_signon_errors_get_error_from_dbus (GError *error)
-{
-    const gchar *error_name;
-    const gchar *nick;
-    GType enum_type;
-    GEnumClass *enum_class;
-    GEnumValue *enum_value;
-    GError *new_error;
-    gint code = SIGNON_ERROR_UNKNOWN;
-
-    if (error == NULL)
-        return NULL;
-
-    error_name = dbus_g_error_get_name (error);
-
-    if (!g_str_has_prefix (error_name, SIGNON_ERROR_PREFIX))
-        return error;
-
-    nick = error_name + sizeof(SIGNON_ERROR_PREFIX);
-
-    enum_type = signon_error_get_type ();
-    enum_class = g_type_class_ref (enum_type);
-    enum_value = g_enum_get_value_by_nick (enum_class, nick);
-
-    if (enum_value)
-        code = enum_value->value;
-
-    new_error = g_error_new_literal (SIGNON_ERROR, code, error->message);
-
-    g_error_free (error);
-    g_type_class_unref (enum_class);
-
-    return new_error;
-}
index e0f5d76546305d494057bfd3b9089ff34db7d5ed..bd7fd797539d6c9c20c5b0eb6b58b71f7d911207 100644 (file)
@@ -86,164 +86,6 @@ void signon_identity_info_set_methods (SignonIdentityInfo *info,
     g_hash_table_foreach ((GHashTable *)methods, identity_methods_copy, info);
 }
 
-static void
-add_method (gpointer key, gpointer value, gpointer user_data)
-{
-    gchar **stringarray = (gchar **)value;
-    g_hash_table_insert ((GHashTable *)user_data, g_strdup((gchar *)key),
-                         g_strdupv (stringarray));
-}
-
-SignonIdentityInfo *
-signon_identity_info_new_from_hash_table (GHashTable *map)
-{
-    if (!map)
-        return NULL;
-
-    SignonIdentityInfo *info = signon_identity_info_new ();
-
-    DEBUG("%s: ", G_STRFUNC);
-    GValue *value;
-
-    /* get the id (gint) */
-    value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_ID);
-    if (value != NULL)
-    {
-        g_assert (G_VALUE_HOLDS_UINT (value));
-        identity_info_set_id (info, g_value_get_uint (value));
-    }
-
-    /* get the user name (gchar*) */
-    value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_USERNAME);
-    if (value != NULL)
-    {
-        g_assert (G_VALUE_HOLDS_STRING (value));
-        signon_identity_info_set_username (info, g_value_get_string (value));
-    }
-
-    /* get the password (gchar*) */
-    value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_SECRET);
-    if (value != NULL)
-    {
-        GValue *v_store_secret;
-        gboolean store_secret;
-
-        g_assert (G_VALUE_HOLDS_STRING (value));
-
-        v_store_secret = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_STORESECRET);
-        store_secret = (v_store_secret != NULL) ?
-            g_value_get_boolean (v_store_secret) : FALSE;
-
-        signon_identity_info_set_secret (info, g_value_get_string (value),
-                                         store_secret);
-    }
-
-    /* get the caption (gchar*) */
-    value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_CAPTION);
-    if (value != NULL)
-    {
-        g_assert (G_VALUE_HOLDS_STRING (value));
-        signon_identity_info_set_caption (info, g_value_get_string (value));
-    }
-
-    /* get the realms (gchar**) */
-    value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_REALMS);
-    if (value != NULL)
-    {
-        g_assert (G_VALUE_TYPE (value) == G_TYPE_STRV);
-        signon_identity_info_set_realms (info,
-                                         (const gchar* const *)
-                                         g_value_get_boxed (value));
-    }
-
-    /* get the methods */
-    value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_AUTHMETHODS);
-    if (value != NULL)
-    {
-        g_assert (G_VALUE_HOLDS_BOXED (value));
-        g_assert (G_VALUE_TYPE (value) ==
-                  dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRV));
-
-        info->methods = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                               g_free, (GDestroyNotify)g_strfreev);
-        g_hash_table_foreach ((GHashTable *)g_value_get_boxed(value),
-                              add_method,
-                              info->methods);
-    }
-
-    /* get the accessControlList (gchar**) */
-    value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_ACL);
-    if (value != NULL)
-    {
-        g_assert (G_VALUE_TYPE (value) == G_TYPE_STRV);
-        signon_identity_info_set_access_control_list (info,
-                                                      (const gchar* const *)
-                                                      g_value_get_boxed (value));
-    }
-
-    /* get the type (gint) */
-    value = g_hash_table_lookup (map, SIGNOND_IDENTITY_INFO_TYPE);
-    if (value != NULL)
-    {
-        g_assert (G_VALUE_HOLDS_INT(value));
-        signon_identity_info_set_identity_type (info, g_value_get_int (value));
-    }
-
-    return info;
-}
-
-GHashTable *
-signon_identity_info_to_hash_table (const SignonIdentityInfo *self)
-{
-    GHashTable *map;
-    GValue *value;
-    GType type;
-
-    map = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                 NULL,
-                                 signon_gvalue_free);
-
-    value = signon_gvalue_new (G_TYPE_UINT);
-    g_value_set_uint (value, self->id);
-    g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_ID, value);
-
-    value = signon_gvalue_new (G_TYPE_STRING);
-    g_value_set_string (value, self->username);
-    g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_USERNAME, value);
-
-    value = signon_gvalue_new (G_TYPE_STRING);
-    g_value_set_string (value, self->secret);
-    g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_SECRET, value);
-
-    value = signon_gvalue_new (G_TYPE_STRING);
-    g_value_set_string (value, self->caption);
-    g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_CAPTION, value);
-
-    value = signon_gvalue_new (G_TYPE_BOOLEAN);
-    g_value_set_boolean (value, self->store_secret);
-    g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_STORESECRET, value);
-
-    type = dbus_g_type_get_map ("GHashTable",
-                                G_TYPE_STRING, G_TYPE_STRV);
-    value = signon_gvalue_new (type);
-    g_value_set_boxed (value, self->methods);
-    g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_AUTHMETHODS, value);
-
-    value = signon_gvalue_new (G_TYPE_STRV);
-    g_value_set_boxed (value, self->realms);
-    g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_REALMS, value);
-
-    value = signon_gvalue_new (G_TYPE_STRV);
-    g_value_set_boxed (value, self->access_control_list);
-    g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_ACL, value);
-
-    value = signon_gvalue_new (G_TYPE_INT);
-    g_value_set_int (value, self->type);
-    g_hash_table_insert (map, SIGNOND_IDENTITY_INFO_TYPE, value);
-
-    return map;
-}
-
 SignonIdentityInfo *
 signon_identity_info_new_from_variant (GVariant *variant)
 {
index 8fefbce7ba1420265534e753afec1595f831b4f9..c93c0d658925e2ff2201a72b89c3771f29f03a6b 100644 (file)
@@ -37,7 +37,6 @@
 #endif
 
 #include <signoncommon.h>
-#include <dbus/dbus-glib.h>
 
 #include "signon-identity.h"
 #include "signon-auth-session.h"
@@ -57,10 +56,6 @@ struct _SignonIdentityInfo
     gint type;
 };
 
-G_GNUC_INTERNAL
-SignonIdentityInfo *
-signon_identity_info_new_from_hash_table (GHashTable *map);
-
 G_GNUC_INTERNAL
 SignonIdentityInfo *
 signon_identity_info_new_from_variant (GVariant *variant);
@@ -69,22 +64,10 @@ G_GNUC_INTERNAL
 GVariant *
 signon_identity_info_to_variant (const SignonIdentityInfo *self);
 
-G_GNUC_INTERNAL
-GHashTable *
-signon_identity_info_to_hash_table (const SignonIdentityInfo *self);
-
 G_GNUC_INTERNAL
 void signon_identity_info_set_methods (SignonIdentityInfo *self,
                                        const GHashTable *methods);
 
-G_GNUC_INTERNAL
-void _signon_identity_registered (SignonIdentity *identity, DBusGProxy *proxy,
-                                  char *objectPath, GPtrArray *identityArray,
-                                  GError *error);
-
-G_GNUC_INTERNAL
-GError *_signon_errors_get_error_from_dbus (GError *error);
-
 G_GNUC_INTERNAL
 void signon_auth_session_set_id(SignonAuthSession* self,
                                 gint32 id);
index f9dbce568432b4bc2c8a823a2b75f90a4712e73b..70ef29985550fd4df5b418db1ab02119aab0abfe 100644 (file)
@@ -1,3 +1,2 @@
-VOID:POINTER,UINT,BOXED
 VOID:INT,STRING
 
diff --git a/libsignon-glib/signon-proxy.c b/libsignon-glib/signon-proxy.c
deleted file mode 100644 (file)
index d14bdf5..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/* 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.
- *
- * Contact: Alberto Mardegan <alberto.mardegan@nokia.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-proxy.h"
-#include "signon-internals.h"
-#include <dbus/dbus-glib.h>
-
-G_DEFINE_TYPE (SignonProxy, signon_proxy, DBUS_TYPE_G_PROXY);
-
-static SignonProxy *signon_proxy = NULL;
-
-static void
-signon_proxy_init (SignonProxy *self)
-{
-}
-
-static GObject *
-signon_proxy_constructor (GType type, guint n_params,
-                          GObjectConstructParam *params)
-{
-    GObjectClass *object_class =
-        (GObjectClass *)signon_proxy_parent_class;
-    GObject *object;
-
-    if (!signon_proxy)
-    {
-        object = object_class->constructor (type,
-                                            n_params,
-                                            params);
-        signon_proxy = SIGNON_PROXY (object);
-    }
-    else
-        object = g_object_ref (G_OBJECT (signon_proxy));
-
-    return object;
-}
-
-static void
-signon_proxy_dispose (GObject *object)
-{
-    G_OBJECT_CLASS (signon_proxy_parent_class)->dispose (object);
-}
-
-static void
-signon_proxy_finalize (GObject *object)
-{
-    G_OBJECT_CLASS (signon_proxy_parent_class)->finalize (object);
-    signon_proxy = NULL;
-}
-
-static void
-signon_proxy_class_init (SignonProxyClass *klass)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-    object_class->dispose = signon_proxy_dispose;
-    object_class->constructor = signon_proxy_constructor;
-    object_class->finalize = signon_proxy_finalize;
-}
-
-SignonProxy *
-signon_proxy_new ()
-{
-    SignonProxy *proxy;
-    GError *error = NULL;
-
-    DBusGConnection *connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
-
-    if (error)
-    {
-        g_warning ("%s returned error: %s", G_STRFUNC, error->message);
-        g_error_free (error);
-        return NULL;
-    }
-
-    proxy = g_object_new (SIGNON_TYPE_PROXY,
-                          "name", SIGNOND_SERVICE,
-                          "path", SIGNOND_DAEMON_OBJECTPATH,
-                          "interface", SIGNOND_DAEMON_INTERFACE,
-                          "connection", connection,
-                          NULL);
-
-    dbus_g_connection_unref (connection);
-
-    return proxy;
-}
diff --git a/libsignon-glib/signon-proxy.h b/libsignon-glib/signon-proxy.h
deleted file mode 100644 (file)
index 4ef973b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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.
- *
- * Contact: Alberto Mardegan <alberto.mardegan@nokia.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_AUTH_PROXY_H_
-#define _SIGNON_AUTH_PROXY_H_
-
-
-#include <glib-object.h>
-#include <dbus/dbus-glib.h>
-
-#define SIGNON_TYPE_PROXY             (signon_proxy_get_type ())
-#define SIGNON_PROXY(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIGNON_TYPE_PROXY, SignonProxy))
-#define SIGNON_PROXY_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), SIGNON_TYPE_PROXY, SignonProxyClass))
-#define SIGNON_IS_PROXY(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIGNON_TYPE_PROXY))
-#define SIGNON_IS_PROXY_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), SIGNON_TYPE_PROXY))
-#define SIGNON_PROXY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), SIGNON_TYPE_PROXY, SignonProxyClass))
-
-
-typedef struct _SignonProxyClass SignonProxyClass;
-typedef struct _SignonProxy SignonProxy;
-
-struct _SignonProxyClass
-{
-    DBusGProxyClass parent_class;
-};
-
-struct _SignonProxy
-{
-    DBusGProxyClass parent_instance;
-};
-
-G_GNUC_INTERNAL
-GType signon_proxy_get_type (void) G_GNUC_CONST;
-
-G_GNUC_INTERNAL
-SignonProxy *signon_proxy_new ();
-
-G_END_DECLS
-
-#endif /* _SIGNON_PROXY_H_ */
index 485e7426500c27f18306896e161e582d6a1c6ad8..e1c2f0082efbf70c44c76dfd91623f4afe836494 100644 (file)
 #include "libsignon-glib/signon-auth-service.h"
 #include "libsignon-glib/signon-auth-session.h"
 #include "libsignon-glib/signon-identity.h"
-#include "libsignon-glib/signon-client-glib-gen.h"
-#include "libsignon-glib/signon-identity-glib-gen.h"
 #include "libsignon-glib/signon-errors.h"
 
 #include <glib.h>
 #include <check.h>
 #include <stdlib.h>
 #include <string.h>
-#include <dbus/dbus-glib.h>
 
 static GMainLoop *main_loop = NULL;
 static SignonIdentity *identity = NULL;