~ubuntu-branches/debian/wheezy/cheese/wheezy

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
/* cheese-preferences.c generated by valac 0.16.0, the Vala compiler
 * generated from cheese-preferences.vala, do not modify */

/*
 * Copyright © 2010 Yuvaraj Pandian T <yuvipanda@yuvi.in>
 * Copyright © 2010 daniel g. siegel <dgsiegel@gnome.org>
 * Copyright © 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
 *
 * Licensed under the GNU General Public License Version 2
 *
 * 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 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <cheese-camera.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <cheese-fileutil.h>
#include <cheese-config.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <cheese-camera-device.h>
#include <gdk/gdk.h>


#define CHEESE_TYPE_PREFERENCES_DIALOG (cheese_preferences_dialog_get_type ())
#define CHEESE_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_PREFERENCES_DIALOG, CheesePreferencesDialog))
#define CHEESE_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_PREFERENCES_DIALOG, CheesePreferencesDialogClass))
#define CHEESE_IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_PREFERENCES_DIALOG))
#define CHEESE_IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_PREFERENCES_DIALOG))
#define CHEESE_PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_PREFERENCES_DIALOG, CheesePreferencesDialogClass))

typedef struct _CheesePreferencesDialog CheesePreferencesDialog;
typedef struct _CheesePreferencesDialogClass CheesePreferencesDialogClass;
typedef struct _CheesePreferencesDialogPrivate CheesePreferencesDialogPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block1Data Block1Data;
typedef struct _Block2Data Block2Data;

struct _CheesePreferencesDialog {
	GObject parent_instance;
	CheesePreferencesDialogPrivate * priv;
};

struct _CheesePreferencesDialogClass {
	GObjectClass parent_class;
};

struct _CheesePreferencesDialogPrivate {
	CheeseCamera* camera;
	GSettings* settings;
	GtkDialog* dialog;
	GtkComboBox* photo_resolution_combo;
	GtkComboBox* video_resolution_combo;
	GtkComboBox* source_combo;
	GtkListStore* camera_model;
	GtkAdjustment* brightness_adjustment;
	GtkAdjustment* contrast_adjustment;
	GtkAdjustment* hue_adjustment;
	GtkAdjustment* saturation_adjustment;
	GtkScale* brightness_scale;
	GtkScale* contrast_scale;
	GtkScale* hue_scale;
	GtkScale* saturation_scale;
	GtkSpinButton* burst_repeat_spin;
	GtkSpinButton* burst_delay_spin;
	GtkCheckButton* countdown_check;
	GtkCheckButton* flash_check;
	CheeseMediaMode current_mode;
};

struct _Block1Data {
	int _ref_count_;
	CheesePreferencesDialog * self;
	GtkListStore* resolution_model;
};

struct _Block2Data {
	int _ref_count_;
	CheesePreferencesDialog * self;
	GtkTreeIter iter;
	CheeseCameraDevice* active_device;
	gboolean device_removed;
};


static gpointer cheese_preferences_dialog_parent_class = NULL;

GType cheese_preferences_dialog_get_type (void) G_GNUC_CONST;
#define CHEESE_PREFERENCES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_PREFERENCES_DIALOG, CheesePreferencesDialogPrivate))
enum  {
	CHEESE_PREFERENCES_DIALOG_DUMMY_PROPERTY
};
CheesePreferencesDialog* cheese_preferences_dialog_new (CheeseCamera* camera, GSettings* settings);
CheesePreferencesDialog* cheese_preferences_dialog_construct (GType object_type, CheeseCamera* camera, GSettings* settings);
static void cheese_preferences_dialog_setup_combo_box_models (CheesePreferencesDialog* self);
static void cheese_preferences_dialog_initialize_camera_devices (CheesePreferencesDialog* self);
static void cheese_preferences_dialog_initialize_values_from_settings (CheesePreferencesDialog* self);
static void cheese_preferences_dialog_on_camera_update_num_camera_devices (CheesePreferencesDialog* self);
static void _cheese_preferences_dialog_on_camera_update_num_camera_devices_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void cheese_preferences_dialog_add_camera_device (CheesePreferencesDialog* self, void* device);
static void _cheese_preferences_dialog_add_camera_device_gfunc (gconstpointer data, gpointer self);
static void cheese_preferences_dialog_setup_resolutions_for_device (CheesePreferencesDialog* self, CheeseCameraDevice* device);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void __lambda2_ (Block1Data* _data1_, CheeseVideoFormat* format);
static void ___lambda2__gfunc (gconstpointer data, gpointer self);
void cheese_preferences_dialog_on_source_change (GtkComboBox* combo, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_photo_resolution_change (GtkComboBox* combo, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_video_resolution_change (GtkComboBox* combo, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_delete (GtkDialog* dialog, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_dialog_close (GtkButton* button, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_dialog_help (GtkButton* button, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_countdown_toggle (GtkCheckButton* checkbutton, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_flash_toggle (GtkCheckButton* checkbutton, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_burst_repeat_change (GtkSpinButton* spinbutton, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_burst_delay_change (GtkSpinButton* spinbutton, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_brightness_change (GtkAdjustment* adjustment, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_contrast_change (GtkAdjustment* adjustment, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_hue_change (GtkAdjustment* adjustment, CheesePreferencesDialog* self);
void cheese_preferences_dialog_on_saturation_change (GtkAdjustment* adjustment, CheesePreferencesDialog* self);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void ___lambda3_ (Block2Data* _data2_, void* device);
static void cheese_preferences_dialog_remove_camera_device (CheesePreferencesDialog* self, GtkTreeIter* iter, CheeseCameraDevice* device_node, CheeseCameraDevice* active_device_node);
static void ____lambda3__gfunc (gconstpointer data, gpointer self);
static void cheese_preferences_dialog_set_new_available_camera_device (CheesePreferencesDialog* self, GtkTreeIter* iter);
void cheese_preferences_dialog_show (CheesePreferencesDialog* self);
void cheese_preferences_dialog_set_current_mode (CheesePreferencesDialog* self, CheeseMediaMode mode);
static void cheese_preferences_dialog_finalize (GObject* obj);


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void _cheese_preferences_dialog_on_camera_update_num_camera_devices_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	cheese_preferences_dialog_on_camera_update_num_camera_devices (self);
}


CheesePreferencesDialog* cheese_preferences_dialog_construct (GType object_type, CheeseCamera* camera, GSettings* settings) {
	CheesePreferencesDialog * self = NULL;
	CheeseCamera* _tmp0_;
	CheeseCamera* _tmp1_;
	GSettings* _tmp2_;
	GSettings* _tmp3_;
	GtkBuilder* _tmp4_;
	GtkBuilder* builder;
	GObject* _tmp8_ = NULL;
	GtkDialog* _tmp9_;
	GObject* _tmp10_ = NULL;
	GtkAdjustment* _tmp11_;
	GObject* _tmp12_ = NULL;
	GtkAdjustment* _tmp13_;
	GObject* _tmp14_ = NULL;
	GtkAdjustment* _tmp15_;
	GObject* _tmp16_ = NULL;
	GtkAdjustment* _tmp17_;
	GObject* _tmp18_ = NULL;
	GtkScale* _tmp19_;
	GObject* _tmp20_ = NULL;
	GtkScale* _tmp21_;
	GObject* _tmp22_ = NULL;
	GtkScale* _tmp23_;
	GObject* _tmp24_ = NULL;
	GtkScale* _tmp25_;
	GtkScale* _tmp26_;
	GtkScale* _tmp27_;
	GtkScale* _tmp28_;
	GtkScale* _tmp29_;
	GObject* _tmp30_ = NULL;
	GtkComboBox* _tmp31_;
	GObject* _tmp32_ = NULL;
	GtkComboBox* _tmp33_;
	GObject* _tmp34_ = NULL;
	GtkComboBox* _tmp35_;
	GObject* _tmp36_ = NULL;
	GtkSpinButton* _tmp37_;
	GObject* _tmp38_ = NULL;
	GtkSpinButton* _tmp39_;
	GObject* _tmp40_ = NULL;
	GtkCheckButton* _tmp41_;
	GObject* _tmp42_ = NULL;
	GtkCheckButton* _tmp43_;
	CheeseCamera* _tmp44_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (camera != NULL, NULL);
	g_return_val_if_fail (settings != NULL, NULL);
	self = (CheesePreferencesDialog*) g_object_new (object_type, NULL);
	_tmp0_ = camera;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->camera);
	self->priv->camera = _tmp1_;
	_tmp2_ = settings;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp3_;
	_tmp4_ = gtk_builder_new ();
	builder = _tmp4_;
	{
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_;
		_tmp5_ = g_build_filename (PACKAGE_DATADIR, "cheese-prefs.ui", NULL);
		_tmp6_ = _tmp5_;
		gtk_builder_add_from_file (builder, _tmp6_, &_inner_error_);
		_g_free0 (_tmp6_);
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		const gchar* _tmp7_;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp7_ = err->message;
		g_error ("cheese-preferences.vala:69: Error: %s", _tmp7_);
		_g_error_free0 (err);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (builder);
		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);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	_tmp8_ = gtk_builder_get_object (builder, "cheese_prefs_dialog");
	_tmp9_ = _g_object_ref0 (GTK_IS_DIALOG (_tmp8_) ? ((GtkDialog*) _tmp8_) : NULL);
	_g_object_unref0 (self->priv->dialog);
	self->priv->dialog = _tmp9_;
	_tmp10_ = gtk_builder_get_object (builder, "brightness_adjustment");
	_tmp11_ = _g_object_ref0 (GTK_IS_ADJUSTMENT (_tmp10_) ? ((GtkAdjustment*) _tmp10_) : NULL);
	_g_object_unref0 (self->priv->brightness_adjustment);
	self->priv->brightness_adjustment = _tmp11_;
	_tmp12_ = gtk_builder_get_object (builder, "contrast_adjustment");
	_tmp13_ = _g_object_ref0 (GTK_IS_ADJUSTMENT (GTK_IS_ADJUSTMENT (GTK_IS_ADJUSTMENT (GTK_IS_ADJUSTMENT (_tmp12_) ? ((GtkAdjustment*) _tmp12_) : NULL) ? ((GtkAdjustment*) (GTK_IS_ADJUSTMENT (_tmp12_) ? ((GtkAdjustment*) _tmp12_) : NULL)) : NULL) ? ((GtkAdjustment*) (GTK_IS_ADJUSTMENT (GTK_IS_ADJUSTMENT (_tmp12_) ? ((GtkAdjustment*) _tmp12_) : NULL) ? ((GtkAdjustment*) (GTK_IS_ADJUSTMENT (_tmp12_) ? ((GtkAdjustment*) _tmp12_) : NULL)) : NULL)) : NULL) ? ((GtkAdjustment*) (GTK_IS_ADJUSTMENT (GTK_IS_ADJUSTMENT (GTK_IS_ADJUSTMENT (_tmp12_) ? ((GtkAdjustment*) _tmp12_) : NULL) ? ((GtkAdjustment*) (GTK_IS_ADJUSTMENT (_tmp12_) ? ((GtkAdjustment*) _tmp12_) : NULL)) : NULL) ? ((GtkAdjustment*) (GTK_IS_ADJUSTMENT (GTK_IS_ADJUSTMENT (_tmp12_) ? ((GtkAdjustment*) _tmp12_) : NULL) ? ((GtkAdjustment*) (GTK_IS_ADJUSTMENT (_tmp12_) ? ((GtkAdjustment*) _tmp12_) : NULL)) : NULL)) : NULL)) : NULL);
	_g_object_unref0 (self->priv->contrast_adjustment);
	self->priv->contrast_adjustment = _tmp13_;
	_tmp14_ = gtk_builder_get_object (builder, "hue_adjustment");
	_tmp15_ = _g_object_ref0 (GTK_IS_ADJUSTMENT (_tmp14_) ? ((GtkAdjustment*) _tmp14_) : NULL);
	_g_object_unref0 (self->priv->hue_adjustment);
	self->priv->hue_adjustment = _tmp15_;
	_tmp16_ = gtk_builder_get_object (builder, "saturation_adjustment");
	_tmp17_ = _g_object_ref0 (GTK_IS_ADJUSTMENT (_tmp16_) ? ((GtkAdjustment*) _tmp16_) : NULL);
	_g_object_unref0 (self->priv->saturation_adjustment);
	self->priv->saturation_adjustment = _tmp17_;
	_tmp18_ = gtk_builder_get_object (builder, "brightness_scale");
	_tmp19_ = _g_object_ref0 (GTK_IS_SCALE (_tmp18_) ? ((GtkScale*) _tmp18_) : NULL);
	_g_object_unref0 (self->priv->brightness_scale);
	self->priv->brightness_scale = _tmp19_;
	_tmp20_ = gtk_builder_get_object (builder, "contrast_scale");
	_tmp21_ = _g_object_ref0 (GTK_IS_SCALE (_tmp20_) ? ((GtkScale*) _tmp20_) : NULL);
	_g_object_unref0 (self->priv->contrast_scale);
	self->priv->contrast_scale = _tmp21_;
	_tmp22_ = gtk_builder_get_object (builder, "hue_scale");
	_tmp23_ = _g_object_ref0 (GTK_IS_SCALE (_tmp22_) ? ((GtkScale*) _tmp22_) : NULL);
	_g_object_unref0 (self->priv->hue_scale);
	self->priv->hue_scale = _tmp23_;
	_tmp24_ = gtk_builder_get_object (builder, "saturation_scale");
	_tmp25_ = _g_object_ref0 (GTK_IS_SCALE (_tmp24_) ? ((GtkScale*) _tmp24_) : NULL);
	_g_object_unref0 (self->priv->saturation_scale);
	self->priv->saturation_scale = _tmp25_;
	_tmp26_ = self->priv->brightness_scale;
	gtk_scale_add_mark (_tmp26_, (gdouble) 0, GTK_POS_BOTTOM, NULL);
	_tmp27_ = self->priv->contrast_scale;
	gtk_scale_add_mark (_tmp27_, (gdouble) 1, GTK_POS_BOTTOM, NULL);
	_tmp28_ = self->priv->hue_scale;
	gtk_scale_add_mark (_tmp28_, (gdouble) 0, GTK_POS_BOTTOM, NULL);
	_tmp29_ = self->priv->saturation_scale;
	gtk_scale_add_mark (_tmp29_, (gdouble) 1, GTK_POS_BOTTOM, NULL);
	_tmp30_ = gtk_builder_get_object (builder, "photo_resolution_combo_box");
	_tmp31_ = _g_object_ref0 (GTK_IS_COMBO_BOX (_tmp30_) ? ((GtkComboBox*) _tmp30_) : NULL);
	_g_object_unref0 (self->priv->photo_resolution_combo);
	self->priv->photo_resolution_combo = _tmp31_;
	_tmp32_ = gtk_builder_get_object (builder, "video_resolution_combo_box");
	_tmp33_ = _g_object_ref0 (GTK_IS_COMBO_BOX (_tmp32_) ? ((GtkComboBox*) _tmp32_) : NULL);
	_g_object_unref0 (self->priv->video_resolution_combo);
	self->priv->video_resolution_combo = _tmp33_;
	_tmp34_ = gtk_builder_get_object (builder, "camera_combo_box");
	_tmp35_ = _g_object_ref0 (GTK_IS_COMBO_BOX (_tmp34_) ? ((GtkComboBox*) _tmp34_) : NULL);
	_g_object_unref0 (self->priv->source_combo);
	self->priv->source_combo = _tmp35_;
	_tmp36_ = gtk_builder_get_object (builder, "burst_repeat");
	_tmp37_ = _g_object_ref0 (GTK_IS_SPIN_BUTTON (_tmp36_) ? ((GtkSpinButton*) _tmp36_) : NULL);
	_g_object_unref0 (self->priv->burst_repeat_spin);
	self->priv->burst_repeat_spin = _tmp37_;
	_tmp38_ = gtk_builder_get_object (builder, "burst_delay");
	_tmp39_ = _g_object_ref0 (GTK_IS_SPIN_BUTTON (_tmp38_) ? ((GtkSpinButton*) _tmp38_) : NULL);
	_g_object_unref0 (self->priv->burst_delay_spin);
	self->priv->burst_delay_spin = _tmp39_;
	_tmp40_ = gtk_builder_get_object (builder, "countdown");
	_tmp41_ = _g_object_ref0 (GTK_IS_CHECK_BUTTON (_tmp40_) ? ((GtkCheckButton*) _tmp40_) : NULL);
	_g_object_unref0 (self->priv->countdown_check);
	self->priv->countdown_check = _tmp41_;
	_tmp42_ = gtk_builder_get_object (builder, "flash");
	_tmp43_ = _g_object_ref0 (GTK_IS_CHECK_BUTTON (_tmp42_) ? ((GtkCheckButton*) _tmp42_) : NULL);
	_g_object_unref0 (self->priv->flash_check);
	self->priv->flash_check = _tmp43_;
	cheese_preferences_dialog_setup_combo_box_models (self);
	cheese_preferences_dialog_initialize_camera_devices (self);
	cheese_preferences_dialog_initialize_values_from_settings (self);
	gtk_builder_connect_signals (builder, self);
	_tmp44_ = camera;
	g_signal_connect_object ((GObject*) _tmp44_, "notify::num-camera-devices", (GCallback) _cheese_preferences_dialog_on_camera_update_num_camera_devices_g_object_notify, self, 0);
	_g_object_unref0 (builder);
	return self;
}


CheesePreferencesDialog* cheese_preferences_dialog_new (CheeseCamera* camera, GSettings* settings) {
	return cheese_preferences_dialog_construct (CHEESE_TYPE_PREFERENCES_DIALOG, camera, settings);
}


/**
   * Set up combo box cell renderers.
   */
