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
|
/* autosave-manager.c generated by valac 0.28.0, the Vala compiler
* generated from autosave-manager.vala, do not modify */
/*
* Copyright (C) 2011 Timo Kluck
* Authors: Timo Kluck <tkluck@infty.nl>
* Robert Ancell <robert.ancell@canonical.com>
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib/gstdio.h>
#include <gobject/gvaluecollector.h>
#define TYPE_AUTOSAVE_MANAGER (autosave_manager_get_type ())
#define AUTOSAVE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_AUTOSAVE_MANAGER, AutosaveManager))
#define AUTOSAVE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_AUTOSAVE_MANAGER, AutosaveManagerClass))
#define IS_AUTOSAVE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_AUTOSAVE_MANAGER))
#define IS_AUTOSAVE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_AUTOSAVE_MANAGER))
#define AUTOSAVE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_AUTOSAVE_MANAGER, AutosaveManagerClass))
typedef struct _AutosaveManager AutosaveManager;
typedef struct _AutosaveManagerClass AutosaveManagerClass;
typedef struct _AutosaveManagerPrivate AutosaveManagerPrivate;
#define TYPE_PAGE (page_get_type ())
#define PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE, Page))
#define PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE, PageClass))
#define IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PAGE))
#define IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PAGE))
#define PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PAGE, PageClass))
typedef struct _Page Page;
typedef struct _PageClass PageClass;
#define TYPE_BOOK (book_get_type ())
#define BOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BOOK, Book))
#define BOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BOOK, BookClass))
#define IS_BOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BOOK))
#define IS_BOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BOOK))
#define BOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BOOK, BookClass))
typedef struct _Book Book;
typedef struct _BookClass BookClass;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _book_unref0(var) ((var == NULL) ? NULL : (var = (book_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))
#define TYPE_SCAN_DIRECTION (scan_direction_get_type ())
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _page_unref0(var) ((var == NULL) ? NULL : (var = (page_unref (var), NULL)))
#define _g_dir_close0(var) ((var == NULL) ? NULL : (var = (g_dir_close (var), NULL)))
typedef struct _ParamSpecAutosaveManager ParamSpecAutosaveManager;
struct _AutosaveManager {
GTypeInstance parent_instance;
volatile int ref_count;
AutosaveManagerPrivate * priv;
};
struct _AutosaveManagerClass {
GTypeClass parent_class;
void (*finalize) (AutosaveManager *self);
};
struct _AutosaveManagerPrivate {
guint update_timeout;
GHashTable* page_filenames;
Book* book_;
};
typedef enum {
SCAN_DIRECTION_TOP_TO_BOTTOM,
SCAN_DIRECTION_LEFT_TO_RIGHT,
SCAN_DIRECTION_BOTTOM_TO_TOP,
SCAN_DIRECTION_RIGHT_TO_LEFT
} ScanDirection;
struct _ParamSpecAutosaveManager {
GParamSpec parent_instance;
};
static gpointer autosave_manager_parent_class = NULL;
static gchar* autosave_manager_AUTOSAVE_DIR;
static gchar* autosave_manager_AUTOSAVE_DIR = NULL;
static gchar* autosave_manager_AUTOSAVE_FILENAME;
static gchar* autosave_manager_AUTOSAVE_FILENAME = NULL;
static gchar* autosave_manager_AUTOSAVE_PATH;
static gchar* autosave_manager_AUTOSAVE_PATH = NULL;
gpointer autosave_manager_ref (gpointer instance);
void autosave_manager_unref (gpointer instance);
GParamSpec* param_spec_autosave_manager (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_autosave_manager (GValue* value, gpointer v_object);
void value_take_autosave_manager (GValue* value, gpointer v_object);
gpointer value_get_autosave_manager (const GValue* value);
GType autosave_manager_get_type (void) G_GNUC_CONST;
gpointer page_ref (gpointer instance);
void page_unref (gpointer instance);
GParamSpec* param_spec_page (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_page (GValue* value, gpointer v_object);
void value_take_page (GValue* value, gpointer v_object);
gpointer value_get_page (const GValue* value);
GType page_get_type (void) G_GNUC_CONST;
gpointer book_ref (gpointer instance);
void book_unref (gpointer instance);
GParamSpec* param_spec_book (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_book (GValue* value, gpointer v_object);
void value_take_book (GValue* value, gpointer v_object);
gpointer value_get_book (const GValue* value);
GType book_get_type (void) G_GNUC_CONST;
#define AUTOSAVE_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_AUTOSAVE_MANAGER, AutosaveManagerPrivate))
enum {
AUTOSAVE_MANAGER_DUMMY_PROPERTY
};
AutosaveManager* autosave_manager_new (void);
AutosaveManager* autosave_manager_construct (GType object_type);
static void _page_unref0_ (gpointer var);
static void _g_free0_ (gpointer var);
void autosave_manager_load (AutosaveManager* self);
Book* autosave_manager_get_book (AutosaveManager* self);
void book_clear (Book* self);
static gchar* autosave_manager_get_value (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, const gchar* _default_);
static gint autosave_manager_get_integer (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, gint _default_);
GType scan_direction_get_type (void) G_GNUC_CONST;
static gboolean autosave_manager_get_boolean (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, gboolean _default_);
Page* page_new_from_data (gint scan_width, gint scan_height, gint rowstride, gint n_channels, gint depth, gint dpi, ScanDirection scan_direction, const gchar* color_profile, guchar* pixels, int pixels_length1, gboolean has_crop, const gchar* crop_name, gint crop_x, gint crop_y, gint crop_width, gint crop_height);
Page* page_construct_from_data (GType object_type, gint scan_width, gint scan_height, gint rowstride, gint n_channels, gint depth, gint dpi, ScanDirection scan_direction, const gchar* color_profile, guchar* pixels, int pixels_length1, gboolean has_crop, const gchar* crop_name, gint crop_x, gint crop_y, gint crop_width, gint crop_height);
void book_append_page (Book* self, Page* page);
void autosave_manager_cleanup (AutosaveManager* self);
void autosave_manager_on_page_added (AutosaveManager* self, Page* page);
void autosave_manager_on_scan_finished (AutosaveManager* self, Page* page);
static void _autosave_manager_on_scan_finished_page_scan_finished (Page* _sender, gpointer self);
void autosave_manager_on_changed (AutosaveManager* self);
static void _autosave_manager_on_changed_page_crop_changed (Page* _sender, gpointer self);
void autosave_manager_on_page_removed (AutosaveManager* self, Page* page);
static void autosave_manager_save_pixels (AutosaveManager* self, Page* page);
static void autosave_manager_save (AutosaveManager* self, gboolean do_timeout);
void autosave_manager_on_cleared (AutosaveManager* self);
static gboolean ___lambda4_ (AutosaveManager* self);
static void autosave_manager_real_save (AutosaveManager* self);
static gboolean ____lambda4__gsource_func (gpointer self);
guint book_get_n_pages (Book* self);
Page* book_get_page (Book* self, gint page_number);
gboolean page_get_has_data (Page* self);
gint page_get_scan_width (Page* self);
gint page_get_scan_height (Page* self);
gint page_get_rowstride (Page* self);
gint page_get_n_channels (Page* self);
gint page_get_depth (Page* self);
gint page_get_dpi (Page* self);
ScanDirection page_get_scan_direction (Page* self);
const gchar* page_get_color_profile (Page* self);
gboolean page_get_has_crop (Page* self);
const gchar* page_get_crop_name (Page* self);
gint page_get_crop_x (Page* self);
gint page_get_crop_y (Page* self);
gint page_get_crop_width (Page* self);
gint page_get_crop_height (Page* self);
guchar* page_get_pixels (Page* self, int* result_length1);
void autosave_manager_set_book (AutosaveManager* self, Book* value);
static void _autosave_manager_on_page_added_book_page_added (Book* _sender, Page* page, gpointer self);
static void _autosave_manager_on_page_removed_book_page_removed (Book* _sender, Page* page, gpointer self);
static void _autosave_manager_on_changed_book_reordered (Book* _sender, gpointer self);
static void _autosave_manager_on_cleared_book_cleared (Book* _sender, gpointer self);
static void autosave_manager_finalize (AutosaveManager* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);
static void _page_unref0_ (gpointer var) {
#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
(var == NULL) ? NULL : (var = (page_unref (var), NULL));
#line 189 "autosave-manager.c"
}
static void _g_free0_ (gpointer var) {
#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
var = (g_free (var), NULL);
#line 196 "autosave-manager.c"
}
AutosaveManager* autosave_manager_construct (GType object_type) {
AutosaveManager* self = NULL;
GHashFunc _tmp0_ = NULL;
GEqualFunc _tmp1_ = NULL;
GHashTable* _tmp2_ = NULL;
#line 57 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self = (AutosaveManager*) g_type_create_instance (object_type);
#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = g_direct_hash;
#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = g_direct_equal;
#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _page_unref0_, _g_free0_);
#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_hash_table_unref0 (self->priv->page_filenames);
#line 59 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv->page_filenames = _tmp2_;
#line 57 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return self;
#line 219 "autosave-manager.c"
}
AutosaveManager* autosave_manager_new (void) {
#line 57 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return autosave_manager_construct (TYPE_AUTOSAVE_MANAGER);
#line 226 "autosave-manager.c"
}
static gpointer _page_ref0 (gpointer self) {
#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return self ? page_ref (self) : NULL;
#line 233 "autosave-manager.c"
}
void autosave_manager_load (AutosaveManager* self) {
Book* _tmp0_ = NULL;
Book* _tmp1_ = NULL;
GHashTable* _tmp2_ = NULL;
GKeyFile* file = NULL;
GKeyFile* _tmp3_ = NULL;
gchar* pages = NULL;
GKeyFile* _tmp9_ = NULL;
gchar* _tmp10_ = NULL;
const gchar* _tmp11_ = NULL;
gchar** _tmp12_ = NULL;
gchar** _tmp13_ = NULL;
GError * _inner_error_ = NULL;
#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 64 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_debug ("autosave-manager.vala:64: Loading autosave information");
#line 66 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = autosave_manager_get_book (self);
#line 66 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = _tmp0_;
#line 66 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
book_clear (_tmp1_);
#line 67 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = self->priv->page_filenames;
#line 67 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_hash_table_remove_all (_tmp2_);
#line 69 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = g_key_file_new ();
#line 69 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
file = _tmp3_;
#line 268 "autosave-manager.c"
{
GKeyFile* _tmp4_ = NULL;
const gchar* _tmp5_ = NULL;
#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = file;
#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = autosave_manager_AUTOSAVE_PATH;
#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_load_from_file (_tmp4_, _tmp5_, G_KEY_FILE_NONE, &_inner_error_);
#line 72 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 280 "autosave-manager.c"
goto __catch29_g_error;
}
}
goto __finally29;
__catch29_g_error:
{
GError* e = NULL;
GError* _tmp6_ = NULL;
#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
e = _inner_error_;
#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
#line 76 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp6_ = e;
#line 76 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!g_error_matches (_tmp6_, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
#line 297 "autosave-manager.c"
GError* _tmp7_ = NULL;
const gchar* _tmp8_ = NULL;
#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp7_ = e;
#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp8_ = _tmp7_->message;
#line 77 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_warning ("autosave-manager.vala:77: Could not load autosave infomation; not rest" \
"oring any autosaves: %s", _tmp8_);
#line 306 "autosave-manager.c"
}
#line 78 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_error_free0 (e);
#line 78 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_key_file_unref0 (file);
#line 78 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return;
#line 314 "autosave-manager.c"
}
__finally29:
#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_key_file_unref0 (file);
#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.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 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_clear_error (&_inner_error_);
#line 70 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return;
#line 327 "autosave-manager.c"
}
#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp9_ = file;
#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp10_ = autosave_manager_get_value (self, _tmp9_, "simple-scan", "pages", "");
#line 80 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
pages = _tmp10_;
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp11_ = pages;
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp13_ = _tmp12_ = g_strsplit (_tmp11_, " ", 0);
#line 339 "autosave-manager.c"
{
gchar** page_name_collection = NULL;
gint page_name_collection_length1 = 0;
gint _page_name_collection_size_ = 0;
gint page_name_it = 0;
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page_name_collection = _tmp13_;
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page_name_collection_length1 = _vala_array_length (_tmp12_);
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
for (page_name_it = 0; page_name_it < _vala_array_length (_tmp12_); page_name_it = page_name_it + 1) {
#line 351 "autosave-manager.c"
gchar* _tmp14_ = NULL;
gchar* page_name = NULL;
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp14_ = g_strdup (page_name_collection[page_name_it]);
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page_name = _tmp14_;
#line 358 "autosave-manager.c"
{
const gchar* _tmp15_ = NULL;
gint scan_width = 0;
GKeyFile* _tmp16_ = NULL;
const gchar* _tmp17_ = NULL;
gint _tmp18_ = 0;
gint scan_height = 0;
GKeyFile* _tmp19_ = NULL;
const gchar* _tmp20_ = NULL;
gint _tmp21_ = 0;
gint rowstride = 0;
GKeyFile* _tmp22_ = NULL;
const gchar* _tmp23_ = NULL;
gint _tmp24_ = 0;
gint n_channels = 0;
GKeyFile* _tmp25_ = NULL;
const gchar* _tmp26_ = NULL;
gint _tmp27_ = 0;
gint depth = 0;
GKeyFile* _tmp28_ = NULL;
const gchar* _tmp29_ = NULL;
gint _tmp30_ = 0;
gint dpi = 0;
GKeyFile* _tmp31_ = NULL;
const gchar* _tmp32_ = NULL;
gint _tmp33_ = 0;
gchar* scan_direction_name = NULL;
GKeyFile* _tmp34_ = NULL;
const gchar* _tmp35_ = NULL;
gchar* _tmp36_ = NULL;
ScanDirection scan_direction = 0;
const gchar* _tmp37_ = NULL;
const gchar* _tmp38_ = NULL;
GQuark _tmp40_ = 0U;
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
static GQuark _tmp39_label0 = 0;
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
static GQuark _tmp39_label1 = 0;
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
static GQuark _tmp39_label2 = 0;
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
static GQuark _tmp39_label3 = 0;
#line 401 "autosave-manager.c"
gchar* color_profile = NULL;
GKeyFile* _tmp41_ = NULL;
const gchar* _tmp42_ = NULL;
gchar* _tmp43_ = NULL;
const gchar* _tmp44_ = NULL;
gchar* pixels_filename = NULL;
GKeyFile* _tmp45_ = NULL;
const gchar* _tmp46_ = NULL;
gchar* _tmp47_ = NULL;
gboolean has_crop = FALSE;
GKeyFile* _tmp48_ = NULL;
const gchar* _tmp49_ = NULL;
gboolean _tmp50_ = FALSE;
gchar* crop_name = NULL;
GKeyFile* _tmp51_ = NULL;
const gchar* _tmp52_ = NULL;
gchar* _tmp53_ = NULL;
const gchar* _tmp54_ = NULL;
gint crop_x = 0;
GKeyFile* _tmp55_ = NULL;
const gchar* _tmp56_ = NULL;
gint _tmp57_ = 0;
gint crop_y = 0;
GKeyFile* _tmp58_ = NULL;
const gchar* _tmp59_ = NULL;
gint _tmp60_ = 0;
gint crop_width = 0;
GKeyFile* _tmp61_ = NULL;
const gchar* _tmp62_ = NULL;
gint _tmp63_ = 0;
gint crop_height = 0;
GKeyFile* _tmp64_ = NULL;
const gchar* _tmp65_ = NULL;
gint _tmp66_ = 0;
guchar* pixels = NULL;
gint pixels_length1 = 0;
gint _pixels_size_ = 0;
const gchar* _tmp67_ = NULL;
Page* page = NULL;
gint _tmp76_ = 0;
gint _tmp77_ = 0;
gint _tmp78_ = 0;
gint _tmp79_ = 0;
gint _tmp80_ = 0;
gint _tmp81_ = 0;
ScanDirection _tmp82_ = 0;
const gchar* _tmp83_ = NULL;
guchar* _tmp84_ = NULL;
gint _tmp84__length1 = 0;
gboolean _tmp85_ = FALSE;
const gchar* _tmp86_ = NULL;
gint _tmp87_ = 0;
gint _tmp88_ = 0;
gint _tmp89_ = 0;
gint _tmp90_ = 0;
Page* _tmp91_ = NULL;
GHashTable* _tmp92_ = NULL;
Page* _tmp93_ = NULL;
Page* _tmp94_ = NULL;
const gchar* _tmp95_ = NULL;
gchar* _tmp96_ = NULL;
Book* _tmp97_ = NULL;
Book* _tmp98_ = NULL;
Page* _tmp99_ = NULL;
#line 83 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp15_ = page_name;
#line 83 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_debug ("autosave-manager.vala:83: Loading automatically saved page %s", _tmp15_);
#line 85 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp16_ = file;
#line 85 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp17_ = page_name;
#line 85 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp18_ = autosave_manager_get_integer (self, _tmp16_, _tmp17_, "scan-width", 0);
#line 85 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
scan_width = _tmp18_;
#line 86 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp19_ = file;
#line 86 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp20_ = page_name;
#line 86 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp21_ = autosave_manager_get_integer (self, _tmp19_, _tmp20_, "scan-height", 0);
#line 86 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
scan_height = _tmp21_;
#line 87 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp22_ = file;
#line 87 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp23_ = page_name;
#line 87 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp24_ = autosave_manager_get_integer (self, _tmp22_, _tmp23_, "rowstride", 0);
#line 87 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
rowstride = _tmp24_;
#line 88 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp25_ = file;
#line 88 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp26_ = page_name;
#line 88 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp27_ = autosave_manager_get_integer (self, _tmp25_, _tmp26_, "n-channels", 0);
#line 88 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
n_channels = _tmp27_;
#line 89 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp28_ = file;
#line 89 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp29_ = page_name;
#line 89 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp30_ = autosave_manager_get_integer (self, _tmp28_, _tmp29_, "depth", 0);
#line 89 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
depth = _tmp30_;
#line 90 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp31_ = file;
#line 90 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp32_ = page_name;
#line 90 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp33_ = autosave_manager_get_integer (self, _tmp31_, _tmp32_, "dpi", 0);
#line 90 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
dpi = _tmp33_;
#line 91 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp34_ = file;
#line 91 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp35_ = page_name;
#line 91 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp36_ = autosave_manager_get_value (self, _tmp34_, _tmp35_, "scan-direction", "");
#line 91 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
scan_direction_name = _tmp36_;
#line 92 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
scan_direction = SCAN_DIRECTION_TOP_TO_BOTTOM;
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp37_ = scan_direction_name;
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp38_ = _tmp37_;
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp40_ = (NULL == _tmp38_) ? 0 : g_quark_from_string (_tmp38_);
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp40_ == ((0 != _tmp39_label0) ? _tmp39_label0 : (_tmp39_label0 = g_quark_from_static_string ("TOP_TO_BOTTOM")))) {
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
switch (0) {
#line 538 "autosave-manager.c"
default:
{
#line 96 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
scan_direction = SCAN_DIRECTION_TOP_TO_BOTTOM;
#line 97 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 545 "autosave-manager.c"
}
}
} else if (_tmp40_ == ((0 != _tmp39_label1) ? _tmp39_label1 : (_tmp39_label1 = g_quark_from_static_string ("LEFT_TO_RIGHT")))) {
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
switch (0) {
#line 551 "autosave-manager.c"
default:
{
#line 99 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
scan_direction = SCAN_DIRECTION_LEFT_TO_RIGHT;
#line 100 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 558 "autosave-manager.c"
}
}
} else if (_tmp40_ == ((0 != _tmp39_label2) ? _tmp39_label2 : (_tmp39_label2 = g_quark_from_static_string ("BOTTOM_TO_TOP")))) {
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
switch (0) {
#line 564 "autosave-manager.c"
default:
{
#line 102 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
scan_direction = SCAN_DIRECTION_BOTTOM_TO_TOP;
#line 103 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 571 "autosave-manager.c"
}
}
} else if (_tmp40_ == ((0 != _tmp39_label3) ? _tmp39_label3 : (_tmp39_label3 = g_quark_from_static_string ("RIGHT_TO_LEFT")))) {
#line 93 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
switch (0) {
#line 577 "autosave-manager.c"
default:
{
#line 105 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
scan_direction = SCAN_DIRECTION_RIGHT_TO_LEFT;
#line 106 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 584 "autosave-manager.c"
}
}
}
#line 108 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp41_ = file;
#line 108 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp42_ = page_name;
#line 108 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp43_ = autosave_manager_get_value (self, _tmp41_, _tmp42_, "color-profile", "");
#line 108 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
color_profile = _tmp43_;
#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp44_ = color_profile;
#line 109 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (g_strcmp0 (_tmp44_, "") == 0) {
#line 110 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (color_profile);
#line 110 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
color_profile = NULL;
#line 604 "autosave-manager.c"
}
#line 111 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp45_ = file;
#line 111 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp46_ = page_name;
#line 111 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp47_ = autosave_manager_get_value (self, _tmp45_, _tmp46_, "pixels-filename", "");
#line 111 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
pixels_filename = _tmp47_;
#line 112 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp48_ = file;
#line 112 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp49_ = page_name;
#line 112 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp50_ = autosave_manager_get_boolean (self, _tmp48_, _tmp49_, "has-crop", FALSE);
#line 112 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
has_crop = _tmp50_;
#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp51_ = file;
#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp52_ = page_name;
#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp53_ = autosave_manager_get_value (self, _tmp51_, _tmp52_, "crop-name", "");
#line 113 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
crop_name = _tmp53_;
#line 114 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp54_ = crop_name;
#line 114 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (g_strcmp0 (_tmp54_, "") == 0) {
#line 115 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (crop_name);
#line 115 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
crop_name = NULL;
#line 638 "autosave-manager.c"
}
#line 116 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp55_ = file;
#line 116 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp56_ = page_name;
#line 116 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp57_ = autosave_manager_get_integer (self, _tmp55_, _tmp56_, "crop-x", 0);
#line 116 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
crop_x = _tmp57_;
#line 117 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp58_ = file;
#line 117 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp59_ = page_name;
#line 117 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp60_ = autosave_manager_get_integer (self, _tmp58_, _tmp59_, "crop-y", 0);
#line 117 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
crop_y = _tmp60_;
#line 118 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp61_ = file;
#line 118 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp62_ = page_name;
#line 118 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp63_ = autosave_manager_get_integer (self, _tmp61_, _tmp62_, "crop-width", 0);
#line 118 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
crop_width = _tmp63_;
#line 119 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp64_ = file;
#line 119 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp65_ = page_name;
#line 119 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp66_ = autosave_manager_get_integer (self, _tmp64_, _tmp65_, "crop-height", 0);
#line 119 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
crop_height = _tmp66_;
#line 121 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
pixels = NULL;
#line 121 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
pixels_length1 = 0;
#line 121 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_pixels_size_ = pixels_length1;
#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp67_ = pixels_filename;
#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (g_strcmp0 (_tmp67_, "") != 0) {
#line 682 "autosave-manager.c"
gchar* path = NULL;
const gchar* _tmp68_ = NULL;
const gchar* _tmp69_ = NULL;
gchar* _tmp70_ = NULL;
GFile* f = NULL;
const gchar* _tmp71_ = NULL;
GFile* _tmp72_ = NULL;
#line 124 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp68_ = autosave_manager_AUTOSAVE_DIR;
#line 124 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp69_ = pixels_filename;
#line 124 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp70_ = g_build_filename (_tmp68_, _tmp69_, NULL);
#line 124 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
path = _tmp70_;
#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp71_ = path;
#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp72_ = g_file_new_for_path (_tmp71_);
#line 125 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
f = _tmp72_;
#line 704 "autosave-manager.c"
{
GFile* _tmp73_ = NULL;
guint8* _tmp74_ = NULL;
gsize _tmp75_;
#line 128 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp73_ = f;
#line 128 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_file_load_contents (_tmp73_, NULL, &_tmp74_, &_tmp75_, NULL, &_inner_error_);
#line 128 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
pixels = (g_free (pixels), NULL);
#line 128 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
pixels = _tmp74_;
#line 128 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
pixels_length1 = _tmp75_;
#line 128 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_pixels_size_ = pixels_length1;
#line 128 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 723 "autosave-manager.c"
goto __catch30_g_error;
}
}
goto __finally30;
__catch30_g_error:
{
GError* e = NULL;
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
e = _inner_error_;
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
#line 132 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_warning ("autosave-manager.vala:132: Failed to load pixel information");
#line 133 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_error_free0 (e);
#line 133 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_object_unref0 (f);
#line 133 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (path);
#line 133 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
pixels = (g_free (pixels), NULL);
#line 133 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (crop_name);
#line 133 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (pixels_filename);
#line 133 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (color_profile);
#line 133 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (scan_direction_name);
#line 133 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (page_name);
#line 133 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
continue;
#line 757 "autosave-manager.c"
}
__finally30:
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_object_unref0 (f);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (path);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
pixels = (g_free (pixels), NULL);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (crop_name);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (pixels_filename);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (color_profile);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (scan_direction_name);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (page_name);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page_name_collection = (_vala_array_free (page_name_collection, page_name_collection_length1, (GDestroyNotify) g_free), NULL);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (pages);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_key_file_unref0 (file);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.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 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_clear_error (&_inner_error_);
#line 126 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return;
#line 790 "autosave-manager.c"
}
#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_object_unref0 (f);
#line 122 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (path);
#line 796 "autosave-manager.c"
}
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp76_ = scan_width;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp77_ = scan_height;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp78_ = rowstride;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp79_ = n_channels;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp80_ = depth;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp81_ = dpi;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp82_ = scan_direction;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp83_ = color_profile;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp84_ = pixels;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp84__length1 = pixels_length1;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp85_ = has_crop;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp86_ = crop_name;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp87_ = crop_x;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp88_ = crop_y;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp89_ = crop_width;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp90_ = crop_height;
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp91_ = page_new_from_data (_tmp76_, _tmp77_, _tmp78_, _tmp79_, _tmp80_, _tmp81_, _tmp82_, _tmp83_, _tmp84_, _tmp84__length1, _tmp85_, _tmp86_, _tmp87_, _tmp88_, _tmp89_, _tmp90_);
#line 137 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page = _tmp91_;
#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp92_ = self->priv->page_filenames;
#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp93_ = page;
#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp94_ = _page_ref0 (_tmp93_);
#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp95_ = pixels_filename;
#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp96_ = g_strdup (_tmp95_);
#line 152 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_hash_table_insert (_tmp92_, _tmp94_, _tmp96_);
#line 153 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp97_ = autosave_manager_get_book (self);
#line 153 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp98_ = _tmp97_;
#line 153 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp99_ = page;
#line 153 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
book_append_page (_tmp98_, _tmp99_);
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_page_unref0 (page);
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
pixels = (g_free (pixels), NULL);
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (crop_name);
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (pixels_filename);
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (color_profile);
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (scan_direction_name);
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (page_name);
#line 868 "autosave-manager.c"
}
}
#line 81 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page_name_collection = (_vala_array_free (page_name_collection, page_name_collection_length1, (GDestroyNotify) g_free), NULL);
#line 873 "autosave-manager.c"
}
#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (pages);
#line 62 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_key_file_unref0 (file);
#line 879 "autosave-manager.c"
}
static gchar* autosave_manager_get_value (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, const gchar* _default_) {
gchar* result = NULL;
GError * _inner_error_ = NULL;
#line 157 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (self != NULL, NULL);
#line 157 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (file != NULL, NULL);
#line 157 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (group_name != NULL, NULL);
#line 157 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (key != NULL, NULL);
#line 157 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (_default_ != NULL, NULL);
#line 896 "autosave-manager.c"
{
gchar* _tmp0_ = NULL;
GKeyFile* _tmp1_ = NULL;
const gchar* _tmp2_ = NULL;
const gchar* _tmp3_ = NULL;
gchar* _tmp4_ = NULL;
gchar* _tmp5_ = NULL;
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = file;
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = group_name;
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = key;
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = g_key_file_get_value (_tmp1_, _tmp2_, _tmp3_, &_inner_error_);
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = _tmp4_;
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 916 "autosave-manager.c"
goto __catch31_g_error;
}
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = _tmp0_;
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = NULL;
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
result = _tmp5_;
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (_tmp0_);
#line 161 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return result;
#line 929 "autosave-manager.c"
}
goto __finally31;
__catch31_g_error:
{
GError* e = NULL;
const gchar* _tmp6_ = NULL;
gchar* _tmp7_ = NULL;
#line 159 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
e = _inner_error_;
#line 159 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
#line 165 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp6_ = _default_;
#line 165 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp7_ = g_strdup (_tmp6_);
#line 165 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
result = _tmp7_;
#line 165 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_error_free0 (e);
#line 165 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return result;
#line 951 "autosave-manager.c"
}
__finally31:
#line 159 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.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 159 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_clear_error (&_inner_error_);
#line 159 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return NULL;
#line 960 "autosave-manager.c"
}
static gint autosave_manager_get_integer (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, gint _default_) {
gint result = 0;
GError * _inner_error_ = NULL;
#line 169 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (self != NULL, 0);
#line 169 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (file != NULL, 0);
#line 169 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (group_name != NULL, 0);
#line 169 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (key != NULL, 0);
#line 975 "autosave-manager.c"
{
gint _tmp0_ = 0;
GKeyFile* _tmp1_ = NULL;
const gchar* _tmp2_ = NULL;
const gchar* _tmp3_ = NULL;
gint _tmp4_ = 0;
#line 173 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = file;
#line 173 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = group_name;
#line 173 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = key;
#line 173 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = g_key_file_get_integer (_tmp1_, _tmp2_, _tmp3_, &_inner_error_);
#line 173 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = _tmp4_;
#line 173 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 994 "autosave-manager.c"
goto __catch32_g_error;
}
#line 173 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
result = _tmp0_;
#line 173 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return result;
#line 1001 "autosave-manager.c"
}
goto __finally32;
__catch32_g_error:
{
GError* e = NULL;
gint _tmp5_ = 0;
#line 171 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
e = _inner_error_;
#line 171 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
#line 177 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = _default_;
#line 177 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
result = _tmp5_;
#line 177 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_error_free0 (e);
#line 177 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return result;
#line 1020 "autosave-manager.c"
}
__finally32:
#line 171 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.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 171 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_clear_error (&_inner_error_);
#line 171 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return 0;
#line 1029 "autosave-manager.c"
}
static gboolean autosave_manager_get_boolean (AutosaveManager* self, GKeyFile* file, const gchar* group_name, const gchar* key, gboolean _default_) {
gboolean result = FALSE;
GError * _inner_error_ = NULL;
#line 181 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (self != NULL, FALSE);
#line 181 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (file != NULL, FALSE);
#line 181 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (group_name != NULL, FALSE);
#line 181 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (key != NULL, FALSE);
#line 1044 "autosave-manager.c"
{
gboolean _tmp0_ = FALSE;
GKeyFile* _tmp1_ = NULL;
const gchar* _tmp2_ = NULL;
const gchar* _tmp3_ = NULL;
gboolean _tmp4_ = FALSE;
#line 185 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = file;
#line 185 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = group_name;
#line 185 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = key;
#line 185 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = g_key_file_get_boolean (_tmp1_, _tmp2_, _tmp3_, &_inner_error_);
#line 185 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = _tmp4_;
#line 185 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1063 "autosave-manager.c"
goto __catch33_g_error;
}
#line 185 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
result = _tmp0_;
#line 185 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return result;
#line 1070 "autosave-manager.c"
}
goto __finally33;
__catch33_g_error:
{
GError* e = NULL;
gboolean _tmp5_ = FALSE;
#line 183 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
e = _inner_error_;
#line 183 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
#line 189 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = _default_;
#line 189 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
result = _tmp5_;
#line 189 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_error_free0 (e);
#line 189 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return result;
#line 1089 "autosave-manager.c"
}
__finally33:
#line 183 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.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 183 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_clear_error (&_inner_error_);
#line 183 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return FALSE;
#line 1098 "autosave-manager.c"
}
void autosave_manager_cleanup (AutosaveManager* self) {
guint _tmp0_ = 0U;
GDir* dir = NULL;
GError * _inner_error_ = NULL;
#line 193 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 195 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_debug ("autosave-manager.vala:195: Deleting autosave records");
#line 197 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = self->priv->update_timeout;
#line 197 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp0_ > ((guint) 0)) {
#line 1114 "autosave-manager.c"
guint _tmp1_ = 0U;
#line 198 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = self->priv->update_timeout;
#line 198 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_source_remove (_tmp1_);
#line 1120 "autosave-manager.c"
}
#line 199 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv->update_timeout = (guint) 0;
#line 1124 "autosave-manager.c"
{
GDir* _tmp2_ = NULL;
const gchar* _tmp3_ = NULL;
GDir* _tmp4_ = NULL;
GDir* _tmp5_ = NULL;
#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = autosave_manager_AUTOSAVE_DIR;
#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = g_dir_open (_tmp3_, (guint) 0, &_inner_error_);
#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = _tmp4_;
#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1138 "autosave-manager.c"
goto __catch34_g_error;
}
#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = _tmp2_;
#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = NULL;
#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_dir_close0 (dir);
#line 204 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
dir = _tmp5_;
#line 202 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_dir_close0 (_tmp2_);
#line 1151 "autosave-manager.c"
}
goto __finally34;
__catch34_g_error:
{
GError* e = NULL;
GError* _tmp6_ = NULL;
const gchar* _tmp7_ = NULL;
#line 202 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
e = _inner_error_;
#line 202 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
#line 208 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp6_ = e;
#line 208 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp7_ = _tmp6_->message;
#line 208 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_warning ("autosave-manager.vala:208: Failed to delete autosaves: %s", _tmp7_);
#line 209 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_error_free0 (e);
#line 209 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_dir_close0 (dir);
#line 209 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return;
#line 1175 "autosave-manager.c"
}
__finally34:
#line 202 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 202 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_dir_close0 (dir);
#line 202 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.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 202 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_clear_error (&_inner_error_);
#line 202 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return;
#line 1188 "autosave-manager.c"
}
#line 212 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
while (TRUE) {
#line 1192 "autosave-manager.c"
gchar* filename = NULL;
GDir* _tmp8_ = NULL;
const gchar* _tmp9_ = NULL;
gchar* _tmp10_ = NULL;
const gchar* _tmp11_ = NULL;
gchar* path = NULL;
const gchar* _tmp12_ = NULL;
const gchar* _tmp13_ = NULL;
gchar* _tmp14_ = NULL;
const gchar* _tmp15_ = NULL;
#line 214 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp8_ = dir;
#line 214 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp9_ = g_dir_read_name (_tmp8_);
#line 214 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp10_ = g_strdup (_tmp9_);
#line 214 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
filename = _tmp10_;
#line 215 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp11_ = filename;
#line 215 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp11_ == NULL) {
#line 216 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (filename);
#line 216 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 1219 "autosave-manager.c"
}
#line 217 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp12_ = autosave_manager_AUTOSAVE_DIR;
#line 217 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp13_ = filename;
#line 217 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp14_ = g_build_filename (_tmp12_, _tmp13_, NULL);
#line 217 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
path = _tmp14_;
#line 218 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp15_ = path;
#line 218 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_unlink (_tmp15_);
#line 212 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (path);
#line 212 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (filename);
#line 1237 "autosave-manager.c"
}
#line 193 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_dir_close0 (dir);
#line 1241 "autosave-manager.c"
}
static void _autosave_manager_on_scan_finished_page_scan_finished (Page* _sender, gpointer self) {
#line 224 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_scan_finished ((AutosaveManager*) self, _sender);
#line 1248 "autosave-manager.c"
}
static void _autosave_manager_on_changed_page_crop_changed (Page* _sender, gpointer self) {
#line 225 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_changed ((AutosaveManager*) self);
#line 1255 "autosave-manager.c"
}
void autosave_manager_on_page_added (AutosaveManager* self, Page* page) {
Page* _tmp0_ = NULL;
Page* _tmp1_ = NULL;
#line 222 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 222 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (page != NULL);
#line 224 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = page;
#line 224 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_connect (_tmp0_, "scan-finished", (GCallback) _autosave_manager_on_scan_finished_page_scan_finished, self);
#line 225 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = page;
#line 225 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_connect (_tmp1_, "crop-changed", (GCallback) _autosave_manager_on_changed_page_crop_changed, self);
#line 1274 "autosave-manager.c"
}
void autosave_manager_on_page_removed (AutosaveManager* self, Page* page) {
Page* _tmp0_ = NULL;
guint _tmp1_ = 0U;
Page* _tmp2_ = NULL;
guint _tmp3_ = 0U;
gchar* filename = NULL;
GHashTable* _tmp4_ = NULL;
Page* _tmp5_ = NULL;
gconstpointer _tmp6_ = NULL;
gchar* _tmp7_ = NULL;
const gchar* _tmp8_ = NULL;
GHashTable* _tmp10_ = NULL;
Page* _tmp11_ = NULL;
#line 228 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 228 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (page != NULL);
#line 230 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = page;
#line 230 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_parse_name ("scan-finished", TYPE_PAGE, &_tmp1_, NULL, FALSE);
#line 230 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _autosave_manager_on_scan_finished_page_scan_finished, self);
#line 231 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = page;
#line 231 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_parse_name ("crop-changed", TYPE_PAGE, &_tmp3_, NULL, FALSE);
#line 231 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _autosave_manager_on_changed_page_crop_changed, self);
#line 233 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = self->priv->page_filenames;
#line 233 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = page;
#line 233 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp6_ = g_hash_table_lookup (_tmp4_, _tmp5_);
#line 233 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp7_ = g_strdup ((const gchar*) _tmp6_);
#line 233 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
filename = _tmp7_;
#line 234 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp8_ = filename;
#line 234 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp8_ != NULL) {
#line 1321 "autosave-manager.c"
const gchar* _tmp9_ = NULL;
#line 235 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp9_ = filename;
#line 235 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_unlink (_tmp9_);
#line 1327 "autosave-manager.c"
}
#line 236 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp10_ = self->priv->page_filenames;
#line 236 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp11_ = page;
#line 236 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_hash_table_remove (_tmp10_, _tmp11_);
#line 228 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (filename);
#line 1337 "autosave-manager.c"
}
void autosave_manager_on_scan_finished (AutosaveManager* self, Page* page) {
Page* _tmp0_ = NULL;
#line 239 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 239 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (page != NULL);
#line 241 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = page;
#line 241 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_save_pixels (self, _tmp0_);
#line 242 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_save (self, FALSE);
#line 1353 "autosave-manager.c"
}
void autosave_manager_on_changed (AutosaveManager* self) {
#line 245 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 247 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_save (self, TRUE);
#line 1362 "autosave-manager.c"
}
void autosave_manager_on_cleared (AutosaveManager* self) {
GHashTable* _tmp0_ = NULL;
#line 250 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 252 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = self->priv->page_filenames;
#line 252 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_hash_table_remove_all (_tmp0_);
#line 253 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_save (self, TRUE);
#line 1376 "autosave-manager.c"
}
static gboolean ___lambda4_ (AutosaveManager* self) {
gboolean result = FALSE;
#line 270 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_real_save (self);
#line 271 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv->update_timeout = (guint) 0;
#line 272 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
result = FALSE;
#line 272 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return result;
#line 1390 "autosave-manager.c"
}
static gboolean ____lambda4__gsource_func (gpointer self) {
gboolean result;
result = ___lambda4_ ((AutosaveManager*) self);
#line 268 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return result;
#line 1399 "autosave-manager.c"
}
static void autosave_manager_save (AutosaveManager* self, gboolean do_timeout) {
gboolean _tmp0_ = FALSE;
guint _tmp1_ = 0U;
guint _tmp3_ = 0U;
gboolean _tmp5_ = FALSE;
#line 256 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 258 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = self->priv->update_timeout;
#line 258 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp1_ == ((guint) 0)) {
#line 1414 "autosave-manager.c"
gboolean _tmp2_ = FALSE;
#line 258 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = do_timeout;
#line 258 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = _tmp2_;
#line 1420 "autosave-manager.c"
} else {
#line 258 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = FALSE;
#line 1424 "autosave-manager.c"
}
#line 258 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp0_) {
#line 259 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_debug ("autosave-manager.vala:259: Waiting to autosave...");
#line 1430 "autosave-manager.c"
}
#line 262 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = self->priv->update_timeout;
#line 262 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp3_ > ((guint) 0)) {
#line 1436 "autosave-manager.c"
guint _tmp4_ = 0U;
#line 263 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = self->priv->update_timeout;
#line 263 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_source_remove (_tmp4_);
#line 1442 "autosave-manager.c"
}
#line 264 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv->update_timeout = (guint) 0;
#line 266 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = do_timeout;
#line 266 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp5_) {
#line 1450 "autosave-manager.c"
guint _tmp6_ = 0U;
#line 268 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp6_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 100, ____lambda4__gsource_func, autosave_manager_ref (self), autosave_manager_unref);
#line 268 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv->update_timeout = _tmp6_;
#line 1456 "autosave-manager.c"
} else {
#line 276 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_real_save (self);
#line 1460 "autosave-manager.c"
}
}
static void autosave_manager_real_save (AutosaveManager* self) {
GKeyFile* file = NULL;
GKeyFile* _tmp0_ = NULL;
gchar* page_names = NULL;
gchar* _tmp1_ = NULL;
GKeyFile* _tmp109_ = NULL;
const gchar* _tmp110_ = NULL;
GError * _inner_error_ = NULL;
#line 279 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 281 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_debug ("autosave-manager.vala:281: Autosaving book information");
#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = g_key_file_new ();
#line 283 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
file = _tmp0_;
#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = g_strdup ("");
#line 284 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page_names = _tmp1_;
#line 1485 "autosave-manager.c"
{
gint i = 0;
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
i = 0;
#line 1490 "autosave-manager.c"
{
gboolean _tmp2_ = FALSE;
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = TRUE;
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
while (TRUE) {
#line 1497 "autosave-manager.c"
gint _tmp4_ = 0;
Book* _tmp5_ = NULL;
Book* _tmp6_ = NULL;
guint _tmp7_ = 0U;
guint _tmp8_ = 0U;
Page* page = NULL;
Book* _tmp9_ = NULL;
Book* _tmp10_ = NULL;
gint _tmp11_ = 0;
Page* _tmp12_ = NULL;
Page* _tmp13_ = NULL;
gboolean _tmp14_ = FALSE;
gboolean _tmp15_ = FALSE;
gchar* page_name = NULL;
gint _tmp16_ = 0;
gchar* _tmp17_ = NULL;
const gchar* _tmp18_ = NULL;
const gchar* _tmp21_ = NULL;
const gchar* _tmp22_ = NULL;
gchar* _tmp23_ = NULL;
const gchar* _tmp24_ = NULL;
GKeyFile* _tmp25_ = NULL;
const gchar* _tmp26_ = NULL;
Page* _tmp27_ = NULL;
gint _tmp28_ = 0;
gint _tmp29_ = 0;
GKeyFile* _tmp30_ = NULL;
const gchar* _tmp31_ = NULL;
Page* _tmp32_ = NULL;
gint _tmp33_ = 0;
gint _tmp34_ = 0;
GKeyFile* _tmp35_ = NULL;
const gchar* _tmp36_ = NULL;
Page* _tmp37_ = NULL;
gint _tmp38_ = 0;
gint _tmp39_ = 0;
GKeyFile* _tmp40_ = NULL;
const gchar* _tmp41_ = NULL;
Page* _tmp42_ = NULL;
gint _tmp43_ = 0;
gint _tmp44_ = 0;
GKeyFile* _tmp45_ = NULL;
const gchar* _tmp46_ = NULL;
Page* _tmp47_ = NULL;
gint _tmp48_ = 0;
gint _tmp49_ = 0;
GKeyFile* _tmp50_ = NULL;
const gchar* _tmp51_ = NULL;
Page* _tmp52_ = NULL;
gint _tmp53_ = 0;
gint _tmp54_ = 0;
Page* _tmp55_ = NULL;
ScanDirection _tmp56_ = 0;
ScanDirection _tmp57_ = 0;
const gchar* _tmp66_ = NULL;
Page* _tmp67_ = NULL;
const gchar* _tmp68_ = NULL;
const gchar* _tmp69_ = NULL;
GKeyFile* _tmp70_ = NULL;
const gchar* _tmp71_ = NULL;
const gchar* _tmp72_ = NULL;
GHashTable* _tmp73_ = NULL;
Page* _tmp74_ = NULL;
gconstpointer _tmp75_ = NULL;
GKeyFile* _tmp76_ = NULL;
const gchar* _tmp77_ = NULL;
GKeyFile* _tmp78_ = NULL;
const gchar* _tmp79_ = NULL;
Page* _tmp80_ = NULL;
gboolean _tmp81_ = FALSE;
gboolean _tmp82_ = FALSE;
const gchar* _tmp83_ = NULL;
Page* _tmp84_ = NULL;
const gchar* _tmp85_ = NULL;
const gchar* _tmp86_ = NULL;
GKeyFile* _tmp87_ = NULL;
const gchar* _tmp88_ = NULL;
GKeyFile* _tmp89_ = NULL;
const gchar* _tmp90_ = NULL;
Page* _tmp91_ = NULL;
gint _tmp92_ = 0;
gint _tmp93_ = 0;
GKeyFile* _tmp94_ = NULL;
const gchar* _tmp95_ = NULL;
Page* _tmp96_ = NULL;
gint _tmp97_ = 0;
gint _tmp98_ = 0;
GKeyFile* _tmp99_ = NULL;
const gchar* _tmp100_ = NULL;
Page* _tmp101_ = NULL;
gint _tmp102_ = 0;
gint _tmp103_ = 0;
GKeyFile* _tmp104_ = NULL;
const gchar* _tmp105_ = NULL;
Page* _tmp106_ = NULL;
gint _tmp107_ = 0;
gint _tmp108_ = 0;
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!_tmp2_) {
#line 1597 "autosave-manager.c"
gint _tmp3_ = 0;
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = i;
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
i = _tmp3_ + 1;
#line 1603 "autosave-manager.c"
}
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = FALSE;
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = i;
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = autosave_manager_get_book (self);
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp6_ = _tmp5_;
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp7_ = book_get_n_pages (_tmp6_);
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp8_ = _tmp7_;
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!(((guint) _tmp4_) < _tmp8_)) {
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 1621 "autosave-manager.c"
}
#line 287 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp9_ = autosave_manager_get_book (self);
#line 287 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp10_ = _tmp9_;
#line 287 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp11_ = i;
#line 287 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp12_ = book_get_page (_tmp10_, _tmp11_);
#line 287 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page = _tmp12_;
#line 290 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp13_ = page;
#line 290 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp14_ = page_get_has_data (_tmp13_);
#line 290 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp15_ = _tmp14_;
#line 290 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!_tmp15_) {
#line 291 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_page_unref0 (page);
#line 291 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
continue;
#line 1645 "autosave-manager.c"
}
#line 293 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp16_ = i;
#line 293 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp17_ = g_strdup_printf ("page-%d", _tmp16_);
#line 293 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page_name = _tmp17_;
#line 294 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp18_ = page_names;
#line 294 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (g_strcmp0 (_tmp18_, "") != 0) {
#line 1657 "autosave-manager.c"
const gchar* _tmp19_ = NULL;
gchar* _tmp20_ = NULL;
#line 295 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp19_ = page_names;
#line 295 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp20_ = g_strconcat (_tmp19_, " ", NULL);
#line 295 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (page_names);
#line 295 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page_names = _tmp20_;
#line 1668 "autosave-manager.c"
}
#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp21_ = page_names;
#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp22_ = page_name;
#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp23_ = g_strconcat (_tmp21_, _tmp22_, NULL);
#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (page_names);
#line 296 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page_names = _tmp23_;
#line 298 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp24_ = page_name;
#line 298 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_debug ("autosave-manager.vala:298: Autosaving page %s", _tmp24_);
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp25_ = file;
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp26_ = page_name;
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp27_ = page;
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp28_ = page_get_scan_width (_tmp27_);
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp29_ = _tmp28_;
#line 300 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_integer (_tmp25_, _tmp26_, "scan-width", _tmp29_);
#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp30_ = file;
#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp31_ = page_name;
#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp32_ = page;
#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp33_ = page_get_scan_height (_tmp32_);
#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp34_ = _tmp33_;
#line 301 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_integer (_tmp30_, _tmp31_, "scan-height", _tmp34_);
#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp35_ = file;
#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp36_ = page_name;
#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp37_ = page;
#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp38_ = page_get_rowstride (_tmp37_);
#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp39_ = _tmp38_;
#line 302 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_integer (_tmp35_, _tmp36_, "rowstride", _tmp39_);
#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp40_ = file;
#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp41_ = page_name;
#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp42_ = page;
#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp43_ = page_get_n_channels (_tmp42_);
#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp44_ = _tmp43_;
#line 303 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_integer (_tmp40_, _tmp41_, "n-channels", _tmp44_);
#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp45_ = file;
#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp46_ = page_name;
#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp47_ = page;
#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp48_ = page_get_depth (_tmp47_);
#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp49_ = _tmp48_;
#line 304 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_integer (_tmp45_, _tmp46_, "depth", _tmp49_);
#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp50_ = file;
#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp51_ = page_name;
#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp52_ = page;
#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp53_ = page_get_dpi (_tmp52_);
#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp54_ = _tmp53_;
#line 305 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_integer (_tmp50_, _tmp51_, "dpi", _tmp54_);
#line 306 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp55_ = page;
#line 306 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp56_ = page_get_scan_direction (_tmp55_);
#line 306 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp57_ = _tmp56_;
#line 306 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
switch (_tmp57_) {
#line 306 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
case SCAN_DIRECTION_TOP_TO_BOTTOM:
#line 1766 "autosave-manager.c"
{
GKeyFile* _tmp58_ = NULL;
const gchar* _tmp59_ = NULL;
#line 309 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp58_ = file;
#line 309 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp59_ = page_name;
#line 309 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_value (_tmp58_, _tmp59_, "scan-direction", "TOP_TO_BOTTOM");
#line 310 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 1778 "autosave-manager.c"
}
#line 306 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
case SCAN_DIRECTION_LEFT_TO_RIGHT:
#line 1782 "autosave-manager.c"
{
GKeyFile* _tmp60_ = NULL;
const gchar* _tmp61_ = NULL;
#line 312 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp60_ = file;
#line 312 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp61_ = page_name;
#line 312 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_value (_tmp60_, _tmp61_, "scan-direction", "LEFT_TO_RIGHT");
#line 313 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 1794 "autosave-manager.c"
}
#line 306 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
case SCAN_DIRECTION_BOTTOM_TO_TOP:
#line 1798 "autosave-manager.c"
{
GKeyFile* _tmp62_ = NULL;
const gchar* _tmp63_ = NULL;
#line 315 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp62_ = file;
#line 315 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp63_ = page_name;
#line 315 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_value (_tmp62_, _tmp63_, "scan-direction", "BOTTOM_TO_TOP");
#line 316 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 1810 "autosave-manager.c"
}
#line 306 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
case SCAN_DIRECTION_RIGHT_TO_LEFT:
#line 1814 "autosave-manager.c"
{
GKeyFile* _tmp64_ = NULL;
const gchar* _tmp65_ = NULL;
#line 318 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp64_ = file;
#line 318 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp65_ = page_name;
#line 318 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_value (_tmp64_, _tmp65_, "scan-direction", "RIGHT_TO_LEFT");
#line 319 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 1826 "autosave-manager.c"
}
default:
#line 306 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 1831 "autosave-manager.c"
}
#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp67_ = page;
#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp68_ = page_get_color_profile (_tmp67_);
#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp69_ = _tmp68_;
#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp66_ = _tmp69_;
#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp66_ == NULL) {
#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp66_ = "";
#line 1845 "autosave-manager.c"
}
#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp70_ = file;
#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp71_ = page_name;
#line 321 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_value (_tmp70_, _tmp71_, "color-profile", _tmp66_);
#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp73_ = self->priv->page_filenames;
#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp74_ = page;
#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp75_ = g_hash_table_lookup (_tmp73_, _tmp74_);
#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp72_ = (const gchar*) _tmp75_;
#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp72_ == NULL) {
#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp72_ = "";
#line 1865 "autosave-manager.c"
}
#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp76_ = file;
#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp77_ = page_name;
#line 322 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_value (_tmp76_, _tmp77_, "pixels-filename", _tmp72_);
#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp78_ = file;
#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp79_ = page_name;
#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp80_ = page;
#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp81_ = page_get_has_crop (_tmp80_);
#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp82_ = _tmp81_;
#line 323 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_boolean (_tmp78_, _tmp79_, "has-crop", _tmp82_);
#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp84_ = page;
#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp85_ = page_get_crop_name (_tmp84_);
#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp86_ = _tmp85_;
#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp83_ = _tmp86_;
#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp83_ == NULL) {
#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp83_ = "";
#line 1897 "autosave-manager.c"
}
#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp87_ = file;
#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp88_ = page_name;
#line 324 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_value (_tmp87_, _tmp88_, "crop-name", _tmp83_);
#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp89_ = file;
#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp90_ = page_name;
#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp91_ = page;
#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp92_ = page_get_crop_x (_tmp91_);
#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp93_ = _tmp92_;
#line 325 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_integer (_tmp89_, _tmp90_, "crop-x", _tmp93_);
#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp94_ = file;
#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp95_ = page_name;
#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp96_ = page;
#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp97_ = page_get_crop_y (_tmp96_);
#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp98_ = _tmp97_;
#line 326 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_integer (_tmp94_, _tmp95_, "crop-y", _tmp98_);
#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp99_ = file;
#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp100_ = page_name;
#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp101_ = page;
#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp102_ = page_get_crop_width (_tmp101_);
#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp103_ = _tmp102_;
#line 327 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_integer (_tmp99_, _tmp100_, "crop-width", _tmp103_);
#line 328 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp104_ = file;
#line 328 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp105_ = page_name;
#line 328 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp106_ = page;
#line 328 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp107_ = page_get_crop_height (_tmp106_);
#line 328 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp108_ = _tmp107_;
#line 328 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_integer (_tmp104_, _tmp105_, "crop-height", _tmp108_);
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (page_name);
#line 285 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_page_unref0 (page);
#line 1957 "autosave-manager.c"
}
}
}
#line 330 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp109_ = file;
#line 330 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp110_ = page_names;
#line 330 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_key_file_set_value (_tmp109_, "simple-scan", "pages", _tmp110_);
#line 1967 "autosave-manager.c"
{
const gchar* _tmp111_ = NULL;
const gchar* _tmp112_ = NULL;
GKeyFile* _tmp113_ = NULL;
gchar* _tmp114_ = NULL;
gchar* _tmp115_ = NULL;
#line 334 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp111_ = autosave_manager_AUTOSAVE_DIR;
#line 334 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_mkdir_with_parents (_tmp111_, 0777);
#line 335 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp112_ = autosave_manager_AUTOSAVE_PATH;
#line 335 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp113_ = file;
#line 335 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp114_ = g_key_file_to_data (_tmp113_, NULL, NULL);
#line 335 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp115_ = _tmp114_;
#line 335 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_file_set_contents (_tmp112_, _tmp115_, (gssize) (-1), &_inner_error_);
#line 335 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (_tmp115_);
#line 335 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 1992 "autosave-manager.c"
goto __catch35_g_error;
}
}
goto __finally35;
__catch35_g_error:
{
GError* e = NULL;
GError* _tmp116_ = NULL;
const gchar* _tmp117_ = NULL;
#line 332 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
e = _inner_error_;
#line 332 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
#line 339 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp116_ = e;
#line 339 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp117_ = _tmp116_->message;
#line 339 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_warning ("autosave-manager.vala:339: Failed to write autosave: %s", _tmp117_);
#line 332 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_error_free0 (e);
#line 2014 "autosave-manager.c"
}
__finally35:
#line 332 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 332 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (page_names);
#line 332 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_key_file_unref0 (file);
#line 332 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.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 332 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_clear_error (&_inner_error_);
#line 332 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return;
#line 2029 "autosave-manager.c"
}
#line 279 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (page_names);
#line 279 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_key_file_unref0 (file);
#line 2035 "autosave-manager.c"
}
static void autosave_manager_save_pixels (AutosaveManager* self, Page* page) {
gchar* filename = NULL;
GHashFunc _tmp0_ = NULL;
Page* _tmp1_ = NULL;
guint _tmp2_ = 0U;
gchar* _tmp3_ = NULL;
gchar* path = NULL;
const gchar* _tmp4_ = NULL;
gchar* _tmp5_ = NULL;
GHashTable* _tmp6_ = NULL;
Page* _tmp7_ = NULL;
Page* _tmp8_ = NULL;
gchar* _tmp9_ = NULL;
GFile* file = NULL;
GFile* _tmp10_ = NULL;
GError * _inner_error_ = NULL;
#line 343 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 343 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (page != NULL);
#line 345 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = g_direct_hash;
#line 345 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = page;
#line 345 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = _tmp0_ (_tmp1_);
#line 345 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = g_strdup_printf ("%u.pixels", _tmp2_);
#line 345 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
filename = _tmp3_;
#line 346 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = autosave_manager_AUTOSAVE_DIR;
#line 346 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = g_build_filename (_tmp4_, filename, NULL);
#line 346 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
path = _tmp5_;
#line 347 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp6_ = self->priv->page_filenames;
#line 347 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp7_ = page;
#line 347 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp8_ = _page_ref0 (_tmp7_);
#line 347 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp9_ = g_strdup (filename);
#line 347 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_hash_table_insert (_tmp6_, _tmp8_, _tmp9_);
#line 349 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_debug ("autosave-manager.vala:349: Autosaving page pixels to %s", path);
#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp10_ = g_file_new_for_path (path);
#line 351 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
file = _tmp10_;
#line 2091 "autosave-manager.c"
{
Page* _tmp11_ = NULL;
gint _tmp12_ = 0;
guchar* _tmp13_ = NULL;
#line 354 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp11_ = page;
#line 354 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp13_ = page_get_pixels (_tmp11_, &_tmp12_);
#line 354 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_file_replace_contents (file, _tmp13_, (gsize) _tmp12_, NULL, FALSE, G_FILE_CREATE_NONE, NULL, NULL, &_inner_error_);
#line 354 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 2104 "autosave-manager.c"
goto __catch36_g_error;
}
}
goto __finally36;
__catch36_g_error:
{
GError* e = NULL;
GError* _tmp14_ = NULL;
const gchar* _tmp15_ = NULL;
#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
e = _inner_error_;
#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_inner_error_ = NULL;
#line 358 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp14_ = e;
#line 358 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp15_ = _tmp14_->message;
#line 358 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_warning ("autosave-manager.vala:358: Failed to autosave page contents: %s", _tmp15_);
#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_error_free0 (e);
#line 2126 "autosave-manager.c"
}
__finally36:
#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_object_unref0 (file);
#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (path);
#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (filename);
#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.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 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_clear_error (&_inner_error_);
#line 352 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return;
#line 2143 "autosave-manager.c"
}
#line 343 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_object_unref0 (file);
#line 343 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (path);
#line 343 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_free0 (filename);
#line 2151 "autosave-manager.c"
}
Book* autosave_manager_get_book (AutosaveManager* self) {
Book* result;
Book* _tmp0_ = NULL;
#line 26 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (self != NULL, NULL);
#line 28 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = self->priv->book_;
#line 28 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
result = _tmp0_;
#line 28 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return result;
#line 2166 "autosave-manager.c"
}
static void _autosave_manager_on_page_added_book_page_added (Book* _sender, Page* page, gpointer self) {
#line 39 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_page_added ((AutosaveManager*) self, page);
#line 2173 "autosave-manager.c"
}
static void _autosave_manager_on_page_removed_book_page_removed (Book* _sender, Page* page, gpointer self) {
#line 40 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_page_removed ((AutosaveManager*) self, page);
#line 2180 "autosave-manager.c"
}
static void _autosave_manager_on_changed_book_reordered (Book* _sender, gpointer self) {
#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_changed ((AutosaveManager*) self);
#line 2187 "autosave-manager.c"
}
static void _autosave_manager_on_cleared_book_cleared (Book* _sender, gpointer self) {
#line 42 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_cleared ((AutosaveManager*) self);
#line 2194 "autosave-manager.c"
}
static gpointer _book_ref0 (gpointer self) {
#line 44 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return self ? book_ref (self) : NULL;
#line 2201 "autosave-manager.c"
}
void autosave_manager_set_book (AutosaveManager* self, Book* value) {
Book* _tmp0_ = NULL;
Book* _tmp19_ = NULL;
Book* _tmp20_ = NULL;
Book* _tmp21_ = NULL;
Book* _tmp22_ = NULL;
Book* _tmp23_ = NULL;
Book* _tmp24_ = NULL;
#line 30 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (self != NULL);
#line 32 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = self->priv->book_;
#line 32 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (_tmp0_ != NULL) {
#line 2219 "autosave-manager.c"
Book* _tmp11_ = NULL;
guint _tmp12_ = 0U;
Book* _tmp13_ = NULL;
guint _tmp14_ = 0U;
Book* _tmp15_ = NULL;
guint _tmp16_ = 0U;
Book* _tmp17_ = NULL;
guint _tmp18_ = 0U;
{
gint i = 0;
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
i = 0;
#line 2232 "autosave-manager.c"
{
gboolean _tmp1_ = FALSE;
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = TRUE;
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
while (TRUE) {
#line 2239 "autosave-manager.c"
gint _tmp3_ = 0;
Book* _tmp4_ = NULL;
guint _tmp5_ = 0U;
guint _tmp6_ = 0U;
Page* page = NULL;
Book* _tmp7_ = NULL;
gint _tmp8_ = 0;
Page* _tmp9_ = NULL;
Page* _tmp10_ = NULL;
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!_tmp1_) {
#line 2251 "autosave-manager.c"
gint _tmp2_ = 0;
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = i;
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
i = _tmp2_ + 1;
#line 2257 "autosave-manager.c"
}
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = FALSE;
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = i;
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = self->priv->book_;
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = book_get_n_pages (_tmp4_);
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp6_ = _tmp5_;
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!(((guint) _tmp3_) < _tmp6_)) {
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 2273 "autosave-manager.c"
}
#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp7_ = self->priv->book_;
#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp8_ = i;
#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp9_ = book_get_page (_tmp7_, _tmp8_);
#line 36 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page = _tmp9_;
#line 37 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp10_ = page;
#line 37 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_page_removed (self, _tmp10_);
#line 34 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_page_unref0 (page);
#line 2289 "autosave-manager.c"
}
}
}
#line 39 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp11_ = self->priv->book_;
#line 39 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_parse_name ("page-added", TYPE_BOOK, &_tmp12_, NULL, FALSE);
#line 39 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_handlers_disconnect_matched (_tmp11_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp12_, 0, NULL, (GCallback) _autosave_manager_on_page_added_book_page_added, self);
#line 40 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp13_ = self->priv->book_;
#line 40 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_parse_name ("page-removed", TYPE_BOOK, &_tmp14_, NULL, FALSE);
#line 40 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_handlers_disconnect_matched (_tmp13_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp14_, 0, NULL, (GCallback) _autosave_manager_on_page_removed_book_page_removed, self);
#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp15_ = self->priv->book_;
#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_parse_name ("reordered", TYPE_BOOK, &_tmp16_, NULL, FALSE);
#line 41 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_handlers_disconnect_matched (_tmp15_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp16_, 0, NULL, (GCallback) _autosave_manager_on_changed_book_reordered, self);
#line 42 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp17_ = self->priv->book_;
#line 42 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_parse_name ("cleared", TYPE_BOOK, &_tmp18_, NULL, FALSE);
#line 42 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_handlers_disconnect_matched (_tmp17_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp18_, 0, NULL, (GCallback) _autosave_manager_on_cleared_book_cleared, self);
#line 2317 "autosave-manager.c"
}
#line 44 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp19_ = value;
#line 44 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp20_ = _book_ref0 (_tmp19_);
#line 44 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_book_unref0 (self->priv->book_);
#line 44 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv->book_ = _tmp20_;
#line 45 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp21_ = self->priv->book_;
#line 45 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_connect (_tmp21_, "page-added", (GCallback) _autosave_manager_on_page_added_book_page_added, self);
#line 46 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp22_ = self->priv->book_;
#line 46 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_connect (_tmp22_, "page-removed", (GCallback) _autosave_manager_on_page_removed_book_page_removed, self);
#line 47 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp23_ = self->priv->book_;
#line 47 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_connect (_tmp23_, "reordered", (GCallback) _autosave_manager_on_changed_book_reordered, self);
#line 48 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp24_ = self->priv->book_;
#line 48 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_connect (_tmp24_, "cleared", (GCallback) _autosave_manager_on_cleared_book_cleared, self);
#line 2343 "autosave-manager.c"
{
gint i = 0;
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
i = 0;
#line 2348 "autosave-manager.c"
{
gboolean _tmp25_ = FALSE;
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp25_ = TRUE;
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
while (TRUE) {
#line 2355 "autosave-manager.c"
gint _tmp27_ = 0;
Book* _tmp28_ = NULL;
guint _tmp29_ = 0U;
guint _tmp30_ = 0U;
Page* page = NULL;
Book* _tmp31_ = NULL;
gint _tmp32_ = 0;
Page* _tmp33_ = NULL;
Page* _tmp34_ = NULL;
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!_tmp25_) {
#line 2367 "autosave-manager.c"
gint _tmp26_ = 0;
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp26_ = i;
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
i = _tmp26_ + 1;
#line 2373 "autosave-manager.c"
}
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp25_ = FALSE;
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp27_ = i;
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp28_ = self->priv->book_;
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp29_ = book_get_n_pages (_tmp28_);
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp30_ = _tmp29_;
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!(((guint) _tmp27_) < _tmp30_)) {
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
break;
#line 2389 "autosave-manager.c"
}
#line 51 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp31_ = self->priv->book_;
#line 51 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp32_ = i;
#line 51 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp33_ = book_get_page (_tmp31_, _tmp32_);
#line 51 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
page = _tmp33_;
#line 52 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp34_ = page;
#line 52 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_on_page_added (self, _tmp34_);
#line 49 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_page_unref0 (page);
#line 2405 "autosave-manager.c"
}
}
}
}
static void value_autosave_manager_init (GValue* value) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = NULL;
#line 2415 "autosave-manager.c"
}
static void value_autosave_manager_free_value (GValue* value) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (value->data[0].v_pointer) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_unref (value->data[0].v_pointer);
#line 2424 "autosave-manager.c"
}
}
static void value_autosave_manager_copy_value (const GValue* src_value, GValue* dest_value) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (src_value->data[0].v_pointer) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
dest_value->data[0].v_pointer = autosave_manager_ref (src_value->data[0].v_pointer);
#line 2434 "autosave-manager.c"
} else {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
dest_value->data[0].v_pointer = NULL;
#line 2438 "autosave-manager.c"
}
}
static gpointer value_autosave_manager_peek_pointer (const GValue* value) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return value->data[0].v_pointer;
#line 2446 "autosave-manager.c"
}
static gchar* value_autosave_manager_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (collect_values[0].v_pointer) {
#line 2453 "autosave-manager.c"
AutosaveManager* object;
object = collect_values[0].v_pointer;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (object->parent_instance.g_class == NULL) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 2460 "autosave-manager.c"
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.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 2464 "autosave-manager.c"
}
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = autosave_manager_ref (object);
#line 2468 "autosave-manager.c"
} else {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = NULL;
#line 2472 "autosave-manager.c"
}
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return NULL;
#line 2476 "autosave-manager.c"
}
static gchar* value_autosave_manager_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
AutosaveManager** object_p;
object_p = collect_values[0].v_pointer;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!object_p) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 2487 "autosave-manager.c"
}
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (!value->data[0].v_pointer) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
*object_p = NULL;
#line 2493 "autosave-manager.c"
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
*object_p = value->data[0].v_pointer;
#line 2497 "autosave-manager.c"
} else {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
*object_p = autosave_manager_ref (value->data[0].v_pointer);
#line 2501 "autosave-manager.c"
}
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return NULL;
#line 2505 "autosave-manager.c"
}
GParamSpec* param_spec_autosave_manager (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
ParamSpecAutosaveManager* spec;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (g_type_is_a (object_type, TYPE_AUTOSAVE_MANAGER), NULL);
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
G_PARAM_SPEC (spec)->value_type = object_type;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return G_PARAM_SPEC (spec);
#line 2519 "autosave-manager.c"
}
gpointer value_get_autosave_manager (const GValue* value) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_AUTOSAVE_MANAGER), NULL);
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return value->data[0].v_pointer;
#line 2528 "autosave-manager.c"
}
void value_set_autosave_manager (GValue* value, gpointer v_object) {
AutosaveManager* old;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_AUTOSAVE_MANAGER));
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
old = value->data[0].v_pointer;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (v_object) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_AUTOSAVE_MANAGER));
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = v_object;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_ref (value->data[0].v_pointer);
#line 2548 "autosave-manager.c"
} else {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = NULL;
#line 2552 "autosave-manager.c"
}
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (old) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_unref (old);
#line 2558 "autosave-manager.c"
}
}
void value_take_autosave_manager (GValue* value, gpointer v_object) {
AutosaveManager* old;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_AUTOSAVE_MANAGER));
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
old = value->data[0].v_pointer;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (v_object) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_AUTOSAVE_MANAGER));
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = v_object;
#line 2577 "autosave-manager.c"
} else {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
value->data[0].v_pointer = NULL;
#line 2581 "autosave-manager.c"
}
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (old) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_unref (old);
#line 2587 "autosave-manager.c"
}
}
static void autosave_manager_class_init (AutosaveManagerClass * klass) {
const gchar* _tmp0_ = NULL;
gchar* _tmp1_ = NULL;
gchar* _tmp2_ = NULL;
const gchar* _tmp3_ = NULL;
const gchar* _tmp4_ = NULL;
gchar* _tmp5_ = NULL;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_parent_class = g_type_class_peek_parent (klass);
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
((AutosaveManagerClass *) klass)->finalize = autosave_manager_finalize;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_type_class_add_private (klass, sizeof (AutosaveManagerPrivate));
#line 15 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp0_ = g_get_user_cache_dir ();
#line 15 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp1_ = g_build_filename (_tmp0_, "simple-scan", "autosaves", NULL);
#line 15 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_AUTOSAVE_DIR = _tmp1_;
#line 16 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp2_ = g_strdup ("autosave.book");
#line 16 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_AUTOSAVE_FILENAME = _tmp2_;
#line 17 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp3_ = autosave_manager_AUTOSAVE_DIR;
#line 17 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp4_ = autosave_manager_AUTOSAVE_FILENAME;
#line 17 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_tmp5_ = g_build_filename (_tmp3_, _tmp4_, NULL);
#line 17 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
autosave_manager_AUTOSAVE_PATH = _tmp5_;
#line 2623 "autosave-manager.c"
}
static void autosave_manager_instance_init (AutosaveManager * self) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv = AUTOSAVE_MANAGER_GET_PRIVATE (self);
#line 19 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv->update_timeout = (guint) 0;
#line 23 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->priv->book_ = NULL;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self->ref_count = 1;
#line 2636 "autosave-manager.c"
}
static void autosave_manager_finalize (AutosaveManager* obj) {
AutosaveManager * self;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_AUTOSAVE_MANAGER, AutosaveManager);
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_signal_handlers_destroy (self);
#line 21 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_g_hash_table_unref0 (self->priv->page_filenames);
#line 23 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
_book_unref0 (self->priv->book_);
#line 2650 "autosave-manager.c"
}
GType autosave_manager_get_type (void) {
static volatile gsize autosave_manager_type_id__volatile = 0;
if (g_once_init_enter (&autosave_manager_type_id__volatile)) {
static const GTypeValueTable g_define_type_value_table = { value_autosave_manager_init, value_autosave_manager_free_value, value_autosave_manager_copy_value, value_autosave_manager_peek_pointer, "p", value_autosave_manager_collect_value, "p", value_autosave_manager_lcopy_value };
static const GTypeInfo g_define_type_info = { sizeof (AutosaveManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) autosave_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AutosaveManager), 0, (GInstanceInitFunc) autosave_manager_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 autosave_manager_type_id;
autosave_manager_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AutosaveManager", &g_define_type_info, &g_define_type_fundamental_info, 0);
g_once_init_leave (&autosave_manager_type_id__volatile, autosave_manager_type_id);
}
return autosave_manager_type_id__volatile;
}
gpointer autosave_manager_ref (gpointer instance) {
AutosaveManager* self;
self = instance;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_atomic_int_inc (&self->ref_count);
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
return instance;
#line 2675 "autosave-manager.c"
}
void autosave_manager_unref (gpointer instance) {
AutosaveManager* self;
self = instance;
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
if (g_atomic_int_dec_and_test (&self->ref_count)) {
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
AUTOSAVE_MANAGER_GET_CLASS (self)->finalize (self);
#line 13 "/home/bob/bzr/simple-scan/trunk/src/autosave-manager.vala"
g_type_free_instance ((GTypeInstance *) self);
#line 2688 "autosave-manager.c"
}
}
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
if ((array != NULL) && (destroy_func != NULL)) {
int i;
for (i = 0; i < array_length; i = i + 1) {
if (((gpointer*) array)[i] != NULL) {
destroy_func (((gpointer*) array)[i]);
}
}
}
}
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
_vala_array_destroy (array, array_length, destroy_func);
g_free (array);
}
static gint _vala_array_length (gpointer array) {
int length;
length = 0;
if (array) {
while (((gpointer*) array)[length]) {
length++;
}
}
return length;
}
|