1 /* moonshot-identity-request.c generated by valac 0.10.4, the Vala compiler
2 * generated from moonshot-identity-request.vala, do not modify */
6 #include <glib-object.h>
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))
19 typedef struct _IdentityRequest IdentityRequest;
20 typedef struct _IdentityRequestClass IdentityRequestClass;
21 typedef struct _IdentityRequestPrivate IdentityRequestPrivate;
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))
30 typedef struct _IdCard IdCard;
31 typedef struct _IdCardClass IdCardClass;
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))
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;
46 typedef void (*ReturnIdentityCallback) (IdentityRequest* request, void* user_data);
47 struct _IdentityRequest {
48 GObject parent_instance;
49 IdentityRequestPrivate * priv;
54 struct _IdentityRequestClass {
55 GObjectClass parent_class;
58 struct _IdentityRequestPrivate {
59 MainWindow* main_window;
63 ReturnIdentityCallback callback;
64 gpointer callback_target;
65 GDestroyNotify callback_target_destroy_notify;
70 IdentityRequest * self;
71 ReturnIdentityCallback cb;
73 GDestroyNotify cb_target_destroy_notify;
77 static gpointer identity_request_parent_class = NULL;
79 GType identity_request_get_type (void) G_GNUC_CONST;
80 GType id_card_get_type (void) G_GNUC_CONST;
81 GType main_window_get_type (void) G_GNUC_CONST;
82 #define IDENTITY_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_IDENTITY_REQUEST, IdentityRequestPrivate))
84 IDENTITY_REQUEST_DUMMY_PROPERTY
86 IdentityRequest* identity_request_new (MainWindow* main_window, const char* nai, const char* password, const char* certificate);
87 IdentityRequest* identity_request_construct (GType object_type, MainWindow* main_window, const char* nai, const char* password, const char* certificate);
88 void identity_request_set_callback (IdentityRequest* self, ReturnIdentityCallback cb, void* cb_target, GDestroyNotify cb_target_destroy_notify);
89 static void _lambda0_ (IdentityRequest* IdCard, Block1Data* _data1_);
90 static void __lambda0__return_identity_callback (IdentityRequest* request, gpointer self);
91 static Block1Data* block1_data_ref (Block1Data* _data1_);
92 static void block1_data_unref (Block1Data* _data1_);
93 gboolean identity_request_execute (IdentityRequest* self);
94 void main_window_select_identity (MainWindow* self, IdentityRequest* request);
95 void identity_request_return_identity (IdentityRequest* self, IdCard* id_card);
96 static void identity_request_finalize (GObject* obj);
100 static gpointer _g_object_ref0 (gpointer self) {
101 return self ? g_object_ref (self) : NULL;
105 IdentityRequest* identity_request_construct (GType object_type, MainWindow* main_window, const char* nai, const char* password, const char* certificate) {
106 IdentityRequest * self = NULL;
111 g_return_val_if_fail (main_window != NULL, NULL);
112 g_return_val_if_fail (nai != NULL, NULL);
113 g_return_val_if_fail (password != NULL, NULL);
114 g_return_val_if_fail (certificate != NULL, NULL);
115 self = (IdentityRequest*) g_object_new (object_type, NULL);
116 self->priv->main_window = (_tmp0_ = _g_object_ref0 (main_window), _g_object_unref0 (self->priv->main_window), _tmp0_);
117 self->priv->nai = (_tmp1_ = g_strdup (nai), _g_free0 (self->priv->nai), _tmp1_);
118 self->priv->password = (_tmp2_ = g_strdup (password), _g_free0 (self->priv->password), _tmp2_);
119 self->priv->certificate = (_tmp3_ = g_strdup (certificate), _g_free0 (self->priv->certificate), _tmp3_);
124 IdentityRequest* identity_request_new (MainWindow* main_window, const char* nai, const char* password, const char* certificate) {
125 return identity_request_construct (TYPE_IDENTITY_REQUEST, main_window, nai, password, certificate);
129 static void _lambda0_ (IdentityRequest* IdCard, Block1Data* _data1_) {
130 IdentityRequest * self;
131 self = _data1_->self;
132 g_return_if_fail (IdCard != NULL);
133 _data1_->cb (IdCard, _data1_->cb_target);
137 static void __lambda0__return_identity_callback (IdentityRequest* request, gpointer self) {
138 _lambda0_ (request, self);
142 static Block1Data* block1_data_ref (Block1Data* _data1_) {
143 g_atomic_int_inc (&_data1_->_ref_count_);
148 static void block1_data_unref (Block1Data* _data1_) {
149 if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
150 _g_object_unref0 (_data1_->self);
151 (_data1_->cb_target_destroy_notify == NULL) ? NULL : (_data1_->cb_target_destroy_notify (_data1_->cb_target), NULL);
153 _data1_->cb_target = NULL;
154 _data1_->cb_target_destroy_notify = NULL;
155 g_slice_free (Block1Data, _data1_);
160 void identity_request_set_callback (IdentityRequest* self, ReturnIdentityCallback cb, void* cb_target, GDestroyNotify cb_target_destroy_notify) {
162 ReturnIdentityCallback _tmp0_;
163 g_return_if_fail (self != NULL);
164 _data1_ = g_slice_new0 (Block1Data);
165 _data1_->_ref_count_ = 1;
166 _data1_->self = g_object_ref (self);
168 _data1_->cb_target = cb_target;
169 _data1_->cb_target_destroy_notify = cb_target_destroy_notify;
170 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_);
171 block1_data_unref (_data1_);
175 gboolean identity_request_execute (IdentityRequest* self) {
176 gboolean result = FALSE;
177 g_return_val_if_fail (self != NULL, FALSE);
178 main_window_select_identity (self->priv->main_window, self);
184 void identity_request_return_identity (IdentityRequest* self, IdCard* id_card) {
186 g_return_if_fail (self != NULL);
187 g_return_if_fail (self->priv->callback != NULL);
188 self->id_card = (_tmp0_ = _g_object_ref0 (id_card), _g_object_unref0 (self->id_card), _tmp0_);
189 self->complete = TRUE;
190 self->priv->callback (self, self->priv->callback_target);
194 static void identity_request_class_init (IdentityRequestClass * klass) {
195 identity_request_parent_class = g_type_class_peek_parent (klass);
196 g_type_class_add_private (klass, sizeof (IdentityRequestPrivate));
197 G_OBJECT_CLASS (klass)->finalize = identity_request_finalize;
201 static void identity_request_instance_init (IdentityRequest * self) {
202 self->priv = IDENTITY_REQUEST_GET_PRIVATE (self);
203 self->id_card = NULL;
204 self->complete = FALSE;
205 self->priv->callback = NULL;
209 static void identity_request_finalize (GObject* obj) {
210 IdentityRequest * self;
211 self = IDENTITY_REQUEST (obj);
212 _g_object_unref0 (self->id_card);
213 _g_object_unref0 (self->priv->main_window);
214 _g_free0 (self->priv->nai);
215 _g_free0 (self->priv->password);
216 _g_free0 (self->priv->certificate);
217 (self->priv->callback_target_destroy_notify == NULL) ? NULL : (self->priv->callback_target_destroy_notify (self->priv->callback_target), NULL);
218 self->priv->callback = NULL;
219 self->priv->callback_target = NULL;
220 self->priv->callback_target_destroy_notify = NULL;
221 G_OBJECT_CLASS (identity_request_parent_class)->finalize (obj);
225 GType identity_request_get_type (void) {
226 static volatile gsize identity_request_type_id__volatile = 0;
227 if (g_once_init_enter (&identity_request_type_id__volatile)) {
228 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 };
229 GType identity_request_type_id;
230 identity_request_type_id = g_type_register_static (G_TYPE_OBJECT, "IdentityRequest", &g_define_type_info, 0);
231 g_once_init_leave (&identity_request_type_id__volatile, identity_request_type_id);
233 return identity_request_type_id__volatile;