static void cheese_preferences_dialog_setup_combo_box_models (CheesePreferencesDialog* self) {
	GtkCellRendererText* _tmp0_;
	GtkCellRendererText* _tmp1_;
	GtkCellRendererText* cell;
	GtkComboBox* _tmp2_;
	GtkComboBox* _tmp3_;
	GtkComboBox* _tmp4_;
	GtkComboBox* _tmp5_;
	GtkComboBox* _tmp6_;
	GtkComboBox* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	_tmp1_ = g_object_ref_sink (_tmp0_);
	cell = _tmp1_;
	_tmp2_ = self->priv->photo_resolution_combo;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp2_, (GtkCellRenderer*) cell, FALSE);
	_tmp3_ = self->priv->photo_resolution_combo;
	gtk_cell_layout_set_attributes ((GtkCellLayout*) _tmp3_, (GtkCellRenderer*) cell, "text", 0, NULL);
	_tmp4_ = self->priv->video_resolution_combo;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp4_, (GtkCellRenderer*) cell, FALSE);
	_tmp5_ = self->priv->video_resolution_combo;
	gtk_cell_layout_set_attributes ((GtkCellLayout*) _tmp5_, (GtkCellRenderer*) cell, "text", 0, NULL);
	_tmp6_ = self->priv->source_combo;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp6_, (GtkCellRenderer*) cell, FALSE);
	_tmp7_ = self->priv->source_combo;
	gtk_cell_layout_set_attributes ((GtkCellLayout*) _tmp7_, (GtkCellRenderer*) cell, "text", 0, NULL);
	_g_object_unref0 (cell);
}


