9e8c57cff3d6fec5c9ce129ca2035d17536beb77
[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_MAIN_WINDOW (main_window_get_type ())
34 #define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
35 #define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
36 #define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
37 #define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
38 #define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))
39
40 typedef struct _MainWindow MainWindow;
41 typedef struct _MainWindowClass MainWindowClass;
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 _Block1Data Block1Data;
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         MainWindow* main_window;
64         ReturnIdentityCallback callback;
65         gpointer callback_target;
66         GDestroyNotify callback_target_destroy_notify;
67 };
68
69 struct _Block1Data {
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 main_window_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 (MainWindow* main_window, const char* nai, const char* password, const char* service);
88 IdentityRequest* identity_request_construct (GType object_type, MainWindow* main_window, const char* nai, const char* password, const char* service);
89 IdentityRequest* identity_request_new_default (MainWindow* main_window);
90 IdentityRequest* identity_request_construct_default (GType object_type, MainWindow* 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, Block1Data* _data1_);
93 static void __lambda0__return_identity_callback (IdentityRequest* request, gpointer self);
94 static Block1Data* block1_data_ref (Block1Data* _data1_);
95 static void block1_data_unref (Block1Data* _data1_);
96 gboolean identity_request_execute (IdentityRequest* self);
97 void main_window_select_identity (MainWindow* 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 IdentityRequest* identity_request_construct (GType object_type, MainWindow* main_window, const char* nai, const char* password, const char* service) {
109         IdentityRequest * self = NULL;
110         MainWindow* _tmp0_;
111         char* _tmp1_;
112         char* _tmp2_;
113         char* _tmp3_;
114         g_return_val_if_fail (main_window != NULL, NULL);
115         g_return_val_if_fail (nai != NULL, NULL);
116         g_return_val_if_fail (password != NULL, NULL);
117         g_return_val_if_fail (service != NULL, NULL);
118         self = (IdentityRequest*) g_object_new (object_type, NULL);
119         self->priv->main_window = (_tmp0_ = _g_object_ref0 (main_window), _g_object_unref0 (self->priv->main_window), _tmp0_);
120         self->nai = (_tmp1_ = g_strdup (nai), _g_free0 (self->nai), _tmp1_);
121         self->password = (_tmp2_ = g_strdup (password), _g_free0 (self->password), _tmp2_);
122         self->service = (_tmp3_ = g_strdup (service), _g_free0 (self->service), _tmp3_);
123         return self;
124 }
125
126
127 IdentityRequest* identity_request_new (MainWindow* main_window, const char* nai, const char* password, const char* service) {
128         return identity_request_construct (TYPE_IDENTITY_REQUEST, main_window, nai, password, service);
129 }
130
131
132 IdentityRequest* identity_request_construct_default (GType object_type, MainWindow* main_window) {
133         IdentityRequest * self = NULL;
134         MainWindow* _tmp0_;
135         g_return_val_if_fail (main_window != NULL, NULL);
136         self = (IdentityRequest*) g_object_new (object_type, NULL);
137         self->priv->main_window = (_tmp0_ = _g_object_ref0 (main_window), _g_object_unref0 (self->priv->main_window), _tmp0_);
138         self->select_default = TRUE;
139         return self;
140 }
141
142
143 IdentityRequest* identity_request_new_default (MainWindow* main_window) {
144         return identity_request_construct_default (TYPE_IDENTITY_REQUEST, main_window);
145 }
146
147
148 static void _lambda0_ (IdentityRequest* IdCard, Block1Data* _data1_) {
149         IdentityRequest * self;
150         self = _data1_->self;
151         g_return_if_fail (IdCard != NULL);
152         _data1_->cb (IdCard, _data1_->cb_target);
153 }
154
155
156 static void __lambda0__return_identity_callback (IdentityRequest* request, gpointer self) {
157         _lambda0_ (request, self);
158 }
159
160
161 static Block1Data* block1_data_ref (Block1Data* _data1_) {
162         g_atomic_int_inc (&_data1_->_ref_count_);
163         return _data1_;
164 }
165
166
167 static void block1_data_unref (Block1Data* _data1_) {
168         if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
169                 _g_object_unref0 (_data1_->self);
170                 (_data1_->cb_target_destroy_notify == NULL) ? NULL : (_data1_->cb_target_destroy_notify (_data1_->cb_target), NULL);
171                 _data1_->cb = NULL;
172                 _data1_->cb_target = NULL;
173                 _data1_->cb_target_destroy_notify = NULL;
174                 g_slice_free (Block1Data, _data1_);
175         }
176 }
177
178
179 void identity_request_set_callback (IdentityRequest* self, ReturnIdentityCallback cb, void* cb_target, GDestroyNotify cb_target_destroy_notify) {
180         Block1Data* _data1_;
181         ReturnIdentityCallback _tmp0_;
182         g_return_if_fail (self != NULL);
183         _data1_ = g_slice_new0 (Block1Data);
184         _data1_->_ref_count_ = 1;
185         _data1_->self = g_object_ref (self);
186         _data1_->cb = cb;
187         _data1_->cb_target = cb_target;
188         _data1_->cb_target_destroy_notify = cb_target_destroy_notify;
189         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 = block1_data_ref (_data1_), self->priv->callback_target_destroy_notify = block1_data_unref, _tmp0_);
190         block1_data_unref (_data1_);
191 }
192
193
194 gboolean identity_request_execute (IdentityRequest* self) {
195         gboolean result = FALSE;
196         g_return_val_if_fail (self != NULL, FALSE);
197         main_window_select_identity (self->priv->main_window, self);
198         result = FALSE;
199         return result;
200 }
201
202
203 void identity_request_return_identity (IdentityRequest* self, IdCard* id_card) {
204         IdCard* _tmp0_;
205         g_return_if_fail (self != NULL);
206         g_return_if_fail (self->priv->callback != NULL);
207         self->id_card = (_tmp0_ = _g_object_ref0 (id_card), _g_object_unref0 (self->id_card), _tmp0_);
208         self->complete = TRUE;
209         self->priv->callback (self, self->priv->callback_target);
210 }
211
212
213 static void identity_request_class_init (IdentityRequestClass * klass) {
214         identity_request_parent_class = g_type_class_peek_parent (klass);
215         g_type_class_add_private (klass, sizeof (IdentityRequestPrivate));
216         G_OBJECT_CLASS (klass)->finalize = identity_request_finalize;
217 }
218
219
220 static void identity_request_instance_init (IdentityRequest * self) {
221         self->priv = IDENTITY_REQUEST_GET_PRIVATE (self);
222         self->id_card = NULL;
223         self->complete = FALSE;
224         self->select_default = FALSE;
225         self->priv->callback = NULL;
226 }
227
228
229 static void identity_request_finalize (GObject* obj) {
230         IdentityRequest * self;
231         self = IDENTITY_REQUEST (obj);
232         _g_object_unref0 (self->id_card);
233         _g_object_unref0 (self->priv->main_window);
234         _g_free0 (self->nai);
235         _g_free0 (self->password);
236         _g_free0 (self->service);
237         (self->priv->callback_target_destroy_notify == NULL) ? NULL : (self->priv->callback_target_destroy_notify (self->priv->callback_target), NULL);
238         self->priv->callback = NULL;
239         self->priv->callback_target = NULL;
240         self->priv->callback_target_destroy_notify = NULL;
241         G_OBJECT_CLASS (identity_request_parent_class)->finalize (obj);
242 }
243
244
245 GType identity_request_get_type (void) {
246         static volatile gsize identity_request_type_id__volatile = 0;
247         if (g_once_init_enter (&identity_request_type_id__volatile)) {
248                 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 };
249                 GType identity_request_type_id;
250                 identity_request_type_id = g_type_register_static (G_TYPE_OBJECT, "IdentityRequest", &g_define_type_info, 0);
251                 g_once_init_leave (&identity_request_type_id__volatile, identity_request_type_id);
252         }
253         return identity_request_type_id__volatile;
254 }
255
256
257
258