summaryrefslogtreecommitdiff
path: root/modules/gnome-online-accounts/e-goa-client.h
blob: 9896effdd9cefc3bb8667daac184321c9fef5abe (plain)
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
/*
 * e-goa-client.h
 *
 * This library is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License 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, see <http://www.gnu.org/licenses/>.
 *
 */

/* This is an improved GoaClient.  It handles goa-daemon crashes/restarts
 * gracefully by emitting an "account-swapped" signal for each pair of old
 * and new proxy objects for the same "online account" once the goa-daemon
 * restarts.  Contrast with GoaClient, which emits false "account-removed"
 * and "account-added" signals and forces apps to distinguish them from an
 * actual removal or addition of an "online account". */

#ifndef E_GOA_CLIENT_H
#define E_GOA_CLIENT_H

/* XXX Yeah, yeah... */
#define GOA_API_IS_SUBJECT_TO_CHANGE

#include <goa/goa.h>

/* Standard GObject macros */
#define E_TYPE_GOA_CLIENT \
	(e_goa_client_get_type ())
#define E_GOA_CLIENT(obj) \
	(G_TYPE_CHECK_INSTANCE_CAST \
	((obj), E_TYPE_GOA_CLIENT, EGoaClient))
#define E_GOA_CLIENT_CLASS(cls) \
	(G_TYPE_CHECK_CLASS_CAST \
	((cls), E_TYPE_GOA_CLIENT, EGoaClientClass))
#define E_IS_GOA_CLIENT(obj) \
	(G_TYPE_CHECK_INSTANCE_TYPE \
	((obj), E_TYPE_GOA_CLIENT))
#define E_IS_GOA_CLIENT_CLASS(cls) \
	(G_TYPE_CHECK_CLASS_TYPE \
	((cls), E_TYPE_GOA_CLIENT))
#define E_GOA_CLIENT_CLASS_GET_CLASS(obj) \
	(G_TYPE_INSTANCE_GET_CLASS \
	((obj), E_TYPE_GOA_CLIENT, EGoaClientClass))

G_BEGIN_DECLS

typedef struct _EGoaClient EGoaClient;
typedef struct _EGoaClientClass EGoaClientClass;
typedef struct _EGoaClientPrivate EGoaClientPrivate;

struct _EGoaClient {
	GObject parent;
	EGoaClientPrivate *priv;
};

struct _EGoaClientClass {
	GObjectClass parent_class;

	/* Signals */
	void		(*account_added)	(EGoaClient *client,
						 GoaObject *object);
	void		(*account_removed)	(EGoaClient *client,
						 GoaObject *object);
	void		(*account_swapped)	(EGoaClient *client,
						 GoaObject *old_object,
						 GoaObject *new_object);
};

GType		e_goa_client_get_type		(void) G_GNUC_CONST;
void		e_goa_client_type_register	(GTypeModule *type_module);
void		e_goa_client_new		(GCancellable *cancellable,
						 GAsyncReadyCallback callback,
						 gpointer user_data);
EGoaClient *	e_goa_client_new_finish		(GAsyncResult *result,
						 GError **error);
GDBusObjectManager *
		e_goa_client_ref_object_manager	(EGoaClient *client);
GList *		e_goa_client_list_accounts	(EGoaClient *client);
GoaObject *	e_goa_client_lookup_by_id	(EGoaClient *client,
						 const gchar *id);

G_END_DECLS

#endif /* E_GOA_CLIENT_H */