summaryrefslogtreecommitdiff
path: root/src/core/DatabaseSourceCollection.c
blob: b83be404655efc3aaf7d72948898d7c6ffccc236 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
/* DatabaseSourceCollection.c generated by valac 0.32.1, the Vala compiler
 * generated from DatabaseSourceCollection.vala, do not modify */

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>


#define TYPE_DATA_OBJECT (data_object_get_type ())
#define DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_OBJECT, DataObject))
#define DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_OBJECT, DataObjectClass))
#define IS_DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_OBJECT))
#define IS_DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_OBJECT))
#define DATA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_OBJECT, DataObjectClass))

typedef struct _DataObject DataObject;
typedef struct _DataObjectClass DataObjectClass;

#define TYPE_DATA_SOURCE (data_source_get_type ())
#define DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_SOURCE, DataSource))
#define DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_SOURCE, DataSourceClass))
#define IS_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_SOURCE))
#define IS_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_SOURCE))
#define DATA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_SOURCE, DataSourceClass))

typedef struct _DataSource DataSource;
typedef struct _DataSourceClass DataSourceClass;

#define TYPE_DATA_COLLECTION (data_collection_get_type ())
#define DATA_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_COLLECTION, DataCollection))
#define DATA_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_COLLECTION, DataCollectionClass))
#define IS_DATA_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_COLLECTION))
#define IS_DATA_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_COLLECTION))
#define DATA_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_COLLECTION, DataCollectionClass))

typedef struct _DataCollection DataCollection;
typedef struct _DataCollectionClass DataCollectionClass;
typedef struct _DataCollectionPrivate DataCollectionPrivate;

#define TYPE_ALTERATION (alteration_get_type ())
#define ALTERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ALTERATION, Alteration))
#define ALTERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ALTERATION, AlterationClass))
#define IS_ALTERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ALTERATION))
#define IS_ALTERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ALTERATION))
#define ALTERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ALTERATION, AlterationClass))

typedef struct _Alteration Alteration;
typedef struct _AlterationClass AlterationClass;

#define TYPE_MARKER (marker_get_type ())
#define MARKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MARKER, Marker))
#define IS_MARKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MARKER))
#define MARKER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MARKER, MarkerIface))

typedef struct _Marker Marker;
typedef struct _MarkerIface MarkerIface;

#define TYPE_SOURCE_COLLECTION (source_collection_get_type ())
#define SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOURCE_COLLECTION, SourceCollection))
#define SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOURCE_COLLECTION, SourceCollectionClass))
#define IS_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOURCE_COLLECTION))
#define IS_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOURCE_COLLECTION))
#define SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOURCE_COLLECTION, SourceCollectionClass))

typedef struct _SourceCollection SourceCollection;
typedef struct _SourceCollectionClass SourceCollectionClass;
typedef struct _SourceCollectionPrivate SourceCollectionPrivate;

#define TYPE_SOURCE_BACKLINK (source_backlink_get_type ())
#define SOURCE_BACKLINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOURCE_BACKLINK, SourceBacklink))
#define SOURCE_BACKLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOURCE_BACKLINK, SourceBacklinkClass))
#define IS_SOURCE_BACKLINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOURCE_BACKLINK))
#define IS_SOURCE_BACKLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOURCE_BACKLINK))
#define SOURCE_BACKLINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOURCE_BACKLINK, SourceBacklinkClass))

typedef struct _SourceBacklink SourceBacklink;
typedef struct _SourceBacklinkClass SourceBacklinkClass;

#define TYPE_DATABASE_SOURCE_COLLECTION (database_source_collection_get_type ())
#define DATABASE_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollection))
#define DATABASE_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollectionClass))
#define IS_DATABASE_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_SOURCE_COLLECTION))
#define IS_DATABASE_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_SOURCE_COLLECTION))
#define DATABASE_SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollectionClass))

typedef struct _DatabaseSourceCollection DatabaseSourceCollection;
typedef struct _DatabaseSourceCollectionClass DatabaseSourceCollectionClass;
typedef struct _DatabaseSourceCollectionPrivate DatabaseSourceCollectionPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_SOURCE_HOLDING_TANK (source_holding_tank_get_type ())
#define SOURCE_HOLDING_TANK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOURCE_HOLDING_TANK, SourceHoldingTank))
#define SOURCE_HOLDING_TANK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOURCE_HOLDING_TANK, SourceHoldingTankClass))
#define IS_SOURCE_HOLDING_TANK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOURCE_HOLDING_TANK))
#define IS_SOURCE_HOLDING_TANK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOURCE_HOLDING_TANK))
#define SOURCE_HOLDING_TANK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOURCE_HOLDING_TANK, SourceHoldingTankClass))

typedef struct _SourceHoldingTank SourceHoldingTank;
typedef struct _SourceHoldingTankClass SourceHoldingTankClass;
typedef struct _SourceHoldingTankPrivate SourceHoldingTankPrivate;

