1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details:
*
* Copyright (C) 2010 - 2012 Red Hat, Inc.
* Copyright (C) 2012 Google, Inc.
*/
#include "mm-auth-provider.h"
G_DEFINE_TYPE (MMAuthProvider, mm_auth_provider, G_TYPE_OBJECT)
/*****************************************************************************/
MMAuthProvider *
mm_auth_provider_new (void)
{
return g_object_new (MM_TYPE_AUTH_PROVIDER, NULL);
}
/*****************************************************************************/
gboolean
mm_auth_provider_authorize_finish (MMAuthProvider *self,
GAsyncResult *res,
GError **error)
{
g_return_val_if_fail (MM_IS_AUTH_PROVIDER (self), FALSE);
return MM_AUTH_PROVIDER_GET_CLASS (self)->authorize_finish (self, res, error);
}
void
mm_auth_provider_authorize (MMAuthProvider *self,
GDBusMethodInvocation *invocation,
const gchar *authorization,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_return_if_fail (MM_IS_AUTH_PROVIDER (self));
MM_AUTH_PROVIDER_GET_CLASS (self)->authorize (self,
invocation,
authorization,
cancellable,
callback,
user_data);
}
/*****************************************************************************/
static gboolean
authorize_finish (MMAuthProvider *self,
GAsyncResult *res,
GError **error)
{
/* Null auth; everything passes */
return TRUE;
}
static void
authorize (MMAuthProvider *self,
GDBusMethodInvocation *invocation,
const gchar *authorization,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *result;
/* Just create the result and complete it */
result = g_simple_async_result_new (G_OBJECT (self),
callback,
user_data,
authorize);
g_simple_async_result_complete_in_idle (result);
g_object_unref (result);
}
/*****************************************************************************/
static void
mm_auth_provider_init (MMAuthProvider *self)
{
}
static void
mm_auth_provider_class_init (MMAuthProviderClass *class)
{
/* Virtual methods */
class->authorize = authorize;
class->authorize_finish = authorize_finish;
}
|