regenerate artifacts
[moonshot-ui.git] / src / moonshot-local-flat-file-store.c
1 /* moonshot-local-flat-file-store.c generated by valac 0.10.4, the Vala compiler
2  * generated from moonshot-local-flat-file-store.vala, do not modify */
3
4
5 #include <glib.h>
6 #include <glib-object.h>
7 #include <gee.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <stdio.h>
11 #include <gdk-pixbuf/gdk-pixdata.h>
12 #include <config.h>
13 #include <glib/gstdio.h>
14
15
16 #define TYPE_IIDENTITY_CARD_STORE (iidentity_card_store_get_type ())
17 #define IIDENTITY_CARD_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IIDENTITY_CARD_STORE, IIdentityCardStore))
18 #define IS_IIDENTITY_CARD_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IIDENTITY_CARD_STORE))
19 #define IIDENTITY_CARD_STORE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IIDENTITY_CARD_STORE, IIdentityCardStoreIface))
20
21 typedef struct _IIdentityCardStore IIdentityCardStore;
22 typedef struct _IIdentityCardStoreIface IIdentityCardStoreIface;
23
24 #define TYPE_ID_CARD (id_card_get_type ())
25 #define ID_CARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ID_CARD, IdCard))
26 #define ID_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ID_CARD, IdCardClass))
27 #define IS_ID_CARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ID_CARD))
28 #define IS_ID_CARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ID_CARD))
29 #define ID_CARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ID_CARD, IdCardClass))
30
31 typedef struct _IdCard IdCard;
32 typedef struct _IdCardClass IdCardClass;
33
34 #define TYPE_LOCAL_FLAT_FILE_STORE (local_flat_file_store_get_type ())
35 #define LOCAL_FLAT_FILE_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LOCAL_FLAT_FILE_STORE, LocalFlatFileStore))
36 #define LOCAL_FLAT_FILE_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LOCAL_FLAT_FILE_STORE, LocalFlatFileStoreClass))
37 #define IS_LOCAL_FLAT_FILE_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LOCAL_FLAT_FILE_STORE))
38 #define IS_LOCAL_FLAT_FILE_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LOCAL_FLAT_FILE_STORE))
39 #define LOCAL_FLAT_FILE_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LOCAL_FLAT_FILE_STORE, LocalFlatFileStoreClass))
40
41 typedef struct _LocalFlatFileStore LocalFlatFileStore;
42 typedef struct _LocalFlatFileStoreClass LocalFlatFileStoreClass;
43 typedef struct _LocalFlatFileStorePrivate LocalFlatFileStorePrivate;
44 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
45 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
46 #define _g_free0(var) (var = (g_free (var), NULL))
47 #define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL)))
48
49 #define TYPE_RULE (rule_get_type ())
50 typedef struct _Rule Rule;
51
52 #define TYPE_TRUST_ANCHOR (trust_anchor_get_type ())
53 #define TRUST_ANCHOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRUST_ANCHOR, TrustAnchor))
54 #define TRUST_ANCHOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRUST_ANCHOR, TrustAnchorClass))
55 #define IS_TRUST_ANCHOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRUST_ANCHOR))
56 #define IS_TRUST_ANCHOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRUST_ANCHOR))
57 #define TRUST_ANCHOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRUST_ANCHOR, TrustAnchorClass))
58
59 typedef struct _TrustAnchor TrustAnchor;
60 typedef struct _TrustAnchorClass TrustAnchorClass;
61
62 struct _IIdentityCardStoreIface {
63         GTypeInterface parent_iface;
64         void (*add_card) (IIdentityCardStore* self, IdCard* card);
65         void (*remove_card) (IIdentityCardStore* self, IdCard* card);
66         void (*update_card) (IIdentityCardStore* self, IdCard* card);
67         GeeLinkedList* (*get_card_list) (IIdentityCardStore* self);
68 };
69
70 struct _LocalFlatFileStore {
71         GObject parent_instance;
72         LocalFlatFileStorePrivate * priv;
73 };
74
75 struct _LocalFlatFileStoreClass {
76         GObjectClass parent_class;
77 };
78
79 struct _LocalFlatFileStorePrivate {
80         GeeLinkedList* id_card_list;
81 };
82
83 struct _Rule {
84         char* pattern;
85         char* always_confirm;
86 };
87
88
89 static gpointer local_flat_file_store_parent_class = NULL;
90 static IIdentityCardStoreIface* local_flat_file_store_iidentity_card_store_parent_iface = NULL;
91
92 GType id_card_get_type (void) G_GNUC_CONST;
93 GType iidentity_card_store_get_type (void) G_GNUC_CONST;
94 GType local_flat_file_store_get_type (void) G_GNUC_CONST;
95 #define LOCAL_FLAT_FILE_STORE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_LOCAL_FLAT_FILE_STORE, LocalFlatFileStorePrivate))
96 enum  {
97         LOCAL_FLAT_FILE_STORE_DUMMY_PROPERTY
98 };
99 #define LOCAL_FLAT_FILE_STORE_FILE_NAME "identities.txt"
100 static void local_flat_file_store_real_add_card (IIdentityCardStore* base, IdCard* card);
101 void local_flat_file_store_store_id_cards (LocalFlatFileStore* self);
102 static void local_flat_file_store_real_update_card (IIdentityCardStore* base, IdCard* card);
103 static void local_flat_file_store_real_remove_card (IIdentityCardStore* base, IdCard* card);
104 static GeeLinkedList* local_flat_file_store_real_get_card_list (IIdentityCardStore* base);
105 static void local_flat_file_store_load_id_cards (LocalFlatFileStore* self);
106 static char* local_flat_file_store_get_data_dir (LocalFlatFileStore* self);
107 IdCard* id_card_new (void);
108 IdCard* id_card_construct (GType object_type);
109 void id_card_set_issuer (IdCard* self, const char* value);
110 void id_card_set_username (IdCard* self, const char* value);
111 void id_card_set_password (IdCard* self, const char* value);
112 void id_card_set_services (IdCard* self, char** value, int value_length1);
113 void id_card_set_display_name (IdCard* self, const char* value);
114 GdkPixbuf* find_icon (const char* name, gint size);
115 GType rule_get_type (void) G_GNUC_CONST;
116 Rule* rule_dup (const Rule* self);
117 void rule_free (Rule* self);
118 void rule_copy (const Rule* self, Rule* dest);
119 void rule_destroy (Rule* self);
120 void id_card_set_rules (IdCard* self, Rule* value, int value_length1);
121 static void _vala_Rule_array_free (Rule* array, gint array_length);
122 GType trust_anchor_get_type (void) G_GNUC_CONST;
123 TrustAnchor* id_card_get_trust_anchor (IdCard* self);
124 void trust_anchor_set_ca_cert (TrustAnchor* self, const char* value);
125 void trust_anchor_set_subject (TrustAnchor* self, const char* value);
126 void trust_anchor_set_subject_alt (TrustAnchor* self, const char* value);
127 void trust_anchor_set_server_cert (TrustAnchor* self, const char* value);
128 Rule* id_card_get_rules (IdCard* self, int* result_length1);
129 const char* id_card_get_issuer (IdCard* self);
130 const char* id_card_get_display_name (IdCard* self);
131 const char* id_card_get_username (IdCard* self);
132 const char* id_card_get_password (IdCard* self);
133 char** id_card_get_services (IdCard* self, int* result_length1);
134 static char** _vala_array_dup1 (char** self, int length);
135 const char* trust_anchor_get_ca_cert (TrustAnchor* self);
136 const char* trust_anchor_get_subject (TrustAnchor* self);
137 const char* trust_anchor_get_subject_alt (TrustAnchor* self);
138 const char* trust_anchor_get_server_cert (TrustAnchor* self);
139 LocalFlatFileStore* local_flat_file_store_new (void);
140 LocalFlatFileStore* local_flat_file_store_construct (GType object_type);
141 static void local_flat_file_store_finalize (GObject* obj);
142 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
143 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
144
145
146
147 #line 7 "moonshot-local-flat-file-store.vala"
148 static void local_flat_file_store_real_add_card (IIdentityCardStore* base, IdCard* card) {
149 #line 150 "moonshot-local-flat-file-store.c"
150         LocalFlatFileStore * self;
151         self = (LocalFlatFileStore*) base;
152 #line 7 "moonshot-local-flat-file-store.vala"
153         g_return_if_fail (card != NULL);
154 #line 8 "moonshot-local-flat-file-store.vala"
155         gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->id_card_list, card);
156 #line 9 "moonshot-local-flat-file-store.vala"
157         local_flat_file_store_store_id_cards (self);
158 #line 159 "moonshot-local-flat-file-store.c"
159 }
160
161
162 #line 12 "moonshot-local-flat-file-store.vala"
163 static void local_flat_file_store_real_update_card (IIdentityCardStore* base, IdCard* card) {
164 #line 165 "moonshot-local-flat-file-store.c"
165         LocalFlatFileStore * self;
166         self = (LocalFlatFileStore*) base;
167 #line 12 "moonshot-local-flat-file-store.vala"
168         g_return_if_fail (card != NULL);
169 #line 13 "moonshot-local-flat-file-store.vala"
170         gee_abstract_collection_remove ((GeeAbstractCollection*) self->priv->id_card_list, card);
171 #line 14 "moonshot-local-flat-file-store.vala"
172         gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->id_card_list, card);
173 #line 15 "moonshot-local-flat-file-store.vala"
174         local_flat_file_store_store_id_cards (self);
175 #line 176 "moonshot-local-flat-file-store.c"
176 }
177
178
179 #line 18 "moonshot-local-flat-file-store.vala"
180 static void local_flat_file_store_real_remove_card (IIdentityCardStore* base, IdCard* card) {
181 #line 182 "moonshot-local-flat-file-store.c"
182         LocalFlatFileStore * self;
183         self = (LocalFlatFileStore*) base;
184 #line 18 "moonshot-local-flat-file-store.vala"
185         g_return_if_fail (card != NULL);
186 #line 19 "moonshot-local-flat-file-store.vala"
187         gee_abstract_collection_remove ((GeeAbstractCollection*) self->priv->id_card_list, card);
188 #line 20 "moonshot-local-flat-file-store.vala"
189         local_flat_file_store_store_id_cards (self);
190 #line 191 "moonshot-local-flat-file-store.c"
191 }
192
193
194 static gpointer _g_object_ref0 (gpointer self) {
195         return self ? g_object_ref (self) : NULL;
196 }
197
198
199 #line 23 "moonshot-local-flat-file-store.vala"
200 static GeeLinkedList* local_flat_file_store_real_get_card_list (IIdentityCardStore* base) {
201 #line 202 "moonshot-local-flat-file-store.c"
202         LocalFlatFileStore * self;
203         GeeLinkedList* result = NULL;
204         self = (LocalFlatFileStore*) base;
205         result = _g_object_ref0 (self->priv->id_card_list);
206 #line 24 "moonshot-local-flat-file-store.vala"
207         return result;
208 #line 209 "moonshot-local-flat-file-store.c"
209 }
210
211
212 static void _vala_Rule_array_free (Rule* array, gint array_length) {
213         if (array != NULL) {
214                 int i;
215                 for (i = 0; i < array_length; i = i + 1) {
216                         rule_destroy (&array[i]);
217                 }
218         }
219         g_free (array);
220 }
221
222
223 #line 27 "moonshot-local-flat-file-store.vala"
224 static void local_flat_file_store_load_id_cards (LocalFlatFileStore* self) {
225 #line 226 "moonshot-local-flat-file-store.c"
226         GKeyFile* key_file;
227         char* path;
228         char* filename;
229         gint identities_uris_length1;
230         gint _identities_uris_size_;
231         char** _tmp1_;
232         gsize _tmp0_;
233         char** identities_uris;
234         GError * _inner_error_ = NULL;
235 #line 27 "moonshot-local-flat-file-store.vala"
236         g_return_if_fail (self != NULL);
237 #line 28 "moonshot-local-flat-file-store.vala"
238         gee_abstract_collection_clear ((GeeAbstractCollection*) self->priv->id_card_list);
239 #line 29 "moonshot-local-flat-file-store.vala"
240         key_file = g_key_file_new ();
241 #line 30 "moonshot-local-flat-file-store.vala"
242         path = local_flat_file_store_get_data_dir (self);
243 #line 31 "moonshot-local-flat-file-store.vala"
244         filename = g_build_filename (path, LOCAL_FLAT_FILE_STORE_FILE_NAME, NULL);
245 #line 246 "moonshot-local-flat-file-store.c"
246         {
247 #line 34 "moonshot-local-flat-file-store.vala"
248                 g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, &_inner_error_);
249 #line 250 "moonshot-local-flat-file-store.c"
250                 if (_inner_error_ != NULL) {
251                         goto __catch2_g_error;
252                 }
253         }
254         goto __finally2;
255         __catch2_g_error:
256         {
257                 GError * e;
258                 e = _inner_error_;
259                 _inner_error_ = NULL;
260                 {
261 #line 37 "moonshot-local-flat-file-store.vala"
262                         fprintf (stdout, "Error: %s\n", e->message);
263 #line 264 "moonshot-local-flat-file-store.c"
264                         _g_error_free0 (e);
265                         _g_free0 (filename);
266                         _g_free0 (path);
267                         _g_key_file_free0 (key_file);
268 #line 38 "moonshot-local-flat-file-store.vala"
269                         return;
270 #line 271 "moonshot-local-flat-file-store.c"
271                 }
272         }
273         __finally2:
274         if (_inner_error_ != NULL) {
275                 _g_free0 (filename);
276                 _g_free0 (path);
277                 _g_key_file_free0 (key_file);
278                 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
279                 g_clear_error (&_inner_error_);
280                 return;
281         }
282         identities_uris = (_tmp1_ = g_key_file_get_groups (key_file, &_tmp0_), identities_uris_length1 = _tmp0_, _identities_uris_size_ = identities_uris_length1, _tmp1_);
283         {
284                 char** identity_collection;
285                 int identity_collection_length1;
286                 int identity_it;
287 #line 42 "moonshot-local-flat-file-store.vala"
288                 identity_collection = identities_uris;
289 #line 290 "moonshot-local-flat-file-store.c"
290                 identity_collection_length1 = identities_uris_length1;
291                 for (identity_it = 0; identity_it < identities_uris_length1; identity_it = identity_it + 1) {
292                         char* identity;
293                         identity = g_strdup (identity_collection[identity_it]);
294                         {
295                                 {
296                                         IdCard* id_card;
297                                         char* _tmp2_;
298                                         char* _tmp3_;
299                                         char* _tmp4_;
300                                         char* _tmp5_;
301                                         char* _tmp6_;
302                                         char* _tmp7_;
303                                         gint _tmp9__length1;
304                                         gint __tmp9__size_;
305                                         char** _tmp10_;
306                                         gsize _tmp8_;
307                                         char** _tmp9_;
308                                         char** _tmp11_;
309                                         gint _tmp11__length1;
310                                         char** _tmp12_;
311                                         char* _tmp13_;
312                                         char* _tmp14_;
313                                         gboolean _tmp15_ = FALSE;
314                                         gboolean _tmp16_;
315                                         char* _tmp27_;
316                                         char* _tmp28_;
317                                         char* _tmp29_;
318                                         char* _tmp30_;
319                                         char* _tmp31_;
320                                         char* _tmp32_;
321                                         char* _tmp33_;
322                                         char* _tmp34_;
323 #line 44 "moonshot-local-flat-file-store.vala"
324                                         id_card = id_card_new ();
325 #line 46 "moonshot-local-flat-file-store.vala"
326                                         _tmp2_ = g_key_file_get_string (key_file, identity, "Issuer", &_inner_error_);
327 #line 328 "moonshot-local-flat-file-store.c"
328                                         if (_inner_error_ != NULL) {
329                                                 _g_object_unref0 (id_card);
330                                                 goto __catch3_g_error;
331                                         }
332 #line 46 "moonshot-local-flat-file-store.vala"
333                                         id_card_set_issuer (id_card, _tmp3_ = _tmp2_);
334 #line 335 "moonshot-local-flat-file-store.c"
335                                         _g_free0 (_tmp3_);
336 #line 47 "moonshot-local-flat-file-store.vala"
337                                         _tmp4_ = g_key_file_get_string (key_file, identity, "Username", &_inner_error_);
338 #line 339 "moonshot-local-flat-file-store.c"
339                                         if (_inner_error_ != NULL) {
340                                                 _g_object_unref0 (id_card);
341                                                 goto __catch3_g_error;
342                                         }
343 #line 47 "moonshot-local-flat-file-store.vala"
344                                         id_card_set_username (id_card, _tmp5_ = _tmp4_);
345 #line 346 "moonshot-local-flat-file-store.c"
346                                         _g_free0 (_tmp5_);
347 #line 48 "moonshot-local-flat-file-store.vala"
348                                         _tmp6_ = g_key_file_get_string (key_file, identity, "Password", &_inner_error_);
349 #line 350 "moonshot-local-flat-file-store.c"
350                                         if (_inner_error_ != NULL) {
351                                                 _g_object_unref0 (id_card);
352                                                 goto __catch3_g_error;
353                                         }
354 #line 48 "moonshot-local-flat-file-store.vala"
355                                         id_card_set_password (id_card, _tmp7_ = _tmp6_);
356 #line 357 "moonshot-local-flat-file-store.c"
357                                         _g_free0 (_tmp7_);
358                                         _tmp9_ = (_tmp10_ = g_key_file_get_string_list (key_file, identity, "Services", &_tmp8_, &_inner_error_), _tmp9__length1 = _tmp8_, __tmp9__size_ = _tmp9__length1, _tmp10_);
359                                         if (_inner_error_ != NULL) {
360                                                 _g_object_unref0 (id_card);
361                                                 goto __catch3_g_error;
362                                         }
363 #line 49 "moonshot-local-flat-file-store.vala"
364                                         _tmp12_ = (_tmp11_ = _tmp9_, _tmp11__length1 = _tmp9__length1, _tmp11_);
365 #line 49 "moonshot-local-flat-file-store.vala"
366                                         id_card_set_services (id_card, _tmp12_, _tmp9__length1);
367 #line 368 "moonshot-local-flat-file-store.c"
368                                         _tmp11_ = (_vala_array_free (_tmp11_, _tmp11__length1, (GDestroyNotify) g_free), NULL);
369 #line 50 "moonshot-local-flat-file-store.vala"
370                                         _tmp13_ = g_key_file_get_string (key_file, identity, "DisplayName", &_inner_error_);
371 #line 372 "moonshot-local-flat-file-store.c"
372                                         if (_inner_error_ != NULL) {
373                                                 _g_object_unref0 (id_card);
374                                                 goto __catch3_g_error;
375                                         }
376 #line 50 "moonshot-local-flat-file-store.vala"
377                                         id_card_set_display_name (id_card, _tmp14_ = _tmp13_);
378 #line 379 "moonshot-local-flat-file-store.c"
379                                         _g_free0 (_tmp14_);
380 #line 51 "moonshot-local-flat-file-store.vala"
381                                         g_object_set_data_full ((GObject*) id_card, "pixbuf", find_icon ("avatar-default", 48), g_object_unref);
382 #line 54 "moonshot-local-flat-file-store.vala"
383                                         _tmp16_ = g_key_file_has_key (key_file, identity, "Rules-Patterns", &_inner_error_);
384 #line 385 "moonshot-local-flat-file-store.c"
385                                         if (_inner_error_ != NULL) {
386                                                 _g_object_unref0 (id_card);
387                                                 goto __catch3_g_error;
388                                         }
389 #line 54 "moonshot-local-flat-file-store.vala"
390                                         if (_tmp16_) {
391 #line 392 "moonshot-local-flat-file-store.c"
392                                                 gboolean _tmp17_;
393 #line 55 "moonshot-local-flat-file-store.vala"
394                                                 _tmp17_ = g_key_file_has_key (key_file, identity, "Rules-AlwaysConfirm", &_inner_error_);
395 #line 396 "moonshot-local-flat-file-store.c"
396                                                 if (_inner_error_ != NULL) {
397                                                         _g_object_unref0 (id_card);
398                                                         goto __catch3_g_error;
399                                                 }
400 #line 55 "moonshot-local-flat-file-store.vala"
401                                                 _tmp15_ = _tmp17_;
402 #line 403 "moonshot-local-flat-file-store.c"
403                                         } else {
404 #line 54 "moonshot-local-flat-file-store.vala"
405                                                 _tmp15_ = FALSE;
406 #line 407 "moonshot-local-flat-file-store.c"
407                                         }
408 #line 54 "moonshot-local-flat-file-store.vala"
409                                         if (_tmp15_) {
410 #line 411 "moonshot-local-flat-file-store.c"
411                                                 gint rules_patterns_length1;
412                                                 gint _rules_patterns_size_;
413                                                 char** _tmp19_;
414                                                 gsize _tmp18_;
415                                                 char** rules_patterns;
416                                                 gint rules_always_conf_length1;
417                                                 gint _rules_always_conf_size_;
418                                                 char** _tmp21_;
419                                                 gsize _tmp20_;
420                                                 char** rules_always_conf;
421                                                 rules_patterns = (_tmp19_ = g_key_file_get_string_list (key_file, identity, "Rules-Patterns", &_tmp18_, &_inner_error_), rules_patterns_length1 = _tmp18_, _rules_patterns_size_ = rules_patterns_length1, _tmp19_);
422                                                 if (_inner_error_ != NULL) {
423                                                         _g_object_unref0 (id_card);
424                                                         goto __catch3_g_error;
425                                                 }
426                                                 rules_always_conf = (_tmp21_ = g_key_file_get_string_list (key_file, identity, "Rules-AlwaysConfirm", &_tmp20_, &_inner_error_), rules_always_conf_length1 = _tmp20_, _rules_always_conf_size_ = rules_always_conf_length1, _tmp21_);
427                                                 if (_inner_error_ != NULL) {
428                                                         rules_patterns = (_vala_array_free (rules_patterns, rules_patterns_length1, (GDestroyNotify) g_free), NULL);
429                                                         _g_object_unref0 (id_card);
430                                                         goto __catch3_g_error;
431                                                 }
432 #line 59 "moonshot-local-flat-file-store.vala"
433                                                 if (rules_patterns_length1 == rules_always_conf_length1) {
434 #line 435 "moonshot-local-flat-file-store.c"
435                                                         gint rules_length1;
436                                                         gint _rules_size_;
437                                                         Rule* _tmp22_;
438                                                         Rule* rules;
439                                                         Rule* _tmp26_;
440                                                         rules = (_tmp22_ = g_new0 (Rule, rules_patterns_length1), rules_length1 = rules_patterns_length1, _rules_size_ = rules_length1, _tmp22_);
441                                                         {
442                                                                 gint i;
443 #line 61 "moonshot-local-flat-file-store.vala"
444                                                                 i = 0;
445 #line 446 "moonshot-local-flat-file-store.c"
446                                                                 {
447                                                                         gboolean _tmp23_;
448 #line 61 "moonshot-local-flat-file-store.vala"
449                                                                         _tmp23_ = TRUE;
450 #line 61 "moonshot-local-flat-file-store.vala"
451                                                                         while (TRUE) {
452 #line 453 "moonshot-local-flat-file-store.c"
453                                                                                 Rule _tmp24_ = {0};
454                                                                                 Rule _tmp25_;
455 #line 61 "moonshot-local-flat-file-store.vala"
456                                                                                 if (!_tmp23_) {
457 #line 61 "moonshot-local-flat-file-store.vala"
458                                                                                         i++;
459 #line 460 "moonshot-local-flat-file-store.c"
460                                                                                 }
461 #line 61 "moonshot-local-flat-file-store.vala"
462                                                                                 _tmp23_ = FALSE;
463 #line 61 "moonshot-local-flat-file-store.vala"
464                                                                                 if (!(i < rules_patterns_length1)) {
465 #line 61 "moonshot-local-flat-file-store.vala"
466                                                                                         break;
467 #line 468 "moonshot-local-flat-file-store.c"
468                                                                                 }
469 #line 62 "moonshot-local-flat-file-store.vala"
470                                                                                 rules[i] = (_tmp25_ = (_tmp24_.pattern = g_strdup (rules_patterns[i]), _tmp24_.always_confirm = g_strdup (rules_always_conf[i]), _tmp24_), rule_destroy (&rules[i]), _tmp25_);
471 #line 472 "moonshot-local-flat-file-store.c"
472                                                                         }
473                                                                 }
474                                                         }
475 #line 64 "moonshot-local-flat-file-store.vala"
476                                                         _tmp26_ = rules;
477 #line 64 "moonshot-local-flat-file-store.vala"
478                                                         id_card_set_rules (id_card, _tmp26_, rules_length1);
479 #line 480 "moonshot-local-flat-file-store.c"
480                                                         rules = (_vala_Rule_array_free (rules, rules_length1), NULL);
481                                                 }
482                                                 rules_always_conf = (_vala_array_free (rules_always_conf, rules_always_conf_length1, (GDestroyNotify) g_free), NULL);
483                                                 rules_patterns = (_vala_array_free (rules_patterns, rules_patterns_length1, (GDestroyNotify) g_free), NULL);
484                                         }
485 #line 69 "moonshot-local-flat-file-store.vala"
486                                         _tmp27_ = g_key_file_get_string (key_file, identity, "CA-Cert", &_inner_error_);
487 #line 488 "moonshot-local-flat-file-store.c"
488                                         if (_inner_error_ != NULL) {
489                                                 _g_object_unref0 (id_card);
490                                                 goto __catch3_g_error;
491                                         }
492 #line 69 "moonshot-local-flat-file-store.vala"
493                                         trust_anchor_set_ca_cert (id_card_get_trust_anchor (id_card), _tmp28_ = _tmp27_);
494 #line 495 "moonshot-local-flat-file-store.c"
495                                         _g_free0 (_tmp28_);
496 #line 70 "moonshot-local-flat-file-store.vala"
497                                         _tmp29_ = g_key_file_get_string (key_file, identity, "Subject", &_inner_error_);
498 #line 499 "moonshot-local-flat-file-store.c"
499                                         if (_inner_error_ != NULL) {
500                                                 _g_object_unref0 (id_card);
501                                                 goto __catch3_g_error;
502                                         }
503 #line 70 "moonshot-local-flat-file-store.vala"
504                                         trust_anchor_set_subject (id_card_get_trust_anchor (id_card), _tmp30_ = _tmp29_);
505 #line 506 "moonshot-local-flat-file-store.c"
506                                         _g_free0 (_tmp30_);
507 #line 71 "moonshot-local-flat-file-store.vala"
508                                         _tmp31_ = g_key_file_get_string (key_file, identity, "SubjectAlt", &_inner_error_);
509 #line 510 "moonshot-local-flat-file-store.c"
510                                         if (_inner_error_ != NULL) {
511                                                 _g_object_unref0 (id_card);
512                                                 goto __catch3_g_error;
513                                         }
514 #line 71 "moonshot-local-flat-file-store.vala"
515                                         trust_anchor_set_subject_alt (id_card_get_trust_anchor (id_card), _tmp32_ = _tmp31_);
516 #line 517 "moonshot-local-flat-file-store.c"
517                                         _g_free0 (_tmp32_);
518 #line 72 "moonshot-local-flat-file-store.vala"
519                                         _tmp33_ = g_key_file_get_string (key_file, identity, "ServerCert", &_inner_error_);
520 #line 521 "moonshot-local-flat-file-store.c"
521                                         if (_inner_error_ != NULL) {
522                                                 _g_object_unref0 (id_card);
523                                                 goto __catch3_g_error;
524                                         }
525 #line 72 "moonshot-local-flat-file-store.vala"
526                                         trust_anchor_set_server_cert (id_card_get_trust_anchor (id_card), _tmp34_ = _tmp33_);
527 #line 528 "moonshot-local-flat-file-store.c"
528                                         _g_free0 (_tmp34_);
529 #line 74 "moonshot-local-flat-file-store.vala"
530                                         gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->id_card_list, id_card);
531 #line 532 "moonshot-local-flat-file-store.c"
532                                         _g_object_unref0 (id_card);
533                                 }
534                                 goto __finally3;
535                                 __catch3_g_error:
536                                 {
537                                         GError * e;
538                                         e = _inner_error_;
539                                         _inner_error_ = NULL;
540                                         {
541 #line 77 "moonshot-local-flat-file-store.vala"
542                                                 fprintf (stdout, "Error:  %s\n", e->message);
543 #line 544 "moonshot-local-flat-file-store.c"
544                                                 _g_error_free0 (e);
545                                         }
546                                 }
547                                 __finally3:
548                                 if (_inner_error_ != NULL) {
549                                         _g_free0 (identity);
550                                         identities_uris = (_vala_array_free (identities_uris, identities_uris_length1, (GDestroyNotify) g_free), NULL);
551                                         _g_free0 (filename);
552                                         _g_free0 (path);
553                                         _g_key_file_free0 (key_file);
554                                         g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
555                                         g_clear_error (&_inner_error_);
556                                         return;
557                                 }
558                                 _g_free0 (identity);
559                         }
560                 }
561         }
562         identities_uris = (_vala_array_free (identities_uris, identities_uris_length1, (GDestroyNotify) g_free), NULL);
563         _g_free0 (filename);
564         _g_free0 (path);
565         _g_key_file_free0 (key_file);
566 }
567
568
569 #line 82 "moonshot-local-flat-file-store.vala"
570 static char* local_flat_file_store_get_data_dir (LocalFlatFileStore* self) {
571 #line 572 "moonshot-local-flat-file-store.c"
572         char* result = NULL;
573         char* path;
574         char* _tmp0_;
575 #line 82 "moonshot-local-flat-file-store.vala"
576         g_return_val_if_fail (self != NULL, NULL);
577 #line 578 "moonshot-local-flat-file-store.c"
578         path = NULL;
579 #line 84 "moonshot-local-flat-file-store.vala"
580         path = (_tmp0_ = g_build_filename (g_get_user_data_dir (), PACKAGE_TARNAME, NULL), _g_free0 (path), _tmp0_);
581 #line 87 "moonshot-local-flat-file-store.vala"
582         if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
583 #line 88 "moonshot-local-flat-file-store.vala"
584                 g_mkdir_with_parents (path, 0700);
585 #line 586 "moonshot-local-flat-file-store.c"
586         }
587         result = path;
588 #line 90 "moonshot-local-flat-file-store.vala"
589         return result;
590 #line 591 "moonshot-local-flat-file-store.c"
591 }
592
593
594 static char** _vala_array_dup1 (char** self, int length) {
595         char** result;
596         int i;
597         result = g_new0 (char*, length + 1);
598         for (i = 0; i < length; i++) {
599                 result[i] = g_strdup (self[i]);
600         }
601         return result;
602 }
603
604
605 #line 93 "moonshot-local-flat-file-store.vala"
606 void local_flat_file_store_store_id_cards (LocalFlatFileStore* self) {
607 #line 608 "moonshot-local-flat-file-store.c"
608         GKeyFile* key_file;
609         char* text;
610         GError * _inner_error_ = NULL;
611 #line 93 "moonshot-local-flat-file-store.vala"
612         g_return_if_fail (self != NULL);
613 #line 94 "moonshot-local-flat-file-store.vala"
614         key_file = g_key_file_new ();
615 #line 616 "moonshot-local-flat-file-store.c"
616         {
617                 GeeIterator* _id_card_it;
618 #line 95 "moonshot-local-flat-file-store.vala"
619                 _id_card_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->priv->id_card_list);
620 #line 95 "moonshot-local-flat-file-store.vala"
621                 while (TRUE) {
622 #line 623 "moonshot-local-flat-file-store.c"
623                         IdCard* id_card;
624                         gint rules_patterns_length1;
625                         gint _rules_patterns_size_;
626                         char** _tmp1_;
627                         gint _tmp0_;
628                         char** rules_patterns;
629                         gint rules_always_conf_length1;
630                         gint _rules_always_conf_size_;
631                         char** _tmp3_;
632                         gint _tmp2_;
633                         char** rules_always_conf;
634                         char* _tmp10_;
635                         char* _tmp12_;
636                         char* _tmp14_;
637                         char* _tmp16_;
638                         gint _tmp20__length1;
639                         gint __tmp20__size_;
640                         char** _tmp21_;
641                         gint _tmp18_;
642                         char** _tmp19_;
643                         char** _tmp20_;
644                         gint _tmp24_;
645                         char* _tmp25_;
646                         char* _tmp27_;
647                         char* _tmp29_;
648                         char* _tmp31_;
649 #line 95 "moonshot-local-flat-file-store.vala"
650                         if (!gee_iterator_next (_id_card_it)) {
651 #line 95 "moonshot-local-flat-file-store.vala"
652                                 break;
653 #line 654 "moonshot-local-flat-file-store.c"
654                         }
655 #line 95 "moonshot-local-flat-file-store.vala"
656                         id_card = (IdCard*) gee_iterator_get (_id_card_it);
657 #line 658 "moonshot-local-flat-file-store.c"
658                         rules_patterns = (_tmp1_ = g_new0 (char*, _tmp0_ + 1), rules_patterns_length1 = _tmp0_, _rules_patterns_size_ = rules_patterns_length1, _tmp1_);
659                         rules_always_conf = (_tmp3_ = g_new0 (char*, _tmp2_ + 1), rules_always_conf_length1 = _tmp2_, _rules_always_conf_size_ = rules_always_conf_length1, _tmp3_);
660                         {
661                                 gint i;
662 #line 99 "moonshot-local-flat-file-store.vala"
663                                 i = 0;
664 #line 665 "moonshot-local-flat-file-store.c"
665                                 {
666                                         gboolean _tmp4_;
667 #line 99 "moonshot-local-flat-file-store.vala"
668                                         _tmp4_ = TRUE;
669 #line 99 "moonshot-local-flat-file-store.vala"
670                                         while (TRUE) {
671 #line 672 "moonshot-local-flat-file-store.c"
672                                                 gint _tmp5_;
673                                                 gint _tmp6_;
674                                                 char* _tmp7_;
675                                                 gint _tmp8_;
676                                                 char* _tmp9_;
677 #line 99 "moonshot-local-flat-file-store.vala"
678                                                 if (!_tmp4_) {
679 #line 99 "moonshot-local-flat-file-store.vala"
680                                                         i++;
681 #line 682 "moonshot-local-flat-file-store.c"
682                                                 }
683 #line 99 "moonshot-local-flat-file-store.vala"
684                                                 _tmp4_ = FALSE;
685 #line 99 "moonshot-local-flat-file-store.vala"
686                                                 if (!(i < _tmp5_)) {
687 #line 99 "moonshot-local-flat-file-store.vala"
688                                                         break;
689 #line 690 "moonshot-local-flat-file-store.c"
690                                                 }
691 #line 100 "moonshot-local-flat-file-store.vala"
692                                                 rules_patterns[i] = (_tmp7_ = g_strdup (id_card_get_rules (id_card, &_tmp6_)[i].pattern), _g_free0 (rules_patterns[i]), _tmp7_);
693 #line 101 "moonshot-local-flat-file-store.vala"
694                                                 rules_always_conf[i] = (_tmp9_ = g_strdup (id_card_get_rules (id_card, &_tmp8_)[i].always_confirm), _g_free0 (rules_always_conf[i]), _tmp9_);
695 #line 696 "moonshot-local-flat-file-store.c"
696                                         }
697                                 }
698                         }
699 #line 104 "moonshot-local-flat-file-store.vala"
700                         _tmp10_ = g_strdup (id_card_get_issuer (id_card));
701 #line 104 "moonshot-local-flat-file-store.vala"
702                         if (_tmp10_ == NULL) {
703 #line 704 "moonshot-local-flat-file-store.c"
704                                 char* _tmp11_;
705 #line 104 "moonshot-local-flat-file-store.vala"
706                                 _tmp10_ = (_tmp11_ = g_strdup (""), _g_free0 (_tmp10_), _tmp11_);
707 #line 708 "moonshot-local-flat-file-store.c"
708                         }
709 #line 104 "moonshot-local-flat-file-store.vala"
710                         g_key_file_set_string (key_file, id_card_get_display_name (id_card), "Issuer", _tmp10_);
711 #line 105 "moonshot-local-flat-file-store.vala"
712                         _tmp12_ = g_strdup (id_card_get_display_name (id_card));
713 #line 105 "moonshot-local-flat-file-store.vala"
714                         if (_tmp12_ == NULL) {
715 #line 716 "moonshot-local-flat-file-store.c"
716                                 char* _tmp13_;
717 #line 105 "moonshot-local-flat-file-store.vala"
718                                 _tmp12_ = (_tmp13_ = g_strdup (""), _g_free0 (_tmp12_), _tmp13_);
719 #line 720 "moonshot-local-flat-file-store.c"
720                         }
721 #line 105 "moonshot-local-flat-file-store.vala"
722                         g_key_file_set_string (key_file, id_card_get_display_name (id_card), "DisplayName", _tmp12_);
723 #line 106 "moonshot-local-flat-file-store.vala"
724                         _tmp14_ = g_strdup (id_card_get_username (id_card));
725 #line 106 "moonshot-local-flat-file-store.vala"
726                         if (_tmp14_ == NULL) {
727 #line 728 "moonshot-local-flat-file-store.c"
728                                 char* _tmp15_;
729 #line 106 "moonshot-local-flat-file-store.vala"
730                                 _tmp14_ = (_tmp15_ = g_strdup (""), _g_free0 (_tmp14_), _tmp15_);
731 #line 732 "moonshot-local-flat-file-store.c"
732                         }
733 #line 106 "moonshot-local-flat-file-store.vala"
734                         g_key_file_set_string (key_file, id_card_get_display_name (id_card), "Username", _tmp14_);
735 #line 107 "moonshot-local-flat-file-store.vala"
736                         _tmp16_ = g_strdup (id_card_get_password (id_card));
737 #line 107 "moonshot-local-flat-file-store.vala"
738                         if (_tmp16_ == NULL) {
739 #line 740 "moonshot-local-flat-file-store.c"
740                                 char* _tmp17_;
741 #line 107 "moonshot-local-flat-file-store.vala"
742                                 _tmp16_ = (_tmp17_ = g_strdup (""), _g_free0 (_tmp16_), _tmp17_);
743 #line 744 "moonshot-local-flat-file-store.c"
744                         }
745 #line 107 "moonshot-local-flat-file-store.vala"
746                         g_key_file_set_string (key_file, id_card_get_display_name (id_card), "Password", _tmp16_);
747 #line 748 "moonshot-local-flat-file-store.c"
748                         _tmp20_ = (_tmp21_ = (_tmp19_ = id_card_get_services (id_card, &_tmp18_), (_tmp19_ == NULL) ? ((gpointer) _tmp19_) : _vala_array_dup1 (_tmp19_, _tmp18_)), _tmp20__length1 = _tmp18_, __tmp20__size_ = _tmp20__length1, _tmp21_);
749 #line 108 "moonshot-local-flat-file-store.vala"
750                         if (_tmp20_ == NULL) {
751 #line 752 "moonshot-local-flat-file-store.c"
752                                 char** _tmp22_ = NULL;
753                                 char** _tmp23_;
754 #line 108 "moonshot-local-flat-file-store.vala"
755                                 _tmp20_ = (_tmp23_ = (_tmp22_ = g_new0 (char*, 0 + 1), _tmp22_), _tmp20_ = (_vala_array_free (_tmp20_, _tmp20__length1, (GDestroyNotify) g_free), NULL), _tmp20__length1 = 0, __tmp20__size_ = _tmp20__length1, _tmp23_);
756 #line 757 "moonshot-local-flat-file-store.c"
757                         }
758 #line 108 "moonshot-local-flat-file-store.vala"
759                         g_key_file_set_string_list (key_file, id_card_get_display_name (id_card), "Services", (const gchar* const*) _tmp20_, _tmp20__length1);
760 #line 110 "moonshot-local-flat-file-store.vala"
761                         if (_tmp24_ > 0) {
762 #line 111 "moonshot-local-flat-file-store.vala"
763                                 g_key_file_set_string_list (key_file, id_card_get_display_name (id_card), "Rules-Patterns", (const gchar* const*) rules_patterns, rules_patterns_length1);
764 #line 112 "moonshot-local-flat-file-store.vala"
765                                 g_key_file_set_string_list (key_file, id_card_get_display_name (id_card), "Rules-AlwaysConfirm", (const gchar* const*) rules_always_conf, rules_always_conf_length1);
766 #line 767 "moonshot-local-flat-file-store.c"
767                         }
768 #line 116 "moonshot-local-flat-file-store.vala"
769                         _tmp25_ = g_strdup (trust_anchor_get_ca_cert (id_card_get_trust_anchor (id_card)));
770 #line 116 "moonshot-local-flat-file-store.vala"
771                         if (_tmp25_ == NULL) {
772 #line 773 "moonshot-local-flat-file-store.c"
773                                 char* _tmp26_;
774 #line 116 "moonshot-local-flat-file-store.vala"
775                                 _tmp25_ = (_tmp26_ = g_strdup (""), _g_free0 (_tmp25_), _tmp26_);
776 #line 777 "moonshot-local-flat-file-store.c"
777                         }
778 #line 116 "moonshot-local-flat-file-store.vala"
779                         g_key_file_set_string (key_file, id_card_get_display_name (id_card), "CA-Cert", _tmp25_);
780 #line 117 "moonshot-local-flat-file-store.vala"
781                         _tmp27_ = g_strdup (trust_anchor_get_subject (id_card_get_trust_anchor (id_card)));
782 #line 117 "moonshot-local-flat-file-store.vala"
783                         if (_tmp27_ == NULL) {
784 #line 785 "moonshot-local-flat-file-store.c"
785                                 char* _tmp28_;
786 #line 117 "moonshot-local-flat-file-store.vala"
787                                 _tmp27_ = (_tmp28_ = g_strdup (""), _g_free0 (_tmp27_), _tmp28_);
788 #line 789 "moonshot-local-flat-file-store.c"
789                         }
790 #line 117 "moonshot-local-flat-file-store.vala"
791                         g_key_file_set_string (key_file, id_card_get_display_name (id_card), "Subject", _tmp27_);
792 #line 118 "moonshot-local-flat-file-store.vala"
793                         _tmp29_ = g_strdup (trust_anchor_get_subject_alt (id_card_get_trust_anchor (id_card)));
794 #line 118 "moonshot-local-flat-file-store.vala"
795                         if (_tmp29_ == NULL) {
796 #line 797 "moonshot-local-flat-file-store.c"
797                                 char* _tmp30_;
798 #line 118 "moonshot-local-flat-file-store.vala"
799                                 _tmp29_ = (_tmp30_ = g_strdup (""), _g_free0 (_tmp29_), _tmp30_);
800 #line 801 "moonshot-local-flat-file-store.c"
801                         }
802 #line 118 "moonshot-local-flat-file-store.vala"
803                         g_key_file_set_string (key_file, id_card_get_display_name (id_card), "SubjectAlt", _tmp29_);
804 #line 119 "moonshot-local-flat-file-store.vala"
805                         _tmp31_ = g_strdup (trust_anchor_get_server_cert (id_card_get_trust_anchor (id_card)));
806 #line 119 "moonshot-local-flat-file-store.vala"
807                         if (_tmp31_ == NULL) {
808 #line 809 "moonshot-local-flat-file-store.c"
809                                 char* _tmp32_;
810 #line 119 "moonshot-local-flat-file-store.vala"
811                                 _tmp31_ = (_tmp32_ = g_strdup (""), _g_free0 (_tmp31_), _tmp32_);
812 #line 813 "moonshot-local-flat-file-store.c"
813                         }
814 #line 119 "moonshot-local-flat-file-store.vala"
815                         g_key_file_set_string (key_file, id_card_get_display_name (id_card), "ServerCert", _tmp31_);
816 #line 817 "moonshot-local-flat-file-store.c"
817                         _g_free0 (_tmp31_);
818                         _g_free0 (_tmp29_);
819                         _g_free0 (_tmp27_);
820                         _g_free0 (_tmp25_);
821                         _tmp20_ = (_vala_array_free (_tmp20_, _tmp20__length1, (GDestroyNotify) g_free), NULL);
822                         _g_free0 (_tmp16_);
823                         _g_free0 (_tmp14_);
824                         _g_free0 (_tmp12_);
825                         _g_free0 (_tmp10_);
826                         rules_always_conf = (_vala_array_free (rules_always_conf, rules_always_conf_length1, (GDestroyNotify) g_free), NULL);
827                         rules_patterns = (_vala_array_free (rules_patterns, rules_patterns_length1, (GDestroyNotify) g_free), NULL);
828                         _g_object_unref0 (id_card);
829                 }
830                 _g_object_unref0 (_id_card_it);
831         }
832 #line 122 "moonshot-local-flat-file-store.vala"
833         text = g_key_file_to_data (key_file, NULL, NULL);
834 #line 835 "moonshot-local-flat-file-store.c"
835         {
836                 char* path;
837                 char* filename;
838 #line 125 "moonshot-local-flat-file-store.vala"
839                 path = local_flat_file_store_get_data_dir (self);
840 #line 126 "moonshot-local-flat-file-store.vala"
841                 filename = g_build_filename (path, LOCAL_FLAT_FILE_STORE_FILE_NAME, NULL);
842 #line 127 "moonshot-local-flat-file-store.vala"
843                 g_file_set_contents (filename, text, (gssize) (-1), &_inner_error_);
844 #line 845 "moonshot-local-flat-file-store.c"
845                 if (_inner_error_ != NULL) {
846                         _g_free0 (filename);
847                         _g_free0 (path);
848                         goto __catch4_g_error;
849                 }
850                 _g_free0 (filename);
851                 _g_free0 (path);
852         }
853         goto __finally4;
854         __catch4_g_error:
855         {
856                 GError * e;
857                 e = _inner_error_;
858                 _inner_error_ = NULL;
859                 {
860 #line 130 "moonshot-local-flat-file-store.vala"
861                         fprintf (stdout, "Error:  %s\n", e->message);
862 #line 863 "moonshot-local-flat-file-store.c"
863                         _g_error_free0 (e);
864                 }
865         }
866         __finally4:
867         if (_inner_error_ != NULL) {
868                 _g_free0 (text);
869                 _g_key_file_free0 (key_file);
870                 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
871                 g_clear_error (&_inner_error_);
872                 return;
873         }
874 #line 133 "moonshot-local-flat-file-store.vala"
875         local_flat_file_store_load_id_cards (self);
876 #line 877 "moonshot-local-flat-file-store.c"
877         _g_free0 (text);
878         _g_key_file_free0 (key_file);
879 }
880
881
882 #line 136 "moonshot-local-flat-file-store.vala"
883 LocalFlatFileStore* local_flat_file_store_construct (GType object_type) {
884 #line 885 "moonshot-local-flat-file-store.c"
885         LocalFlatFileStore * self = NULL;
886         GeeLinkedList* _tmp0_;
887 #line 136 "moonshot-local-flat-file-store.vala"
888         self = (LocalFlatFileStore*) g_object_new (object_type, NULL);
889 #line 137 "moonshot-local-flat-file-store.vala"
890         self->priv->id_card_list = (_tmp0_ = gee_linked_list_new (TYPE_ID_CARD, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->id_card_list), _tmp0_);
891 #line 138 "moonshot-local-flat-file-store.vala"
892         local_flat_file_store_load_id_cards (self);
893 #line 894 "moonshot-local-flat-file-store.c"
894         return self;
895 }
896
897
898 #line 136 "moonshot-local-flat-file-store.vala"
899 LocalFlatFileStore* local_flat_file_store_new (void) {
900 #line 136 "moonshot-local-flat-file-store.vala"
901         return local_flat_file_store_construct (TYPE_LOCAL_FLAT_FILE_STORE);
902 #line 903 "moonshot-local-flat-file-store.c"
903 }
904
905
906 static void local_flat_file_store_class_init (LocalFlatFileStoreClass * klass) {
907         local_flat_file_store_parent_class = g_type_class_peek_parent (klass);
908         g_type_class_add_private (klass, sizeof (LocalFlatFileStorePrivate));
909         G_OBJECT_CLASS (klass)->finalize = local_flat_file_store_finalize;
910 }
911
912
913 static void local_flat_file_store_iidentity_card_store_interface_init (IIdentityCardStoreIface * iface) {
914         local_flat_file_store_iidentity_card_store_parent_iface = g_type_interface_peek_parent (iface);
915         iface->add_card = local_flat_file_store_real_add_card;
916         iface->update_card = local_flat_file_store_real_update_card;
917         iface->remove_card = local_flat_file_store_real_remove_card;
918         iface->get_card_list = local_flat_file_store_real_get_card_list;
919 }
920
921
922 static void local_flat_file_store_instance_init (LocalFlatFileStore * self) {
923         self->priv = LOCAL_FLAT_FILE_STORE_GET_PRIVATE (self);
924 }
925
926
927 static void local_flat_file_store_finalize (GObject* obj) {
928         LocalFlatFileStore * self;
929         self = LOCAL_FLAT_FILE_STORE (obj);
930         _g_object_unref0 (self->priv->id_card_list);
931         G_OBJECT_CLASS (local_flat_file_store_parent_class)->finalize (obj);
932 }
933
934
935 GType local_flat_file_store_get_type (void) {
936         static volatile gsize local_flat_file_store_type_id__volatile = 0;
937         if (g_once_init_enter (&local_flat_file_store_type_id__volatile)) {
938                 static const GTypeInfo g_define_type_info = { sizeof (LocalFlatFileStoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) local_flat_file_store_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LocalFlatFileStore), 0, (GInstanceInitFunc) local_flat_file_store_instance_init, NULL };
939                 static const GInterfaceInfo iidentity_card_store_info = { (GInterfaceInitFunc) local_flat_file_store_iidentity_card_store_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
940                 GType local_flat_file_store_type_id;
941                 local_flat_file_store_type_id = g_type_register_static (G_TYPE_OBJECT, "LocalFlatFileStore", &g_define_type_info, 0);
942                 g_type_add_interface_static (local_flat_file_store_type_id, TYPE_IIDENTITY_CARD_STORE, &iidentity_card_store_info);
943                 g_once_init_leave (&local_flat_file_store_type_id__volatile, local_flat_file_store_type_id);
944         }
945         return local_flat_file_store_type_id__volatile;
946 }
947
948
949 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
950         if ((array != NULL) && (destroy_func != NULL)) {
951                 int i;
952                 for (i = 0; i < array_length; i = i + 1) {
953                         if (((gpointer*) array)[i] != NULL) {
954                                 destroy_func (((gpointer*) array)[i]);
955                         }
956                 }
957         }
958 }
959
960
961 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
962         _vala_array_destroy (array, array_length, destroy_func);
963         g_free (array);
964 }
965
966
967
968