#define TYPE_DATABASE_SOURCE_HOLDING_TANK (database_source_holding_tank_get_type ())
#define DATABASE_SOURCE_HOLDING_TANK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_SOURCE_HOLDING_TANK, DatabaseSourceHoldingTank))
#define DATABASE_SOURCE_HOLDING_TANK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_SOURCE_HOLDING_TANK, DatabaseSourceHoldingTankClass))
#define IS_DATABASE_SOURCE_HOLDING_TANK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_SOURCE_HOLDING_TANK))
#define IS_DATABASE_SOURCE_HOLDING_TANK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_SOURCE_HOLDING_TANK))
#define DATABASE_SOURCE_HOLDING_TANK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_SOURCE_HOLDING_TANK, DatabaseSourceHoldingTankClass))

typedef struct _DatabaseSourceHoldingTank DatabaseSourceHoldingTank;
typedef struct _DatabaseSourceHoldingTankClass DatabaseSourceHoldingTankClass;
typedef struct _DatabaseSourceHoldingTankPrivate DatabaseSourceHoldingTankPrivate;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

typedef gint64 (*GetSourceDatabaseKey) (DataSource* source, void* user_data);
typedef gint64 (*Comparator) (void* a, void* b, void* user_data);
typedef gboolean (*ComparatorPredicate) (DataObject* object, Alteration* alteration, void* user_data);
typedef gboolean (*ProgressMonitor) (guint64 current, guint64 total, gboolean do_event_loop, void* user_data);
struct _MarkerIface {
	GTypeInterface parent_iface;
	void (*mark) (Marker* self, DataObject* object);
	void (*unmark) (Marker* self, DataObject* object);
	gboolean (*toggle) (Marker* self, DataObject* object);
	void (*mark_many) (Marker* self, GeeCollection* list);
	void (*unmark_many) (Marker* self, GeeCollection* list);
	void (*mark_all) (Marker* self);
	gint (*get_count) (Marker* self);
	GeeCollection* (*get_all) (Marker* self);
};

struct _DataCollection {
	GTypeInstance parent_instance;
	volatile int ref_count;
	DataCollectionPrivate * priv;
};

struct _DataCollectionClass {
	GTypeClass parent_class;
	void (*finalize) (DataCollection *self);
	gchar* (*to_string) (DataCollection* self);
	void (*notify_items_added) (DataCollection* self, GeeIterable* added);
	void (*notify_items_removed) (DataCollection* self, GeeIterable* removed);
	void (*notify_contents_altered) (DataCollection* self, GeeIterable* added, GeeIterable* removed);
	void (*notify_items_altered) (DataCollection* self, GeeMap* items);
	void (*notify_ordering_changed) (DataCollection* self);
	void (*notify_property_set) (DataCollection* self, const gchar* name, GValue* old, GValue* val);
	void (*notify_property_cleared) (DataCollection* self, const gchar* name);
	gboolean (*valid_type) (DataCollection* self, DataObject* object);
	void (*set_comparator) (DataCollection* self, Comparator comparator, void* comparator_target, ComparatorPredicate predicate, void* predicate_target);
	void (*reset_comparator) (DataCollection* self);
	GeeCollection* (*get_all) (DataCollection* self);
	gint (*get_count) (DataCollection* self);
	DataObject* (*get_at) (DataCollection* self, gint index);
	gint (*index_of) (DataCollection* self, DataObject* object);
	gboolean (*contains) (DataCollection* self, DataObject* object);
	gboolean (*add) (DataCollection* self, DataObject* object);
	GeeCollection* (*add_many) (DataCollection* self, GeeCollection* objects, ProgressMonitor monitor, void* monitor_target);
	void (*remove_marked) (DataCollection* self, Marker* m);
	void (*clear) (DataCollection* self);
	void (*close) (DataCollection* self);
	void (*notify_frozen) (DataCollection* self);
	void (*notify_thawed) (DataCollection* self);
	void (*items_added) (DataCollection* self, GeeIterable* added);
	void (*items_removed) (DataCollection* self, GeeIterable* removed);
	void (*contents_altered) (DataCollection* self, GeeIterable* added, GeeIterable* removed);
	void (*items_altered) (DataCollection* self, GeeMap* items);
	void (*ordering_changed) (DataCollection* self);
	void (*property_set) (DataCollection* self, const gchar* name, GValue* old, GValue* val);
	void (*property_cleared) (DataCollection* self, const gchar* name);
	void (*frozen) (DataCollection* self);
	void (*thawed) (DataCollection* self);
};

struct _SourceCollection {
	DataCollection parent_instance;
	SourceCollectionPrivate * priv;
};