/**
   * Initialize and populate the camera device combo box model.
   */
static void _cheese_preferences_dialog_add_camera_device_gfunc (gconstpointer data, gpointer self) {
	cheese_preferences_dialog_add_camera_device (self, data);
}


static void cheese_preferences_dialog_initialize_camera_devices (CheesePreferencesDialog* self) {
	CheeseCamera* _tmp0_;
	GPtrArray* _tmp1_ = NULL;
	GPtrArray* devices;
	GtkListStore* _tmp2_;
	GtkComboBox* _tmp3_;
	GtkListStore* _tmp4_;
	GPtrArray* _tmp5_;
	guint _tmp6_;
	GPtrArray* _tmp8_;
	GSettings* _tmp9_;
	CheeseCamera* _tmp10_;
	CheeseCameraDevice* _tmp11_ = NULL;
	const gchar* _tmp12_ = NULL;
	CheeseCamera* _tmp13_;
	CheeseCameraDevice* _tmp14_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->camera;
	_tmp1_ = cheese_camera_get_camera_devices (_tmp0_);
	devices = _tmp1_;
	_tmp2_ = gtk_list_store_new (2, G_TYPE_STRING, CHEESE_TYPE_CAMERA_DEVICE);
	_g_object_unref0 (self->priv->camera_model);
	self->priv->camera_model = _tmp2_;
	_tmp3_ = self->priv->source_combo;
	_tmp4_ = self->priv->camera_model;
	gtk_combo_box_set_model (_tmp3_, (GtkTreeModel*) _tmp4_);
	_tmp5_ = devices;
	_tmp6_ = _tmp5_->len;
	if (_tmp6_ <= ((guint) 1)) {
		GtkComboBox* _tmp7_;
		_tmp7_ = self->priv->source_combo;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp7_, FALSE);
	}
	_tmp8_ = devices;
	g_ptr_array_foreach (_tmp8_, _cheese_preferences_dialog_add_camera_device_gfunc, self);
	_tmp9_ = self->priv->settings;
	_tmp10_ = self->priv->camera;
	_tmp11_ = cheese_camera_get_selected_device (_tmp10_);
	_tmp12_ = cheese_camera_device_get_device_node (_tmp11_);
	g_settings_set_string (_tmp9_, "camera", _tmp12_);
	_tmp13_ = self->priv->camera;
	_tmp14_ = cheese_camera_get_selected_device (_tmp13_);
	cheese_preferences_dialog_setup_resolutions_for_device (self, _tmp14_);
}


/**
   * Initialize and populate the resolution combo box models for the device.
   *
   * @param device the Cheese.CameraDevice for which to enumerate resolutions
   */
static Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (void * _userdata_) {
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		CheesePreferencesDialog * self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->resolution_model);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}


