Merge branch 'master' of git://git.project-moonshot.org/moonshot-ui into HEAD
[moonshot-ui.git] / src / moonshot-identity-request.c
1 /* moonshot-identity-request.c generated by valac 0.10.4, the Vala compiler
2  * generated from moonshot-identity-request.vala, do not modify */
3
4
5 #include <glib.h>
6 #include <glib-object.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <gtk/gtk.h>
10
11
12 #define TYPE_IDENTITY_REQUEST (identity_request_get_type ())
13 #define IDENTITY_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_REQUEST, IdentityRequest))
14 #define IDENTITY_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_REQUEST, IdentityRequestClass))
15 #define IS_IDENTITY_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_REQUEST))
16 #define IS_IDENTITY_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_REQUEST))
17 #define IDENTITY_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_REQUEST, IdentityRequestClass))
18
19 typedef struct _IdentityRequest IdentityRequest;
20 typedef struct _IdentityRequestClass IdentityRequestClass;
21 typedef struct _IdentityRequestPrivate IdentityRequestPrivate;
22
23 #define TYPE_ID_CARD (id_card_get_type ())
24 #define ID_CARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ID_CARD, IdCard))
25 #define ID_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ID_CARD, IdCardClass))
26 #define IS_ID_CARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ID_CARD))
27 #define IS_ID_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ID_CARD))
28 #define ID_CARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ID_CARD, IdCardClass))
29
30 typedef struct _IdCard IdCard;
31 typedef struct _IdCardClass IdCardClass;
32
33 #define TYPE_IDENTITY_MANAGER_VIEW (identity_manager_view_get_type ())
34 #define IDENTITY_MANAGER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerView))
35 #define IDENTITY_MANAGER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerViewClass))
36 #define IS_IDENTITY_MANAGER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_MANAGER_VIEW))
37 #define IS_IDENTITY_MANAGER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_MANAGER_VIEW))
38 #define IDENTITY_MANAGER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerViewClass))
39
40 typedef struct _IdentityManagerView IdentityManagerView;
41 typedef struct _IdentityManagerViewClass IdentityManagerViewClass;
42 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
43 #define _g_free0(var) (var = (g_free (var), NULL))
44 typedef struct _Block2Data Block2Data;
45
46 typedef void (*ReturnIdentityCallback) (IdentityRequest* request, void* user_data);
47 struct _IdentityRequest {
48         GObject parent_instance;
49         IdentityRequestPrivate * priv;
50         IdCard* id_card;
51         gboolean complete;
52         gboolean select_default;
53         char* nai;
54         char* password;
55         char* service;
56 };
57
58 struct _IdentityRequestClass {
59         GObjectClass parent_class;
60 };
61
62 struct _IdentityRequestPrivate {
63         IdentityManagerView* main_window;
64         ReturnIdentityCallback callback;
65         gpointer callback_target;
66         GDestroyNotify callback_target_destroy_notify;
67 };
68
69 struct _Block2Data {
70         int _ref_count_;
71         IdentityRequest * self;
72         ReturnIdentityCallback cb;
73         gpointer cb_target;
74         GDestroyNotify cb_target_destroy_notify;
75 };
76
77
78 static gpointer identity_request_parent_class = NULL;
79
80 GType identity_request_get_type (void) G_GNUC_CONST;
81 GType id_card_get_type (void) G_GNUC_CONST;
82 GType identity_manager_view_get_type (void) G_GNUC_CONST;
83 #define IDENTITY_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_IDENTITY_REQUEST, IdentityRequestPrivate))
84 enum  {
85         IDENTITY_REQUEST_DUMMY_PROPERTY
86 };
87 IdentityRequest* identity_request_new (IdentityManagerView* main_window, const char* nai, const char* password, const char* service);
88 IdentityRequest* identity_request_construct (GType object_type, IdentityManagerView* main_window, const char* nai, const char* password, const char* service);
89 IdentityRequest* identity_request_new_default (IdentityManagerView* main_window);
90 IdentityRequest* identity_request_construct_default (GType object_type, IdentityManagerView* main_window);
91 void identity_request_set_callback (IdentityRequest* self, ReturnIdentityCallback cb, void* cb_target, GDestroyNotify cb_target_destroy_notify);
92 static void _lambda0_ (IdentityRequest* IdCard, Block2Data* _data2_);
93 static void __lambda0__return_identity_callback (IdentityRequest* request, gpointer self);
94 static Block2Data* block2_data_ref (Block2Data* _data2_);
95 static void block2_data_unref (Block2Data* _data2_);
96 gboolean identity_request_execute (IdentityRequest* self);
97 void identity_manager_view_select_identity (IdentityManagerView* self, IdentityRequest* request);
98 void identity_request_return_identity (IdentityRequest* self, IdCard* id_card);
99 static void identity_request_finalize (GObject* obj);
100
101
102
103 static gpointer _g_object_ref0 (gpointer self) {
104         return self ? g_object_ref (self) : NULL;
105 }
106
107
108 #line 15 "moonshot-identity-request.vala"
109 IdentityRequest* identity_request_construct (GType object_type, IdentityManagerView* main_window, const char* nai, const char* password, const char* service) {
110 #line 111 "moonshot-identity-request.c"
111         IdentityRequest * self = NULL;
112         IdentityManagerView* _tmp0_;
113         char* _tmp1_;
114         char* _tmp2_;
115         char* _tmp3_;
116 #line 15 "moonshot-identity-request.vala"
117         g_return_val_if_fail (main_window != NULL, NULL);
118 #line 15 "moonshot-identity-request.vala"
119         g_return_val_if_fail (nai != NULL, NULL);
120 #line 15 "moonshot-identity-request.vala"
121         g_return_val_if_fail (password != NULL, NULL);
122 #line 15 "moonshot-identity-request.vala"
123         g_return_val_if_fail (service != NULL, NULL);
124 #line 15 "moonshot-identity-request.vala"
125         self = (IdentityRequest*) g_object_new (object_type, NULL);
126 #line 20 "moonshot-identity-request.vala"
127         self->priv->main_window = (_tmp0_ = _g_object_ref0 (main_window), _g_object_unref0 (self->priv->main_window), _tmp0_);
128 #line 21 "moonshot-identity-request.vala"
129         self->nai = (_tmp1_ = g_strdup (nai), _g_free0 (self->nai), _tmp1_);
130 #line 22 "moonshot-identity-request.vala"
131         self->password = (_tmp2_ = g_strdup (password), _g_free0 (self->password), _tmp2_);
132 #line 23 "moonshot-identity-request.vala"
133         self->service = (_tmp3_ = g_strdup (service), _g_free0 (self->service), _tmp3_);
134 #line 135 "moonshot-identity-request.c"
135         return self;
136 }
137
138
139 #line 15 "moonshot-identity-request.vala"
140 IdentityRequest* identity_request_new (IdentityManagerView* main_window, const char* nai, const char* password, const char* service) {
141 #line 15 "moonshot-identity-request.vala"
142         return identity_request_construct (TYPE_IDENTITY_REQUEST, main_window, nai, password, service);
143 #line 144 "moonshot-identity-request.c"
144 }
145
146
147 #line 26 "moonshot-identity-request.vala"
148 IdentityRequest* identity_request_construct_default (GType object_type, IdentityManagerView* main_window) {
149 #line 150 "moonshot-identity-request.c"
150         IdentityRequest * self = NULL;
151         IdentityManagerView* _tmp0_;
152 #line 26 "moonshot-identity-request.vala"
153         g_return_val_if_fail (main_window != NULL, NULL);
154 #line 26 "moonshot-identity-request.vala"
155         self = (IdentityRequest*) g_object_new (object_type, NULL);
156 #line 28 "moonshot-identity-request.vala"
157         self->priv->main_window = (_tmp0_ = _g_object_ref0 (main_window), _g_object_unref0 (self->priv->main_window), _tmp0_);
158 #line 29 "moonshot-identity-request.vala"
159         self->select_default = TRUE;
160 #line 161 "moonshot-identity-request.c"
161         return self;
162 }
163
164
165 #line 26 "moonshot-identity-request.vala"
166 IdentityRequest* identity_request_new_default (IdentityManagerView* main_window) {
167 #line 26 "moonshot-identity-request.vala"
168         return identity_request_construct_default (TYPE_IDENTITY_REQUEST, main_window);
169 #line 170 "moonshot-identity-request.c"
170 }
171
172
173 #line 37 "moonshot-identity-request.vala"
174 static void _lambda0_ (IdentityRequest* IdCard, Block2Data* _data2_) {
175 #line 176 "moonshot-identity-request.c"
176         IdentityRequest * self;
177         self = _data2_->self;
178 #line 37 "moonshot-identity-request.vala"
179         g_return_if_fail (IdCard != NULL);
180 #line 37 "moonshot-identity-request.vala"
181         _data2_->cb (IdCard, _data2_->cb_target);
182 #line 183 "moonshot-identity-request.c"
183 }
184
185
186 #line 37 "moonshot-identity-request.vala"
187 static void __lambda0__return_identity_callback (IdentityRequest* request, gpointer self) {
188 #line 189 "moonshot-identity-request.c"
189         _lambda0_ (request, self);
190 }
191
192
193 static Block2Data* block2_data_ref (Block2Data* _data2_) {
194         g_atomic_int_inc (&_data2_->_ref_count_);
195         return _data2_;
196 }
197
198
199 static void block2_data_unref (Block2Data* _data2_) {
200         if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
201                 _g_object_unref0 (_data2_->self);
202                 (_data2_->cb_target_destroy_notify == NULL) ? NULL : (_data2_->cb_target_destroy_notify (_data2_->cb_target), NULL);
203                 _data2_->cb = NULL;
204                 _data2_->cb_target = NULL;
205                 _data2_->cb_target_destroy_notify = NULL;
206                 g_slice_free (Block2Data, _data2_);
207         }
208 }
209
210
211 #line 32 "moonshot-identity-request.vala"
212 void identity_request_set_callback (IdentityRequest* self, ReturnIdentityCallback cb, void* cb_target, GDestroyNotify cb_target_destroy_notify) {
213 #line 214 "moonshot-identity-request.c"
214         Block2Data* _data2_;
215         ReturnIdentityCallback _tmp0_;
216 #line 32 "moonshot-identity-request.vala"
217         g_return_if_fail (self != NULL);
218 #line 219 "moonshot-identity-request.c"
219         _data2_ = g_slice_new0 (Block2Data);
220         _data2_->_ref_count_ = 1;
221         _data2_->self = g_object_ref (self);
222         _data2_->cb = cb;
223         _data2_->cb_target = cb_target;
224         _data2_->cb_target_destroy_notify = cb_target_destroy_notify;
225 #line 37 "moonshot-identity-request.vala"
226         self->priv->callback = (_tmp0_ = __lambda0__return_identity_callback, ((self->priv->callback_target_destroy_notify == NULL) ? NULL : (self->priv->callback_target_destroy_notify (self->priv->callback_target), NULL), self->priv->callback = NULL, self->priv->callback_target = NULL, self->priv->callback_target_destroy_notify = NULL), self->priv->callback_target = block2_data_ref (_data2_), self->priv->callback_target_destroy_notify = block2_data_unref, _tmp0_);
227 #line 228 "moonshot-identity-request.c"
228         block2_data_unref (_data2_);
229 }
230
231
232 #line 41 "moonshot-identity-request.vala"
233 gboolean identity_request_execute (IdentityRequest* self) {
234 #line 235 "moonshot-identity-request.c"
235         gboolean result = FALSE;
236 #line 41 "moonshot-identity-request.vala"
237         g_return_val_if_fail (self != NULL, FALSE);
238 #line 42 "moonshot-identity-request.vala"
239         identity_manager_view_select_identity (self->priv->main_window, self);
240 #line 241 "moonshot-identity-request.c"
241         result = FALSE;
242 #line 47 "moonshot-identity-request.vala"
243         return result;
244 #line 245 "moonshot-identity-request.c"
245 }
246
247
248 #line 50 "moonshot-identity-request.vala"
249 void identity_request_return_identity (IdentityRequest* self, IdCard* id_card) {
250 #line 251 "moonshot-identity-request.c"
251         IdCard* _tmp0_;
252 #line 50 "moonshot-identity-request.vala"
253         g_return_if_fail (self != NULL);
254 #line 51 "moonshot-identity-request.vala"
255         g_return_if_fail (self->priv->callback != NULL);
256 #line 53 "moonshot-identity-request.vala"
257         self->id_card = (_tmp0_ = _g_object_ref0 (id_card), _g_object_unref0 (self->id_card), _tmp0_);
258 #line 54 "moonshot-identity-request.vala"
259         self->complete = TRUE;
260 #line 56 "moonshot-identity-request.vala"
261         self->priv->callback (self, self->priv->callback_target);
262 #line 263 "moonshot-identity-request.c"
263 }
264
265
266 static void identity_request_class_init (IdentityRequestClass * klass) {
267         identity_request_parent_class = g_type_class_peek_parent (klass);
268         g_type_class_add_private (klass, sizeof (IdentityRequestPrivate));
269         G_OBJECT_CLASS (klass)->finalize = identity_request_finalize;
270 }
271
272
273 static void identity_request_instance_init (IdentityRequest * self) {
274         self->priv = IDENTITY_REQUEST_GET_PRIVATE (self);
275         self->id_card = NULL;
276         self->complete = FALSE;
277         self->select_default = FALSE;
278         self->priv->callback = NULL;
279 }
280
281
282 static void identity_request_finalize (GObject* obj) {
283         IdentityRequest * self;
284         self = IDENTITY_REQUEST (obj);
285         _g_object_unref0 (self->id_card);
286         _g_object_unref0 (self->priv->main_window);
287         _g_free0 (self->nai);
288         _g_free0 (self->password);
289         _g_free0 (self->service);
290         (self->priv->callback_target_destroy_notify == NULL) ? NULL : (self->priv->callback_target_destroy_notify (self->priv->callback_target), NULL);
291         self->priv->callback = NULL;
292         self->priv->callback_target = NULL;
293         self->priv->callback_target_destroy_notify = NULL;
294         G_OBJECT_CLASS (identity_request_parent_class)->finalize (obj);
295 }
296
297
298 GType identity_request_get_type (void) {
299         static volatile gsize identity_request_type_id__volatile = 0;
300         if (g_once_init_enter (&identity_request_type_id__volatile)) {
301                 static const GTypeInfo g_define_type_info = { sizeof (IdentityRequestClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) identity_request_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IdentityRequest), 0, (GInstanceInitFunc) identity_request_instance_init, NULL };
302                 GType identity_request_type_id;
303                 identity_request_type_id = g_type_register_static (G_TYPE_OBJECT, "IdentityRequest", &g_define_type_info, 0);
304                 g_once_init_leave (&identity_request_type_id__volatile, identity_request_type_id);
305         }
306         return identity_request_type_id__volatile;
307 }
308
309
310
311