struct _SourceCollectionClass {
	DataCollectionClass parent_class;
	gboolean (*holds_type_of_source) (SourceCollection* self, DataSource* source);
	void (*notify_items_unlinking) (SourceCollection* self, GeeCollection* unlinking);
	void (*notify_items_relinked) (SourceCollection* self, GeeCollection* relinked);
	void (*notify_item_destroyed) (SourceCollection* self, DataSource* source);
	void (*notify_items_destroyed) (SourceCollection* self, GeeCollection* destroyed);
	void (*notify_unlinked_destroyed) (SourceCollection* self, DataSource* unlinked);
	void (*notify_backlink_removed) (SourceCollection* self, SourceBacklink* backlink, GeeCollection* sources);
	gboolean (*has_backlink) (SourceCollection* self, SourceBacklink* backlink);
	void (*remove_backlink) (SourceCollection* self, SourceBacklink* backlink);
	void (*items_unlinking) (SourceCollection* self, GeeCollection* unlinking);
	void (*items_relinked) (SourceCollection* self, GeeCollection* relinked);
	void (*item_destroyed) (SourceCollection* self, DataSource* source);
	void (*items_destroyed) (SourceCollection* self, GeeCollection* destroyed);
	void (*unlinked_destroyed) (SourceCollection* self, DataSource* source);
	void (*backlink_removed) (SourceCollection* self, SourceBacklink* backlink, GeeCollection* sources);
};

struct _DatabaseSourceCollection {
	SourceCollection parent_instance;
	DatabaseSourceCollectionPrivate * priv;
};

struct _DatabaseSourceCollectionClass {
	SourceCollectionClass parent_class;
};

struct _DatabaseSourceCollectionPrivate {
	GetSourceDatabaseKey source_key_func;
	gpointer source_key_func_target;
	GeeHashMap* map;
};

struct _SourceHoldingTank {
	GTypeInstance parent_instance;
	volatile int ref_count;
	SourceHoldingTankPrivate * priv;
};

struct _SourceHoldingTankClass {
	GTypeClass parent_class;
	void (*finalize) (SourceHoldingTank *self);
	void (*notify_contents_altered) (SourceHoldingTank* self, GeeCollection* added, GeeCollection* removed);
	void (*contents_altered) (SourceHoldingTank* self, GeeCollection* added, GeeCollection* removed);
};

struct _DatabaseSourceHoldingTank {
	SourceHoldingTank parent_instance;
	DatabaseSourceHoldingTankPrivate * priv;
};

struct _DatabaseSourceHoldingTankClass {
	SourceHoldingTankClass parent_class;
};

struct _DatabaseSourceHoldingTankPrivate {
	GetSourceDatabaseKey get_key;
	gpointer get_key_target;
	GeeHashMap* map;
};

typedef gboolean (*SourceHoldingTankCheckToKeep) (DataSource* source, Alteration* alteration, void* user_data);

static gpointer database_source_collection_parent_class = NULL;
static gpointer database_source_holding_tank_parent_class = NULL;