static void __lambda2_ (Block1Data* _data1_, CheeseVideoFormat* format) {
	CheesePreferencesDialog * self;
	GtkTreeIter iter = {0};
	GtkListStore* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	GtkListStore* _tmp2_;
	GtkTreeIter _tmp3_;
	CheeseVideoFormat* _tmp4_;
	gint _tmp5_;
	gchar* _tmp6_ = NULL;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	CheeseVideoFormat* _tmp10_;
	gint _tmp11_;
	gchar* _tmp12_ = NULL;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	CheeseVideoFormat* _tmp16_;
	gboolean _tmp17_ = FALSE;
	CheeseCamera* _tmp18_;
	CheeseVideoFormat* _tmp19_ = NULL;
	gint _tmp20_;
	CheeseVideoFormat* _tmp21_;
	gint _tmp22_;
	gboolean _tmp28_;
	gboolean _tmp37_ = FALSE;
	GSettings* _tmp38_;
	gint _tmp39_ = 0;
	CheeseVideoFormat* _tmp40_;
	gint _tmp41_;
	gboolean _tmp46_;
	self = _data1_->self;
	g_return_if_fail (format != NULL);
	_tmp0_ = _data1_->resolution_model;
	gtk_list_store_append (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = _data1_->resolution_model;
	_tmp3_ = iter;
	_tmp4_ = format;
	_tmp5_ = _tmp4_->width;
	_tmp6_ = g_strdup_printf ("%i", _tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strconcat (_tmp7_, " × ", NULL);
	_tmp9_ = _tmp8_;
	_tmp10_ = format;
	_tmp11_ = _tmp10_->height;
	_tmp12_ = g_strdup_printf ("%i", _tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strconcat (_tmp9_, _tmp13_, NULL);
	_tmp15_ = _tmp14_;
	_tmp16_ = format;
	gtk_list_store_set (_tmp2_, &_tmp3_, 0, _tmp15_, 1, _tmp16_, -1);
	_g_free0 (_tmp15_);
	_g_free0 (_tmp13_);
	_g_free0 (_tmp9_);
	_g_free0 (_tmp7_);
	_tmp18_ = self->priv->camera;
	_tmp19_ = cheese_camera_get_current_video_format (_tmp18_);
	_tmp20_ = _tmp19_->width;
	_tmp21_ = format;
	_tmp22_ = _tmp21_->width;
	if (_tmp20_ == _tmp22_) {
		CheeseCamera* _tmp23_;
		CheeseVideoFormat* _tmp24_ = NULL;
		gint _tmp25_;
		CheeseVideoFormat* _tmp26_;
		gint _tmp27_;
		_tmp23_ = self->priv->camera;
		_tmp24_ = cheese_camera_get_current_video_format (_tmp23_);
		_tmp25_ = _tmp24_->height;
		_tmp26_ = format;
		_tmp27_ = _tmp26_->height;
		_tmp17_ = _tmp25_ == _tmp27_;
	} else {
		_tmp17_ = FALSE;
	}
	_tmp28_ = _tmp17_;
	if (_tmp28_) {
		GtkComboBox* _tmp29_;
		GtkTreeIter _tmp30_;
		GSettings* _tmp31_;
		CheeseVideoFormat* _tmp32_;
		gint _tmp33_;
		GSettings* _tmp34_;
		CheeseVideoFormat* _tmp35_;
		gint _tmp36_;
		_tmp29_ = self->priv->photo_resolution_combo;
		_tmp30_ = iter;
		gtk_combo_box_set_active_iter (_tmp29_, &_tmp30_);
		_tmp31_ = self->priv->settings;
		_tmp32_ = format;
		_tmp33_ = _tmp32_->width;
		g_settings_set_int (_tmp31_, "photo-x-resolution", _tmp33_);
		_tmp34_ = self->priv->settings;
		_tmp35_ = format;
		_tmp36_ = _tmp35_->height;
		g_settings_set_int (_tmp34_, "photo-y-resolution", _tmp36_);
	}
	_tmp38_ = self->priv->settings;
	_tmp39_ = g_settings_get_int (_tmp38_, "video-x-resolution");
	_tmp40_ = format;
	_tmp41_ = _tmp40_->width;
	if (_tmp39_ == _tmp41_) {
		GSettings* _tmp42_;
		gint _tmp43_ = 0;
		CheeseVideoFormat* _tmp44_;
		gint _tmp45_;
		_tmp42_ = self->priv->settings;
		_tmp43_ = g_settings_get_int (_tmp42_, "video-y-resolution");
		_tmp44_ = format;
		_tmp45_ = _tmp44_->height;
		_tmp37_ = _tmp43_ == _tmp45_;
	} else {
		_tmp37_ = FALSE;
	}
	_tmp46_ = _tmp37_;
	if (_tmp46_) {
		GtkComboBox* _tmp47_;
		GtkTreeIter _tmp48_;
		_tmp47_ = self->priv->video_resolution_combo;
		_tmp48_ = iter;
		gtk_combo_box_set_active_iter (_tmp47_, &_tmp48_);
	}
}


static void ___lambda2__gfunc (gconstpointer data, gpointer self) {
	__lambda2_ (self, data);
}


static void cheese_preferences_dialog_setup_resolutions_for_device (CheesePreferencesDialog* self, CheeseCameraDevice* device) {
	Block1Data* _data1_;
	CheeseCameraDevice* _tmp0_;
	GList* _tmp1_ = NULL;
	GList* formats;
	GtkListStore* _tmp2_;
	GtkComboBox* _tmp3_;
	GtkListStore* _tmp4_;
	GtkComboBox* _tmp5_;
	GtkListStore* _tmp6_;
	GList* _tmp7_;
	GtkComboBox* _tmp8_;
	gint _tmp9_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (device != NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_tmp0_ = device;
	_tmp1_ = cheese_camera_device_get_format_list (_tmp0_);
	formats = _tmp1_;
	_tmp2_ = gtk_list_store_new (2, G_TYPE_STRING, CHEESE_TYPE_VIDEO_FORMAT);
	_data1_->resolution_model = _tmp2_;
	_tmp3_ = self->priv->photo_resolution_combo;
	_tmp4_ = _data1_->resolution_model;
	gtk_combo_box_set_model (_tmp3_, (GtkTreeModel*) _tmp4_);
	_tmp5_ = self->priv->video_resolution_combo;
	_tmp6_ = _data1_->resolution_model;
	gtk_combo_box_set_model (_tmp5_, (GtkTreeModel*) _tmp6_);
	_tmp7_ = formats;
	g_list_foreach (_tmp7_, ___lambda2__gfunc, _data1_);
	_tmp8_ = self->priv->video_resolution_combo;
	_tmp9_ = gtk_combo_box_get_active (_tmp8_);
	if (_tmp9_ == (-1)) {
		GtkComboBox* _tmp10_;
		GtkComboBox* _tmp11_;
		gint _tmp12_ = 0;
		GSettings* _tmp13_;
		GSettings* _tmp14_;
		gint _tmp15_ = 0;
		GSettings* _tmp16_;
		GSettings* _tmp17_;
		gint _tmp18_ = 0;
		_tmp10_ = self->priv->video_resolution_combo;
		_tmp11_ = self->priv->photo_resolution_combo;
		_tmp12_ = gtk_combo_box_get_active (_tmp11_);
		gtk_combo_box_set_active (_tmp10_, _tmp12_);
		_tmp13_ = self->priv->settings;
		_tmp14_ = self->priv->settings;
		_tmp15_ = g_settings_get_int (_tmp14_, "photo-x-resolution");
		g_settings_set_int (_tmp13_, "video-x-resolution", _tmp15_);
		_tmp16_ = self->priv->settings;
		_tmp17_ = self->priv->settings;
		_tmp18_ = g_settings_get_int (_tmp17_, "photo-y-resolution");
		g_settings_set_int (_tmp16_, "video-y-resolution", _tmp18_);
	}
	block1_data_unref (_data1_);
	_data1_ = NULL;
}


/**
   * Take the user preferences from GSettings.
   */
static void cheese_preferences_dialog_initialize_values_from_settings (CheesePreferencesDialog* self) {
	GtkAdjustment* _tmp0_;
	GSettings* _tmp1_;
	gdouble _tmp2_ = 0.0;
	GtkAdjustment* _tmp3_;
	GSettings* _tmp4_;
	gdouble _tmp5_ = 0.0;
	GtkAdjustment* _tmp6_;
	GSettings* _tmp7_;
	gdouble _tmp8_ = 0.0;
	GtkAdjustment* _tmp9_;
	GSettings* _tmp10_;
	gdouble _tmp11_ = 0.0;
	GtkSpinButton* _tmp12_;
	GSettings* _tmp13_;
	gint _tmp14_ = 0;
	GtkSpinButton* _tmp15_;
	GSettings* _tmp16_;
	gint _tmp17_ = 0;
	GtkCheckButton* _tmp18_;
	GSettings* _tmp19_;
	gboolean _tmp20_ = FALSE;
	GtkCheckButton* _tmp21_;
	GSettings* _tmp22_;
	gboolean _tmp23_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->brightness_adjustment;
	_tmp1_ = self->priv->settings;
	_tmp2_ = g_settings_get_double (_tmp1_, "brightness");
	gtk_adjustment_set_value (_tmp0_, _tmp2_);
	_tmp3_ = self->priv->contrast_adjustment;
	_tmp4_ = self->priv->settings;
	_tmp5_ = g_settings_get_double (_tmp4_, "contrast");
	gtk_adjustment_set_value (_tmp3_, _tmp5_);
	_tmp6_ = self->priv->hue_adjustment;
	_tmp7_ = self->priv->settings;
	_tmp8_ = g_settings_get_double (_tmp7_, "hue");
	gtk_adjustment_set_value (_tmp6_, _tmp8_);
	_tmp9_ = self->priv->saturation_adjustment;
	_tmp10_ = self->priv->settings;
	_tmp11_ = g_settings_get_double (_tmp10_, "saturation");
	gtk_adjustment_set_value (_tmp9_, _tmp11_);
	_tmp12_ = self->priv->burst_repeat_spin;
	_tmp13_ = self->priv->settings;
	_tmp14_ = g_settings_get_int (_tmp13_, "burst-repeat");
	gtk_spin_button_set_value (_tmp12_, (gdouble) _tmp14_);
	_tmp15_ = self->priv->burst_delay_spin;
	_tmp16_ = self->priv->settings;
	_tmp17_ = g_settings_get_int (_tmp16_, "burst-delay");
	gtk_spin_button_set_value (_tmp15_, (gdouble) (_tmp17_ / 1000));
	_tmp18_ = self->priv->countdown_check;
	_tmp19_ = self->priv->settings;
	_tmp20_ = g_settings_get_boolean (_tmp19_, "countdown");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp18_, _tmp20_);
	_tmp21_ = self->priv->flash_check;
	_tmp22_ = self->priv->settings;
	_tmp23_ = g_settings_get_boolean (_tmp22_, "flash");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp21_, _tmp23_);
}


/**
   * Update the active device to the active iter of the device combo box.
   *
   * @param combo the video device combo box
   */
void cheese_preferences_dialog_on_source_change (GtkComboBox* combo, CheesePreferencesDialog* self) {
	CheeseCamera* _tmp0_;
	guint _tmp1_ = 0U;
	guint _tmp2_;
	GtkTreeIter iter = {0};
	CheeseCameraDevice* dev = NULL;
	GtkComboBox* _tmp3_;
	GtkTreeIter _tmp4_ = {0};
	GtkComboBox* _tmp5_;
	GtkTreeModel* _tmp6_;
	GtkTreeModel* _tmp7_;
	GtkTreeIter _tmp8_;
	CheeseCamera* _tmp9_;
	const gchar* _tmp10_ = NULL;
	CheeseCamera* _tmp11_;
	CheeseCamera* _tmp12_;
	CheeseCameraDevice* _tmp13_ = NULL;
	GSettings* _tmp14_;
	const gchar* _tmp15_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp0_ = self->priv->camera;
	g_object_get (_tmp0_, "num-camera-devices", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	g_return_if_fail (_tmp2_ > ((guint) 0));
	_tmp3_ = combo;
	gtk_combo_box_get_active_iter (_tmp3_, &_tmp4_);
	iter = _tmp4_;
	_tmp5_ = combo;
	_tmp6_ = gtk_combo_box_get_model (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = iter;
	gtk_tree_model_get (_tmp7_, &_tmp8_, 1, &dev, -1);
	_tmp9_ = self->priv->camera;
	_tmp10_ = cheese_camera_device_get_device_node (dev);
	cheese_camera_set_device_by_device_node (_tmp9_, _tmp10_);
	_tmp11_ = self->priv->camera;
	cheese_camera_switch_camera_device (_tmp11_);
	_tmp12_ = self->priv->camera;
	_tmp13_ = cheese_camera_get_selected_device (_tmp12_);
	cheese_preferences_dialog_setup_resolutions_for_device (self, _tmp13_);
	_tmp14_ = self->priv->settings;
	_tmp15_ = cheese_camera_device_get_device_node (dev);
	g_settings_set_string (_tmp14_, "camera", _tmp15_);
	_g_object_unref0 (dev);
}


/**
   * Update the current photo capture resolution to the active iter of the
   * photo resolution combo box.
   *
   * @param combo the photo resolution combo box
   */
void cheese_preferences_dialog_on_photo_resolution_change (GtkComboBox* combo, CheesePreferencesDialog* self) {
	GtkTreeIter iter = {0};
	CheeseVideoFormat* format = NULL;
	GtkComboBox* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	GtkComboBox* _tmp2_;
	GtkTreeModel* _tmp3_;
	GtkTreeModel* _tmp4_;
	GtkTreeIter _tmp5_;
	gboolean _tmp6_ = FALSE;
	CheeseMediaMode _tmp7_;
	gboolean _tmp9_;
	GSettings* _tmp12_;
	CheeseVideoFormat* _tmp13_;
	gint _tmp14_;
	GSettings* _tmp15_;
	CheeseVideoFormat* _tmp16_;
	gint _tmp17_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp0_ = combo;
	gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = combo;
	_tmp3_ = gtk_combo_box_get_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = iter;
	gtk_tree_model_get (_tmp4_, &_tmp5_, 1, &format, -1);
	_tmp7_ = self->priv->current_mode;
	if (_tmp7_ == CHEESE_MEDIA_MODE_PHOTO) {
		_tmp6_ = TRUE;
	} else {
		CheeseMediaMode _tmp8_;
		_tmp8_ = self->priv->current_mode;
		_tmp6_ = _tmp8_ == CHEESE_MEDIA_MODE_BURST;
	}
	_tmp9_ = _tmp6_;
	if (_tmp9_) {
		CheeseCamera* _tmp10_;
		CheeseVideoFormat* _tmp11_;
		_tmp10_ = self->priv->camera;
		_tmp11_ = format;
		cheese_camera_set_video_format (_tmp10_, _tmp11_);
	}
	_tmp12_ = self->priv->settings;
	_tmp13_ = format;
	_tmp14_ = _tmp13_->width;
	g_settings_set_int (_tmp12_, "photo-x-resolution", _tmp14_);
	_tmp15_ = self->priv->settings;
	_tmp16_ = format;
	_tmp17_ = _tmp16_->height;
	g_settings_set_int (_tmp15_, "photo-y-resolution", _tmp17_);
}


/**
   * Update the current video capture resolution to the active iter of the
   * video resolution combo box.
   *
   * @param combo the video resolution combo box
   */
void cheese_preferences_dialog_on_video_resolution_change (GtkComboBox* combo, CheesePreferencesDialog* self) {
	GtkTreeIter iter = {0};
	CheeseVideoFormat* format = NULL;
	GtkComboBox* _tmp0_;
	GtkTreeIter _tmp1_ = {0};
	GtkComboBox* _tmp2_;
	GtkTreeModel* _tmp3_;
	GtkTreeModel* _tmp4_;
	GtkTreeIter _tmp5_;
	CheeseMediaMode _tmp6_;
	GSettings* _tmp9_;
	CheeseVideoFormat* _tmp10_;
	gint _tmp11_;
	GSettings* _tmp12_;
	CheeseVideoFormat* _tmp13_;
	gint _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (combo != NULL);
	_tmp0_ = combo;
	gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = combo;
	_tmp3_ = gtk_combo_box_get_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = iter;
	gtk_tree_model_get (_tmp4_, &_tmp5_, 1, &format, -1);
	_tmp6_ = self->priv->current_mode;
	if (_tmp6_ == CHEESE_MEDIA_MODE_VIDEO) {
		CheeseCamera* _tmp7_;
		CheeseVideoFormat* _tmp8_;
		_tmp7_ = self->priv->camera;
		_tmp8_ = format;
		cheese_camera_set_video_format (_tmp7_, _tmp8_);
	}
	_tmp9_ = self->priv->settings;
	_tmp10_ = format;
	_tmp11_ = _tmp10_->width;
	g_settings_set_int (_tmp9_, "video-x-resolution", _tmp11_);
	_tmp12_ = self->priv->settings;
	_tmp13_ = format;
	_tmp14_ = _tmp13_->height;
	g_settings_set_int (_tmp12_, "video-y-resolution", _tmp14_);
}


/**
   * Hide the dialog when it is closed, rather than deleting it.
   *
   * @param dialog the dialog on which the delete event was generated
   */
void cheese_preferences_dialog_on_delete (GtkDialog* dialog, CheesePreferencesDialog* self) {
	GtkDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (dialog != NULL);
	_tmp0_ = dialog;
	gtk_widget_hide_on_delete ((GtkWidget*) _tmp0_);
}


/**
   * Hide the dialog when it is closed, rather than deleting it.
   *
   * @param button the close button
   */
void cheese_preferences_dialog_on_dialog_close (GtkButton* button, CheesePreferencesDialog* self) {
	GtkDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = self->priv->dialog;
	gtk_widget_hide ((GtkWidget*) _tmp0_);
}


/**
   * Show the help for the preferences dialog.
   *
   * @param button the help button
   */
void cheese_preferences_dialog_on_dialog_help (GtkButton* button, CheesePreferencesDialog* self) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	{
		GtkDialog* _tmp0_;
		GdkScreen* _tmp1_ = NULL;
		_tmp0_ = self->priv->dialog;
		_tmp1_ = gtk_window_get_screen ((GtkWindow*) _tmp0_);
		gtk_show_uri (_tmp1_, "help:cheese/index#preferences", (guint32) GDK_CURRENT_TIME, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch1_g_error;
		}
	}
	goto __finally1;
	__catch1_g_error:
	{
		g_clear_error (&_inner_error_);
		_inner_error_ = NULL;
		g_warning ("cheese-preferences.vala:318: %s", "Error showing help");
	}
	__finally1:
	if (_inner_error_ != NULL) {
		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);
		g_clear_error (&_inner_error_);
		return;
	}
}


/**
   * Toggle the countdown GSetting when toggling the check button.
   *
   * @param checkbutton the countdown check button
   */
void cheese_preferences_dialog_on_countdown_toggle (GtkCheckButton* checkbutton, CheesePreferencesDialog* self) {
	GSettings* _tmp0_;
	GtkCheckButton* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (checkbutton != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = checkbutton;
	_tmp2_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp1_);
	_tmp3_ = _tmp2_;
	g_settings_set_boolean (_tmp0_, "countdown", _tmp3_);
}


/**
   * Toggle the flash GSetting when toggling the check button.
   *
   * @param checkbutton the flash check button
   */
void cheese_preferences_dialog_on_flash_toggle (GtkCheckButton* checkbutton, CheesePreferencesDialog* self) {
	GSettings* _tmp0_;
	GtkCheckButton* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (checkbutton != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = checkbutton;
	_tmp2_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp1_);
	_tmp3_ = _tmp2_;
	g_settings_set_boolean (_tmp0_, "flash", _tmp3_);
}


/**
   * Change the burst-repeat GSetting when changing the spin button.
   *
   * The burst repeat is the total number of photos to take in a single burst.
   *
   * @param spinbutton the burst-repeat spin button
   */
void cheese_preferences_dialog_on_burst_repeat_change (GtkSpinButton* spinbutton, CheesePreferencesDialog* self) {
	GSettings* _tmp0_;
	GtkSpinButton* _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (spinbutton != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = spinbutton;
	_tmp2_ = gtk_spin_button_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	g_settings_set_int (_tmp0_, "burst-repeat", (gint) _tmp3_);
}


/**
   * Change the burst-delay GSetting when changing the spin button.
   *
   * The burst delay is the time, in milliseconds, between individual photos in
   * a burst.
   *
   * @param spinbutton the burst-delay spin button
   */
void cheese_preferences_dialog_on_burst_delay_change (GtkSpinButton* spinbutton, CheesePreferencesDialog* self) {
	GSettings* _tmp0_;
	GtkSpinButton* _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (spinbutton != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = spinbutton;
	_tmp2_ = gtk_spin_button_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	g_settings_set_int (_tmp0_, "burst-delay", ((gint) _tmp3_) * 1000);
}


/**
   * Change the brightness of the image, and update the GSetting, when changing
   * the scale.
   *
   * @param adjustment the adjustment of the brightness Gtk.Scale
   */
void cheese_preferences_dialog_on_brightness_change (GtkAdjustment* adjustment, CheesePreferencesDialog* self) {
	CheeseCamera* _tmp0_;
	GtkAdjustment* _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	GSettings* _tmp4_;
	GtkAdjustment* _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (adjustment != NULL);
	_tmp0_ = self->priv->camera;
	_tmp1_ = adjustment;
	_tmp2_ = gtk_adjustment_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	cheese_camera_set_balance_property (_tmp0_, "brightness", _tmp3_);
	_tmp4_ = self->priv->settings;
	_tmp5_ = adjustment;
	_tmp6_ = gtk_adjustment_get_value (_tmp5_);
	_tmp7_ = _tmp6_;
	g_settings_set_double (_tmp4_, "brightness", _tmp7_);
}


/**
   * Change the contrast of the image, and update the GSetting, when changing
   * the scale.
   *
   * @param adjustment the adjustment of the contrast Gtk.Scale
   */
void cheese_preferences_dialog_on_contrast_change (GtkAdjustment* adjustment, CheesePreferencesDialog* self) {
	CheeseCamera* _tmp0_;
	GtkAdjustment* _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	GSettings* _tmp4_;
	GtkAdjustment* _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (adjustment != NULL);
	_tmp0_ = self->priv->camera;
	_tmp1_ = adjustment;
	_tmp2_ = gtk_adjustment_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	cheese_camera_set_balance_property (_tmp0_, "contrast", _tmp3_);
	_tmp4_ = self->priv->settings;
	_tmp5_ = adjustment;
	_tmp6_ = gtk_adjustment_get_value (_tmp5_);
	_tmp7_ = _tmp6_;
	g_settings_set_double (_tmp4_, "contrast", _tmp7_);
}


/**
   * Change the hue of the image, and update the GSetting, when changing the
   * scale.
   *
   * @param adjustment the adjustment of the hue Gtk.Scale
   */
void cheese_preferences_dialog_on_hue_change (GtkAdjustment* adjustment, CheesePreferencesDialog* self) {
	CheeseCamera* _tmp0_;
	GtkAdjustment* _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	GSettings* _tmp4_;
	GtkAdjustment* _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (adjustment != NULL);
	_tmp0_ = self->priv->camera;
	_tmp1_ = adjustment;
	_tmp2_ = gtk_adjustment_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	cheese_camera_set_balance_property (_tmp0_, "hue", _tmp3_);
	_tmp4_ = self->priv->settings;
	_tmp5_ = adjustment;
	_tmp6_ = gtk_adjustment_get_value (_tmp5_);
	_tmp7_ = _tmp6_;
	g_settings_set_double (_tmp4_, "hue", _tmp7_);
}


/**
   * Change the saturation of the image, and update the GSetting, when changing
   * the scale.
   *
   * @param adjustment the adjustment of the saturation Gtk.Scale
   */
void cheese_preferences_dialog_on_saturation_change (GtkAdjustment* adjustment, CheesePreferencesDialog* self) {
	CheeseCamera* _tmp0_;
	GtkAdjustment* _tmp1_;
	gdouble _tmp2_;
	gdouble _tmp3_;
	GSettings* _tmp4_;
	GtkAdjustment* _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (adjustment != NULL);
	_tmp0_ = self->priv->camera;
	_tmp1_ = adjustment;
	_tmp2_ = gtk_adjustment_get_value (_tmp1_);
	_tmp3_ = _tmp2_;
	cheese_camera_set_balance_property (_tmp0_, "saturation", _tmp3_);
	_tmp4_ = self->priv->settings;
	_tmp5_ = adjustment;
	_tmp6_ = gtk_adjustment_get_value (_tmp5_);
	_tmp7_ = _tmp6_;
	g_settings_set_double (_tmp4_, "saturation", _tmp7_);
}


/**
   * Update the video device combo box when a camera device was added or
   * removed.
   */
static Block2Data* block2_data_ref (Block2Data* _data2_) {
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}


static void block2_data_unref (void * _userdata_) {
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		CheesePreferencesDialog * self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->active_device);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}


static void ___lambda3_ (Block2Data* _data2_, void* device) {
	CheesePreferencesDialog * self;
	void* _tmp0_;
	CheeseCameraDevice* _tmp1_;
	CheeseCameraDevice* old_device;
	CheeseCameraDevice* new_device = NULL;
	GtkListStore* _tmp2_;
	GtkTreeIter _tmp3_;
	GCompareFunc _tmp4_;
	CheeseCameraDevice* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	CheeseCameraDevice* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gint _tmp11_ = 0;
	GtkListStore* _tmp15_;
	self = _data2_->self;
	_tmp0_ = device;
	_tmp1_ = _g_object_ref0 (CHEESE_CAMERA_DEVICE (_tmp0_));
	old_device = _tmp1_;
	_tmp2_ = self->priv->camera_model;
	_tmp3_ = _data2_->iter;
	gtk_tree_model_get ((GtkTreeModel*) _tmp2_, &_tmp3_, 1, &new_device, -1, -1);
	_tmp4_ = g_strcmp0;
	_tmp5_ = old_device;
	_tmp6_ = cheese_camera_device_get_device_node (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = new_device;
	_tmp9_ = cheese_camera_device_get_device_node (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp4_ (_tmp7_, _tmp10_);
	if (_tmp11_ != 0) {
		GtkTreeIter _tmp12_;
		CheeseCameraDevice* _tmp13_;
		CheeseCameraDevice* _tmp14_;
		_tmp12_ = _data2_->iter;
		_tmp13_ = new_device;
		_tmp14_ = _data2_->active_device;
		cheese_preferences_dialog_remove_camera_device (self, &_tmp12_, _tmp13_, _tmp14_);
		_data2_->device_removed = TRUE;
		_g_object_unref0 (new_device);
		_g_object_unref0 (old_device);
		return;
	}
	_tmp15_ = self->priv->camera_model;
	gtk_tree_model_iter_next ((GtkTreeModel*) _tmp15_, &_data2_->iter);
	_g_object_unref0 (new_device);
	_g_object_unref0 (old_device);
}


static void ____lambda3__gfunc (gconstpointer data, gpointer self) {
	___lambda3_ (self, data);
}


static void cheese_preferences_dialog_on_camera_update_num_camera_devices (CheesePreferencesDialog* self) {
	CheeseCamera* _tmp0_;
	GPtrArray* _tmp1_ = NULL;
	GPtrArray* devices;
	CheeseCameraDevice* dev = NULL;
	GPtrArray* _tmp2_;
	guint _tmp3_;
	GtkListStore* _tmp4_;
	gint _tmp5_ = 0;
	GSettings* _tmp25_;
	CheeseCamera* _tmp26_;
	CheeseCameraDevice* _tmp27_ = NULL;
	const gchar* _tmp28_ = NULL;
	CheeseCamera* _tmp29_;
	CheeseCameraDevice* _tmp30_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->camera;
	_tmp1_ = cheese_camera_get_camera_devices (_tmp0_);
	devices = _tmp1_;
	_tmp2_ = devices;
	_tmp3_ = _tmp2_->len;
	_tmp4_ = self->priv->camera_model;
	_tmp5_ = gtk_tree_model_iter_n_children ((GtkTreeModel*) _tmp4_, NULL);
	if (_tmp3_ > ((guint) _tmp5_)) {
		GPtrArray* _tmp6_;
		GPtrArray* _tmp7_;
		guint _tmp8_;
		void* _tmp9_ = NULL;
		CheeseCameraDevice* _tmp10_;
		CheeseCameraDevice* _tmp11_;
		_tmp6_ = devices;
		_tmp7_ = devices;
		_tmp8_ = _tmp7_->len;
		_tmp9_ = g_ptr_array_index (_tmp6_, _tmp8_ - 1);
		_tmp10_ = _g_object_ref0 (CHEESE_CAMERA_DEVICE (_tmp9_));
		_g_object_unref0 (dev);
		dev = _tmp10_;
		_tmp11_ = dev;
		cheese_preferences_dialog_add_camera_device (self, _tmp11_);
	} else {
		Block2Data* _data2_;
		GtkListStore* _tmp12_;
		GtkTreeIter _tmp13_ = {0};
		GtkTreeIter active_iter = {0};
		GtkComboBox* _tmp14_;
		GtkTreeIter _tmp15_ = {0};
		GtkListStore* _tmp16_;
		GtkTreeIter _tmp17_;
		GPtrArray* _tmp18_;
		gboolean _tmp19_;
		_data2_ = g_slice_new0 (Block2Data);
		_data2_->_ref_count_ = 1;
		_data2_->self = g_object_ref (self);
		_tmp12_ = self->priv->camera_model;
		gtk_tree_model_get_iter_first ((GtkTreeModel*) _tmp12_, &_tmp13_);
		_data2_->iter = _tmp13_;
		_tmp14_ = self->priv->source_combo;
		gtk_combo_box_get_active_iter (_tmp14_, &_tmp15_);
		active_iter = _tmp15_;
		_tmp16_ = self->priv->camera_model;
		_tmp17_ = active_iter;
		gtk_tree_model_get ((GtkTreeModel*) _tmp16_, &_tmp17_, 1, &_data2_->active_device, -1, -1);
		_data2_->device_removed = FALSE;
		_tmp18_ = devices;
		g_ptr_array_foreach (_tmp18_, ____lambda3__gfunc, _data2_);
		_tmp19_ = _data2_->device_removed;
		if (!_tmp19_) {
			CheeseCameraDevice* old_device = NULL;
			GtkListStore* _tmp20_;
			GtkTreeIter _tmp21_;
			GtkTreeIter _tmp22_;
			CheeseCameraDevice* _tmp23_;
			CheeseCameraDevice* _tmp24_;
			_tmp20_ = self->priv->camera_model;
			_tmp21_ = _data2_->iter;
			gtk_tree_model_get ((GtkTreeModel*) _tmp20_, &_tmp21_, 1, &old_device, -1, -1);
			_tmp22_ = _data2_->iter;
			_tmp23_ = old_device;
			_tmp24_ = _data2_->active_device;
			cheese_preferences_dialog_remove_camera_device (self, &_tmp22_, _tmp23_, _tmp24_);
			_g_object_unref0 (old_device);
		}
		block2_data_unref (_data2_);
		_data2_ = NULL;
	}
	_tmp25_ = self->priv->settings;
	_tmp26_ = self->priv->camera;
	_tmp27_ = cheese_camera_get_selected_device (_tmp26_);
	_tmp28_ = cheese_camera_device_get_device_node (_tmp27_);
	g_settings_set_string (_tmp25_, "camera", _tmp28_);
	_tmp29_ = self->priv->camera;
	_tmp30_ = cheese_camera_get_selected_device (_tmp29_);
	cheese_preferences_dialog_setup_resolutions_for_device (self, _tmp30_);
	_g_object_unref0 (dev);
}


/**
   * Add the supplied camera device to the device combo box model.
   *
   * This method is intended to be used with the foreach method of GLib
   * containers.
   *
   * @param device a Cheese.CameraDevice to add to the device combo box model
   */
static void cheese_preferences_dialog_add_camera_device (CheesePreferencesDialog* self, void* device) {
	GtkTreeIter iter = {0};
	void* _tmp0_;
	CheeseCameraDevice* _tmp1_;
	CheeseCameraDevice* dev;
	GtkListStore* _tmp2_;
	GtkTreeIter _tmp3_ = {0};
	GtkListStore* _tmp4_;
	GtkTreeIter _tmp5_;
	CheeseCameraDevice* _tmp6_;
	const gchar* _tmp7_ = NULL;
	gchar* _tmp8_;
	gchar* _tmp9_;
	CheeseCameraDevice* _tmp10_;
	const gchar* _tmp11_ = NULL;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	CheeseCameraDevice* _tmp16_;
	CheeseCamera* _tmp17_;
	CheeseCameraDevice* _tmp18_ = NULL;
	const gchar* _tmp19_ = NULL;
	CheeseCameraDevice* _tmp20_;
	const gchar* _tmp21_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = device;
	_tmp1_ = _g_object_ref0 (CHEESE_CAMERA_DEVICE (_tmp0_));
	dev = _tmp1_;
	_tmp2_ = self->priv->camera_model;
	gtk_list_store_append (_tmp2_, &_tmp3_);
	iter = _tmp3_;
	_tmp4_ = self->priv->camera_model;
	_tmp5_ = iter;
	_tmp6_ = dev;
	_tmp7_ = cheese_camera_device_get_name (_tmp6_);
	_tmp8_ = g_strconcat (_tmp7_, " (", NULL);
	_tmp9_ = _tmp8_;
	_tmp10_ = dev;
	_tmp11_ = cheese_camera_device_get_device_node (_tmp10_);
	_tmp12_ = g_strconcat (_tmp9_, _tmp11_, NULL);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strconcat (_tmp13_, ")", NULL);
	_tmp15_ = _tmp14_;
	_tmp16_ = dev;
	gtk_list_store_set (_tmp4_, &_tmp5_, 0, _tmp15_, 1, _tmp16_, -1);
	_g_free0 (_tmp15_);
	_g_free0 (_tmp13_);
	_g_free0 (_tmp9_);
	_tmp17_ = self->priv->camera;
	_tmp18_ = cheese_camera_get_selected_device (_tmp17_);
	_tmp19_ = cheese_camera_device_get_device_node (_tmp18_);
	_tmp20_ = dev;
	_tmp21_ = cheese_camera_device_get_device_node (_tmp20_);
	if (g_strcmp0 (_tmp19_, _tmp21_) == 0) {
		GtkComboBox* _tmp22_;
		GtkTreeIter _tmp23_;
		_tmp22_ = self->priv->source_combo;
		_tmp23_ = iter;
		gtk_combo_box_set_active_iter (_tmp22_, &_tmp23_);
	}
	_g_object_unref0 (dev);
}


/**
   * Remove the supplied camera device from the device combo box model.
   *
   * @param iter the iterator of the device to remove
   * @param device_node the device to remove from the combo box model
   * @param active_device_node the currently-active camera device
   */
static void cheese_preferences_dialog_remove_camera_device (CheesePreferencesDialog* self, GtkTreeIter* iter, CheeseCameraDevice* device_node, CheeseCameraDevice* active_device_node) {
	CheeseCamera* _tmp0_;
	GPtrArray* _tmp1_ = NULL;
	GPtrArray* devices;
	GCompareFunc _tmp2_;
	CheeseCameraDevice* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	CheeseCameraDevice* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gint _tmp9_ = 0;
	GtkListStore* _tmp14_;
	GtkTreeIter _tmp15_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (iter != NULL);
	g_return_if_fail (device_node != NULL);
	g_return_if_fail (active_device_node != NULL);
	_tmp0_ = self->priv->camera;
	_tmp1_ = cheese_camera_get_camera_devices (_tmp0_);
	devices = _tmp1_;
	_tmp2_ = g_strcmp0;
	_tmp3_ = device_node;
	_tmp4_ = cheese_camera_device_get_device_node (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = active_device_node;
	_tmp7_ = cheese_camera_device_get_device_node (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp2_ (_tmp5_, _tmp8_);
	if (_tmp9_ == 0) {
		GPtrArray* _tmp10_;
		guint _tmp11_;
		_tmp10_ = devices;
		_tmp11_ = _tmp10_->len;
		if (_tmp11_ > ((guint) 0)) {
			GtkTreeIter _tmp12_;
			_tmp12_ = *iter;
			cheese_preferences_dialog_set_new_available_camera_device (self, &_tmp12_);
		} else {
			GtkDialog* _tmp13_;
			_tmp13_ = self->priv->dialog;
			gtk_widget_hide ((GtkWidget*) _tmp13_);
		}
	}
	_tmp14_ = self->priv->camera_model;
	_tmp15_ = *iter;
	gtk_list_store_remove (_tmp14_, &_tmp15_);
}


/**
   * Search for an available camera device and activate it in the device combo
   * box model.
   *
   * @param iter a device in the combo box model to search either side of
   */
static void cheese_preferences_dialog_set_new_available_camera_device (CheesePreferencesDialog* self, GtkTreeIter* iter) {
	GtkTreeIter _tmp0_;
	GtkTreeIter new_iter;
	GtkListStore* _tmp1_;
	gboolean _tmp2_ = FALSE;
	GtkComboBox* _tmp5_;
	GtkTreeIter _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (iter != NULL);
	_tmp0_ = *iter;
	new_iter = _tmp0_;
	_tmp1_ = self->priv->camera_model;
	_tmp2_ = gtk_tree_model_iter_next ((GtkTreeModel*) _tmp1_, &new_iter);
	if (!_tmp2_) {
		GtkTreeIter _tmp3_;
		GtkListStore* _tmp4_;
		_tmp3_ = *iter;
		new_iter = _tmp3_;
		_tmp4_ = self->priv->camera_model;
		gtk_tree_model_iter_previous ((GtkTreeModel*) _tmp4_, &new_iter);
	}
	_tmp5_ = self->priv->source_combo;
	_tmp6_ = new_iter;
	gtk_combo_box_set_active_iter (_tmp5_, &_tmp6_);
}


/**
   * Show the dialog.
   */
void cheese_preferences_dialog_show (CheesePreferencesDialog* self) {
	GtkDialog* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->dialog;
	gtk_widget_show_all ((GtkWidget*) _tmp0_);
}


/**
   * Set the current media mode (photo, video, burst).
   *
   * The current mode is used if the photo or video resolution is changed, in
   * order to propagate that change to the Cheese.Camera.
   *
   * @param mode the media mode to set
   */
void cheese_preferences_dialog_set_current_mode (CheesePreferencesDialog* self, CheeseMediaMode mode) {
	CheeseMediaMode _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = mode;
	self->priv->current_mode = _tmp0_;
}


static void cheese_preferences_dialog_class_init (CheesePreferencesDialogClass * klass) {
	cheese_preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (CheesePreferencesDialogPrivate));
	G_OBJECT_CLASS (klass)->finalize = cheese_preferences_dialog_finalize;
}


static void cheese_preferences_dialog_instance_init (CheesePreferencesDialog * self) {
	self->priv = CHEESE_PREFERENCES_DIALOG_GET_PRIVATE (self);
}


static void cheese_preferences_dialog_finalize (GObject* obj) {
	CheesePreferencesDialog * self;
	self = CHEESE_PREFERENCES_DIALOG (obj);
	_g_object_unref0 (self->priv->camera);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->dialog);
	_g_object_unref0 (self->priv->photo_resolution_combo);
	_g_object_unref0 (self->priv->video_resolution_combo);
	_g_object_unref0 (self->priv->source_combo);
	_g_object_unref0 (self->priv->camera_model);
	_g_object_unref0 (self->priv->brightness_adjustment);
	_g_object_unref0 (self->priv->contrast_adjustment);
	_g_object_unref0 (self->priv->hue_adjustment);
	_g_object_unref0 (self->priv->saturation_adjustment);
	_g_object_unref0 (self->priv->brightness_scale);
	_g_object_unref0 (self->priv->contrast_scale);
	_g_object_unref0 (self->priv->hue_scale);
	_g_object_unref0 (self->priv->saturation_scale);
	_g_object_unref0 (self->priv->burst_repeat_spin);
	_g_object_unref0 (self->priv->burst_delay_spin);
	_g_object_unref0 (self->priv->countdown_check);
	_g_object_unref0 (self->priv->flash_check);
	G_OBJECT_CLASS (cheese_preferences_dialog_parent_class)->finalize (obj);
}


GType cheese_preferences_dialog_get_type (void) {
	static volatile gsize cheese_preferences_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&cheese_preferences_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (CheesePreferencesDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) cheese_preferences_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CheesePreferencesDialog), 0, (GInstanceInitFunc) cheese_preferences_dialog_instance_init, NULL };
		GType cheese_preferences_dialog_type_id;
		cheese_preferences_dialog_type_id = g_type_register_static (G_TYPE_OBJECT, "CheesePreferencesDialog", &g_define_type_info, 0);
		g_once_init_leave (&cheese_preferences_dialog_type_id__volatile, cheese_preferences_dialog_type_id);
	}
	return cheese_preferences_dialog_type_id__volatile;
}