diff options
author | Stef Walter <stefw@redhat.com> | 2014-09-03 11:04:06 +0200 |
---|---|---|
committer | Daiki Ueno <dueno@src.gnome.org> | 2018-02-15 17:05:07 +0100 |
commit | 3548ba1367fa977728746939af3abc899e205546 (patch) | |
tree | d60d7749568a9677da8f85efce199ddf988c8fbf /gck | |
parent | 09fe5705e81485d33ecf07a7c0fdc6613aff1993 (diff) | |
download | gcr-3548ba1367fa977728746939af3abc899e205546.tar.gz |
egg: Move mock-interaction.[ch] to egg/ directory
Since we want to use this from the gcr/ code
https://bugzilla.gnome.org/show_bug.cgi?id=735873
Diffstat (limited to 'gck')
-rw-r--r-- | gck/Makefile.am | 12 | ||||
-rw-r--r-- | gck/mock-interaction.c | 96 | ||||
-rw-r--r-- | gck/mock-interaction.h | 42 | ||||
-rw-r--r-- | gck/test-gck-enumerator.c | 3 | ||||
-rw-r--r-- | gck/test-gck-session.c | 3 |
5 files changed, 6 insertions, 150 deletions
diff --git a/gck/Makefile.am b/gck/Makefile.am index 44a2882..10fb456 100644 --- a/gck/Makefile.am +++ b/gck/Makefile.am @@ -213,11 +213,9 @@ test_gck_crypto_SOURCES = gck/test-gck-crypto.c test_gck_crypto_CFLAGS = $(gck_CFLAGS) test_gck_crypto_LDADD = $(gck_LIBS) -test_gck_enumerator_SOURCES = \ - gck/test-gck-enumerator.c \ - gck/mock-interaction.c gck/mock-interaction.h +test_gck_enumerator_SOURCES = gck/test-gck-enumerator.c test_gck_enumerator_CFLAGS = $(gck_CFLAGS) -test_gck_enumerator_LDADD = $(gck_LIBS) +test_gck_enumerator_LDADD = libegg-test.la $(gck_LIBS) test_gck_object_SOURCES = gck/test-gck-object.c test_gck_object_CFLAGS = $(gck_CFLAGS) @@ -231,11 +229,9 @@ test_gck_modules_SOURCES = gck/test-gck-modules.c test_gck_modules_CFLAGS = $(gck_CFLAGS) test_gck_modules_LDADD = $(gck_LIBS) -test_gck_session_SOURCES = \ - gck/test-gck-session.c \ - gck/mock-interaction.c gck/mock-interaction.h +test_gck_session_SOURCES = gck/test-gck-session.c test_gck_session_CFLAGS = $(gck_CFLAGS) -test_gck_session_LDADD = $(gck_LIBS) +test_gck_session_LDADD = libegg-test.la $(gck_LIBS) test_gck_slot_SOURCES = gck/test-gck-slot.c test_gck_slot_CFLAGS = $(gck_CFLAGS) diff --git a/gck/mock-interaction.c b/gck/mock-interaction.c deleted file mode 100644 index c431454..0000000 --- a/gck/mock-interaction.c +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mock-interaction.c - - Copyright (C) 2011 Collabora Ltd - - The Gnome Keyring Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Keyring 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - see <http://www.gnu.org/licenses/>. - - Author: Stef Walter <stefw@collabora.co.uk> -*/ - -#include "config.h" - -#include "mock-interaction.h" - -#define MOCK_INTERACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOCK_TYPE_INTERACTION, MockInteraction)) -#define MOCK_IS_INTERACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOCK_TYPE_INTERACTION)) -#define MOCK_INTERACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOCK_TYPE_INTERACTION, MockInteractionClass)) - -typedef struct _MockInteractionClass MockInteractionClass; - -struct _MockInteraction { - GTlsInteraction interaction; - gchar *password; -}; - -struct _MockInteractionClass { - GTlsInteractionClass parent; -}; - -G_DEFINE_TYPE (MockInteraction, mock_interaction, G_TYPE_TLS_INTERACTION); - -static void -mock_interaction_init (MockInteraction *self) -{ - -} - -static void -mock_interaction_finalize (GObject *obj) -{ - MockInteraction *self = MOCK_INTERACTION (obj); - - g_free (self->password); - - G_OBJECT_CLASS (mock_interaction_parent_class)->dispose (obj); -} - -static GTlsInteractionResult -mock_interaction_ask_password (GTlsInteraction *interaction, - GTlsPassword *password, - GCancellable *cancellable, - GError **error) -{ - MockInteraction *self = MOCK_INTERACTION (interaction); - - if (self->password) { - g_tls_password_set_value (password, (const guchar *)self->password, -1); - return G_TLS_INTERACTION_HANDLED; - } else { - return G_TLS_INTERACTION_UNHANDLED; - } -} - -static void -mock_interaction_class_init (MockInteractionClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GTlsInteractionClass *interaction_class = G_TLS_INTERACTION_CLASS (klass); - - object_class->finalize = mock_interaction_finalize; - - interaction_class->ask_password = mock_interaction_ask_password; -} - -GTlsInteraction * -mock_interaction_new (const gchar *password) -{ - MockInteraction *result; - - result = g_object_new (MOCK_TYPE_INTERACTION, NULL); - result->password = g_strdup (password); - - return G_TLS_INTERACTION (result); -} diff --git a/gck/mock-interaction.h b/gck/mock-interaction.h deleted file mode 100644 index 5053cd2..0000000 --- a/gck/mock-interaction.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* mock-interaction.h - - Copyright (C) 2011 Collabora Ltd - - The Gnome Keyring Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Keyring 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - see <http://www.gnu.org/licenses/>. - - Author: Stef Walter <stefw@collabora.co.uk> -*/ - -#ifndef MOCK_INTERACTION_H -#define MOCK_INTERACTION_H - -#include <gio/gio.h> - -G_BEGIN_DECLS - -#define MOCK_TYPE_INTERACTION (mock_interaction_get_type ()) -#define MOCK_INTERACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOCK_TYPE_INTERACTION, MockInteraction)) -#define MOCK_IS_INTERACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOCK_TYPE_INTERACTION)) - -typedef struct _MockInteraction MockInteraction; - -GType mock_interaction_get_type (void) G_GNUC_CONST; - -GTlsInteraction * mock_interaction_new (const gchar *password); - -G_END_DECLS - -#endif /* MOCK_INTERACTION_H */ diff --git a/gck/test-gck-enumerator.c b/gck/test-gck-enumerator.c index 90e7253..13ea19f 100644 --- a/gck/test-gck-enumerator.c +++ b/gck/test-gck-enumerator.c @@ -27,9 +27,8 @@ #include "gck/gck-private.h" #include "gck/gck-test.h" -#include "mock-interaction.h" - #include "egg/egg-testing.h" +#include "egg/mock-interaction.h" #include <glib.h> diff --git a/gck/test-gck-session.c b/gck/test-gck-session.c index cedb436..6cd4c97 100644 --- a/gck/test-gck-session.c +++ b/gck/test-gck-session.c @@ -22,12 +22,11 @@ #include "config.h" -#include "mock-interaction.h" - #include "gck/gck.h" #include "gck/gck-test.h" #include "egg/egg-testing.h" +#include "egg/mock-interaction.h" #include <glib.h> |