GType data_object_get_type (void) G_GNUC_CONST;
GType data_source_get_type (void) G_GNUC_CONST;
gpointer data_collection_ref (gpointer instance);
void data_collection_unref (gpointer instance);
GParamSpec* param_spec_data_collection (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_data_collection (GValue* value, gpointer v_object);
void value_take_data_collection (GValue* value, gpointer v_object);
gpointer value_get_data_collection (const GValue* value);
GType data_collection_get_type (void) G_GNUC_CONST;
gpointer alteration_ref (gpointer instance);
void alteration_unref (gpointer instance);
GParamSpec* param_spec_alteration (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_alteration (GValue* value, gpointer v_object);
void value_take_alteration (GValue* value, gpointer v_object);
gpointer value_get_alteration (const GValue* value);
GType alteration_get_type (void) G_GNUC_CONST;
GType marker_get_type (void) G_GNUC_CONST;
GType source_collection_get_type (void) G_GNUC_CONST;
gpointer source_backlink_ref (gpointer instance);
void source_backlink_unref (gpointer instance);
GParamSpec* param_spec_source_backlink (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_source_backlink (GValue* value, gpointer v_object);
void value_take_source_backlink (GValue* value, gpointer v_object);
gpointer value_get_source_backlink (const GValue* value);
GType source_backlink_get_type (void) G_GNUC_CONST;
GType database_source_collection_get_type (void) G_GNUC_CONST;
#define DATABASE_SOURCE_COLLECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollectionPrivate))
enum  {
	DATABASE_SOURCE_COLLECTION_DUMMY_PROPERTY
};
guint int64_hash (gint64* n);
static guint _int64_hash_gee_hash_data_func (gconstpointer v, gpointer self);
gboolean int64_equal (gint64* a, gint64* b);
static gboolean _int64_equal_gee_equal_data_func (gconstpointer a, gconstpointer b, gpointer self);
static gint64* _int64_dup (gint64* self);
DatabaseSourceCollection* database_source_collection_construct (GType object_type, const gchar* name, GetSourceDatabaseKey source_key_func, void* source_key_func_target);
SourceCollection* source_collection_construct (GType object_type, const gchar* name);
static void database_source_collection_real_notify_items_added (DataCollection* base, GeeIterable* added);
void data_collection_notify_items_added (DataCollection* self, GeeIterable* added);
static void database_source_collection_real_notify_items_removed (DataCollection* base, GeeIterable* removed);
void data_collection_notify_items_removed (DataCollection* self, GeeIterable* removed);
DataSource* database_source_collection_fetch_by_key (DatabaseSourceCollection* self, gint64 key);
static void database_source_collection_finalize (DataCollection* obj);
gpointer source_holding_tank_ref (gpointer instance);
void source_holding_tank_unref (gpointer instance);
GParamSpec* param_spec_source_holding_tank (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_source_holding_tank (GValue* value, gpointer v_object);
void value_take_source_holding_tank (GValue* value, gpointer v_object);
gpointer value_get_source_holding_tank (const GValue* value);
GType source_holding_tank_get_type (void) G_GNUC_CONST;
GType database_source_holding_tank_get_type (void) G_GNUC_CONST;
#define DATABASE_SOURCE_HOLDING_TANK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DATABASE_SOURCE_HOLDING_TANK, DatabaseSourceHoldingTankPrivate))
enum  {
	DATABASE_SOURCE_HOLDING_TANK_DUMMY_PROPERTY
};
DatabaseSourceHoldingTank* database_source_holding_tank_new (SourceCollection* sources, SourceHoldingTankCheckToKeep check_to_keep, void* check_to_keep_target, GetSourceDatabaseKey get_key, void* get_key_target);
DatabaseSourceHoldingTank* database_source_holding_tank_construct (GType object_type, SourceCollection* sources, SourceHoldingTankCheckToKeep check_to_keep, void* check_to_keep_target, GetSourceDatabaseKey get_key, void* get_key_target);
SourceHoldingTank* source_holding_tank_new (SourceCollection* sources, SourceHoldingTankCheckToKeep check_to_keep, void* check_to_keep_target);
SourceHoldingTank* source_holding_tank_construct (GType object_type, SourceCollection* sources, SourceHoldingTankCheckToKeep check_to_keep, void* check_to_keep_target);
DataSource* database_source_holding_tank_get_by_id (DatabaseSourceHoldingTank* self, gint64 id);
static void database_source_holding_tank_real_notify_contents_altered (SourceHoldingTank* base, GeeCollection* added, GeeCollection* removed);
void source_holding_tank_notify_contents_altered (SourceHoldingTank* self, GeeCollection* added, GeeCollection* removed);
static void database_source_holding_tank_finalize (SourceHoldingTank* obj);


static guint _int64_hash_gee_hash_data_func (gconstpointer v, gpointer self) {
	guint result;
	result = int64_hash ((gint64*) v);
#line 17 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	return result;
#line 327 "DatabaseSourceCollection.c"
}


static gboolean _int64_equal_gee_equal_data_func (gconstpointer a, gconstpointer b, gpointer self) {
	gboolean result;
	result = int64_equal ((gint64*) a, (gint64*) b);
#line 17 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	return result;
#line 336 "DatabaseSourceCollection.c"
}


static gint64* _int64_dup (gint64* self) {
	gint64* dup;
#line 17 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	dup = g_new0 (gint64, 1);
#line 17 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	memcpy (dup, self, sizeof (gint64));
#line 17 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	return dup;
#line 348 "DatabaseSourceCollection.c"
}


DatabaseSourceCollection* database_source_collection_construct (GType object_type, const gchar* name, GetSourceDatabaseKey source_key_func, void* source_key_func_target) {
	DatabaseSourceCollection* self = NULL;
	const gchar* _tmp0_ = NULL;
	GetSourceDatabaseKey _tmp1_ = NULL;
	void* _tmp1__target = NULL;
#line 20 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	g_return_val_if_fail (name != NULL, NULL);
#line 21 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp0_ = name;
#line 21 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self = (DatabaseSourceCollection*) source_collection_construct (object_type, _tmp0_);
#line 23 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp1_ = source_key_func;
#line 23 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp1__target = source_key_func_target;
#line 23 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self->priv->source_key_func = _tmp1_;
#line 23 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self->priv->source_key_func_target = _tmp1__target;
#line 20 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	return self;
#line 373 "DatabaseSourceCollection.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 28 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	return self ? g_object_ref (self) : NULL;
#line 380 "DatabaseSourceCollection.c"
}


static void database_source_collection_real_notify_items_added (DataCollection* base, GeeIterable* added) {
	DatabaseSourceCollection * self;
	GeeIterable* _tmp17_ = NULL;
#line 26 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollection);
#line 26 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	g_return_if_fail (GEE_IS_ITERABLE (added));
#line 391 "DatabaseSourceCollection.c"
	{
		GeeIterator* _object_it = NULL;
		GeeIterable* _tmp0_ = NULL;
		GeeIterator* _tmp1_ = NULL;
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
		_tmp0_ = added;
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
		_tmp1_ = gee_iterable_iterator (_tmp0_);
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
		_object_it = _tmp1_;
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
		while (TRUE) {
#line 404 "DatabaseSourceCollection.c"
			GeeIterator* _tmp2_ = NULL;
			gboolean _tmp3_ = FALSE;
			DataObject* object = NULL;
			GeeIterator* _tmp4_ = NULL;
			gpointer _tmp5_ = NULL;
			DataSource* source = NULL;
			DataObject* _tmp6_ = NULL;
			DataSource* _tmp7_ = NULL;
			gint64 key = 0LL;
			GetSourceDatabaseKey _tmp8_ = NULL;
			void* _tmp8__target = NULL;
			DataSource* _tmp9_ = NULL;
			gint64 _tmp10_ = 0LL;
			GeeHashMap* _tmp11_ = NULL;
			gint64 _tmp12_ = 0LL;
			gboolean _tmp13_ = FALSE;
			GeeHashMap* _tmp14_ = NULL;
			gint64 _tmp15_ = 0LL;
			DataSource* _tmp16_ = NULL;
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp2_ = _object_it;
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp3_ = gee_iterator_next (_tmp2_);
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			if (!_tmp3_) {
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				break;
#line 432 "DatabaseSourceCollection.c"
			}
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp4_ = _object_it;
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp5_ = gee_iterator_get (_tmp4_);
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			object = (DataObject*) _tmp5_;
#line 28 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp6_ = object;
#line 28 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, TYPE_DATA_SOURCE, DataSource));
#line 28 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			source = _tmp7_;
#line 29 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp8_ = self->priv->source_key_func;
#line 29 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp8__target = self->priv->source_key_func_target;
#line 29 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp9_ = source;
#line 29 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp10_ = _tmp8_ (_tmp9_, _tmp8__target);
#line 29 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			key = _tmp10_;
#line 31 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp11_ = self->priv->map;
#line 31 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp12_ = key;
#line 31 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp13_ = gee_abstract_map_has_key (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), &_tmp12_);
#line 31 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_vala_assert (!_tmp13_, "!map.has_key(key)");
#line 33 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp14_ = self->priv->map;
#line 33 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp15_ = key;
#line 33 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp16_ = source;
#line 33 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), &_tmp15_, _tmp16_);
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_g_object_unref0 (source);
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_g_object_unref0 (object);
#line 476 "DatabaseSourceCollection.c"
		}
#line 27 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
		_g_object_unref0 (_object_it);
#line 480 "DatabaseSourceCollection.c"
	}
#line 36 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp17_ = added;
#line 36 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	DATA_COLLECTION_CLASS (database_source_collection_parent_class)->notify_items_added (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SOURCE_COLLECTION, SourceCollection), TYPE_DATA_COLLECTION, DataCollection), _tmp17_);
#line 486 "DatabaseSourceCollection.c"
}


static void database_source_collection_real_notify_items_removed (DataCollection* base, GeeIterable* removed) {
	DatabaseSourceCollection * self;
	GeeIterable* _tmp13_ = NULL;
#line 39 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollection);
#line 39 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	g_return_if_fail (GEE_IS_ITERABLE (removed));
#line 497 "DatabaseSourceCollection.c"
	{
		GeeIterator* _object_it = NULL;
		GeeIterable* _tmp0_ = NULL;
		GeeIterator* _tmp1_ = NULL;
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
		_tmp0_ = removed;
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
		_tmp1_ = gee_iterable_iterator (_tmp0_);
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
		_object_it = _tmp1_;
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
		while (TRUE) {
#line 510 "DatabaseSourceCollection.c"
			GeeIterator* _tmp2_ = NULL;
			gboolean _tmp3_ = FALSE;
			DataObject* object = NULL;
			GeeIterator* _tmp4_ = NULL;
			gpointer _tmp5_ = NULL;
			gint64 key = 0LL;
			GetSourceDatabaseKey _tmp6_ = NULL;
			void* _tmp6__target = NULL;
			DataObject* _tmp7_ = NULL;
			gint64 _tmp8_ = 0LL;
			gboolean is_removed = FALSE;
			GeeHashMap* _tmp9_ = NULL;
			gint64 _tmp10_ = 0LL;
			gboolean _tmp11_ = FALSE;
			gboolean _tmp12_ = FALSE;
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp2_ = _object_it;
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp3_ = gee_iterator_next (_tmp2_);
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			if (!_tmp3_) {
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				break;
#line 534 "DatabaseSourceCollection.c"
			}
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp4_ = _object_it;
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp5_ = gee_iterator_get (_tmp4_);
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			object = (DataObject*) _tmp5_;
#line 41 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp6_ = self->priv->source_key_func;
#line 41 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp6__target = self->priv->source_key_func_target;
#line 41 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp7_ = object;
#line 41 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp8_ = _tmp6_ (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, TYPE_DATA_SOURCE, DataSource), _tmp6__target);
#line 41 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			key = _tmp8_;
#line 43 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp9_ = self->priv->map;
#line 43 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp10_ = key;
#line 43 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp11_ = gee_abstract_map_unset (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), &_tmp10_, NULL);
#line 43 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			is_removed = _tmp11_;
#line 44 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp12_ = is_removed;
#line 44 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_vala_assert (_tmp12_, "is_removed");
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_g_object_unref0 (object);
#line 566 "DatabaseSourceCollection.c"
		}
#line 40 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
		_g_object_unref0 (_object_it);
#line 570 "DatabaseSourceCollection.c"
	}
#line 47 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp13_ = removed;
#line 47 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	DATA_COLLECTION_CLASS (database_source_collection_parent_class)->notify_items_removed (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SOURCE_COLLECTION, SourceCollection), TYPE_DATA_COLLECTION, DataCollection), _tmp13_);
#line 576 "DatabaseSourceCollection.c"
}


DataSource* database_source_collection_fetch_by_key (DatabaseSourceCollection* self, gint64 key) {
	DataSource* result = NULL;
	GeeHashMap* _tmp0_ = NULL;
	gint64 _tmp1_ = 0LL;
	gpointer _tmp2_ = NULL;
#line 50 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	g_return_val_if_fail (IS_DATABASE_SOURCE_COLLECTION (self), NULL);
#line 51 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp0_ = self->priv->map;
#line 51 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp1_ = key;
#line 51 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp2_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), &_tmp1_);
#line 51 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	result = (DataSource*) _tmp2_;
#line 51 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	return result;
#line 597 "DatabaseSourceCollection.c"
}


static void database_source_collection_class_init (DatabaseSourceCollectionClass * klass) {
#line 15 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	database_source_collection_parent_class = g_type_class_peek_parent (klass);
#line 15 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	((DataCollectionClass *) klass)->finalize = database_source_collection_finalize;
#line 15 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	g_type_class_add_private (klass, sizeof (DatabaseSourceCollectionPrivate));
#line 15 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	((DataCollectionClass *) klass)->notify_items_added = database_source_collection_real_notify_items_added;
#line 15 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	((DataCollectionClass *) klass)->notify_items_removed = database_source_collection_real_notify_items_removed;
#line 612 "DatabaseSourceCollection.c"
}


static void database_source_collection_instance_init (DatabaseSourceCollection * self) {
	GeeHashMap* _tmp0_ = NULL;
#line 15 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self->priv = DATABASE_SOURCE_COLLECTION_GET_PRIVATE (self);
#line 17 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp0_ = gee_hash_map_new (G_TYPE_INT64, (GBoxedCopyFunc) _int64_dup, g_free, TYPE_DATA_SOURCE, (GBoxedCopyFunc) g_object_ref, g_object_unref, _int64_hash_gee_hash_data_func, NULL, NULL, _int64_equal_gee_equal_data_func, NULL, NULL, NULL, NULL, NULL);
#line 17 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self->priv->map = _tmp0_;
#line 624 "DatabaseSourceCollection.c"
}


static void database_source_collection_finalize (DataCollection* obj) {
	DatabaseSourceCollection * self;
#line 15 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollection);
#line 17 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_g_object_unref0 (self->priv->map);
#line 15 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	DATA_COLLECTION_CLASS (database_source_collection_parent_class)->finalize (obj);
#line 636 "DatabaseSourceCollection.c"
}


GType database_source_collection_get_type (void) {
	static volatile gsize database_source_collection_type_id__volatile = 0;
	if (g_once_init_enter (&database_source_collection_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DatabaseSourceCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) database_source_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DatabaseSourceCollection), 0, (GInstanceInitFunc) database_source_collection_instance_init, NULL };
		GType database_source_collection_type_id;
		database_source_collection_type_id = g_type_register_static (TYPE_SOURCE_COLLECTION, "DatabaseSourceCollection", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&database_source_collection_type_id__volatile, database_source_collection_type_id);
	}
	return database_source_collection_type_id__volatile;
}


DatabaseSourceHoldingTank* database_source_holding_tank_construct (GType object_type, SourceCollection* sources, SourceHoldingTankCheckToKeep check_to_keep, void* check_to_keep_target, GetSourceDatabaseKey get_key, void* get_key_target) {
	DatabaseSourceHoldingTank* self = NULL;
	SourceCollection* _tmp0_ = NULL;
	SourceHoldingTankCheckToKeep _tmp1_ = NULL;
	void* _tmp1__target = NULL;
	GetSourceDatabaseKey _tmp2_ = NULL;
	void* _tmp2__target = NULL;
#line 60 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	g_return_val_if_fail (IS_SOURCE_COLLECTION (sources), NULL);
#line 62 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp0_ = sources;
#line 62 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp1_ = check_to_keep;
#line 62 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp1__target = check_to_keep_target;
#line 62 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self = (DatabaseSourceHoldingTank*) source_holding_tank_construct (object_type, _tmp0_, _tmp1_, _tmp1__target);
#line 64 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp2_ = get_key;
#line 64 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp2__target = get_key_target;
#line 64 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self->priv->get_key = _tmp2_;
#line 64 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self->priv->get_key_target = _tmp2__target;
#line 60 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	return self;
#line 679 "DatabaseSourceCollection.c"
}


DatabaseSourceHoldingTank* database_source_holding_tank_new (SourceCollection* sources, SourceHoldingTankCheckToKeep check_to_keep, void* check_to_keep_target, GetSourceDatabaseKey get_key, void* get_key_target) {
#line 60 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	return database_source_holding_tank_construct (TYPE_DATABASE_SOURCE_HOLDING_TANK, sources, check_to_keep, check_to_keep_target, get_key, get_key_target);
#line 686 "DatabaseSourceCollection.c"
}


DataSource* database_source_holding_tank_get_by_id (DatabaseSourceHoldingTank* self, gint64 id) {
	DataSource* result = NULL;
	GeeHashMap* _tmp0_ = NULL;
	gint64 _tmp1_ = 0LL;
	gpointer _tmp2_ = NULL;
#line 67 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	g_return_val_if_fail (IS_DATABASE_SOURCE_HOLDING_TANK (self), NULL);
#line 68 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp0_ = self->priv->map;
#line 68 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp1_ = id;
#line 68 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp2_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), &_tmp1_);
#line 68 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	result = (DataSource*) _tmp2_;
#line 68 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	return result;
#line 707 "DatabaseSourceCollection.c"
}


static void database_source_holding_tank_real_notify_contents_altered (SourceHoldingTank* base, GeeCollection* added, GeeCollection* removed) {
	DatabaseSourceHoldingTank * self;
	GeeCollection* _tmp0_ = NULL;
	GeeCollection* _tmp12_ = NULL;
	GeeCollection* _tmp23_ = NULL;
	GeeCollection* _tmp24_ = NULL;
#line 71 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_DATABASE_SOURCE_HOLDING_TANK, DatabaseSourceHoldingTank);
#line 71 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	g_return_if_fail ((added == NULL) || GEE_IS_COLLECTION (added));
#line 71 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	g_return_if_fail ((removed == NULL) || GEE_IS_COLLECTION (removed));
#line 73 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp0_ = added;
#line 73 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	if (_tmp0_ != NULL) {
#line 727 "DatabaseSourceCollection.c"
		{
			GeeIterator* _source_it = NULL;
			GeeCollection* _tmp1_ = NULL;
			GeeIterator* _tmp2_ = NULL;
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp1_ = added;
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp2_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GEE_TYPE_ITERABLE, GeeIterable));
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_source_it = _tmp2_;
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			while (TRUE) {
#line 740 "DatabaseSourceCollection.c"
				GeeIterator* _tmp3_ = NULL;
				gboolean _tmp4_ = FALSE;
				DataSource* source = NULL;
				GeeIterator* _tmp5_ = NULL;
				gpointer _tmp6_ = NULL;
				GeeHashMap* _tmp7_ = NULL;
				GetSourceDatabaseKey _tmp8_ = NULL;
				void* _tmp8__target = NULL;
				DataSource* _tmp9_ = NULL;
				gint64 _tmp10_ = 0LL;
				DataSource* _tmp11_ = NULL;
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp3_ = _source_it;
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp4_ = gee_iterator_next (_tmp3_);
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				if (!_tmp4_) {
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
					break;
#line 760 "DatabaseSourceCollection.c"
				}
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp5_ = _source_it;
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp6_ = gee_iterator_get (_tmp5_);
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				source = (DataSource*) _tmp6_;
#line 75 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp7_ = self->priv->map;
#line 75 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp8_ = self->priv->get_key;
#line 75 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp8__target = self->priv->get_key_target;
#line 75 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp9_ = source;
#line 75 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp10_ = _tmp8_ (_tmp9_, _tmp8__target);
#line 75 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp11_ = source;
#line 75 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), &_tmp10_, _tmp11_);
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_g_object_unref0 (source);
#line 784 "DatabaseSourceCollection.c"
			}
#line 74 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_g_object_unref0 (_source_it);
#line 788 "DatabaseSourceCollection.c"
		}
	}
