summaryrefslogtreecommitdiff
path: root/src/ThumbnailCache.c
blob: 9e928e3473b52d544e0a33258821014b27a96fec (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
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
/* ThumbnailCache.c generated by valac 0.32.1, the Vala compiler
 * generated from ThumbnailCache.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <gee.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <gobject/gvaluecollector.h>


#define TYPE_THUMBNAILS (thumbnails_get_type ())
#define THUMBNAILS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THUMBNAILS, Thumbnails))
#define THUMBNAILS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THUMBNAILS, ThumbnailsClass))
#define IS_THUMBNAILS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THUMBNAILS))
#define IS_THUMBNAILS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THUMBNAILS))
#define THUMBNAILS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THUMBNAILS, ThumbnailsClass))

typedef struct _Thumbnails Thumbnails;
typedef struct _ThumbnailsClass ThumbnailsClass;
typedef struct _ThumbnailsPrivate ThumbnailsPrivate;

#define THUMBNAIL_CACHE_TYPE_SIZE (thumbnail_cache_size_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ParamSpecThumbnails ParamSpecThumbnails;

#define TYPE_THUMBNAIL_CACHE (thumbnail_cache_get_type ())
#define THUMBNAIL_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THUMBNAIL_CACHE, ThumbnailCache))
#define THUMBNAIL_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THUMBNAIL_CACHE, ThumbnailCacheClass))
#define IS_THUMBNAIL_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THUMBNAIL_CACHE))
#define IS_THUMBNAIL_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THUMBNAIL_CACHE))
#define THUMBNAIL_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THUMBNAIL_CACHE, ThumbnailCacheClass))

typedef struct _ThumbnailCache ThumbnailCache;
typedef struct _ThumbnailCacheClass ThumbnailCacheClass;
typedef struct _ThumbnailCachePrivate ThumbnailCachePrivate;

#define JPEG_TYPE_QUALITY (jpeg_quality_get_type ())

#define THUMBNAIL_CACHE_TYPE_IMAGE_DATA (thumbnail_cache_image_data_get_type ())
#define THUMBNAIL_CACHE_IMAGE_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THUMBNAIL_CACHE_TYPE_IMAGE_DATA, ThumbnailCacheImageData))
#define THUMBNAIL_CACHE_IMAGE_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), THUMBNAIL_CACHE_TYPE_IMAGE_DATA, ThumbnailCacheImageDataClass))
#define THUMBNAIL_CACHE_IS_IMAGE_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THUMBNAIL_CACHE_TYPE_IMAGE_DATA))
#define THUMBNAIL_CACHE_IS_IMAGE_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUMBNAIL_CACHE_TYPE_IMAGE_DATA))
#define THUMBNAIL_CACHE_IMAGE_DATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THUMBNAIL_CACHE_TYPE_IMAGE_DATA, ThumbnailCacheImageDataClass))

typedef struct _ThumbnailCacheImageData ThumbnailCacheImageData;
typedef struct _ThumbnailCacheImageDataClass ThumbnailCacheImageDataClass;

#define TYPE_SCALING (scaling_get_type ())

#define TYPE_SCALE_CONSTRAINT (scale_constraint_get_type ())

#define TYPE_DIMENSIONS (dimensions_get_type ())
typedef struct _Dimensions Dimensions;
typedef struct _Scaling Scaling;

#define TYPE_WORKERS (workers_get_type ())
#define WORKERS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_WORKERS, Workers))
#define WORKERS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_WORKERS, WorkersClass))
#define IS_WORKERS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_WORKERS))
#define IS_WORKERS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_WORKERS))
#define WORKERS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_WORKERS, WorkersClass))

typedef struct _Workers Workers;
typedef struct _WorkersClass WorkersClass;

#define TYPE_ONE_SHOT_SCHEDULER (one_shot_scheduler_get_type ())
#define ONE_SHOT_SCHEDULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ONE_SHOT_SCHEDULER, OneShotScheduler))
#define ONE_SHOT_SCHEDULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ONE_SHOT_SCHEDULER, OneShotSchedulerClass))
#define IS_ONE_SHOT_SCHEDULER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ONE_SHOT_SCHEDULER))
#define IS_ONE_SHOT_SCHEDULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ONE_SHOT_SCHEDULER))
#define ONE_SHOT_SCHEDULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ONE_SHOT_SCHEDULER, OneShotSchedulerClass))

typedef struct _OneShotScheduler OneShotScheduler;
typedef struct _OneShotSchedulerClass OneShotSchedulerClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _one_shot_scheduler_unref0(var) ((var == NULL) ? NULL : (var = (one_shot_scheduler_unref (var), NULL)))
#define _workers_unref0(var) ((var == NULL) ? NULL : (var = (workers_unref (var), NULL)))

#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_THUMBNAIL_SOURCE (thumbnail_source_get_type ())
#define THUMBNAIL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THUMBNAIL_SOURCE, ThumbnailSource))
#define THUMBNAIL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THUMBNAIL_SOURCE, ThumbnailSourceClass))
#define IS_THUMBNAIL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THUMBNAIL_SOURCE))
#define IS_THUMBNAIL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THUMBNAIL_SOURCE))
#define THUMBNAIL_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THUMBNAIL_SOURCE, ThumbnailSourceClass))

typedef struct _ThumbnailSource ThumbnailSource;
typedef struct _ThumbnailSourceClass ThumbnailSourceClass;

#define TYPE_PHOTO_FILE_FORMAT (photo_file_format_get_type ())

#define TYPE_ROTATION (rotation_get_type ())

#define TYPE_PHOTO_FILE_ADAPTER (photo_file_adapter_get_type ())
#define PHOTO_FILE_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_ADAPTER, PhotoFileAdapter))
#define PHOTO_FILE_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_ADAPTER, PhotoFileAdapterClass))
#define IS_PHOTO_FILE_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_ADAPTER))
#define IS_PHOTO_FILE_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_ADAPTER))
#define PHOTO_FILE_ADAPTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_ADAPTER, PhotoFileAdapterClass))

typedef struct _PhotoFileAdapter PhotoFileAdapter;
typedef struct _PhotoFileAdapterClass PhotoFileAdapterClass;

#define TYPE_PHOTO_FILE_READER (photo_file_reader_get_type ())
#define PHOTO_FILE_READER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_READER, PhotoFileReader))
#define PHOTO_FILE_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_READER, PhotoFileReaderClass))
#define IS_PHOTO_FILE_READER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_READER))
#define IS_PHOTO_FILE_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_READER))
#define PHOTO_FILE_READER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_READER, PhotoFileReaderClass))

typedef struct _PhotoFileReader PhotoFileReader;
typedef struct _PhotoFileReaderClass PhotoFileReaderClass;

#define TYPE_ORIENTATION (orientation_get_type ())
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define TYPE_BACKGROUND_JOB (background_job_get_type ())
#define BACKGROUND_JOB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BACKGROUND_JOB, BackgroundJob))
#define BACKGROUND_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BACKGROUND_JOB, BackgroundJobClass))
#define IS_BACKGROUND_JOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BACKGROUND_JOB))
#define IS_BACKGROUND_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BACKGROUND_JOB))
#define BACKGROUND_JOB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BACKGROUND_JOB, BackgroundJobClass))

typedef struct _BackgroundJob BackgroundJob;
typedef struct _BackgroundJobClass BackgroundJobClass;

#define THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB (thumbnail_cache_async_fetch_job_get_type ())
#define THUMBNAIL_CACHE_ASYNC_FETCH_JOB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB, ThumbnailCacheAsyncFetchJob))
#define THUMBNAIL_CACHE_ASYNC_FETCH_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB, ThumbnailCacheAsyncFetchJobClass))
#define THUMBNAIL_CACHE_IS_ASYNC_FETCH_JOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB))
#define THUMBNAIL_CACHE_IS_ASYNC_FETCH_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB))
#define THUMBNAIL_CACHE_ASYNC_FETCH_JOB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB, ThumbnailCacheAsyncFetchJobClass))

typedef struct _ThumbnailCacheAsyncFetchJob ThumbnailCacheAsyncFetchJob;
typedef struct _ThumbnailCacheAsyncFetchJobClass ThumbnailCacheAsyncFetchJobClass;
#define _background_job_unref0(var) ((var == NULL) ? NULL : (var = (background_job_unref (var), NULL)))
typedef struct _BackgroundJobPrivate BackgroundJobPrivate;

#define BACKGROUND_JOB_TYPE_JOB_PRIORITY (background_job_job_priority_get_type ())
typedef struct _ThumbnailCacheAsyncFetchJobPrivate ThumbnailCacheAsyncFetchJobPrivate;

#define TYPE_MEDIA_SOURCE (media_source_get_type ())
#define MEDIA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_SOURCE, MediaSource))
#define MEDIA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_SOURCE, MediaSourceClass))
#define IS_MEDIA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_SOURCE))
#define IS_MEDIA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_SOURCE))
#define MEDIA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_SOURCE, MediaSourceClass))

typedef struct _MediaSource MediaSource;
typedef struct _MediaSourceClass MediaSourceClass;

#define TYPE_PHOTO_SOURCE (photo_source_get_type ())
#define PHOTO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_SOURCE, PhotoSource))
#define PHOTO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_SOURCE, PhotoSourceClass))
#define IS_PHOTO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_SOURCE))
#define IS_PHOTO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_SOURCE))
#define PHOTO_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_SOURCE, PhotoSourceClass))

typedef struct _PhotoSource PhotoSource;
typedef struct _PhotoSourceClass PhotoSourceClass;

#define TYPE_PHOTO (photo_get_type ())
#define PHOTO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO, Photo))
#define PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO, PhotoClass))
#define IS_PHOTO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO))
#define IS_PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO))
#define PHOTO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO, PhotoClass))

typedef struct _Photo Photo;
typedef struct _PhotoClass PhotoClass;

#define TYPE_LIBRARY_PHOTO (library_photo_get_type ())
#define LIBRARY_PHOTO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIBRARY_PHOTO, LibraryPhoto))
#define LIBRARY_PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIBRARY_PHOTO, LibraryPhotoClass))
#define IS_LIBRARY_PHOTO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIBRARY_PHOTO))
#define IS_LIBRARY_PHOTO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIBRARY_PHOTO))
#define LIBRARY_PHOTO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIBRARY_PHOTO, LibraryPhotoClass))

typedef struct _LibraryPhoto LibraryPhoto;
typedef struct _LibraryPhotoClass LibraryPhotoClass;
#define _photo_file_adapter_unref0(var) ((var == NULL) ? NULL : (var = (photo_file_adapter_unref (var), NULL)))
typedef struct _ThumbnailCacheImageDataPrivate ThumbnailCacheImageDataPrivate;
#define _thumbnail_cache_image_data_unref0(var) ((var == NULL) ? NULL : (var = (thumbnail_cache_image_data_unref (var), NULL)))

#define TYPE_PHOTO_FILE_WRITER (photo_file_writer_get_type ())
#define PHOTO_FILE_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_WRITER, PhotoFileWriter))
#define PHOTO_FILE_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_WRITER, PhotoFileWriterClass))
#define IS_PHOTO_FILE_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_WRITER))
#define IS_PHOTO_FILE_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_WRITER))
#define PHOTO_FILE_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_WRITER, PhotoFileWriterClass))

typedef struct _PhotoFileWriter PhotoFileWriter;
typedef struct _PhotoFileWriterClass PhotoFileWriterClass;
typedef struct _ThumbnailCacheParamSpecImageData ThumbnailCacheParamSpecImageData;

#define TYPE_ABSTRACT_SEMAPHORE (abstract_semaphore_get_type ())
#define ABSTRACT_SEMAPHORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ABSTRACT_SEMAPHORE, AbstractSemaphore))
#define ABSTRACT_SEMAPHORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ABSTRACT_SEMAPHORE, AbstractSemaphoreClass))
#define IS_ABSTRACT_SEMAPHORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ABSTRACT_SEMAPHORE))
#define IS_ABSTRACT_SEMAPHORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ABSTRACT_SEMAPHORE))
#define ABSTRACT_SEMAPHORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ABSTRACT_SEMAPHORE, AbstractSemaphoreClass))

typedef struct _AbstractSemaphore AbstractSemaphore;
typedef struct _AbstractSemaphoreClass AbstractSemaphoreClass;

#define TYPE_VIDEO_SOURCE (video_source_get_type ())
#define VIDEO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VIDEO_SOURCE, VideoSource))
#define VIDEO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VIDEO_SOURCE, VideoSourceClass))
#define IS_VIDEO_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VIDEO_SOURCE))
#define IS_VIDEO_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VIDEO_SOURCE))
#define VIDEO_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VIDEO_SOURCE, VideoSourceClass))

typedef struct _VideoSource VideoSource;
typedef struct _VideoSourceClass VideoSourceClass;

#define TYPE_VIDEO (video_get_type ())
#define VIDEO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VIDEO, Video))
#define VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VIDEO, VideoClass))
#define IS_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VIDEO))
#define IS_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VIDEO))
#define VIDEO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VIDEO, VideoClass))

typedef struct _Video Video;
typedef struct _VideoClass VideoClass;
#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);

struct _Thumbnails {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ThumbnailsPrivate * priv;
};

struct _ThumbnailsClass {
	GTypeClass parent_class;
	void (*finalize) (Thumbnails *self);
};

typedef enum  {
	THUMBNAIL_CACHE_SIZE_LARGEST = 360,
	THUMBNAIL_CACHE_SIZE_BIG = 360,
	THUMBNAIL_CACHE_SIZE_MEDIUM = 128,
	THUMBNAIL_CACHE_SIZE_SMALLEST = 128
} ThumbnailCacheSize;

struct _ThumbnailsPrivate {
	GeeHashMap* map;
};

struct _ParamSpecThumbnails {
	GParamSpec parent_instance;
};

struct _ThumbnailCache {
	GObject parent_instance;
	ThumbnailCachePrivate * priv;
};

struct _ThumbnailCacheClass {
	GObjectClass parent_class;
};

typedef enum  {
	JPEG_QUALITY_LOW = 50,
	JPEG_QUALITY_MEDIUM = 75,
	JPEG_QUALITY_HIGH = 90,
	JPEG_QUALITY_MAXIMUM = 100
} JpegQuality;

struct _ThumbnailCachePrivate {
	GFile* cache_dir;
	ThumbnailCacheSize size;
	gulong max_cached_bytes;
	GdkInterpType interp;
	JpegQuality quality;
	GeeHashMap* cache_map;
	GeeArrayList* cache_lru;
	gulong cached_bytes;
};

typedef enum  {
	SCALE_CONSTRAINT_ORIGINAL,
	SCALE_CONSTRAINT_DIMENSIONS,
	SCALE_CONSTRAINT_WIDTH,
	SCALE_CONSTRAINT_HEIGHT,
	SCALE_CONSTRAINT_FILL_VIEWPORT
} ScaleConstraint;

struct _Dimensions {
	gint width;
	gint height;
};

struct _Scaling {
	ScaleConstraint constraint;
	gint scale;
	Dimensions viewport;
	gboolean scale_up;
};

typedef void (*OneShotCallback) (void* user_data);
typedef void (*ThumbnailCacheAsyncFetchCallback) (GdkPixbuf* pixbuf, GdkPixbuf* unscaled, Dimensions* dim, GdkInterpType interp, GError* err, void* user_data);
typedef enum  {
	PHOTO_FILE_FORMAT_JFIF,
	PHOTO_FILE_FORMAT_RAW,
	PHOTO_FILE_FORMAT_PNG,
	PHOTO_FILE_FORMAT_TIFF,
	PHOTO_FILE_FORMAT_BMP,
	PHOTO_FILE_FORMAT_UNKNOWN
} PhotoFileFormat;

typedef enum  {
	ROTATION_CLOCKWISE,
	ROTATION_COUNTERCLOCKWISE,
	ROTATION_MIRROR,
	ROTATION_UPSIDE_DOWN
} Rotation;

typedef enum  {
	ORIENTATION_MIN = 1,
	ORIENTATION_TOP_LEFT = 1,
	ORIENTATION_TOP_RIGHT = 2,
	ORIENTATION_BOTTOM_RIGHT = 3,
	ORIENTATION_BOTTOM_LEFT = 4,
	ORIENTATION_LEFT_TOP = 5,
	ORIENTATION_RIGHT_TOP = 6,
	ORIENTATION_RIGHT_BOTTOM = 7,
	ORIENTATION_LEFT_BOTTOM = 8,
	ORIENTATION_MAX = 8
} Orientation;

typedef enum  {
	BACKGROUND_JOB_JOB_PRIORITY_HIGHEST = 100,
	BACKGROUND_JOB_JOB_PRIORITY_HIGH = 75,
	BACKGROUND_JOB_JOB_PRIORITY_NORMAL = 50,
	BACKGROUND_JOB_JOB_PRIORITY_LOW = 25,
	BACKGROUND_JOB_JOB_PRIORITY_LOWEST = 0
} BackgroundJobJobPriority;

struct _BackgroundJob {
	GTypeInstance parent_instance;
	volatile int ref_count;
	BackgroundJobPrivate * priv;
};

struct _BackgroundJobClass {
	GTypeClass parent_class;
	void (*finalize) (BackgroundJob *self);
	void (*execute) (BackgroundJob* self);
	BackgroundJobJobPriority (*get_priority) (BackgroundJob* self);
};

struct _ThumbnailCacheAsyncFetchJob {
	BackgroundJob parent_instance;
	ThumbnailCacheAsyncFetchJobPrivate * priv;
	ThumbnailCache* cache;
	gchar* thumbnail_name;
	ThumbnailSource* source;
	PhotoFileFormat source_format;
	Dimensions dim;
	GdkInterpType interp;
	ThumbnailCacheAsyncFetchCallback callback;
	gpointer callback_target;
	GdkPixbuf* unscaled;
	GdkPixbuf* scaled;
	GError* err;
	gboolean fetched;
	gboolean replace;
};

struct _ThumbnailCacheAsyncFetchJobClass {
	BackgroundJobClass parent_class;
};

struct _ThumbnailCacheImageData {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ThumbnailCacheImageDataPrivate * priv;
	GdkPixbuf* pixbuf;
	gulong bytes;
};

struct _ThumbnailCacheImageDataClass {
	GTypeClass parent_class;
	void (*finalize) (ThumbnailCacheImageData *self);
};

typedef enum  {
	PHOTO_FORMAT_ERROR_READ_ONLY
} PhotoFormatError;
#define PHOTO_FORMAT_ERROR photo_format_error_quark ()
struct _ThumbnailCacheParamSpecImageData {
	GParamSpec parent_instance;
};

typedef void (*CompletionCallback) (BackgroundJob* job, void* user_data);
typedef void (*CancellationCallback) (BackgroundJob* job, void* user_data);

static gpointer thumbnails_parent_class = NULL;
static gpointer thumbnail_cache_parent_class = NULL;
static ThumbnailCacheSize* thumbnail_cache_ALL_SIZES;
static gint thumbnail_cache_ALL_SIZES_length1;
static ThumbnailCacheSize* thumbnail_cache_ALL_SIZES = NULL;
static gint thumbnail_cache_ALL_SIZES_length1 = 0;
static gint _thumbnail_cache_ALL_SIZES_size_ = 0;
static Workers* thumbnail_cache_fetch_workers;
static Workers* thumbnail_cache_fetch_workers = NULL;
static ThumbnailCache* thumbnail_cache_big;
static ThumbnailCache* thumbnail_cache_big = NULL;
static ThumbnailCache* thumbnail_cache_medium;
static ThumbnailCache* thumbnail_cache_medium = NULL;
static OneShotScheduler* thumbnail_cache_debug_scheduler;
static OneShotScheduler* thumbnail_cache_debug_scheduler = NULL;
static gint thumbnail_cache_cycle_fetched_thumbnails;
static gint thumbnail_cache_cycle_fetched_thumbnails = 0;
static gint thumbnail_cache_cycle_async_fetched_thumbnails;
static gint thumbnail_cache_cycle_async_fetched_thumbnails = 0;
static gint thumbnail_cache_cycle_async_resized_thumbnails;
static gint thumbnail_cache_cycle_async_resized_thumbnails = 0;
static gint thumbnail_cache_cycle_overflow_thumbnails;
static gint thumbnail_cache_cycle_overflow_thumbnails = 0;
static gulong thumbnail_cache_cycle_dropped_bytes;
static gulong thumbnail_cache_cycle_dropped_bytes = (gulong) 0;
static gpointer thumbnail_cache_image_data_parent_class = NULL;
static gpointer thumbnail_cache_async_fetch_job_parent_class = NULL;

gpointer thumbnails_ref (gpointer instance);
void thumbnails_unref (gpointer instance);
GParamSpec* param_spec_thumbnails (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_thumbnails (GValue* value, gpointer v_object);
void value_take_thumbnails (GValue* value, gpointer v_object);
gpointer value_get_thumbnails (const GValue* value);
GType thumbnails_get_type (void) G_GNUC_CONST;
GType thumbnail_cache_size_get_type (void) G_GNUC_CONST;
#define THUMBNAILS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_THUMBNAILS, ThumbnailsPrivate))
enum  {
	THUMBNAILS_DUMMY_PROPERTY
};
Thumbnails* thumbnails_new (void);
Thumbnails* thumbnails_construct (GType object_type);
void thumbnails_set (Thumbnails* self, ThumbnailCacheSize size, GdkPixbuf* pixbuf);
void thumbnails_remove (Thumbnails* self, ThumbnailCacheSize size);
GdkPixbuf* thumbnails_get (Thumbnails* self, ThumbnailCacheSize size);
static void thumbnails_finalize (Thumbnails* obj);
GType thumbnail_cache_get_type (void) G_GNUC_CONST;
GType jpeg_quality_get_type (void) G_GNUC_CONST;
static gpointer thumbnail_cache_image_data_ref (gpointer instance);
static void thumbnail_cache_image_data_unref (gpointer instance);
static GParamSpec* thumbnail_cache_param_spec_image_data (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED;
static void thumbnail_cache_value_set_image_data (GValue* value, gpointer v_object) G_GNUC_UNUSED;
static void thumbnail_cache_value_take_image_data (GValue* value, gpointer v_object) G_GNUC_UNUSED;
static gpointer thumbnail_cache_value_get_image_data (const GValue* value) G_GNUC_UNUSED;
static GType thumbnail_cache_image_data_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
#define THUMBNAIL_CACHE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_THUMBNAIL_CACHE, ThumbnailCachePrivate))
enum  {
	THUMBNAIL_CACHE_DUMMY_PROPERTY
};
gint thumbnail_cache_size_get_scale (ThumbnailCacheSize self);
GType scaling_get_type (void) G_GNUC_CONST;
GType scale_constraint_get_type (void) G_GNUC_CONST;
GType dimensions_get_type (void) G_GNUC_CONST;
Dimensions* dimensions_dup (const Dimensions* self);
void dimensions_free (Dimensions* self);
Scaling* scaling_dup (const Scaling* self);
void scaling_free (Scaling* self);
void thumbnail_cache_size_get_scaling (ThumbnailCacheSize self, Scaling* result);
void scaling_for_best_fit (gint pixels, gboolean scale_up, Scaling* result);
ThumbnailCacheSize thumbnail_cache_size_get_best_size (gint scale);
gpointer workers_ref (gpointer instance);
void workers_unref (gpointer instance);
GParamSpec* param_spec_workers (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_workers (GValue* value, gpointer v_object);
void value_take_workers (GValue* value, gpointer v_object);
gpointer value_get_workers (const GValue* value);
GType workers_get_type (void) G_GNUC_CONST;
gpointer one_shot_scheduler_ref (gpointer instance);
void one_shot_scheduler_unref (gpointer instance);
GParamSpec* param_spec_one_shot_scheduler (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_one_shot_scheduler (GValue* value, gpointer v_object);
void value_take_one_shot_scheduler (GValue* value, gpointer v_object);
gpointer value_get_one_shot_scheduler (const GValue* value);
GType one_shot_scheduler_get_type (void) G_GNUC_CONST;
#define THUMBNAIL_CACHE_DEFAULT_INTERP GDK_INTERP_HYPER
#define THUMBNAIL_CACHE_DEFAULT_QUALITY JPEG_QUALITY_HIGH
#define THUMBNAIL_CACHE_MAX_INMEMORY_DATA_SIZE (512 * 1024)
#define THUMBNAIL_CACHE_MAX_BIG_CACHED_BYTES ((gulong) ((40 * 1024) * 1024))
#define THUMBNAIL_CACHE_MAX_MEDIUM_CACHED_BYTES ((gulong) ((30 * 1024) * 1024))
static ThumbnailCache* thumbnail_cache_new (ThumbnailCacheSize size, gulong max_cached_bytes, GdkInterpType interp, JpegQuality quality);
static ThumbnailCache* thumbnail_cache_construct (GType object_type, ThumbnailCacheSize size, gulong max_cached_bytes, GdkInterpType interp, JpegQuality quality);
GFile* app_dirs_get_cache_subdir (const gchar* name, const gchar* subname);
void thumbnail_cache_init (void);
static void thumbnail_cache_report_cycle (void);
static void _thumbnail_cache_report_cycle_one_shot_callback (gpointer self);
OneShotScheduler* one_shot_scheduler_new (const gchar* name, OneShotCallback callback, void* callback_target);
OneShotScheduler* one_shot_scheduler_construct (GType object_type, const gchar* name, OneShotCallback callback, void* callback_target);
guint workers_threads_per_cpu (gint per, gint max);
Workers* workers_new (guint max_threads, gboolean exclusive);
Workers* workers_construct (GType object_type, guint max_threads, gboolean exclusive);
void thumbnail_cache_terminate (void);
GType data_object_get_type (void) G_GNUC_CONST;
GType data_source_get_type (void) G_GNUC_CONST;
GType thumbnail_source_get_type (void) G_GNUC_CONST;
void thumbnail_cache_import_from_source (ThumbnailSource* source, gboolean force, GError** error);
gchar* data_object_to_string (DataObject* self);
static void _thumbnail_cache_import_from_source (ThumbnailCache* self, ThumbnailSource* source, gboolean force, GError** error);
void thumbnail_cache_import_thumbnails (ThumbnailSource* source, Thumbnails* thumbnails, gboolean force, GError** error);
static void _thumbnail_cache_import_thumbnail (ThumbnailCache* self, ThumbnailSource* source, GdkPixbuf* scaled, gboolean force, GError** error);
void thumbnail_cache_duplicate (ThumbnailSource* src_source, ThumbnailSource* dest_source);
static void _thumbnail_cache_duplicate (ThumbnailCache* self, ThumbnailSource* src_source, ThumbnailSource* dest_source);
void thumbnail_cache_remove (ThumbnailSource* source);
static void _thumbnail_cache_remove (ThumbnailCache* self, ThumbnailSource* source);
static ThumbnailCache* thumbnail_cache_get_best_cache (gint scale);
static ThumbnailCache* thumbnail_cache_get_cache_for (ThumbnailCacheSize size);
GdkPixbuf* thumbnail_cache_fetch (ThumbnailSource* source, gint scale, GError** error);
static GdkPixbuf* _thumbnail_cache_fetch (ThumbnailCache* self, ThumbnailSource* source, GError** error);
void thumbnail_cache_fetch_async (ThumbnailSource* source, gint scale, ThumbnailCacheAsyncFetchCallback callback, void* callback_target, GCancellable* cancellable);
GType photo_file_format_get_type (void) G_GNUC_CONST;
static void _thumbnail_cache_fetch_async (ThumbnailCache* self, ThumbnailSource* source, PhotoFileFormat format, Dimensions* dim, GdkInterpType interp, ThumbnailCacheAsyncFetchCallback callback, void* callback_target, GCancellable* cancellable);
PhotoFileFormat thumbnail_source_get_preferred_thumbnail_format (ThumbnailSource* self);
void dimensions_init (Dimensions *self, gint width, gint height);
void thumbnail_cache_fetch_async_scaled (ThumbnailSource* source, gint scale, Dimensions* dim, GdkInterpType interp, ThumbnailCacheAsyncFetchCallback callback, void* callback_target, GCancellable* cancellable);
void thumbnail_cache_replace (ThumbnailSource* source, ThumbnailCacheSize size, GdkPixbuf* replacement, GError** error);
static void _thumbnail_cache_replace (ThumbnailCache* self, ThumbnailSource* source, GdkPixbuf* original, GError** error);
gboolean thumbnail_cache_exists (ThumbnailSource* source);
static gboolean _thumbnail_cache_exists (ThumbnailCache* self, ThumbnailSource* source);
GType rotation_get_type (void) G_GNUC_CONST;
void thumbnail_cache_rotate (ThumbnailSource* source, Rotation rotation, GError** error);
GdkPixbuf* rotation_perform (Rotation self, GdkPixbuf* pixbuf);
gpointer photo_file_adapter_ref (gpointer instance);
void photo_file_adapter_unref (gpointer instance);
GParamSpec* param_spec_photo_file_adapter (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_photo_file_adapter (GValue* value, gpointer v_object);
void value_take_photo_file_adapter (GValue* value, gpointer v_object);
gpointer value_get_photo_file_adapter (const GValue* value);
GType photo_file_adapter_get_type (void) G_GNUC_CONST;
GType photo_file_reader_get_type (void) G_GNUC_CONST;
GType orientation_get_type (void) G_GNUC_CONST;
void thumbnail_cache_generate_for_photo (Thumbnails* thumbnails, PhotoFileReader* reader, Orientation orientation, Dimensions* original_dim, GError** error);
void scaling_get_scaled_dimensions (Scaling *self, Dimensions* original, Dimensions* result);
GdkPixbuf* photo_file_reader_scaled_read (PhotoFileReader* self, Dimensions* full, Dimensions* scaled, GError** error);
GdkPixbuf* photo_file_reader_unscaled_read (PhotoFileReader* self, GError** error);
GdkPixbuf* orientation_rotate_pixbuf (Orientation self, GdkPixbuf* pixbuf);
void dimensions_for_pixbuf (GdkPixbuf* pixbuf, Dimensions* result);
void thumbnail_cache_generate_for_video_frame (Thumbnails* thumbnails, GdkPixbuf* preview_frame);
GdkPixbuf* scaling_perform_on_pixbuf (Scaling *self, GdkPixbuf* pixbuf, GdkInterpType interp, gboolean scale_up);
static void thumbnail_cache_schedule_debug (void);
static GdkPixbuf* thumbnail_cache_fetch_from_memory (ThumbnailCache* self, const gchar* thumbnail_name);
gchar* data_source_get_source_id (DataSource* self);
static GdkPixbuf* thumbnail_cache_read_pixbuf (ThumbnailCache* self, const gchar* thumbnail_name, PhotoFileFormat format, GError** error);
static void thumbnail_cache_store_in_memory (ThumbnailCache* self, const gchar* thumbnail_name, GdkPixbuf* thumbnail);
gboolean dimensions_has_area (Dimensions *self);
gboolean dimensions_equals (Dimensions *self, Dimensions* dim);
gpointer background_job_ref (gpointer instance);
void background_job_unref (gpointer instance);
GParamSpec* param_spec_background_job (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_background_job (GValue* value, gpointer v_object);
void value_take_background_job (GValue* value, gpointer v_object);
gpointer value_get_background_job (const GValue* value);
GType background_job_get_type (void) G_GNUC_CONST;
void workers_enqueue (Workers* self, BackgroundJob* job);
static ThumbnailCacheAsyncFetchJob* thumbnail_cache_async_fetch_job_new (ThumbnailCache* cache, const gchar* thumbnail_name, ThumbnailSource* source, GdkPixbuf* prefetched, Dimensions* dim, GdkInterpType interp, ThumbnailCacheAsyncFetchCallback callback, void* callback_target, GCancellable* cancellable);
static ThumbnailCacheAsyncFetchJob* thumbnail_cache_async_fetch_job_construct (GType object_type, ThumbnailCache* cache, const gchar* thumbnail_name, ThumbnailSource* source, GdkPixbuf* prefetched, Dimensions* dim, GdkInterpType interp, ThumbnailCacheAsyncFetchCallback callback, void* callback_target, GCancellable* cancellable);
static GType thumbnail_cache_async_fetch_job_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
static void thumbnail_cache_async_fetch_completion_callback (BackgroundJob* background_job);
GType background_job_job_priority_get_type (void) G_GNUC_CONST;
static GFile* thumbnail_cache_get_source_cached_file (ThumbnailCache* self, ThumbnailSource* source);
GType media_source_get_type (void) G_GNUC_CONST;
GType photo_source_get_type (void) G_GNUC_CONST;
GType photo_get_type (void) G_GNUC_CONST;
GType library_photo_get_type (void) G_GNUC_CONST;
GdkPixbuf* photo_source_get_pixbuf (PhotoSource* self, Scaling* scaling, GError** error);
static void thumbnail_cache_save_thumbnail (ThumbnailCache* self, GFile* file, GdkPixbuf* pixbuf, ThumbnailSource* source, GError** error);
gboolean dimensions_approx_scaled (Dimensions *self, gint scale, gint fudge);
static GFile* thumbnail_cache_get_cached_file (ThumbnailCache* self, const gchar* thumbnail_name, PhotoFileFormat thumbnail_format);
gchar* thumbnail_source_get_representative_id (ThumbnailSource* self);
void app_window_panic (const gchar* msg);
static gboolean thumbnail_cache_remove_from_memory (ThumbnailCache* self, const gchar* thumbnail_name);
GdkPixbuf* scale_pixbuf (GdkPixbuf* pixbuf, gint scale, GdkInterpType interp, gboolean scale_up);
PhotoFileReader* photo_file_format_create_reader (PhotoFileFormat self, const gchar* filepath);
gchar* photo_file_format_get_default_basename (PhotoFileFormat self, const gchar* name);
static ThumbnailCacheImageData* thumbnail_cache_image_data_new (GdkPixbuf* pixbuf);
static ThumbnailCacheImageData* thumbnail_cache_image_data_construct (GType object_type, GdkPixbuf* pixbuf);
GType photo_file_writer_get_type (void) G_GNUC_CONST;
GQuark photo_format_error_quark (void);
PhotoFileWriter* photo_file_format_create_writer (PhotoFileFormat self, const gchar* filepath, GError** error);
void photo_file_writer_write (PhotoFileWriter* self, GdkPixbuf* pixbuf, JpegQuality quality, GError** error);
enum  {
	THUMBNAIL_CACHE_IMAGE_DATA_DUMMY_PROPERTY
};
static void thumbnail_cache_image_data_finalize (ThumbnailCacheImageData* obj);
enum  {
	THUMBNAIL_CACHE_ASYNC_FETCH_JOB_DUMMY_PROPERTY
};
static void _thumbnail_cache_async_fetch_completion_callback_completion_callback (BackgroundJob* job, gpointer self);
gpointer abstract_semaphore_ref (gpointer instance);
void abstract_semaphore_unref (gpointer instance);
GParamSpec* param_spec_abstract_semaphore (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_abstract_semaphore (GValue* value, gpointer v_object);
void value_take_abstract_semaphore (GValue* value, gpointer v_object);
gpointer value_get_abstract_semaphore (const GValue* value);
GType abstract_semaphore_get_type (void) G_GNUC_CONST;
BackgroundJob* background_job_construct (GType object_type, GObject* owner, CompletionCallback callback, void* callback_target, GCancellable* cancellable, CancellationCallback cancellation, void* cancellation_target, AbstractSemaphore* completion_semaphore);
static BackgroundJobJobPriority thumbnail_cache_async_fetch_job_real_get_priority (BackgroundJob* base);
static void thumbnail_cache_async_fetch_job_real_execute (BackgroundJob* base);
gboolean background_job_is_cancelled (BackgroundJob* self);
GdkPixbuf* resize_pixbuf (GdkPixbuf* pixbuf, Dimensions* resized, GdkInterpType interp);
static void thumbnail_cache_async_fetch_job_generate_thumbnail (ThumbnailCacheAsyncFetchJob* self, GError** error);
GType video_source_get_type (void) G_GNUC_CONST;
GType video_get_type (void) G_GNUC_CONST;
GdkPixbuf* thumbnail_source_create_thumbnail (ThumbnailSource* self, gint scale, GError** error);
static void thumbnail_cache_async_fetch_job_finalize (BackgroundJob* obj);
static void thumbnail_cache_finalize (GObject* obj);


Thumbnails* thumbnails_construct (GType object_type) {
	Thumbnails* self = NULL;
#line 11 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self = (Thumbnails*) g_type_create_instance (object_type);
#line 11 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return self;
#line 653 "ThumbnailCache.c"
}


Thumbnails* thumbnails_new (void) {
#line 11 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return thumbnails_construct (TYPE_THUMBNAILS);
#line 660 "ThumbnailCache.c"
}


void thumbnails_set (Thumbnails* self, ThumbnailCacheSize size, GdkPixbuf* pixbuf) {
	GeeHashMap* _tmp0_ = NULL;
	ThumbnailCacheSize _tmp1_ = 0;
	GdkPixbuf* _tmp2_ = NULL;
#line 14 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAILS (self));
#line 14 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
#line 15 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = self->priv->map;
#line 15 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = size;
#line 15 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = pixbuf;
#line 15 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), (gpointer) ((gintptr) _tmp1_), _tmp2_);
#line 680 "ThumbnailCache.c"
}


void thumbnails_remove (Thumbnails* self, ThumbnailCacheSize size) {
	GeeHashMap* _tmp0_ = NULL;
	ThumbnailCacheSize _tmp1_ = 0;
#line 18 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAILS (self));
#line 19 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = self->priv->map;
#line 19 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = size;
#line 19 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	gee_abstract_map_unset (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), (gpointer) ((gintptr) _tmp1_), NULL);
#line 695 "ThumbnailCache.c"
}


GdkPixbuf* thumbnails_get (Thumbnails* self, ThumbnailCacheSize size) {
	GdkPixbuf* result = NULL;
	GeeHashMap* _tmp0_ = NULL;
	ThumbnailCacheSize _tmp1_ = 0;
	gpointer _tmp2_ = NULL;
#line 22 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAILS (self), NULL);
#line 23 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = self->priv->map;
#line 23 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = size;
#line 23 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), (gpointer) ((gintptr) _tmp1_));
#line 23 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = (GdkPixbuf*) _tmp2_;
#line 23 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 716 "ThumbnailCache.c"
}


static void value_thumbnails_init (GValue* value) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	value->data[0].v_pointer = NULL;
#line 723 "ThumbnailCache.c"
}


static void value_thumbnails_free_value (GValue* value) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (value->data[0].v_pointer) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		thumbnails_unref (value->data[0].v_pointer);
#line 732 "ThumbnailCache.c"
	}
}


static void value_thumbnails_copy_value (const GValue* src_value, GValue* dest_value) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (src_value->data[0].v_pointer) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		dest_value->data[0].v_pointer = thumbnails_ref (src_value->data[0].v_pointer);
#line 742 "ThumbnailCache.c"
	} else {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		dest_value->data[0].v_pointer = NULL;
#line 746 "ThumbnailCache.c"
	}
}


static gpointer value_thumbnails_peek_pointer (const GValue* value) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return value->data[0].v_pointer;
#line 754 "ThumbnailCache.c"
}


static gchar* value_thumbnails_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (collect_values[0].v_pointer) {
#line 761 "ThumbnailCache.c"
		Thumbnails* object;
		object = collect_values[0].v_pointer;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (object->parent_instance.g_class == NULL) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 768 "ThumbnailCache.c"
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 772 "ThumbnailCache.c"
		}
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = thumbnails_ref (object);
#line 776 "ThumbnailCache.c"
	} else {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = NULL;
#line 780 "ThumbnailCache.c"
	}
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return NULL;
#line 784 "ThumbnailCache.c"
}


static gchar* value_thumbnails_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	Thumbnails** object_p;
	object_p = collect_values[0].v_pointer;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (!object_p) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 795 "ThumbnailCache.c"
	}
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (!value->data[0].v_pointer) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		*object_p = NULL;
#line 801 "ThumbnailCache.c"
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		*object_p = value->data[0].v_pointer;
#line 805 "ThumbnailCache.c"
	} else {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		*object_p = thumbnails_ref (value->data[0].v_pointer);
#line 809 "ThumbnailCache.c"
	}
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return NULL;
#line 813 "ThumbnailCache.c"
}


GParamSpec* param_spec_thumbnails (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecThumbnails* spec;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_THUMBNAILS), NULL);
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	G_PARAM_SPEC (spec)->value_type = object_type;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return G_PARAM_SPEC (spec);
#line 827 "ThumbnailCache.c"
}


gpointer value_get_thumbnails (const GValue* value) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_THUMBNAILS), NULL);
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return value->data[0].v_pointer;
#line 836 "ThumbnailCache.c"
}


void value_set_thumbnails (GValue* value, gpointer v_object) {
	Thumbnails* old;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_THUMBNAILS));
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	old = value->data[0].v_pointer;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (v_object) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_THUMBNAILS));
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = v_object;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		thumbnails_ref (value->data[0].v_pointer);
#line 856 "ThumbnailCache.c"
	} else {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = NULL;
#line 860 "ThumbnailCache.c"
	}
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (old) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		thumbnails_unref (old);
#line 866 "ThumbnailCache.c"
	}
}


void value_take_thumbnails (GValue* value, gpointer v_object) {
	Thumbnails* old;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_THUMBNAILS));
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	old = value->data[0].v_pointer;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (v_object) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_THUMBNAILS));
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = v_object;
#line 885 "ThumbnailCache.c"
	} else {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = NULL;
#line 889 "ThumbnailCache.c"
	}
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (old) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		thumbnails_unref (old);
#line 895 "ThumbnailCache.c"
	}
}


static void thumbnails_class_init (ThumbnailsClass * klass) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnails_parent_class = g_type_class_peek_parent (klass);
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	((ThumbnailsClass *) klass)->finalize = thumbnails_finalize;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_type_class_add_private (klass, sizeof (ThumbnailsPrivate));
#line 907 "ThumbnailCache.c"
}


static void thumbnails_instance_init (Thumbnails * self) {
	GeeHashMap* _tmp0_ = NULL;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv = THUMBNAILS_GET_PRIVATE (self);
#line 8 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = gee_hash_map_new (THUMBNAIL_CACHE_TYPE_SIZE, NULL, NULL, GDK_TYPE_PIXBUF, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
#line 8 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->map = _tmp0_;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->ref_count = 1;
#line 921 "ThumbnailCache.c"
}


static void thumbnails_finalize (Thumbnails* obj) {
	Thumbnails * self;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_THUMBNAILS, Thumbnails);
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_signal_handlers_destroy (self);
#line 8 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->priv->map);
#line 933 "ThumbnailCache.c"
}


GType thumbnails_get_type (void) {
	static volatile gsize thumbnails_type_id__volatile = 0;
	if (g_once_init_enter (&thumbnails_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_thumbnails_init, value_thumbnails_free_value, value_thumbnails_copy_value, value_thumbnails_peek_pointer, "p", value_thumbnails_collect_value, "p", value_thumbnails_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (ThumbnailsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) thumbnails_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Thumbnails), 0, (GInstanceInitFunc) thumbnails_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType thumbnails_type_id;
		thumbnails_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Thumbnails", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&thumbnails_type_id__volatile, thumbnails_type_id);
	}
	return thumbnails_type_id__volatile;
}


gpointer thumbnails_ref (gpointer instance) {
	Thumbnails* self;
	self = instance;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_atomic_int_inc (&self->ref_count);
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return instance;
#line 958 "ThumbnailCache.c"
}


void thumbnails_unref (gpointer instance) {
	Thumbnails* self;
	self = instance;
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		THUMBNAILS_GET_CLASS (self)->finalize (self);
#line 7 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_type_free_instance ((GTypeInstance *) self);
#line 971 "ThumbnailCache.c"
	}
}


gint thumbnail_cache_size_get_scale (ThumbnailCacheSize self) {
	gint result = 0;
#line 42 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = (gint) self;
#line 42 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 982 "ThumbnailCache.c"
}


void thumbnail_cache_size_get_scaling (ThumbnailCacheSize self, Scaling* result) {
	gint _tmp0_ = 0;
	Scaling _tmp1_ = {0};
#line 46 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = thumbnail_cache_size_get_scale (self);
#line 46 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	scaling_for_best_fit (_tmp0_, TRUE, &_tmp1_);
#line 46 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	*result = _tmp1_;
#line 46 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return;
#line 997 "ThumbnailCache.c"
}


ThumbnailCacheSize thumbnail_cache_size_get_best_size (gint scale) {
	ThumbnailCacheSize result = 0;
	ThumbnailCacheSize _tmp0_ = 0;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
#line 50 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = scale;
#line 50 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = thumbnail_cache_size_get_scale (THUMBNAIL_CACHE_SIZE_MEDIUM);
#line 50 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp1_ <= _tmp2_) {
#line 50 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp0_ = THUMBNAIL_CACHE_SIZE_MEDIUM;
#line 1014 "ThumbnailCache.c"
	} else {
#line 50 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp0_ = THUMBNAIL_CACHE_SIZE_BIG;
#line 1018 "ThumbnailCache.c"
	}
#line 50 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = _tmp0_;
#line 50 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 1024 "ThumbnailCache.c"
}


GType thumbnail_cache_size_get_type (void) {
	static volatile gsize thumbnail_cache_size_type_id__volatile = 0;
	if (g_once_init_enter (&thumbnail_cache_size_type_id__volatile)) {
		static const GEnumValue values[] = {{THUMBNAIL_CACHE_SIZE_LARGEST, "THUMBNAIL_CACHE_SIZE_LARGEST", "largest"}, {THUMBNAIL_CACHE_SIZE_BIG, "THUMBNAIL_CACHE_SIZE_BIG", "big"}, {THUMBNAIL_CACHE_SIZE_MEDIUM, "THUMBNAIL_CACHE_SIZE_MEDIUM", "medium"}, {THUMBNAIL_CACHE_SIZE_SMALLEST, "THUMBNAIL_CACHE_SIZE_SMALLEST", "smallest"}, {0, NULL, NULL}};
		GType thumbnail_cache_size_type_id;
		thumbnail_cache_size_type_id = g_enum_register_static ("ThumbnailCacheSize", values);
		g_once_init_leave (&thumbnail_cache_size_type_id__volatile, thumbnail_cache_size_type_id);
	}
	return thumbnail_cache_size_type_id__volatile;
}


static ThumbnailCache* thumbnail_cache_construct (GType object_type, ThumbnailCacheSize size, gulong max_cached_bytes, GdkInterpType interp, JpegQuality quality) {
	ThumbnailCache * self = NULL;
	ThumbnailCacheSize _tmp0_ = 0;
	gint _tmp1_ = 0;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	GFile* _tmp4_ = NULL;
	ThumbnailCacheSize _tmp5_ = 0;
	gulong _tmp6_ = 0UL;
	GdkInterpType _tmp7_ = 0;
	JpegQuality _tmp8_ = 0;
#line 190 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self = (ThumbnailCache*) g_object_new (object_type, NULL);
#line 192 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = size;
#line 192 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_size_get_scale (_tmp0_);
#line 192 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = g_strdup_printf ("thumbs%d", _tmp1_);
#line 192 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = _tmp2_;
#line 192 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = app_dirs_get_cache_subdir ("thumbs", _tmp3_);
#line 192 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->priv->cache_dir);
#line 192 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->cache_dir = _tmp4_;
#line 192 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp3_);
#line 193 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = size;
#line 193 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->size = _tmp5_;
#line 194 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = max_cached_bytes;
#line 194 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->max_cached_bytes = _tmp6_;
#line 195 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = interp;
#line 195 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->interp = _tmp7_;
#line 196 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = quality;
#line 196 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->quality = _tmp8_;
#line 190 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return self;
#line 1087 "ThumbnailCache.c"
}


static ThumbnailCache* thumbnail_cache_new (ThumbnailCacheSize size, gulong max_cached_bytes, GdkInterpType interp, JpegQuality quality) {
#line 190 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return thumbnail_cache_construct (TYPE_THUMBNAIL_CACHE, size, max_cached_bytes, interp, quality);
#line 1094 "ThumbnailCache.c"
}


static void _thumbnail_cache_report_cycle_one_shot_callback (gpointer self) {
#line 201 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_report_cycle ();
#line 1101 "ThumbnailCache.c"
}


void thumbnail_cache_init (void) {
	OneShotScheduler* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	Workers* _tmp2_ = NULL;
	ThumbnailCache* _tmp3_ = NULL;
	ThumbnailCache* _tmp4_ = NULL;
#line 201 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = one_shot_scheduler_new ("ThumbnailCache cycle reporter", _thumbnail_cache_report_cycle_one_shot_callback, NULL);
#line 201 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_one_shot_scheduler_unref0 (thumbnail_cache_debug_scheduler);
#line 201 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_debug_scheduler = _tmp0_;
#line 202 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = workers_threads_per_cpu (1, -1);
#line 202 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = workers_new (_tmp1_, TRUE);
#line 202 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_workers_unref0 (thumbnail_cache_fetch_workers);
#line 202 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_fetch_workers = _tmp2_;
#line 204 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = thumbnail_cache_new (THUMBNAIL_CACHE_SIZE_BIG, THUMBNAIL_CACHE_MAX_BIG_CACHED_BYTES, THUMBNAIL_CACHE_DEFAULT_INTERP, THUMBNAIL_CACHE_DEFAULT_QUALITY);
#line 204 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (thumbnail_cache_big);
#line 204 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_big = _tmp3_;
#line 205 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = thumbnail_cache_new (THUMBNAIL_CACHE_SIZE_MEDIUM, THUMBNAIL_CACHE_MAX_MEDIUM_CACHED_BYTES, THUMBNAIL_CACHE_DEFAULT_INTERP, THUMBNAIL_CACHE_DEFAULT_QUALITY);
#line 205 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (thumbnail_cache_medium);
#line 205 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_medium = _tmp4_;
#line 1137 "ThumbnailCache.c"
}


void thumbnail_cache_terminate (void) {
}


void thumbnail_cache_import_from_source (ThumbnailSource* source, gboolean force, GError** error) {
	ThumbnailSource* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	ThumbnailCache* _tmp3_ = NULL;
	ThumbnailSource* _tmp4_ = NULL;
	gboolean _tmp5_ = FALSE;
	ThumbnailCache* _tmp6_ = NULL;
	ThumbnailSource* _tmp7_ = NULL;
	gboolean _tmp8_ = FALSE;
	GError * _inner_error_ = NULL;
#line 211 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 213 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = source;
#line 213 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = data_object_to_string (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_DATA_OBJECT, DataObject));
#line 213 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = _tmp1_;
#line 213 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_debug ("ThumbnailCache.vala:213: import from source: %s", _tmp2_);
#line 213 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp2_);
#line 214 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = thumbnail_cache_big;
#line 214 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = source;
#line 214 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = force;
#line 214 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_import_from_source (_tmp3_, _tmp4_, _tmp5_, &_inner_error_);
#line 214 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 214 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 214 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 1182 "ThumbnailCache.c"
	}
#line 215 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = thumbnail_cache_medium;
#line 215 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = source;
#line 215 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = force;
#line 215 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_import_from_source (_tmp6_, _tmp7_, _tmp8_, &_inner_error_);
#line 215 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 215 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 215 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 1198 "ThumbnailCache.c"
	}
}


void thumbnail_cache_import_thumbnails (ThumbnailSource* source, Thumbnails* thumbnails, gboolean force, GError** error) {
	ThumbnailCache* _tmp0_ = NULL;
	ThumbnailSource* _tmp1_ = NULL;
	Thumbnails* _tmp2_ = NULL;
	GdkPixbuf* _tmp3_ = NULL;
	GdkPixbuf* _tmp4_ = NULL;
	gboolean _tmp5_ = FALSE;
	ThumbnailCache* _tmp6_ = NULL;
	ThumbnailSource* _tmp7_ = NULL;
	Thumbnails* _tmp8_ = NULL;
	GdkPixbuf* _tmp9_ = NULL;
	GdkPixbuf* _tmp10_ = NULL;
	gboolean _tmp11_ = FALSE;
	GError * _inner_error_ = NULL;
#line 218 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 218 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAILS (thumbnails));
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = thumbnail_cache_big;
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = source;
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = thumbnails;
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = thumbnails_get (_tmp2_, THUMBNAIL_CACHE_SIZE_BIG);
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = _tmp3_;
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = force;
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_import_thumbnail (_tmp0_, _tmp1_, _tmp4_, _tmp5_, &_inner_error_);
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp4_);
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 220 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 1243 "ThumbnailCache.c"
	}
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = thumbnail_cache_medium;
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = source;
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = thumbnails;
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp9_ = thumbnails_get (_tmp8_, THUMBNAIL_CACHE_SIZE_MEDIUM);
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp10_ = _tmp9_;
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp11_ = force;
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_import_thumbnail (_tmp6_, _tmp7_, _tmp10_, _tmp11_, &_inner_error_);
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp10_);
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 221 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 1267 "ThumbnailCache.c"
	}
}


void thumbnail_cache_duplicate (ThumbnailSource* src_source, ThumbnailSource* dest_source) {
	ThumbnailCache* _tmp0_ = NULL;
	ThumbnailSource* _tmp1_ = NULL;
	ThumbnailSource* _tmp2_ = NULL;
	ThumbnailCache* _tmp3_ = NULL;
	ThumbnailSource* _tmp4_ = NULL;
	ThumbnailSource* _tmp5_ = NULL;
#line 224 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (src_source));
#line 224 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (dest_source));
#line 225 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = thumbnail_cache_big;
#line 225 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = src_source;
#line 225 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = dest_source;
#line 225 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_duplicate (_tmp0_, _tmp1_, _tmp2_);
#line 226 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = thumbnail_cache_medium;
#line 226 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = src_source;
#line 226 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = dest_source;
#line 226 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_duplicate (_tmp3_, _tmp4_, _tmp5_);
#line 1299 "ThumbnailCache.c"
}


void thumbnail_cache_remove (ThumbnailSource* source) {
	ThumbnailCache* _tmp0_ = NULL;
	ThumbnailSource* _tmp1_ = NULL;
	ThumbnailCache* _tmp2_ = NULL;
	ThumbnailSource* _tmp3_ = NULL;
#line 229 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 230 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = thumbnail_cache_big;
#line 230 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = source;
#line 230 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_remove (_tmp0_, _tmp1_);
#line 231 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = thumbnail_cache_medium;
#line 231 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = source;
#line 231 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_remove (_tmp2_, _tmp3_);
#line 1322 "ThumbnailCache.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 237 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return self ? g_object_ref (self) : NULL;
#line 1329 "ThumbnailCache.c"
}


static ThumbnailCache* thumbnail_cache_get_best_cache (gint scale) {
	ThumbnailCache* result = NULL;
	ThumbnailCacheSize size = 0;
	gint _tmp0_ = 0;
	ThumbnailCacheSize _tmp1_ = 0;
	ThumbnailCacheSize _tmp2_ = 0;
#line 235 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = scale;
#line 235 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_size_get_best_size (_tmp0_);
#line 235 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	size = _tmp1_;
#line 236 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = size;
#line 236 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp2_ == THUMBNAIL_CACHE_SIZE_BIG) {
#line 1349 "ThumbnailCache.c"
		ThumbnailCache* _tmp3_ = NULL;
		ThumbnailCache* _tmp4_ = NULL;
#line 237 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp3_ = thumbnail_cache_big;
#line 237 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp4_ = _g_object_ref0 (_tmp3_);
#line 237 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		result = _tmp4_;
#line 237 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return result;
#line 1360 "ThumbnailCache.c"
	} else {
		ThumbnailCacheSize _tmp5_ = 0;
		ThumbnailCache* _tmp6_ = NULL;
		ThumbnailCache* _tmp7_ = NULL;
#line 239 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp5_ = size;
#line 239 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_vala_assert (_tmp5_ == THUMBNAIL_CACHE_SIZE_MEDIUM, "size == Size.MEDIUM");
#line 241 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp6_ = thumbnail_cache_medium;
#line 241 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp7_ = _g_object_ref0 (_tmp6_);
#line 241 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		result = _tmp7_;
#line 241 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return result;
#line 1377 "ThumbnailCache.c"
	}
}


static ThumbnailCache* thumbnail_cache_get_cache_for (ThumbnailCacheSize size) {
	ThumbnailCache* result = NULL;
	ThumbnailCacheSize _tmp0_ = 0;
#line 246 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = size;
#line 246 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	switch (_tmp0_) {
#line 246 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		case THUMBNAIL_CACHE_SIZE_BIG:
#line 1391 "ThumbnailCache.c"
		{
			ThumbnailCache* _tmp1_ = NULL;
			ThumbnailCache* _tmp2_ = NULL;
#line 248 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp1_ = thumbnail_cache_big;
#line 248 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp2_ = _g_object_ref0 (_tmp1_);
#line 248 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			result = _tmp2_;
#line 248 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return result;
#line 1403 "ThumbnailCache.c"
		}
#line 246 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		case THUMBNAIL_CACHE_SIZE_MEDIUM:
#line 1407 "ThumbnailCache.c"
		{
			ThumbnailCache* _tmp3_ = NULL;
			ThumbnailCache* _tmp4_ = NULL;
#line 251 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp3_ = thumbnail_cache_medium;
#line 251 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp4_ = _g_object_ref0 (_tmp3_);
#line 251 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			result = _tmp4_;
#line 251 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return result;
#line 1419 "ThumbnailCache.c"
		}
		default:
		{
			ThumbnailCacheSize _tmp5_ = 0;
			gint _tmp6_ = 0;
#line 254 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp5_ = size;
#line 254 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp6_ = thumbnail_cache_size_get_scale (_tmp5_);
#line 254 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			g_error ("ThumbnailCache.vala:254: Unknown thumbnail size %d", _tmp6_);
#line 1431 "ThumbnailCache.c"
		}
	}
}


GdkPixbuf* thumbnail_cache_fetch (ThumbnailSource* source, gint scale, GError** error) {
	GdkPixbuf* result = NULL;
	GdkPixbuf* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	ThumbnailCache* _tmp2_ = NULL;
	ThumbnailCache* _tmp3_ = NULL;
	ThumbnailSource* _tmp4_ = NULL;
	GdkPixbuf* _tmp5_ = NULL;
	GdkPixbuf* _tmp6_ = NULL;
	GdkPixbuf* _tmp7_ = NULL;
	GError * _inner_error_ = NULL;
#line 258 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_SOURCE (source), NULL);
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = scale;
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = thumbnail_cache_get_best_cache (_tmp1_);
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = _tmp2_;
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = source;
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = _thumbnail_cache_fetch (_tmp3_, _tmp4_, &_inner_error_);
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = _tmp5_;
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp3_);
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = _tmp6_;
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return NULL;
#line 1472 "ThumbnailCache.c"
	}
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = _tmp0_;
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = NULL;
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = _tmp7_;
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp0_);
#line 259 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 1484 "ThumbnailCache.c"
}


void thumbnail_cache_fetch_async (ThumbnailSource* source, gint scale, ThumbnailCacheAsyncFetchCallback callback, void* callback_target, GCancellable* cancellable) {
	gint _tmp0_ = 0;
	ThumbnailCache* _tmp1_ = NULL;
	ThumbnailCache* _tmp2_ = NULL;
	ThumbnailSource* _tmp3_ = NULL;
	ThumbnailSource* _tmp4_ = NULL;
	PhotoFileFormat _tmp5_ = 0;
	Dimensions _tmp6_ = {0};
	ThumbnailCacheAsyncFetchCallback _tmp7_ = NULL;
	void* _tmp7__target = NULL;
	GCancellable* _tmp8_ = NULL;
#line 262 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 262 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail ((cancellable == NULL) || G_IS_CANCELLABLE (cancellable));
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = scale;
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_get_best_cache (_tmp0_);
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = _tmp1_;
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = source;
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = source;
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = thumbnail_source_get_preferred_thumbnail_format (_tmp4_);
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	dimensions_init (&_tmp6_, 0, 0);
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = callback;
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7__target = callback_target;
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = cancellable;
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_fetch_async (_tmp2_, _tmp3_, _tmp5_, &_tmp6_, THUMBNAIL_CACHE_DEFAULT_INTERP, _tmp7_, _tmp7__target, _tmp8_);
#line 264 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp2_);
#line 1527 "ThumbnailCache.c"
}


void thumbnail_cache_fetch_async_scaled (ThumbnailSource* source, gint scale, Dimensions* dim, GdkInterpType interp, ThumbnailCacheAsyncFetchCallback callback, void* callback_target, GCancellable* cancellable) {
	gint _tmp0_ = 0;
	ThumbnailCache* _tmp1_ = NULL;
	ThumbnailCache* _tmp2_ = NULL;
	ThumbnailSource* _tmp3_ = NULL;
	ThumbnailSource* _tmp4_ = NULL;
	PhotoFileFormat _tmp5_ = 0;
	Dimensions _tmp6_ = {0};
	GdkInterpType _tmp7_ = 0;
	ThumbnailCacheAsyncFetchCallback _tmp8_ = NULL;
	void* _tmp8__target = NULL;
	GCancellable* _tmp9_ = NULL;
#line 268 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 268 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (dim != NULL);
#line 268 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail ((cancellable == NULL) || G_IS_CANCELLABLE (cancellable));
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = scale;
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_get_best_cache (_tmp0_);
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = _tmp1_;
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = source;
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = source;
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = thumbnail_source_get_preferred_thumbnail_format (_tmp4_);
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = *dim;
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = interp;
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = callback;
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8__target = callback_target;
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp9_ = cancellable;
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_fetch_async (_tmp2_, _tmp3_, _tmp5_, &_tmp6_, _tmp7_, _tmp8_, _tmp8__target, _tmp9_);
#line 270 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp2_);
#line 1575 "ThumbnailCache.c"
}


void thumbnail_cache_replace (ThumbnailSource* source, ThumbnailCacheSize size, GdkPixbuf* replacement, GError** error) {
	ThumbnailCacheSize _tmp0_ = 0;
	ThumbnailCache* _tmp1_ = NULL;
	ThumbnailCache* _tmp2_ = NULL;
	ThumbnailSource* _tmp3_ = NULL;
	GdkPixbuf* _tmp4_ = NULL;
	GError * _inner_error_ = NULL;
#line 274 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 274 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (GDK_IS_PIXBUF (replacement));
#line 276 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = size;
#line 276 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_get_cache_for (_tmp0_);
#line 276 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = _tmp1_;
#line 276 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = source;
#line 276 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = replacement;
#line 276 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_replace (_tmp2_, _tmp3_, _tmp4_, &_inner_error_);
#line 276 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp2_);
#line 276 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 276 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 276 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 1610 "ThumbnailCache.c"
	}
}


gboolean thumbnail_cache_exists (ThumbnailSource* source) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	ThumbnailCache* _tmp1_ = NULL;
	ThumbnailSource* _tmp2_ = NULL;
	gboolean _tmp3_ = FALSE;
#line 279 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_SOURCE (source), FALSE);
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_big;
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = source;
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = _thumbnail_cache_exists (_tmp1_, _tmp2_);
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp3_) {
#line 1631 "ThumbnailCache.c"
		ThumbnailCache* _tmp4_ = NULL;
		ThumbnailSource* _tmp5_ = NULL;
		gboolean _tmp6_ = FALSE;
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp4_ = thumbnail_cache_medium;
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp5_ = source;
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp6_ = _thumbnail_cache_exists (_tmp4_, _tmp5_);
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp0_ = _tmp6_;
#line 1643 "ThumbnailCache.c"
	} else {
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp0_ = FALSE;
#line 1647 "ThumbnailCache.c"
	}
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = _tmp0_;
#line 280 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 1653 "ThumbnailCache.c"
}


void thumbnail_cache_rotate (ThumbnailSource* source, Rotation rotation, GError** error) {
	ThumbnailCacheSize* _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	GError * _inner_error_ = NULL;
#line 283 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 284 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = thumbnail_cache_ALL_SIZES;
#line 284 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0__length1 = thumbnail_cache_ALL_SIZES_length1;
#line 1667 "ThumbnailCache.c"
	{
		ThumbnailCacheSize* size_collection = NULL;
		gint size_collection_length1 = 0;
		gint _size_collection_size_ = 0;
		gint size_it = 0;
#line 284 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		size_collection = _tmp0_;
#line 284 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		size_collection_length1 = _tmp0__length1;
#line 284 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		for (size_it = 0; size_it < _tmp0__length1; size_it = size_it + 1) {
#line 1679 "ThumbnailCache.c"
			ThumbnailCacheSize size = 0;
#line 284 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			size = size_collection[size_it];
#line 1683 "ThumbnailCache.c"
			{
				GdkPixbuf* thumbnail = NULL;
				ThumbnailSource* _tmp1_ = NULL;
				ThumbnailCacheSize _tmp2_ = 0;
				GdkPixbuf* _tmp3_ = NULL;
				Rotation _tmp4_ = 0;
				GdkPixbuf* _tmp5_ = NULL;
				GdkPixbuf* _tmp6_ = NULL;
				ThumbnailSource* _tmp7_ = NULL;
				ThumbnailCacheSize _tmp8_ = 0;
				GdkPixbuf* _tmp9_ = NULL;
#line 285 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp1_ = source;
#line 285 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp2_ = size;
#line 285 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp3_ = thumbnail_cache_fetch (_tmp1_, (gint) _tmp2_, &_inner_error_);
#line 285 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				thumbnail = _tmp3_;
#line 285 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 285 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
					g_propagate_error (error, _inner_error_);
#line 285 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
					return;
#line 1709 "ThumbnailCache.c"
				}
#line 286 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp4_ = rotation;
#line 286 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp5_ = thumbnail;
#line 286 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp6_ = rotation_perform (_tmp4_, _tmp5_);
#line 286 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_g_object_unref0 (thumbnail);
#line 286 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				thumbnail = _tmp6_;
#line 287 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp7_ = source;
#line 287 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp8_ = size;
#line 287 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp9_ = thumbnail;
#line 287 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				thumbnail_cache_replace (_tmp7_, _tmp8_, _tmp9_, &_inner_error_);
#line 287 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 287 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
					g_propagate_error (error, _inner_error_);
#line 287 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
					_g_object_unref0 (thumbnail);
#line 287 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
					return;
#line 1737 "ThumbnailCache.c"
				}
#line 284 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_g_object_unref0 (thumbnail);
#line 1741 "ThumbnailCache.c"
			}
		}
	}
}


void thumbnail_cache_generate_for_photo (Thumbnails* thumbnails, PhotoFileReader* reader, Orientation orientation, Dimensions* original_dim, GError** error) {
	ThumbnailCacheSize max_size = 0;
	Dimensions dim = {0};
	ThumbnailCacheSize _tmp0_ = 0;
	Scaling _tmp1_ = {0};
	Dimensions _tmp2_ = {0};
	Dimensions _tmp3_ = {0};
	GdkPixbuf* largest_thumbnail = NULL;
	Orientation _tmp14_ = 0;
	GdkPixbuf* _tmp15_ = NULL;
	GdkPixbuf* _tmp16_ = NULL;
	Dimensions largest_thumb_dimensions = {0};
	GdkPixbuf* _tmp17_ = NULL;
	Dimensions _tmp18_ = {0};
	ThumbnailCacheSize* _tmp19_ = NULL;
	gint _tmp19__length1 = 0;
	GError * _inner_error_ = NULL;
#line 293 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAILS (thumbnails));
#line 293 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_PHOTO_FILE_READER (reader));
#line 293 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (original_dim != NULL);
#line 296 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	max_size = THUMBNAIL_CACHE_SIZE_BIG * 2;
#line 297 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = max_size;
#line 297 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_size_get_scaling (_tmp0_, &_tmp1_);
#line 297 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = *original_dim;
#line 297 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	scaling_get_scaled_dimensions (&_tmp1_, &_tmp2_, &_tmp3_);
#line 297 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	dim = _tmp3_;
#line 298 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	largest_thumbnail = NULL;
#line 1785 "ThumbnailCache.c"
	{
		GdkPixbuf* _tmp4_ = NULL;
		PhotoFileReader* _tmp5_ = NULL;
		Dimensions _tmp6_ = {0};
		Dimensions _tmp7_ = {0};
		GdkPixbuf* _tmp8_ = NULL;
		GdkPixbuf* _tmp9_ = NULL;
#line 300 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp5_ = reader;
#line 300 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp6_ = *original_dim;
#line 300 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp7_ = dim;
#line 300 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp8_ = photo_file_reader_scaled_read (_tmp5_, &_tmp6_, &_tmp7_, &_inner_error_);
#line 300 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp4_ = _tmp8_;
#line 300 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1805 "ThumbnailCache.c"
			goto __catch233_g_error;
		}
#line 300 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp9_ = _tmp4_;
#line 300 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp4_ = NULL;
#line 300 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (largest_thumbnail);
#line 300 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		largest_thumbnail = _tmp9_;
#line 299 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (_tmp4_);
#line 1818 "ThumbnailCache.c"
	}
	goto __finally233;
	__catch233_g_error:
	{
		GError* err = NULL;
		GdkPixbuf* _tmp10_ = NULL;
		PhotoFileReader* _tmp11_ = NULL;
		GdkPixbuf* _tmp12_ = NULL;
		GdkPixbuf* _tmp13_ = NULL;
#line 299 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		err = _inner_error_;
#line 299 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_inner_error_ = NULL;
#line 305 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp11_ = reader;
#line 305 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp12_ = photo_file_reader_unscaled_read (_tmp11_, &_inner_error_);
#line 305 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp10_ = _tmp12_;
#line 305 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 305 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_error_free0 (err);
#line 1842 "ThumbnailCache.c"
			goto __finally233;
		}
#line 305 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp13_ = _tmp10_;
#line 305 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp10_ = NULL;
#line 305 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (largest_thumbnail);
#line 305 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		largest_thumbnail = _tmp13_;
#line 299 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (_tmp10_);
#line 299 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_error_free0 (err);
#line 1857 "ThumbnailCache.c"
	}
	__finally233:
#line 299 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 299 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 299 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (largest_thumbnail);
#line 299 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 1868 "ThumbnailCache.c"
	}
#line 307 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp14_ = orientation;
#line 307 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp15_ = largest_thumbnail;
#line 307 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp16_ = orientation_rotate_pixbuf (_tmp14_, _tmp15_);
#line 307 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (largest_thumbnail);
#line 307 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	largest_thumbnail = _tmp16_;
#line 308 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp17_ = largest_thumbnail;
#line 308 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	dimensions_for_pixbuf (_tmp17_, &_tmp18_);
#line 308 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	largest_thumb_dimensions = _tmp18_;
#line 310 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp19_ = thumbnail_cache_ALL_SIZES;
#line 310 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp19__length1 = thumbnail_cache_ALL_SIZES_length1;
#line 1890 "ThumbnailCache.c"
	{
		ThumbnailCacheSize* size_collection = NULL;
		gint size_collection_length1 = 0;
		gint _size_collection_size_ = 0;
		gint size_it = 0;
#line 310 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		size_collection = _tmp19_;
#line 310 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		size_collection_length1 = _tmp19__length1;
#line 310 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		for (size_it = 0; size_it < _tmp19__length1; size_it = size_it + 1) {
#line 1902 "ThumbnailCache.c"
			ThumbnailCacheSize size = 0;
#line 310 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			size = size_collection[size_it];
#line 1906 "ThumbnailCache.c"
			{
				ThumbnailCacheSize _tmp20_ = 0;
				Scaling _tmp21_ = {0};
				Dimensions _tmp22_ = {0};
				Dimensions _tmp23_ = {0};
				Thumbnails* _tmp24_ = NULL;
				ThumbnailCacheSize _tmp25_ = 0;
				GdkPixbuf* _tmp26_ = NULL;
				Dimensions _tmp27_ = {0};
				gint _tmp28_ = 0;
				Dimensions _tmp29_ = {0};
				gint _tmp30_ = 0;
				GdkPixbuf* _tmp31_ = NULL;
				GdkPixbuf* _tmp32_ = NULL;
#line 311 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp20_ = size;
#line 311 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				thumbnail_cache_size_get_scaling (_tmp20_, &_tmp21_);
#line 311 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp22_ = largest_thumb_dimensions;
#line 311 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				scaling_get_scaled_dimensions (&_tmp21_, &_tmp22_, &_tmp23_);
#line 311 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				dim = _tmp23_;
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp24_ = thumbnails;
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp25_ = size;
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp26_ = largest_thumbnail;
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp27_ = dim;
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp28_ = _tmp27_.width;
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp29_ = dim;
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp30_ = _tmp29_.height;
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp31_ = gdk_pixbuf_scale_simple (_tmp26_, _tmp28_, _tmp30_, GDK_INTERP_HYPER);
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp32_ = _tmp31_;
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				thumbnails_set (_tmp24_, _tmp25_, _tmp32_);
#line 312 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_g_object_unref0 (_tmp32_);
#line 1953 "ThumbnailCache.c"
			}
		}
	}
#line 293 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (largest_thumbnail);
#line 1959 "ThumbnailCache.c"
}


void thumbnail_cache_generate_for_video_frame (Thumbnails* thumbnails, GdkPixbuf* preview_frame) {
	ThumbnailCacheSize* _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
#line 316 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAILS (thumbnails));
#line 316 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (GDK_IS_PIXBUF (preview_frame));
#line 317 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = thumbnail_cache_ALL_SIZES;
#line 317 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0__length1 = thumbnail_cache_ALL_SIZES_length1;
#line 1974 "ThumbnailCache.c"
	{
		ThumbnailCacheSize* size_collection = NULL;
		gint size_collection_length1 = 0;
		gint _size_collection_size_ = 0;
		gint size_it = 0;
#line 317 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		size_collection = _tmp0_;
#line 317 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		size_collection_length1 = _tmp0__length1;
#line 317 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		for (size_it = 0; size_it < _tmp0__length1; size_it = size_it + 1) {
#line 1986 "ThumbnailCache.c"
			ThumbnailCacheSize size = 0;
#line 317 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			size = size_collection[size_it];
#line 1990 "ThumbnailCache.c"
			{
				Scaling current_scaling = {0};
				ThumbnailCacheSize _tmp1_ = 0;
				Scaling _tmp2_ = {0};
				GdkPixbuf* current_thumbnail = NULL;
				GdkPixbuf* _tmp3_ = NULL;
				GdkPixbuf* _tmp4_ = NULL;
				Thumbnails* _tmp5_ = NULL;
				ThumbnailCacheSize _tmp6_ = 0;
				GdkPixbuf* _tmp7_ = NULL;
#line 318 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp1_ = size;
#line 318 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				thumbnail_cache_size_get_scaling (_tmp1_, &_tmp2_);
#line 318 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				current_scaling = _tmp2_;
#line 319 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp3_ = preview_frame;
#line 319 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp4_ = scaling_perform_on_pixbuf (&current_scaling, _tmp3_, GDK_INTERP_HYPER, TRUE);
#line 319 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				current_thumbnail = _tmp4_;
#line 321 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp5_ = thumbnails;
#line 321 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp6_ = size;
#line 321 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp7_ = current_thumbnail;
#line 321 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				thumbnails_set (_tmp5_, _tmp6_, _tmp7_);
#line 317 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_g_object_unref0 (current_thumbnail);
#line 2023 "ThumbnailCache.c"
			}
		}
	}
}


static void thumbnail_cache_schedule_debug (void) {
}


static void thumbnail_cache_report_cycle (void) {
}


static GdkPixbuf* _thumbnail_cache_fetch (ThumbnailCache* self, ThumbnailSource* source, GError** error) {
	GdkPixbuf* result = NULL;
	GdkPixbuf* pixbuf = NULL;
	ThumbnailSource* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	GdkPixbuf* _tmp3_ = NULL;
	GdkPixbuf* _tmp4_ = NULL;
	GdkPixbuf* _tmp5_ = NULL;
	GdkPixbuf* _tmp6_ = NULL;
	ThumbnailSource* _tmp7_ = NULL;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_ = NULL;
	ThumbnailSource* _tmp10_ = NULL;
	PhotoFileFormat _tmp11_ = 0;
	GdkPixbuf* _tmp12_ = NULL;
	GdkPixbuf* _tmp13_ = NULL;
	GdkPixbuf* _tmp14_ = NULL;
	gint _tmp15_ = 0;
	ThumbnailSource* _tmp16_ = NULL;
	gchar* _tmp17_ = NULL;
	gchar* _tmp18_ = NULL;
	GdkPixbuf* _tmp19_ = NULL;
	GError * _inner_error_ = NULL;
#line 371 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_CACHE (self), NULL);
#line 371 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_SOURCE (source), NULL);
#line 373 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = source;
#line 373 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = data_source_get_source_id (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_DATA_SOURCE, DataSource));
#line 373 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = _tmp1_;
#line 373 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = thumbnail_cache_fetch_from_memory (self, _tmp2_);
#line 373 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = _tmp3_;
#line 373 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp2_);
#line 373 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	pixbuf = _tmp4_;
#line 374 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = pixbuf;
#line 374 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp5_ != NULL) {
#line 375 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		result = pixbuf;
#line 375 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return result;
#line 2088 "ThumbnailCache.c"
	}
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = source;
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = data_source_get_source_id (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, TYPE_DATA_SOURCE, DataSource));
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp9_ = _tmp8_;
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp10_ = source;
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp11_ = thumbnail_source_get_preferred_thumbnail_format (_tmp10_);
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp12_ = thumbnail_cache_read_pixbuf (self, _tmp9_, _tmp11_, &_inner_error_);
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp13_ = _tmp12_;
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp9_);
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = _tmp13_;
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (pixbuf);
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return NULL;
#line 2116 "ThumbnailCache.c"
	}
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp14_ = _tmp6_;
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = NULL;
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (pixbuf);
#line 377 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	pixbuf = _tmp14_;
#line 379 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp15_ = thumbnail_cache_cycle_fetched_thumbnails;
#line 379 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_cycle_fetched_thumbnails = _tmp15_ + 1;
#line 380 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_schedule_debug ();
#line 383 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp16_ = source;
#line 383 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp17_ = data_source_get_source_id (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, TYPE_DATA_SOURCE, DataSource));
#line 383 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp18_ = _tmp17_;
#line 383 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp19_ = pixbuf;
#line 383 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_store_in_memory (self, _tmp18_, _tmp19_);
#line 383 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp18_);
#line 385 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = pixbuf;
#line 385 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp6_);
#line 385 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 2150 "ThumbnailCache.c"
}


static void _thumbnail_cache_fetch_async (ThumbnailCache* self, ThumbnailSource* source, PhotoFileFormat format, Dimensions* dim, GdkInterpType interp, ThumbnailCacheAsyncFetchCallback callback, void* callback_target, GCancellable* cancellable) {
	gchar* thumbnail_name = NULL;
	ThumbnailSource* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	GdkPixbuf* pixbuf = NULL;
	const gchar* _tmp2_ = NULL;
	GdkPixbuf* _tmp3_ = NULL;
	gboolean _tmp4_ = FALSE;
	GdkPixbuf* _tmp5_ = NULL;
	Workers* _tmp17_ = NULL;
	const gchar* _tmp18_ = NULL;
	ThumbnailSource* _tmp19_ = NULL;
	GdkPixbuf* _tmp20_ = NULL;
	Dimensions _tmp21_ = {0};
	GdkInterpType _tmp22_ = 0;
	ThumbnailCacheAsyncFetchCallback _tmp23_ = NULL;
	void* _tmp23__target = NULL;
	GCancellable* _tmp24_ = NULL;
	ThumbnailCacheAsyncFetchJob* _tmp25_ = NULL;
	ThumbnailCacheAsyncFetchJob* _tmp26_ = NULL;
#line 388 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_CACHE (self));
#line 388 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 388 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (dim != NULL);
#line 388 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail ((cancellable == NULL) || G_IS_CANCELLABLE (cancellable));
#line 391 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = source;
#line 391 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = data_source_get_source_id (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_DATA_SOURCE, DataSource));
#line 391 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_name = _tmp1_;
#line 392 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = thumbnail_name;
#line 392 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = thumbnail_cache_fetch_from_memory (self, _tmp2_);
#line 392 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	pixbuf = _tmp3_;
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = pixbuf;
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp5_ != NULL) {
#line 2198 "ThumbnailCache.c"
		gboolean _tmp6_ = FALSE;
		gboolean _tmp7_ = FALSE;
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp7_ = dimensions_has_area (dim);
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (!_tmp7_) {
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp6_ = TRUE;
#line 2207 "ThumbnailCache.c"
		} else {
			GdkPixbuf* _tmp8_ = NULL;
			Dimensions _tmp9_ = {0};
			Dimensions _tmp10_ = {0};
			gboolean _tmp11_ = FALSE;
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp8_ = pixbuf;
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			dimensions_for_pixbuf (_tmp8_, &_tmp9_);
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp10_ = *dim;
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp11_ = dimensions_equals (&_tmp9_, &_tmp10_);
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp6_ = _tmp11_;
#line 2223 "ThumbnailCache.c"
		}
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp4_ = _tmp6_;
#line 2227 "ThumbnailCache.c"
	} else {
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp4_ = FALSE;
#line 2231 "ThumbnailCache.c"
	}
#line 393 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp4_) {
#line 2235 "ThumbnailCache.c"
		ThumbnailCacheAsyncFetchCallback _tmp12_ = NULL;
		void* _tmp12__target = NULL;
		GdkPixbuf* _tmp13_ = NULL;
		GdkPixbuf* _tmp14_ = NULL;
		Dimensions _tmp15_ = {0};
		GdkInterpType _tmp16_ = 0;
#line 396 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp12_ = callback;
#line 396 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp12__target = callback_target;
#line 396 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp13_ = pixbuf;
#line 396 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp14_ = pixbuf;
#line 396 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp15_ = *dim;
#line 396 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp16_ = interp;
#line 396 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp12_ (_tmp13_, _tmp14_, &_tmp15_, _tmp16_, NULL, _tmp12__target);
#line 398 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (pixbuf);
#line 398 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_free0 (thumbnail_name);
#line 398 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 2262 "ThumbnailCache.c"
	}
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp17_ = thumbnail_cache_fetch_workers;
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp18_ = thumbnail_name;
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp19_ = source;
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp20_ = pixbuf;
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp21_ = *dim;
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp22_ = interp;
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp23_ = callback;
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp23__target = callback_target;
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp24_ = cancellable;
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp25_ = thumbnail_cache_async_fetch_job_new (self, _tmp18_, _tmp19_, _tmp20_, &_tmp21_, _tmp22_, _tmp23_, _tmp23__target, _tmp24_);
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp26_ = _tmp25_;
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	workers_enqueue (_tmp17_, G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, TYPE_BACKGROUND_JOB, BackgroundJob));
#line 411 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_background_job_unref0 (_tmp26_);
#line 388 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (pixbuf);
#line 388 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (thumbnail_name);
#line 2294 "ThumbnailCache.c"
}


static gpointer _background_job_ref0 (gpointer self) {
#line 417 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return self ? background_job_ref (self) : NULL;
#line 2301 "ThumbnailCache.c"
}


static gpointer _g_error_copy0 (gpointer self) {
#line 425 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return self ? g_error_copy (self) : NULL;
#line 2308 "ThumbnailCache.c"
}


static void thumbnail_cache_async_fetch_completion_callback (BackgroundJob* background_job) {
	ThumbnailCacheAsyncFetchJob* job = NULL;
	BackgroundJob* _tmp0_ = NULL;
	ThumbnailCacheAsyncFetchJob* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	ThumbnailCacheAsyncFetchJob* _tmp3_ = NULL;
	gboolean _tmp4_ = FALSE;
	ThumbnailCacheAsyncFetchJob* _tmp17_ = NULL;
	GdkPixbuf* _tmp18_ = NULL;
	ThumbnailCacheAsyncFetchJob* _tmp29_ = NULL;
	ThumbnailCacheAsyncFetchCallback _tmp30_ = NULL;
	void* _tmp30__target = NULL;
	ThumbnailCacheAsyncFetchJob* _tmp31_ = NULL;
	GdkPixbuf* _tmp32_ = NULL;
	ThumbnailCacheAsyncFetchJob* _tmp33_ = NULL;
	GdkPixbuf* _tmp34_ = NULL;
	ThumbnailCacheAsyncFetchJob* _tmp35_ = NULL;
	Dimensions _tmp36_ = {0};
	ThumbnailCacheAsyncFetchJob* _tmp37_ = NULL;
	GdkInterpType _tmp38_ = 0;
	ThumbnailCacheAsyncFetchJob* _tmp39_ = NULL;
	GError* _tmp40_ = NULL;
	GError * _inner_error_ = NULL;
#line 416 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_BACKGROUND_JOB (background_job));
#line 417 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = background_job;
#line 417 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = _background_job_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB, ThumbnailCacheAsyncFetchJob));
#line 417 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	job = _tmp1_;
#line 421 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = job;
#line 421 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = _tmp3_->replace;
#line 421 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp4_) {
#line 2349 "ThumbnailCache.c"
		ThumbnailCacheAsyncFetchJob* _tmp5_ = NULL;
		GdkPixbuf* _tmp6_ = NULL;
#line 421 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp5_ = job;
#line 421 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp6_ = _tmp5_->unscaled;
#line 421 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp2_ = _tmp6_ != NULL;
#line 2358 "ThumbnailCache.c"
	} else {
#line 421 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp2_ = FALSE;
#line 2362 "ThumbnailCache.c"
	}
#line 421 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp2_) {
#line 2366 "ThumbnailCache.c"
		{
			ThumbnailCacheAsyncFetchJob* _tmp7_ = NULL;
			ThumbnailSource* _tmp8_ = NULL;
			ThumbnailCacheAsyncFetchJob* _tmp9_ = NULL;
			ThumbnailCache* _tmp10_ = NULL;
			ThumbnailCacheSize _tmp11_ = 0;
			ThumbnailCacheAsyncFetchJob* _tmp12_ = NULL;
			GdkPixbuf* _tmp13_ = NULL;
#line 423 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp7_ = job;
#line 423 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp8_ = _tmp7_->source;
#line 423 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp9_ = job;
#line 423 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp10_ = _tmp9_->cache;
#line 423 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp11_ = _tmp10_->priv->size;
#line 423 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp12_ = job;
#line 423 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp13_ = _tmp12_->unscaled;
#line 423 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			thumbnail_cache_replace (_tmp8_, _tmp11_, _tmp13_, &_inner_error_);
#line 423 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 2393 "ThumbnailCache.c"
				goto __catch234_g_error;
			}
		}
		goto __finally234;
		__catch234_g_error:
		{
			GError* err = NULL;
			ThumbnailCacheAsyncFetchJob* _tmp14_ = NULL;
			GError* _tmp15_ = NULL;
			GError* _tmp16_ = NULL;
#line 422 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			err = _inner_error_;
#line 422 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_inner_error_ = NULL;
#line 425 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp14_ = job;
#line 425 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp15_ = err;
#line 425 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp16_ = _g_error_copy0 (_tmp15_);
#line 425 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_error_free0 (_tmp14_->err);
#line 425 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp14_->err = _tmp16_;
#line 422 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_error_free0 (err);
#line 2420 "ThumbnailCache.c"
		}
		__finally234:
#line 422 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 422 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_background_job_unref0 (job);
#line 422 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			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);
#line 422 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			g_clear_error (&_inner_error_);
#line 422 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return;
#line 2433 "ThumbnailCache.c"
		}
	}
#line 429 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp17_ = job;
#line 429 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp18_ = _tmp17_->unscaled;
#line 429 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp18_ != NULL) {
#line 2442 "ThumbnailCache.c"
		ThumbnailCacheAsyncFetchJob* _tmp19_ = NULL;
		gboolean _tmp20_ = FALSE;
#line 430 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp19_ = job;
#line 430 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp20_ = _tmp19_->fetched;
#line 430 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (_tmp20_) {
#line 2451 "ThumbnailCache.c"
			ThumbnailCacheAsyncFetchJob* _tmp21_ = NULL;
			ThumbnailCache* _tmp22_ = NULL;
			ThumbnailCacheAsyncFetchJob* _tmp23_ = NULL;
			const gchar* _tmp24_ = NULL;
			ThumbnailCacheAsyncFetchJob* _tmp25_ = NULL;
			GdkPixbuf* _tmp26_ = NULL;
			gint _tmp27_ = 0;
#line 432 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp21_ = job;
#line 432 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp22_ = _tmp21_->cache;
#line 432 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp23_ = job;
#line 432 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp24_ = _tmp23_->thumbnail_name;
#line 432 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp25_ = job;
#line 432 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp26_ = _tmp25_->unscaled;
#line 432 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			thumbnail_cache_store_in_memory (_tmp22_, _tmp24_, _tmp26_);
#line 434 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp27_ = thumbnail_cache_cycle_async_fetched_thumbnails;
#line 434 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			thumbnail_cache_cycle_async_fetched_thumbnails = _tmp27_ + 1;
#line 435 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			thumbnail_cache_schedule_debug ();
#line 2479 "ThumbnailCache.c"
		} else {
			gint _tmp28_ = 0;
#line 437 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp28_ = thumbnail_cache_cycle_async_resized_thumbnails;
#line 437 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			thumbnail_cache_cycle_async_resized_thumbnails = _tmp28_ + 1;
#line 438 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			thumbnail_cache_schedule_debug ();
#line 2488 "ThumbnailCache.c"
		}
	}
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp29_ = job;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp30_ = _tmp29_->callback;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp30__target = _tmp29_->callback_target;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp31_ = job;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp32_ = _tmp31_->scaled;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp33_ = job;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp34_ = _tmp33_->unscaled;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp35_ = job;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp36_ = _tmp35_->dim;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp37_ = job;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp38_ = _tmp37_->interp;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp39_ = job;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp40_ = _tmp39_->err;
#line 442 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp30_ (_tmp32_, _tmp34_, &_tmp36_, _tmp38_, _tmp40_, _tmp30__target);
#line 416 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_background_job_unref0 (job);
#line 2521 "ThumbnailCache.c"
}


static void _thumbnail_cache_import_from_source (ThumbnailCache* self, ThumbnailSource* source, gboolean force, GError** error) {
	GFile* file = NULL;
	ThumbnailSource* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	LibraryPhoto* photo = NULL;
	ThumbnailSource* _tmp6_ = NULL;
	LibraryPhoto* _tmp7_ = NULL;
	GdkPixbuf* _tmp8_ = NULL;
	LibraryPhoto* _tmp9_ = NULL;
	ThumbnailCacheSize _tmp10_ = 0;
	gint _tmp11_ = 0;
	Scaling _tmp12_ = {0};
	GdkPixbuf* _tmp13_ = NULL;
	GFile* _tmp14_ = NULL;
	ThumbnailSource* _tmp15_ = NULL;
	GError * _inner_error_ = NULL;
#line 445 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_CACHE (self));
#line 445 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 447 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = source;
#line 447 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_get_source_cached_file (self, _tmp0_);
#line 447 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	file = _tmp1_;
#line 451 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = force;
#line 451 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (!_tmp2_) {
#line 2556 "ThumbnailCache.c"
		ThumbnailSource* _tmp3_ = NULL;
		gboolean _tmp4_ = FALSE;
#line 452 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp3_ = source;
#line 452 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp4_ = _thumbnail_cache_exists (self, _tmp3_);
#line 452 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (_tmp4_) {
#line 453 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_object_unref0 (file);
#line 453 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return;
#line 2569 "ThumbnailCache.c"
		}
	} else {
		ThumbnailSource* _tmp5_ = NULL;
#line 456 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp5_ = source;
#line 456 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_thumbnail_cache_remove (self, _tmp5_);
#line 2577 "ThumbnailCache.c"
	}
#line 459 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = source;
#line 459 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, TYPE_LIBRARY_PHOTO, LibraryPhoto));
#line 459 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	photo = _tmp7_;
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp9_ = photo;
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp10_ = self->priv->size;
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp11_ = thumbnail_cache_size_get_scale (_tmp10_);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	scaling_for_best_fit (_tmp11_, TRUE, &_tmp12_);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp13_ = photo_source_get_pixbuf (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, TYPE_PHOTO_SOURCE, PhotoSource), &_tmp12_, &_inner_error_);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = _tmp13_;
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (photo);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (file);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 2607 "ThumbnailCache.c"
	}
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp14_ = file;
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp15_ = source;
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_save_thumbnail (self, _tmp14_, _tmp8_, _tmp15_, &_inner_error_);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (_tmp8_);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (photo);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (file);
#line 460 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 2627 "ThumbnailCache.c"
	}
#line 445 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp8_);
#line 445 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (photo);
#line 445 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (file);
#line 2635 "ThumbnailCache.c"
}


static void _thumbnail_cache_import_thumbnail (ThumbnailCache* self, ThumbnailSource* source, GdkPixbuf* scaled, gboolean force, GError** error) {
	GdkPixbuf* _tmp0_ = NULL;
	GdkPixbuf* _tmp1_ = NULL;
	Dimensions _tmp2_ = {0};
	ThumbnailCacheSize _tmp3_ = 0;
	gint _tmp4_ = 0;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	ThumbnailSource* _tmp10_ = NULL;
	GFile* _tmp11_ = NULL;
	GFile* _tmp12_ = NULL;
	GdkPixbuf* _tmp13_ = NULL;
	ThumbnailSource* _tmp14_ = NULL;
	GError * _inner_error_ = NULL;
#line 466 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_CACHE (self));
#line 466 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 466 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail ((scaled == NULL) || GDK_IS_PIXBUF (scaled));
#line 468 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = scaled;
#line 468 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_vala_assert (_tmp0_ != NULL, "scaled != null");
#line 469 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = scaled;
#line 469 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	dimensions_for_pixbuf (_tmp1_, &_tmp2_);
#line 469 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = self->priv->size;
#line 469 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = thumbnail_cache_size_get_scale (_tmp3_);
#line 469 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = dimensions_approx_scaled (&_tmp2_, _tmp4_, 1);
#line 469 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_vala_assert (_tmp5_, "Dimensions.for_pixbuf(scaled).approx_scaled(size.get_scale())");
#line 473 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = force;
#line 473 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (!_tmp6_) {
#line 2679 "ThumbnailCache.c"
		ThumbnailSource* _tmp7_ = NULL;
		gboolean _tmp8_ = FALSE;
#line 474 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp7_ = source;
#line 474 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp8_ = _thumbnail_cache_exists (self, _tmp7_);
#line 474 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (_tmp8_) {
#line 475 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return;
#line 2690 "ThumbnailCache.c"
		}
	} else {
		ThumbnailSource* _tmp9_ = NULL;
#line 478 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp9_ = source;
#line 478 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_thumbnail_cache_remove (self, _tmp9_);
#line 2698 "ThumbnailCache.c"
	}
#line 481 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp10_ = source;
#line 481 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp11_ = thumbnail_cache_get_source_cached_file (self, _tmp10_);
#line 481 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp12_ = _tmp11_;
#line 481 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp13_ = scaled;
#line 481 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp14_ = source;
#line 481 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_save_thumbnail (self, _tmp12_, _tmp13_, _tmp14_, &_inner_error_);
#line 481 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp12_);
#line 481 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 481 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 481 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 2720 "ThumbnailCache.c"
	}
}


static void _thumbnail_cache_duplicate (ThumbnailCache* self, ThumbnailSource* src_source, ThumbnailSource* dest_source) {
	GFile* src_file = NULL;
	ThumbnailSource* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	GFile* dest_file = NULL;
	ThumbnailSource* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	ThumbnailSource* _tmp5_ = NULL;
	PhotoFileFormat _tmp6_ = 0;
	GFile* _tmp7_ = NULL;
	GFile* _tmp8_ = NULL;
	GError * _inner_error_ = NULL;
#line 488 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_CACHE (self));
#line 488 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (src_source));
#line 488 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (dest_source));
#line 489 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = src_source;
#line 489 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_get_source_cached_file (self, _tmp0_);
#line 489 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	src_file = _tmp1_;
#line 490 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = dest_source;
#line 490 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = thumbnail_source_get_representative_id (_tmp2_);
#line 490 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = _tmp3_;
#line 490 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = src_source;
#line 490 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = thumbnail_source_get_preferred_thumbnail_format (_tmp5_);
#line 490 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = thumbnail_cache_get_cached_file (self, _tmp4_, _tmp6_);
#line 490 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = _tmp7_;
#line 490 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp4_);
#line 490 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	dest_file = _tmp8_;
#line 2768 "ThumbnailCache.c"
	{
#line 494 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_file_copy (src_file, dest_file, G_FILE_COPY_ALL_METADATA | G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &_inner_error_);
#line 494 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 2774 "ThumbnailCache.c"
			goto __catch235_g_error;
		}
	}
	goto __finally235;
	__catch235_g_error:
	{
		GError* err = NULL;
		GError* _tmp9_ = NULL;
		const gchar* _tmp10_ = NULL;
		gchar* _tmp11_ = NULL;
		gchar* _tmp12_ = NULL;
#line 493 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		err = _inner_error_;
#line 493 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_inner_error_ = NULL;
#line 496 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp9_ = err;
#line 496 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp10_ = _tmp9_->message;
#line 496 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp11_ = g_strdup_printf ("%s", _tmp10_);
#line 496 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp12_ = _tmp11_;
#line 496 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		app_window_panic (_tmp12_);
#line 496 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_free0 (_tmp12_);
#line 493 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_error_free0 (err);
#line 2804 "ThumbnailCache.c"
	}
	__finally235:
#line 493 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 493 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (dest_file);
#line 493 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (src_file);
#line 493 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		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);
#line 493 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_clear_error (&_inner_error_);
#line 493 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 2819 "ThumbnailCache.c"
	}
#line 488 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (dest_file);
#line 488 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (src_file);
#line 2825 "ThumbnailCache.c"
}


static void _thumbnail_cache_replace (ThumbnailCache* self, ThumbnailSource* source, GdkPixbuf* original, GError** error) {
	GFile* file = NULL;
	ThumbnailSource* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	ThumbnailSource* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	GdkPixbuf* scaled = NULL;
	GdkPixbuf* _tmp5_ = NULL;
	ThumbnailCacheSize _tmp6_ = 0;
	gint _tmp7_ = 0;
	GdkInterpType _tmp8_ = 0;
	GdkPixbuf* _tmp9_ = NULL;
	ThumbnailSource* _tmp10_ = NULL;
	ThumbnailSource* _tmp11_ = NULL;
	gchar* _tmp12_ = NULL;
	gchar* _tmp13_ = NULL;
	GError * _inner_error_ = NULL;
#line 502 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_CACHE (self));
#line 502 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 502 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (GDK_IS_PIXBUF (original));
#line 503 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = source;
#line 503 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_get_source_cached_file (self, _tmp0_);
#line 503 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	file = _tmp1_;
#line 506 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = source;
#line 506 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = data_source_get_source_id (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_DATA_SOURCE, DataSource));
#line 506 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = _tmp3_;
#line 506 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_remove_from_memory (self, _tmp4_);
#line 506 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp4_);
#line 509 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = original;
#line 509 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = self->priv->size;
#line 509 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = thumbnail_cache_size_get_scale (_tmp6_);
#line 509 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = self->priv->interp;
#line 509 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp9_ = scale_pixbuf (_tmp5_, _tmp7_, _tmp8_, TRUE);
#line 509 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	scaled = _tmp9_;
#line 512 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp10_ = source;
#line 512 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_save_thumbnail (self, file, scaled, _tmp10_, &_inner_error_);
#line 512 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 512 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 512 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (scaled);
#line 512 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (file);
#line 512 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 2895 "ThumbnailCache.c"
	}
#line 518 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp11_ = source;
#line 518 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp12_ = data_source_get_source_id (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, TYPE_DATA_SOURCE, DataSource));
#line 518 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp13_ = _tmp12_;
#line 518 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_store_in_memory (self, _tmp13_, scaled);
#line 518 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp13_);
#line 502 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (scaled);
#line 502 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (file);
#line 2911 "ThumbnailCache.c"
}


static void _thumbnail_cache_remove (ThumbnailCache* self, ThumbnailSource* source) {
	GFile* file = NULL;
	ThumbnailSource* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	ThumbnailSource* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	GError * _inner_error_ = NULL;
#line 521 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_CACHE (self));
#line 521 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 522 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = source;
#line 522 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_get_source_cached_file (self, _tmp0_);
#line 522 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	file = _tmp1_;
#line 525 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = source;
#line 525 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = data_source_get_source_id (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, TYPE_DATA_SOURCE, DataSource));
#line 525 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = _tmp3_;
#line 525 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_remove_from_memory (self, _tmp4_);
#line 525 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp4_);
#line 2943 "ThumbnailCache.c"
	{
#line 529 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_file_delete (file, NULL, &_inner_error_);
#line 529 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 2949 "ThumbnailCache.c"
			goto __catch236_g_error;
		}
	}
	goto __finally236;
	__catch236_g_error:
	{
		GError* err = NULL;
#line 528 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		err = _inner_error_;
#line 528 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_inner_error_ = NULL;
#line 528 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_error_free0 (err);
#line 2963 "ThumbnailCache.c"
	}
	__finally236:
#line 528 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 528 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (file);
#line 528 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		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);
#line 528 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_clear_error (&_inner_error_);
#line 528 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 2976 "ThumbnailCache.c"
	}
#line 521 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (file);
#line 2980 "ThumbnailCache.c"
}


static gboolean _thumbnail_cache_exists (ThumbnailCache* self, ThumbnailSource* source) {
	gboolean result = FALSE;
	ThumbnailSource* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	GFile* _tmp2_ = NULL;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
#line 535 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_CACHE (self), FALSE);
#line 535 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_SOURCE (source), FALSE);
#line 536 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = source;
#line 536 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_cache_get_source_cached_file (self, _tmp0_);
#line 536 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = _tmp1_;
#line 536 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = g_file_query_exists (_tmp2_, NULL);
#line 536 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = _tmp3_;
#line 536 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp2_);
#line 536 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = _tmp4_;
#line 536 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 3011 "ThumbnailCache.c"
}


static GdkPixbuf* thumbnail_cache_read_pixbuf (ThumbnailCache* self, const gchar* thumbnail_name, PhotoFileFormat format, GError** error) {
	GdkPixbuf* result = NULL;
	GdkPixbuf* _tmp0_ = NULL;
	PhotoFileFormat _tmp1_ = 0;
	const gchar* _tmp2_ = NULL;
	PhotoFileFormat _tmp3_ = 0;
	GFile* _tmp4_ = NULL;
	GFile* _tmp5_ = NULL;
	gchar* _tmp6_ = NULL;
	gchar* _tmp7_ = NULL;
	PhotoFileReader* _tmp8_ = NULL;
	PhotoFileReader* _tmp9_ = NULL;
	GdkPixbuf* _tmp10_ = NULL;
	GdkPixbuf* _tmp11_ = NULL;
	GdkPixbuf* _tmp12_ = NULL;
	GError * _inner_error_ = NULL;
#line 540 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_CACHE (self), NULL);
#line 540 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (thumbnail_name != NULL, NULL);
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = format;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = thumbnail_name;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = format;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = thumbnail_cache_get_cached_file (self, _tmp2_, _tmp3_);
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = _tmp4_;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = g_file_get_path (_tmp5_);
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = _tmp6_;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = photo_file_format_create_reader (_tmp1_, _tmp7_);
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp9_ = _tmp8_;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp10_ = photo_file_reader_unscaled_read (_tmp9_, &_inner_error_);
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp11_ = _tmp10_;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_photo_file_adapter_unref0 (_tmp9_);
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp7_);
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp5_);
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = _tmp11_;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return NULL;
#line 3071 "ThumbnailCache.c"
	}
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp12_ = _tmp0_;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = NULL;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = _tmp12_;
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (_tmp0_);
#line 541 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 3083 "ThumbnailCache.c"
}


static GFile* thumbnail_cache_get_source_cached_file (ThumbnailCache* self, ThumbnailSource* source) {
	GFile* result = NULL;
	ThumbnailSource* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	ThumbnailSource* _tmp3_ = NULL;
	PhotoFileFormat _tmp4_ = 0;
	GFile* _tmp5_ = NULL;
	GFile* _tmp6_ = NULL;
#line 545 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_CACHE (self), NULL);
#line 545 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_SOURCE (source), NULL);
#line 546 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = source;
#line 546 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_source_get_representative_id (_tmp0_);
#line 546 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = _tmp1_;
#line 546 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = source;
#line 546 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = thumbnail_source_get_preferred_thumbnail_format (_tmp3_);
#line 546 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = thumbnail_cache_get_cached_file (self, _tmp2_, _tmp4_);
#line 546 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = _tmp5_;
#line 546 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp2_);
#line 546 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = _tmp6_;
#line 546 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 3120 "ThumbnailCache.c"
}


static GFile* thumbnail_cache_get_cached_file (ThumbnailCache* self, const gchar* thumbnail_name, PhotoFileFormat thumbnail_format) {
	GFile* result = NULL;
	GFile* _tmp0_ = NULL;
	PhotoFileFormat _tmp1_ = 0;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	GFile* _tmp5_ = NULL;
	GFile* _tmp6_ = NULL;
#line 550 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_CACHE (self), NULL);
#line 550 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (thumbnail_name != NULL, NULL);
#line 551 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = self->priv->cache_dir;
#line 551 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_format;
#line 551 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = thumbnail_name;
#line 551 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = photo_file_format_get_default_basename (_tmp1_, _tmp2_);
#line 551 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = _tmp3_;
#line 551 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = g_file_get_child (_tmp0_, _tmp4_);
#line 551 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = _tmp5_;
#line 551 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp4_);
#line 551 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = _tmp6_;
#line 551 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 3157 "ThumbnailCache.c"
}


static GdkPixbuf* thumbnail_cache_fetch_from_memory (ThumbnailCache* self, const gchar* thumbnail_name) {
	GdkPixbuf* result = NULL;
	ThumbnailCacheImageData* data = NULL;
	GeeHashMap* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gpointer _tmp2_ = NULL;
	GdkPixbuf* _tmp3_ = NULL;
	ThumbnailCacheImageData* _tmp4_ = NULL;
	GdkPixbuf* _tmp7_ = NULL;
#line 554 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_CACHE (self), NULL);
#line 554 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (thumbnail_name != NULL, NULL);
#line 555 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = self->priv->cache_map;
#line 555 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_name;
#line 555 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp1_);
#line 555 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	data = (ThumbnailCacheImageData*) _tmp2_;
#line 557 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = data;
#line 557 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp4_ != NULL) {
#line 3186 "ThumbnailCache.c"
		ThumbnailCacheImageData* _tmp5_ = NULL;
		GdkPixbuf* _tmp6_ = NULL;
#line 557 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp5_ = data;
#line 557 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp6_ = _tmp5_->pixbuf;
#line 557 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp3_ = _tmp6_;
#line 3195 "ThumbnailCache.c"
	} else {
#line 557 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp3_ = NULL;
#line 3199 "ThumbnailCache.c"
	}
#line 557 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = _g_object_ref0 (_tmp3_);
#line 557 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = _tmp7_;
#line 557 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_image_data_unref0 (data);
#line 557 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 3209 "ThumbnailCache.c"
}


static void thumbnail_cache_store_in_memory (ThumbnailCache* self, const gchar* thumbnail_name, GdkPixbuf* thumbnail) {
	gulong _tmp0_ = 0UL;
	const gchar* _tmp1_ = NULL;
	ThumbnailCacheImageData* data = NULL;
	GdkPixbuf* _tmp2_ = NULL;
	ThumbnailCacheImageData* _tmp3_ = NULL;
	ThumbnailCacheImageData* _tmp4_ = NULL;
	gulong _tmp5_ = 0UL;
	GeeHashMap* _tmp7_ = NULL;
	const gchar* _tmp8_ = NULL;
	ThumbnailCacheImageData* _tmp9_ = NULL;
	GeeArrayList* _tmp10_ = NULL;
	const gchar* _tmp11_ = NULL;
	gulong _tmp12_ = 0UL;
	ThumbnailCacheImageData* _tmp13_ = NULL;
	gulong _tmp14_ = 0UL;
#line 560 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_CACHE (self));
#line 560 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (thumbnail_name != NULL);
#line 560 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (GDK_IS_PIXBUF (thumbnail));
#line 561 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = self->priv->max_cached_bytes;
#line 561 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp0_ <= ((gulong) 0)) {
#line 562 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 3241 "ThumbnailCache.c"
	}
#line 564 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_name;
#line 564 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_remove_from_memory (self, _tmp1_);
#line 566 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = thumbnail;
#line 566 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = thumbnail_cache_image_data_new (_tmp2_);
#line 566 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	data = _tmp3_;
#line 569 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = data;
#line 569 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = _tmp4_->bytes;
#line 569 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp5_ > ((gulong) THUMBNAIL_CACHE_MAX_INMEMORY_DATA_SIZE)) {
#line 3259 "ThumbnailCache.c"
		const gchar* _tmp6_ = NULL;
#line 570 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp6_ = thumbnail_name;
#line 570 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_debug ("ThumbnailCache.vala:570: Persistent thumbnail [%s] too large to cache " \
"in memory", _tmp6_);
#line 572 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_thumbnail_cache_image_data_unref0 (data);
#line 572 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 3269 "ThumbnailCache.c"
	}
#line 575 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = self->priv->cache_map;
#line 575 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = thumbnail_name;
#line 575 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp9_ = data;
#line 575 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp8_, _tmp9_);
#line 576 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp10_ = self->priv->cache_lru;
#line 576 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp11_ = thumbnail_name;
#line 576 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	gee_abstract_list_insert (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList), 0, _tmp11_);
#line 578 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp12_ = self->priv->cached_bytes;
#line 578 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp13_ = data;
#line 578 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp14_ = _tmp13_->bytes;
#line 578 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->cached_bytes = _tmp12_ + _tmp14_;
#line 581 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	while (TRUE) {
#line 3295 "ThumbnailCache.c"
		gulong _tmp15_ = 0UL;
		gulong _tmp16_ = 0UL;
		GeeArrayList* _tmp17_ = NULL;
		gint _tmp18_ = 0;
		gint _tmp19_ = 0;
		gint index = 0;
		GeeArrayList* _tmp20_ = NULL;
		gint _tmp21_ = 0;
		gint _tmp22_ = 0;
		gchar* victim_name = NULL;
		GeeArrayList* _tmp23_ = NULL;
		gint _tmp24_ = 0;
		gpointer _tmp25_ = NULL;
		GeeArrayList* _tmp26_ = NULL;
		gint _tmp27_ = 0;
		gpointer _tmp28_ = NULL;
		gchar* _tmp29_ = NULL;
		GeeHashMap* _tmp30_ = NULL;
		const gchar* _tmp31_ = NULL;
		gpointer _tmp32_ = NULL;
		gint _tmp33_ = 0;
		gboolean removed = FALSE;
		GeeHashMap* _tmp34_ = NULL;
		const gchar* _tmp35_ = NULL;
		gboolean _tmp36_ = FALSE;
		gboolean _tmp37_ = FALSE;
		ThumbnailCacheImageData* _tmp38_ = NULL;
		gulong _tmp39_ = 0UL;
		gulong _tmp40_ = 0UL;
		gulong _tmp41_ = 0UL;
		ThumbnailCacheImageData* _tmp42_ = NULL;
		gulong _tmp43_ = 0UL;
#line 581 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp15_ = self->priv->cached_bytes;
#line 581 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp16_ = self->priv->max_cached_bytes;
#line 581 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (!(_tmp15_ > _tmp16_)) {
#line 581 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			break;
#line 3336 "ThumbnailCache.c"
		}
#line 582 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp17_ = self->priv->cache_lru;
#line 582 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp18_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, GEE_TYPE_COLLECTION, GeeCollection));
#line 582 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp19_ = _tmp18_;
#line 582 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_vala_assert (_tmp19_ > 0, "cache_lru.size > 0");
#line 583 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp20_ = self->priv->cache_lru;
#line 583 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp21_ = gee_abstract_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_tmp20_, GEE_TYPE_COLLECTION, GeeCollection));
#line 583 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp22_ = _tmp21_;
#line 583 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		index = _tmp22_ - 1;
#line 585 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp23_ = self->priv->cache_lru;
#line 585 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp24_ = index;
#line 585 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp25_ = gee_abstract_list_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList), _tmp24_);
#line 585 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		victim_name = (gchar*) _tmp25_;
#line 586 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp26_ = self->priv->cache_lru;
#line 586 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp27_ = index;
#line 586 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp28_ = gee_abstract_list_remove_at (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, GEE_TYPE_ABSTRACT_LIST, GeeAbstractList), _tmp27_);
#line 586 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp29_ = (gchar*) _tmp28_;
#line 586 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_free0 (_tmp29_);
#line 588 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp30_ = self->priv->cache_map;
#line 588 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp31_ = victim_name;
#line 588 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp32_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp31_);
#line 588 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_thumbnail_cache_image_data_unref0 (data);
#line 588 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		data = (ThumbnailCacheImageData*) _tmp32_;
#line 590 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp33_ = thumbnail_cache_cycle_overflow_thumbnails;
#line 590 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		thumbnail_cache_cycle_overflow_thumbnails = _tmp33_ + 1;
#line 591 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		thumbnail_cache_schedule_debug ();
#line 593 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp34_ = self->priv->cache_map;
#line 593 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp35_ = victim_name;
#line 593 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp36_ = gee_abstract_map_unset (G_TYPE_CHECK_INSTANCE_CAST (_tmp34_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp35_, NULL);
#line 593 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		removed = _tmp36_;
#line 594 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp37_ = removed;
#line 594 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_vala_assert (_tmp37_, "removed");
#line 596 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp38_ = data;
#line 596 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp39_ = _tmp38_->bytes;
#line 596 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp40_ = self->priv->cached_bytes;
#line 596 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_vala_assert (_tmp39_ <= _tmp40_, "data.bytes <= cached_bytes");
#line 597 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp41_ = self->priv->cached_bytes;
#line 597 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp42_ = data;
#line 597 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp43_ = _tmp42_->bytes;
#line 597 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		self->priv->cached_bytes = _tmp41_ - _tmp43_;
#line 581 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_free0 (victim_name);
#line 3418 "ThumbnailCache.c"
	}
#line 560 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_image_data_unref0 (data);
#line 3422 "ThumbnailCache.c"
}


static gboolean thumbnail_cache_remove_from_memory (ThumbnailCache* self, const gchar* thumbnail_name) {
	gboolean result = FALSE;
	ThumbnailCacheImageData* data = NULL;
	GeeHashMap* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gpointer _tmp2_ = NULL;
	ThumbnailCacheImageData* _tmp3_ = NULL;
	gulong _tmp4_ = 0UL;
	ThumbnailCacheImageData* _tmp5_ = NULL;
	gulong _tmp6_ = 0UL;
	gulong _tmp7_ = 0UL;
	ThumbnailCacheImageData* _tmp8_ = NULL;
	gulong _tmp9_ = 0UL;
	gboolean removed = FALSE;
	GeeHashMap* _tmp10_ = NULL;
	const gchar* _tmp11_ = NULL;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_ = FALSE;
	GeeArrayList* _tmp14_ = NULL;
	const gchar* _tmp15_ = NULL;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_ = FALSE;
#line 601 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_CACHE (self), FALSE);
#line 601 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (thumbnail_name != NULL, FALSE);
#line 602 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = self->priv->cache_map;
#line 602 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = thumbnail_name;
#line 602 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp1_);
#line 602 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	data = (ThumbnailCacheImageData*) _tmp2_;
#line 603 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = data;
#line 603 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp3_ == NULL) {
#line 604 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		result = FALSE;
#line 604 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_thumbnail_cache_image_data_unref0 (data);
#line 604 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return result;
#line 3470 "ThumbnailCache.c"
	}
#line 606 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = self->priv->cached_bytes;
#line 606 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = data;
#line 606 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = _tmp5_->bytes;
#line 606 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_vala_assert (_tmp4_ >= _tmp6_, "cached_bytes >= data.bytes");
#line 607 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = self->priv->cached_bytes;
#line 607 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = data;
#line 607 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp9_ = _tmp8_->bytes;
#line 607 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->cached_bytes = _tmp7_ - _tmp9_;
#line 610 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp10_ = self->priv->cache_map;
#line 610 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp11_ = thumbnail_name;
#line 610 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp12_ = gee_abstract_map_unset (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp11_, NULL);
#line 610 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	removed = _tmp12_;
#line 611 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp13_ = removed;
#line 611 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_vala_assert (_tmp13_, "removed");
#line 614 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp14_ = self->priv->cache_lru;
#line 614 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp15_ = thumbnail_name;
#line 614 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp16_ = gee_abstract_collection_remove (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp15_);
#line 614 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	removed = _tmp16_;
#line 615 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp17_ = removed;
#line 615 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_vala_assert (_tmp17_, "removed");
#line 617 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	result = TRUE;
#line 617 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_thumbnail_cache_image_data_unref0 (data);
#line 617 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return result;
#line 3518 "ThumbnailCache.c"
}


static void thumbnail_cache_save_thumbnail (ThumbnailCache* self, GFile* file, GdkPixbuf* pixbuf, ThumbnailSource* source, GError** error) {
	PhotoFileWriter* _tmp0_ = NULL;
	ThumbnailSource* _tmp1_ = NULL;
	PhotoFileFormat _tmp2_ = 0;
	GFile* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	PhotoFileWriter* _tmp6_ = NULL;
	PhotoFileWriter* _tmp7_ = NULL;
	PhotoFileWriter* _tmp8_ = NULL;
	PhotoFileWriter* _tmp9_ = NULL;
	GdkPixbuf* _tmp10_ = NULL;
	GError * _inner_error_ = NULL;
#line 620 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_CACHE (self));
#line 620 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (G_IS_FILE (file));
#line 620 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
#line 620 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (IS_THUMBNAIL_SOURCE (source));
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = source;
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = thumbnail_source_get_preferred_thumbnail_format (_tmp1_);
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = file;
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = g_file_get_path (_tmp3_);
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = _tmp4_;
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = photo_file_format_create_writer (_tmp2_, _tmp5_, &_inner_error_);
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = _tmp6_;
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (_tmp5_);
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = _tmp7_;
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 3567 "ThumbnailCache.c"
	}
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = _tmp0_;
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = NULL;
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp9_ = _tmp8_;
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp10_ = pixbuf;
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	photo_file_writer_write (_tmp9_, _tmp10_, THUMBNAIL_CACHE_DEFAULT_QUALITY, &_inner_error_);
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_photo_file_adapter_unref0 (_tmp9_);
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_propagate_error (error, _inner_error_);
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_photo_file_adapter_unref0 (_tmp0_);
#line 621 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 3589 "ThumbnailCache.c"
	}
#line 620 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_photo_file_adapter_unref0 (_tmp0_);
#line 3593 "ThumbnailCache.c"
}


static ThumbnailCacheImageData* thumbnail_cache_image_data_construct (GType object_type, GdkPixbuf* pixbuf) {
	ThumbnailCacheImageData* self = NULL;
	GdkPixbuf* _tmp0_ = NULL;
	GdkPixbuf* _tmp1_ = NULL;
	GdkPixbuf* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	GdkPixbuf* _tmp4_ = NULL;
	gint _tmp5_ = 0;
#line 63 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
#line 63 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self = (ThumbnailCacheImageData*) g_type_create_instance (object_type);
#line 64 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = pixbuf;
#line 64 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 64 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->pixbuf);
#line 64 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->pixbuf = _tmp1_;
#line 68 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = pixbuf;
#line 68 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = gdk_pixbuf_get_rowstride (_tmp2_);
#line 68 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = pixbuf;
#line 68 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = gdk_pixbuf_get_height (_tmp4_);
#line 68 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->bytes = ((gulong) _tmp3_) * ((gulong) _tmp5_);
#line 63 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return self;
#line 3629 "ThumbnailCache.c"
}


static ThumbnailCacheImageData* thumbnail_cache_image_data_new (GdkPixbuf* pixbuf) {
#line 63 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return thumbnail_cache_image_data_construct (THUMBNAIL_CACHE_TYPE_IMAGE_DATA, pixbuf);
#line 3636 "ThumbnailCache.c"
}


static void thumbnail_cache_value_image_data_init (GValue* value) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	value->data[0].v_pointer = NULL;
#line 3643 "ThumbnailCache.c"
}


static void thumbnail_cache_value_image_data_free_value (GValue* value) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (value->data[0].v_pointer) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		thumbnail_cache_image_data_unref (value->data[0].v_pointer);
#line 3652 "ThumbnailCache.c"
	}
}


static void thumbnail_cache_value_image_data_copy_value (const GValue* src_value, GValue* dest_value) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (src_value->data[0].v_pointer) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		dest_value->data[0].v_pointer = thumbnail_cache_image_data_ref (src_value->data[0].v_pointer);
#line 3662 "ThumbnailCache.c"
	} else {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		dest_value->data[0].v_pointer = NULL;
#line 3666 "ThumbnailCache.c"
	}
}


static gpointer thumbnail_cache_value_image_data_peek_pointer (const GValue* value) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return value->data[0].v_pointer;
#line 3674 "ThumbnailCache.c"
}


static gchar* thumbnail_cache_value_image_data_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (collect_values[0].v_pointer) {
#line 3681 "ThumbnailCache.c"
		ThumbnailCacheImageData* object;
		object = collect_values[0].v_pointer;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (object->parent_instance.g_class == NULL) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 3688 "ThumbnailCache.c"
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 3692 "ThumbnailCache.c"
		}
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = thumbnail_cache_image_data_ref (object);
#line 3696 "ThumbnailCache.c"
	} else {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = NULL;
#line 3700 "ThumbnailCache.c"
	}
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return NULL;
#line 3704 "ThumbnailCache.c"
}


static gchar* thumbnail_cache_value_image_data_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	ThumbnailCacheImageData** object_p;
	object_p = collect_values[0].v_pointer;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (!object_p) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 3715 "ThumbnailCache.c"
	}
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (!value->data[0].v_pointer) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		*object_p = NULL;
#line 3721 "ThumbnailCache.c"
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		*object_p = value->data[0].v_pointer;
#line 3725 "ThumbnailCache.c"
	} else {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		*object_p = thumbnail_cache_image_data_ref (value->data[0].v_pointer);
#line 3729 "ThumbnailCache.c"
	}
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return NULL;
#line 3733 "ThumbnailCache.c"
}


static GParamSpec* thumbnail_cache_param_spec_image_data (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ThumbnailCacheParamSpecImageData* spec;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (g_type_is_a (object_type, THUMBNAIL_CACHE_TYPE_IMAGE_DATA), NULL);
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	G_PARAM_SPEC (spec)->value_type = object_type;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return G_PARAM_SPEC (spec);
#line 3747 "ThumbnailCache.c"
}


static gpointer thumbnail_cache_value_get_image_data (const GValue* value) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, THUMBNAIL_CACHE_TYPE_IMAGE_DATA), NULL);
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return value->data[0].v_pointer;
#line 3756 "ThumbnailCache.c"
}


static void thumbnail_cache_value_set_image_data (GValue* value, gpointer v_object) {
	ThumbnailCacheImageData* old;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, THUMBNAIL_CACHE_TYPE_IMAGE_DATA));
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	old = value->data[0].v_pointer;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (v_object) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, THUMBNAIL_CACHE_TYPE_IMAGE_DATA));
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = v_object;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		thumbnail_cache_image_data_ref (value->data[0].v_pointer);
#line 3776 "ThumbnailCache.c"
	} else {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = NULL;
#line 3780 "ThumbnailCache.c"
	}
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (old) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		thumbnail_cache_image_data_unref (old);
#line 3786 "ThumbnailCache.c"
	}
}


static void thumbnail_cache_value_take_image_data (GValue* value, gpointer v_object) {
	ThumbnailCacheImageData* old;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, THUMBNAIL_CACHE_TYPE_IMAGE_DATA));
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	old = value->data[0].v_pointer;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (v_object) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, THUMBNAIL_CACHE_TYPE_IMAGE_DATA));
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = v_object;
#line 3805 "ThumbnailCache.c"
	} else {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		value->data[0].v_pointer = NULL;
#line 3809 "ThumbnailCache.c"
	}
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (old) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		thumbnail_cache_image_data_unref (old);
#line 3815 "ThumbnailCache.c"
	}
}


static void thumbnail_cache_image_data_class_init (ThumbnailCacheImageDataClass * klass) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_image_data_parent_class = g_type_class_peek_parent (klass);
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	((ThumbnailCacheImageDataClass *) klass)->finalize = thumbnail_cache_image_data_finalize;
#line 3825 "ThumbnailCache.c"
}


static void thumbnail_cache_image_data_instance_init (ThumbnailCacheImageData * self) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->ref_count = 1;
#line 3832 "ThumbnailCache.c"
}


static void thumbnail_cache_image_data_finalize (ThumbnailCacheImageData* obj) {
	ThumbnailCacheImageData * self;
	gulong _tmp0_ = 0UL;
	gulong _tmp1_ = 0UL;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, THUMBNAIL_CACHE_TYPE_IMAGE_DATA, ThumbnailCacheImageData);
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_signal_handlers_destroy (self);
#line 72 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = thumbnail_cache_cycle_dropped_bytes;
#line 72 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = self->bytes;
#line 72 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_cycle_dropped_bytes = _tmp0_ + _tmp1_;
#line 73 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_schedule_debug ();
#line 60 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->pixbuf);
#line 3854 "ThumbnailCache.c"
}


static GType thumbnail_cache_image_data_get_type (void) {
	static volatile gsize thumbnail_cache_image_data_type_id__volatile = 0;
	if (g_once_init_enter (&thumbnail_cache_image_data_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { thumbnail_cache_value_image_data_init, thumbnail_cache_value_image_data_free_value, thumbnail_cache_value_image_data_copy_value, thumbnail_cache_value_image_data_peek_pointer, "p", thumbnail_cache_value_image_data_collect_value, "p", thumbnail_cache_value_image_data_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (ThumbnailCacheImageDataClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) thumbnail_cache_image_data_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ThumbnailCacheImageData), 0, (GInstanceInitFunc) thumbnail_cache_image_data_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType thumbnail_cache_image_data_type_id;
		thumbnail_cache_image_data_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ThumbnailCacheImageData", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&thumbnail_cache_image_data_type_id__volatile, thumbnail_cache_image_data_type_id);
	}
	return thumbnail_cache_image_data_type_id__volatile;
}


static gpointer thumbnail_cache_image_data_ref (gpointer instance) {
	ThumbnailCacheImageData* self;
	self = instance;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_atomic_int_inc (&self->ref_count);
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return instance;
#line 3879 "ThumbnailCache.c"
}


static void thumbnail_cache_image_data_unref (gpointer instance) {
	ThumbnailCacheImageData* self;
	self = instance;
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		THUMBNAIL_CACHE_IMAGE_DATA_GET_CLASS (self)->finalize (self);
#line 59 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_type_free_instance ((GTypeInstance *) self);
#line 3892 "ThumbnailCache.c"
	}
}


static void _thumbnail_cache_async_fetch_completion_callback_completion_callback (BackgroundJob* job, gpointer self) {
#line 94 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_async_fetch_completion_callback (job);
#line 3900 "ThumbnailCache.c"
}


static ThumbnailCacheAsyncFetchJob* thumbnail_cache_async_fetch_job_construct (GType object_type, ThumbnailCache* cache, const gchar* thumbnail_name, ThumbnailSource* source, GdkPixbuf* prefetched, Dimensions* dim, GdkInterpType interp, ThumbnailCacheAsyncFetchCallback callback, void* callback_target, GCancellable* cancellable) {
	ThumbnailCacheAsyncFetchJob* self = NULL;
	ThumbnailCache* _tmp0_ = NULL;
	GCancellable* _tmp1_ = NULL;
	ThumbnailCache* _tmp2_ = NULL;
	ThumbnailCache* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	ThumbnailSource* _tmp6_ = NULL;
	ThumbnailSource* _tmp7_ = NULL;
	ThumbnailSource* _tmp8_ = NULL;
	PhotoFileFormat _tmp9_ = 0;
	GdkPixbuf* _tmp10_ = NULL;
	GdkPixbuf* _tmp11_ = NULL;
	Dimensions _tmp12_ = {0};
	GdkInterpType _tmp13_ = 0;
	ThumbnailCacheAsyncFetchCallback _tmp14_ = NULL;
	void* _tmp14__target = NULL;
#line 91 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_CACHE (cache), NULL);
#line 91 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (thumbnail_name != NULL, NULL);
#line 91 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (IS_THUMBNAIL_SOURCE (source), NULL);
#line 91 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail ((prefetched == NULL) || GDK_IS_PIXBUF (prefetched), NULL);
#line 91 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail (dim != NULL, NULL);
#line 91 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_val_if_fail ((cancellable == NULL) || G_IS_CANCELLABLE (cancellable), NULL);
#line 94 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = cache;
#line 94 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = cancellable;
#line 94 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self = (ThumbnailCacheAsyncFetchJob*) background_job_construct (object_type, G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, G_TYPE_OBJECT, GObject), _thumbnail_cache_async_fetch_completion_callback_completion_callback, NULL, _tmp1_, NULL, NULL, NULL);
#line 96 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = cache;
#line 96 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp3_ = _g_object_ref0 (_tmp2_);
#line 96 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->cache);
#line 96 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->cache = _tmp3_;
#line 97 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp4_ = thumbnail_name;
#line 97 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp5_ = g_strdup (_tmp4_);
#line 97 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (self->thumbnail_name);
#line 97 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->thumbnail_name = _tmp5_;
#line 98 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp6_ = source;
#line 98 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp7_ = _g_object_ref0 (_tmp6_);
#line 98 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->source);
#line 98 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->source = _tmp7_;
#line 99 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp8_ = source;
#line 99 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp9_ = thumbnail_source_get_preferred_thumbnail_format (_tmp8_);
#line 99 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->source_format = _tmp9_;
#line 100 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp10_ = prefetched;
#line 100 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp11_ = _g_object_ref0 (_tmp10_);
#line 100 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->unscaled);
#line 100 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->unscaled = _tmp11_;
#line 101 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp12_ = *dim;
#line 101 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->dim = _tmp12_;
#line 102 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp13_ = interp;
#line 102 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->interp = _tmp13_;
#line 103 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp14_ = callback;
#line 103 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp14__target = callback_target;
#line 103 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->callback = _tmp14_;
#line 103 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->callback_target = _tmp14__target;
#line 91 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return self;
#line 3996 "ThumbnailCache.c"
}


static ThumbnailCacheAsyncFetchJob* thumbnail_cache_async_fetch_job_new (ThumbnailCache* cache, const gchar* thumbnail_name, ThumbnailSource* source, GdkPixbuf* prefetched, Dimensions* dim, GdkInterpType interp, ThumbnailCacheAsyncFetchCallback callback, void* callback_target, GCancellable* cancellable) {
#line 91 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	return thumbnail_cache_async_fetch_job_construct (THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB, cache, thumbnail_name, source, prefetched, dim, interp, callback, callback_target, cancellable);
#line 4003 "ThumbnailCache.c"
}


static BackgroundJobJobPriority thumbnail_cache_async_fetch_job_real_get_priority (BackgroundJob* base) {
	ThumbnailCacheAsyncFetchJob * self;
	BackgroundJobJobPriority result = 0;
	GdkInterpType _tmp0_ = 0;
#line 106 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (base, THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB, ThumbnailCacheAsyncFetchJob);
#line 109 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = self->interp;
#line 109 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	switch (_tmp0_) {
#line 109 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		case GDK_INTERP_NEAREST:
#line 109 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		case GDK_INTERP_TILES:
#line 4021 "ThumbnailCache.c"
		{
#line 112 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			result = BACKGROUND_JOB_JOB_PRIORITY_HIGH;
#line 112 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return result;
#line 4027 "ThumbnailCache.c"
		}
		default:
#line 109 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		case GDK_INTERP_BILINEAR:
#line 109 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		case GDK_INTERP_HYPER:
#line 4034 "ThumbnailCache.c"
		{
#line 117 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			result = BACKGROUND_JOB_JOB_PRIORITY_NORMAL;
#line 117 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return result;
#line 4040 "ThumbnailCache.c"
		}
	}
}


static void thumbnail_cache_async_fetch_job_real_execute (BackgroundJob* base) {
	ThumbnailCacheAsyncFetchJob * self;
	GError * _inner_error_ = NULL;
#line 121 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (base, THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB, ThumbnailCacheAsyncFetchJob);
#line 4051 "ThumbnailCache.c"
	{
		GdkPixbuf* _tmp0_ = NULL;
		gboolean _tmp7_ = FALSE;
		GdkPixbuf* _tmp8_ = NULL;
		gboolean _tmp9_ = FALSE;
		GdkPixbuf* _tmp16_ = NULL;
#line 124 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp0_ = self->unscaled;
#line 124 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (_tmp0_ == NULL) {
#line 4062 "ThumbnailCache.c"
			GdkPixbuf* _tmp1_ = NULL;
			ThumbnailCache* _tmp2_ = NULL;
			const gchar* _tmp3_ = NULL;
			PhotoFileFormat _tmp4_ = 0;
			GdkPixbuf* _tmp5_ = NULL;
			GdkPixbuf* _tmp6_ = NULL;
#line 125 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp2_ = self->cache;
#line 125 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp3_ = self->thumbnail_name;
#line 125 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp4_ = self->source_format;
#line 125 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp5_ = thumbnail_cache_read_pixbuf (_tmp2_, _tmp3_, _tmp4_, &_inner_error_);
#line 125 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp1_ = _tmp5_;
#line 125 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 4081 "ThumbnailCache.c"
				goto __catch237_g_error;
			}
#line 125 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp6_ = _tmp1_;
#line 125 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp1_ = NULL;
#line 125 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_object_unref0 (self->unscaled);
#line 125 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			self->unscaled = _tmp6_;
#line 126 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			self->fetched = TRUE;
#line 124 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_object_unref0 (_tmp1_);
#line 4096 "ThumbnailCache.c"
		}
#line 129 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp7_ = background_job_is_cancelled (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BACKGROUND_JOB, BackgroundJob));
#line 129 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (_tmp7_) {
#line 130 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return;
#line 4104 "ThumbnailCache.c"
		}
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp9_ = dimensions_has_area (&self->dim);
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (_tmp9_) {
#line 4110 "ThumbnailCache.c"
			GdkPixbuf* _tmp10_ = NULL;
			Dimensions _tmp11_ = {0};
			GdkInterpType _tmp12_ = 0;
			GdkPixbuf* _tmp13_ = NULL;
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp10_ = self->unscaled;
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp11_ = self->dim;
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp12_ = self->interp;
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp13_ = resize_pixbuf (_tmp10_, &_tmp11_, _tmp12_);
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_object_unref0 (_tmp8_);
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp8_ = _tmp13_;
#line 4127 "ThumbnailCache.c"
		} else {
			GdkPixbuf* _tmp14_ = NULL;
			GdkPixbuf* _tmp15_ = NULL;
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp14_ = self->unscaled;
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp15_ = _g_object_ref0 (_tmp14_);
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_object_unref0 (_tmp8_);
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp8_ = _tmp15_;
#line 4139 "ThumbnailCache.c"
		}
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp16_ = _g_object_ref0 (_tmp8_);
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (self->scaled);
#line 133 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		self->scaled = _tmp16_;
#line 122 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (_tmp8_);
#line 4149 "ThumbnailCache.c"
	}
	goto __finally237;
	__catch237_g_error:
	{
		GError* err = NULL;
		GError* _tmp17_ = NULL;
#line 122 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		err = _inner_error_;
#line 122 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_inner_error_ = NULL;
#line 135 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp17_ = err;
#line 135 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (_tmp17_->domain == G_FILE_ERROR) {
#line 4164 "ThumbnailCache.c"
			{
#line 137 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				thumbnail_cache_async_fetch_job_generate_thumbnail (self, &_inner_error_);
#line 137 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 4170 "ThumbnailCache.c"
					goto __catch238_g_error;
				}
			}
			goto __finally238;
			__catch238_g_error:
			{
				GError* generr = NULL;
				GError* _tmp18_ = NULL;
				GError* _tmp19_ = NULL;
#line 136 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				generr = _inner_error_;
#line 136 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_inner_error_ = NULL;
#line 140 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp18_ = generr;
#line 140 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_tmp19_ = _g_error_copy0 (_tmp18_);
#line 140 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_g_error_free0 (err);
#line 140 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				err = _tmp19_;
#line 136 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_g_error_free0 (generr);
#line 4194 "ThumbnailCache.c"
			}
			__finally238:
#line 136 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 136 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_g_error_free0 (err);
#line 136 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_g_error_free0 (err);
#line 136 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 136 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				g_clear_error (&_inner_error_);
#line 136 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				return;
#line 4209 "ThumbnailCache.c"
			}
		} else {
			GError* _tmp20_ = NULL;
			GError* _tmp21_ = NULL;
#line 144 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp20_ = err;
#line 144 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp21_ = _g_error_copy0 (_tmp20_);
#line 144 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_error_free0 (self->err);
#line 144 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			self->err = _tmp21_;
#line 4222 "ThumbnailCache.c"
		}
#line 122 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_error_free0 (err);
#line 4226 "ThumbnailCache.c"
	}
	__finally237:
#line 122 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 122 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		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);
#line 122 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		g_clear_error (&_inner_error_);
#line 122 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		return;
#line 4237 "ThumbnailCache.c"
	}
}


static void thumbnail_cache_async_fetch_job_generate_thumbnail (ThumbnailCacheAsyncFetchJob* self, GError** error) {
	Photo* photo = NULL;
	ThumbnailSource* _tmp0_ = NULL;
	Photo* _tmp1_ = NULL;
	Photo* _tmp2_ = NULL;
	GdkPixbuf* _tmp19_ = NULL;
	GError * _inner_error_ = NULL;
#line 149 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_return_if_fail (THUMBNAIL_CACHE_IS_ASYNC_FETCH_JOB (self));
#line 150 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = self->source;
#line 150 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, TYPE_PHOTO) ? ((Photo*) _tmp0_) : NULL);
#line 150 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	photo = _tmp1_;
#line 151 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp2_ = photo;
#line 151 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp2_ != NULL) {
#line 4261 "ThumbnailCache.c"
		GdkPixbuf* _tmp3_ = NULL;
		Photo* _tmp4_ = NULL;
		Dimensions _tmp5_ = {0};
		gint _tmp6_ = 0;
		Scaling _tmp7_ = {0};
		GdkPixbuf* _tmp8_ = NULL;
		GdkPixbuf* _tmp9_ = NULL;
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp4_ = photo;
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp5_ = self->dim;
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp6_ = _tmp5_.width;
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		scaling_for_best_fit (_tmp6_, TRUE, &_tmp7_);
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp8_ = photo_source_get_pixbuf (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, TYPE_PHOTO_SOURCE, PhotoSource), &_tmp7_, &_inner_error_);
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp3_ = _tmp8_;
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			g_propagate_error (error, _inner_error_);
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_object_unref0 (photo);
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			return;
#line 4289 "ThumbnailCache.c"
		}
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp9_ = _tmp3_;
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp3_ = NULL;
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (self->unscaled);
#line 152 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		self->unscaled = _tmp9_;
#line 151 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (_tmp3_);
#line 4301 "ThumbnailCache.c"
	} else {
		Video* video = NULL;
		ThumbnailSource* _tmp10_ = NULL;
		Video* _tmp11_ = NULL;
		Video* _tmp12_ = NULL;
#line 154 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp10_ = self->source;
#line 154 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp11_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, TYPE_VIDEO) ? ((Video*) _tmp10_) : NULL);
#line 154 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		video = _tmp11_;
#line 155 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp12_ = video;
#line 155 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		if (_tmp12_ != NULL) {
#line 4317 "ThumbnailCache.c"
			GdkPixbuf* _tmp13_ = NULL;
			Video* _tmp14_ = NULL;
			Dimensions _tmp15_ = {0};
			gint _tmp16_ = 0;
			GdkPixbuf* _tmp17_ = NULL;
			GdkPixbuf* _tmp18_ = NULL;
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp14_ = video;
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp15_ = self->dim;
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp16_ = _tmp15_.width;
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp17_ = thumbnail_source_create_thumbnail (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, TYPE_THUMBNAIL_SOURCE, ThumbnailSource), _tmp16_, &_inner_error_);
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp13_ = _tmp17_;
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				g_propagate_error (error, _inner_error_);
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_g_object_unref0 (video);
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				_g_object_unref0 (photo);
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
				return;
#line 4344 "ThumbnailCache.c"
			}
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp18_ = _tmp13_;
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_tmp13_ = NULL;
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_object_unref0 (self->unscaled);
#line 156 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			self->unscaled = _tmp18_;
#line 155 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
			_g_object_unref0 (_tmp13_);
#line 4356 "ThumbnailCache.c"
		}
#line 151 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (video);
#line 4360 "ThumbnailCache.c"
	}
#line 159 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp19_ = self->unscaled;
#line 159 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	if (_tmp19_ != NULL) {
#line 4366 "ThumbnailCache.c"
		GdkPixbuf* _tmp20_ = NULL;
		Dimensions _tmp21_ = {0};
		GdkInterpType _tmp22_ = 0;
		GdkPixbuf* _tmp23_ = NULL;
#line 160 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp20_ = self->unscaled;
#line 160 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp21_ = self->dim;
#line 160 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp22_ = self->interp;
#line 160 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_tmp23_ = resize_pixbuf (_tmp20_, &_tmp21_, _tmp22_);
#line 160 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		_g_object_unref0 (self->scaled);
#line 160 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		self->scaled = _tmp23_;
#line 161 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
		self->replace = TRUE;
#line 4385 "ThumbnailCache.c"
	}
#line 149 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (photo);
#line 4389 "ThumbnailCache.c"
}


static void thumbnail_cache_async_fetch_job_class_init (ThumbnailCacheAsyncFetchJobClass * klass) {
#line 77 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_async_fetch_job_parent_class = g_type_class_peek_parent (klass);
#line 77 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	((BackgroundJobClass *) klass)->finalize = thumbnail_cache_async_fetch_job_finalize;
#line 77 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	((BackgroundJobClass *) klass)->get_priority = thumbnail_cache_async_fetch_job_real_get_priority;
#line 77 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	((BackgroundJobClass *) klass)->execute = thumbnail_cache_async_fetch_job_real_execute;
#line 4402 "ThumbnailCache.c"
}


static void thumbnail_cache_async_fetch_job_instance_init (ThumbnailCacheAsyncFetchJob * self) {
#line 86 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->scaled = NULL;
#line 87 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->err = NULL;
#line 88 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->fetched = FALSE;
#line 89 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->replace = FALSE;
#line 4415 "ThumbnailCache.c"
}


static void thumbnail_cache_async_fetch_job_finalize (BackgroundJob* obj) {
	ThumbnailCacheAsyncFetchJob * self;
#line 77 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, THUMBNAIL_CACHE_TYPE_ASYNC_FETCH_JOB, ThumbnailCacheAsyncFetchJob);
#line 78 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->cache);
#line 79 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_free0 (self->thumbnail_name);
#line 80 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->source);
#line 85 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->unscaled);
#line 86 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->scaled);
#line 87 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_error_free0 (self->err);
#line 77 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	BACKGROUND_JOB_CLASS (thumbnail_cache_async_fetch_job_parent_class)->finalize (obj);
#line 4437 "ThumbnailCache.c"
}


static GType thumbnail_cache_async_fetch_job_get_type (void) {
	static volatile gsize thumbnail_cache_async_fetch_job_type_id__volatile = 0;
	if (g_once_init_enter (&thumbnail_cache_async_fetch_job_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ThumbnailCacheAsyncFetchJobClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) thumbnail_cache_async_fetch_job_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ThumbnailCacheAsyncFetchJob), 0, (GInstanceInitFunc) thumbnail_cache_async_fetch_job_instance_init, NULL };
		GType thumbnail_cache_async_fetch_job_type_id;
		thumbnail_cache_async_fetch_job_type_id = g_type_register_static (TYPE_BACKGROUND_JOB, "ThumbnailCacheAsyncFetchJob", &g_define_type_info, 0);
		g_once_init_leave (&thumbnail_cache_async_fetch_job_type_id__volatile, thumbnail_cache_async_fetch_job_type_id);
	}
	return thumbnail_cache_async_fetch_job_type_id__volatile;
}


static void thumbnail_cache_class_init (ThumbnailCacheClass * klass) {
	ThumbnailCacheSize* _tmp0_ = NULL;
#line 27 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_parent_class = g_type_class_peek_parent (klass);
#line 27 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	g_type_class_add_private (klass, sizeof (ThumbnailCachePrivate));
#line 27 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	G_OBJECT_CLASS (klass)->finalize = thumbnail_cache_finalize;
#line 54 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = g_new0 (ThumbnailCacheSize, 2);
#line 54 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_[0] = THUMBNAIL_CACHE_SIZE_BIG;
#line 54 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_[1] = THUMBNAIL_CACHE_SIZE_MEDIUM;
#line 54 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_ALL_SIZES = _tmp0_;
#line 54 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	thumbnail_cache_ALL_SIZES_length1 = 2;
#line 4471 "ThumbnailCache.c"
}


static void thumbnail_cache_instance_init (ThumbnailCache * self) {
	GeeHashMap* _tmp0_ = NULL;
	GeeArrayList* _tmp1_ = NULL;
#line 27 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv = THUMBNAIL_CACHE_GET_PRIVATE (self);
#line 186 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, THUMBNAIL_CACHE_TYPE_IMAGE_DATA, (GBoxedCopyFunc) thumbnail_cache_image_data_ref, thumbnail_cache_image_data_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
#line 186 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->cache_map = _tmp0_;
#line 187 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
#line 187 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->cache_lru = _tmp1_;
#line 188 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self->priv->cached_bytes = (gulong) 0;
#line 4490 "ThumbnailCache.c"
}


static void thumbnail_cache_finalize (GObject* obj) {
	ThumbnailCache * self;
#line 27 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_THUMBNAIL_CACHE, ThumbnailCache);
#line 181 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->priv->cache_dir);
#line 186 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->priv->cache_map);
#line 187 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	_g_object_unref0 (self->priv->cache_lru);
#line 27 "/home/jens/Source/shotwell/src/ThumbnailCache.vala"
	G_OBJECT_CLASS (thumbnail_cache_parent_class)->finalize (obj);
#line 4506 "ThumbnailCache.c"
}


GType thumbnail_cache_get_type (void) {
	static volatile gsize thumbnail_cache_type_id__volatile = 0;
	if (g_once_init_enter (&thumbnail_cache_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ThumbnailCacheClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) thumbnail_cache_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ThumbnailCache), 0, (GInstanceInitFunc) thumbnail_cache_instance_init, NULL };
		GType thumbnail_cache_type_id;
		thumbnail_cache_type_id = g_type_register_static (G_TYPE_OBJECT, "ThumbnailCache", &g_define_type_info, 0);
		g_once_init_leave (&thumbnail_cache_type_id__volatile, thumbnail_cache_type_id);
	}
	return thumbnail_cache_type_id__volatile;
}