#line 78 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp12_ = removed;
#line 78 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	if (_tmp12_ != NULL) {
#line 795 "DatabaseSourceCollection.c"
		{
			GeeIterator* _source_it = NULL;
			GeeCollection* _tmp13_ = NULL;
			GeeIterator* _tmp14_ = NULL;
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp13_ = removed;
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_tmp14_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, GEE_TYPE_ITERABLE, GeeIterable));
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_source_it = _tmp14_;
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			while (TRUE) {
#line 808 "DatabaseSourceCollection.c"
				GeeIterator* _tmp15_ = NULL;
				gboolean _tmp16_ = FALSE;
				DataSource* source = NULL;
				GeeIterator* _tmp17_ = NULL;
				gpointer _tmp18_ = NULL;
				GeeHashMap* _tmp19_ = NULL;
				GetSourceDatabaseKey _tmp20_ = NULL;
				void* _tmp20__target = NULL;
				DataSource* _tmp21_ = NULL;
				gint64 _tmp22_ = 0LL;
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp15_ = _source_it;
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp16_ = gee_iterator_next (_tmp15_);
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				if (!_tmp16_) {
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
					break;
#line 827 "DatabaseSourceCollection.c"
				}
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp17_ = _source_it;
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp18_ = gee_iterator_get (_tmp17_);
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				source = (DataSource*) _tmp18_;
#line 80 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp19_ = self->priv->map;
#line 80 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp20_ = self->priv->get_key;
#line 80 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp20__target = self->priv->get_key_target;
#line 80 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp21_ = source;
#line 80 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_tmp22_ = _tmp20_ (_tmp21_, _tmp20__target);
#line 80 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				gee_abstract_map_unset (G_TYPE_CHECK_INSTANCE_CAST (_tmp19_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), &_tmp22_, NULL);
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
				_g_object_unref0 (source);
#line 849 "DatabaseSourceCollection.c"
			}
#line 79 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
			_g_object_unref0 (_source_it);
#line 853 "DatabaseSourceCollection.c"
		}
	}
#line 83 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp23_ = added;
#line 83 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp24_ = removed;
#line 83 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	SOURCE_HOLDING_TANK_CLASS (database_source_holding_tank_parent_class)->notify_contents_altered (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SOURCE_HOLDING_TANK, SourceHoldingTank), _tmp23_, _tmp24_);
#line 862 "DatabaseSourceCollection.c"
}


static void database_source_holding_tank_class_init (DatabaseSourceHoldingTankClass * klass) {
#line 55 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	database_source_holding_tank_parent_class = g_type_class_peek_parent (klass);
#line 55 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	((SourceHoldingTankClass *) klass)->finalize = database_source_holding_tank_finalize;
#line 55 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	g_type_class_add_private (klass, sizeof (DatabaseSourceHoldingTankPrivate));
#line 55 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	((SourceHoldingTankClass *) klass)->notify_contents_altered = database_source_holding_tank_real_notify_contents_altered;
#line 875 "DatabaseSourceCollection.c"
}


static void database_source_holding_tank_instance_init (DatabaseSourceHoldingTank * self) {
	GeeHashMap* _tmp0_ = NULL;
#line 55 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self->priv = DATABASE_SOURCE_HOLDING_TANK_GET_PRIVATE (self);
#line 57 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_tmp0_ = gee_hash_map_new (G_TYPE_INT64, (GBoxedCopyFunc) _int64_dup, g_free, TYPE_DATA_SOURCE, (GBoxedCopyFunc) g_object_ref, g_object_unref, _int64_hash_gee_hash_data_func, NULL, NULL, _int64_equal_gee_equal_data_func, NULL, NULL, NULL, NULL, NULL);
#line 57 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self->priv->map = _tmp0_;
#line 887 "DatabaseSourceCollection.c"
}


static void database_source_holding_tank_finalize (SourceHoldingTank* obj) {
	DatabaseSourceHoldingTank * self;
#line 55 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_DATABASE_SOURCE_HOLDING_TANK, DatabaseSourceHoldingTank);
#line 57 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	_g_object_unref0 (self->priv->map);
#line 55 "/home/jens/Source/shotwell/src/core/DatabaseSourceCollection.vala"
	SOURCE_HOLDING_TANK_CLASS (database_source_holding_tank_parent_class)->finalize (obj);
#line 899 "DatabaseSourceCollection.c"
}


GType database_source_holding_tank_get_type (void) {
	static volatile gsize database_source_holding_tank_type_id__volatile = 0;
	if (g_once_init_enter (&database_source_holding_tank_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DatabaseSourceHoldingTankClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) database_source_holding_tank_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DatabaseSourceHoldingTank), 0, (GInstanceInitFunc) database_source_holding_tank_instance_init, NULL };
		GType database_source_holding_tank_type_id;
		database_source_holding_tank_type_id = g_type_register_static (TYPE_SOURCE_HOLDING_TANK, "DatabaseSourceHoldingTank", &g_define_type_info, 0);
		g_once_init_leave (&database_source_holding_tank_type_id__volatile, database_source_holding_tank_type_id);
	}
	return database_source_holding_tank_type_id__volatile;
}