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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use bitflags::bitflags;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::ToValue;
use glib::StaticType;
use glib::Type;
use std::fmt;

bitflags! {
    /// Flags used when creating a [`AppInfo`][crate::AppInfo].
    #[doc(alias = "GAppInfoCreateFlags")]
    pub struct AppInfoCreateFlags: u32 {
        /// No flags.
        #[doc(alias = "G_APP_INFO_CREATE_NONE")]
        const NONE = ffi::G_APP_INFO_CREATE_NONE as u32;
        /// Application opens in a terminal window.
        #[doc(alias = "G_APP_INFO_CREATE_NEEDS_TERMINAL")]
        const NEEDS_TERMINAL = ffi::G_APP_INFO_CREATE_NEEDS_TERMINAL as u32;
        /// Application supports URI arguments.
        #[doc(alias = "G_APP_INFO_CREATE_SUPPORTS_URIS")]
        const SUPPORTS_URIS = ffi::G_APP_INFO_CREATE_SUPPORTS_URIS as u32;
        /// Application supports startup notification. Since 2.26
        #[doc(alias = "G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION")]
        const SUPPORTS_STARTUP_NOTIFICATION = ffi::G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION as u32;
    }
}

impl fmt::Display for AppInfoCreateFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for AppInfoCreateFlags {
    type GlibType = ffi::GAppInfoCreateFlags;

    fn into_glib(self) -> ffi::GAppInfoCreateFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GAppInfoCreateFlags> for AppInfoCreateFlags {
    unsafe fn from_glib(value: ffi::GAppInfoCreateFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for AppInfoCreateFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_app_info_create_flags_get_type()) }
    }
}

impl glib::value::ValueType for AppInfoCreateFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for AppInfoCreateFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for AppInfoCreateFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used to define the behaviour of a [`Application`][crate::Application].
    #[doc(alias = "GApplicationFlags")]
    pub struct ApplicationFlags: u32 {
        /// Default
        #[doc(alias = "G_APPLICATION_FLAGS_NONE")]
        const FLAGS_NONE = ffi::G_APPLICATION_FLAGS_NONE as u32;
        /// Run as a service. In this mode, registration
        ///  fails if the service is already running, and the application
        ///  will initially wait up to 10 seconds for an initial activation
        ///  message to arrive.
        #[doc(alias = "G_APPLICATION_IS_SERVICE")]
        const IS_SERVICE = ffi::G_APPLICATION_IS_SERVICE as u32;
        /// Don't try to become the primary instance.
        #[doc(alias = "G_APPLICATION_IS_LAUNCHER")]
        const IS_LAUNCHER = ffi::G_APPLICATION_IS_LAUNCHER as u32;
        /// This application handles opening files (in
        ///  the primary instance). Note that this flag only affects the default
        ///  implementation of `local_command_line()`, and has no effect if
        ///  [`HANDLES_COMMAND_LINE`][Self::HANDLES_COMMAND_LINE] is given.
        ///  See [`ApplicationExtManual::run()`][crate::prelude::ApplicationExtManual::run()] for details.
        #[doc(alias = "G_APPLICATION_HANDLES_OPEN")]
        const HANDLES_OPEN = ffi::G_APPLICATION_HANDLES_OPEN as u32;
        /// This application handles command line
        ///  arguments (in the primary instance). Note that this flag only affect
        ///  the default implementation of `local_command_line()`.
        ///  See [`ApplicationExtManual::run()`][crate::prelude::ApplicationExtManual::run()] for details.
        #[doc(alias = "G_APPLICATION_HANDLES_COMMAND_LINE")]
        const HANDLES_COMMAND_LINE = ffi::G_APPLICATION_HANDLES_COMMAND_LINE as u32;
        /// Send the environment of the
        ///  launching process to the primary instance. Set this flag if your
        ///  application is expected to behave differently depending on certain
        ///  environment variables. For instance, an editor might be expected
        ///  to use the `GIT_COMMITTER_NAME` environment variable
        ///  when editing a git commit message. The environment is available
        ///  to the `signal::Application::command-line` signal handler, via
        ///  [`ApplicationCommandLineExt::getenv()`][crate::prelude::ApplicationCommandLineExt::getenv()].
        #[doc(alias = "G_APPLICATION_SEND_ENVIRONMENT")]
        const SEND_ENVIRONMENT = ffi::G_APPLICATION_SEND_ENVIRONMENT as u32;
        /// Make no attempts to do any of the typical
        ///  single-instance application negotiation, even if the application
        ///  ID is given. The application neither attempts to become the
        ///  owner of the application ID nor does it check if an existing
        ///  owner already exists. Everything occurs in the local process.
        ///  Since: 2.30.
        #[doc(alias = "G_APPLICATION_NON_UNIQUE")]
        const NON_UNIQUE = ffi::G_APPLICATION_NON_UNIQUE as u32;
        /// Allow users to override the
        ///  application ID from the command line with `--gapplication-app-id`.
        ///  Since: 2.48
        #[doc(alias = "G_APPLICATION_CAN_OVERRIDE_APP_ID")]
        const CAN_OVERRIDE_APP_ID = ffi::G_APPLICATION_CAN_OVERRIDE_APP_ID as u32;
        /// Allow another instance to take over
        ///  the bus name. Since: 2.60
        #[doc(alias = "G_APPLICATION_ALLOW_REPLACEMENT")]
        const ALLOW_REPLACEMENT = ffi::G_APPLICATION_ALLOW_REPLACEMENT as u32;
        /// Take over from another instance. This flag is
        ///  usually set by passing `--gapplication-replace` on the commandline.
        ///  Since: 2.60
        #[doc(alias = "G_APPLICATION_REPLACE")]
        const REPLACE = ffi::G_APPLICATION_REPLACE as u32;
    }
}

impl fmt::Display for ApplicationFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for ApplicationFlags {
    type GlibType = ffi::GApplicationFlags;

    fn into_glib(self) -> ffi::GApplicationFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GApplicationFlags> for ApplicationFlags {
    unsafe fn from_glib(value: ffi::GApplicationFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for ApplicationFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_application_flags_get_type()) }
    }
}

impl glib::value::ValueType for ApplicationFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for ApplicationFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for ApplicationFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// [`AskPasswordFlags`][crate::AskPasswordFlags] are used to request specific information from the
    /// user, or to notify the user of their choices in an authentication
    /// situation.
    #[doc(alias = "GAskPasswordFlags")]
    pub struct AskPasswordFlags: u32 {
        /// operation requires a password.
        #[doc(alias = "G_ASK_PASSWORD_NEED_PASSWORD")]
        const NEED_PASSWORD = ffi::G_ASK_PASSWORD_NEED_PASSWORD as u32;
        /// operation requires a username.
        #[doc(alias = "G_ASK_PASSWORD_NEED_USERNAME")]
        const NEED_USERNAME = ffi::G_ASK_PASSWORD_NEED_USERNAME as u32;
        /// operation requires a domain.
        #[doc(alias = "G_ASK_PASSWORD_NEED_DOMAIN")]
        const NEED_DOMAIN = ffi::G_ASK_PASSWORD_NEED_DOMAIN as u32;
        /// operation supports saving settings.
        #[doc(alias = "G_ASK_PASSWORD_SAVING_SUPPORTED")]
        const SAVING_SUPPORTED = ffi::G_ASK_PASSWORD_SAVING_SUPPORTED as u32;
        /// operation supports anonymous users.
        #[doc(alias = "G_ASK_PASSWORD_ANONYMOUS_SUPPORTED")]
        const ANONYMOUS_SUPPORTED = ffi::G_ASK_PASSWORD_ANONYMOUS_SUPPORTED as u32;
        /// operation takes TCRYPT parameters (Since: 2.58)
        #[doc(alias = "G_ASK_PASSWORD_TCRYPT")]
        const TCRYPT = ffi::G_ASK_PASSWORD_TCRYPT as u32;
    }
}

impl fmt::Display for AskPasswordFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for AskPasswordFlags {
    type GlibType = ffi::GAskPasswordFlags;

    fn into_glib(self) -> ffi::GAskPasswordFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GAskPasswordFlags> for AskPasswordFlags {
    unsafe fn from_glib(value: ffi::GAskPasswordFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for AskPasswordFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_ask_password_flags_get_type()) }
    }
}

impl glib::value::ValueType for AskPasswordFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for AskPasswordFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for AskPasswordFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used in `g_bus_own_name()`.
    #[doc(alias = "GBusNameOwnerFlags")]
    pub struct BusNameOwnerFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_BUS_NAME_OWNER_FLAGS_NONE")]
        const NONE = ffi::G_BUS_NAME_OWNER_FLAGS_NONE as u32;
        /// Allow another message bus connection to claim the name.
        #[doc(alias = "G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT")]
        const ALLOW_REPLACEMENT = ffi::G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT as u32;
        /// If another message bus connection owns the name and have
        /// specified [`ALLOW_REPLACEMENT`][Self::ALLOW_REPLACEMENT], then take the name from the other connection.
        #[doc(alias = "G_BUS_NAME_OWNER_FLAGS_REPLACE")]
        const REPLACE = ffi::G_BUS_NAME_OWNER_FLAGS_REPLACE as u32;
        /// If another message bus connection owns the name, immediately
        /// return an error from `g_bus_own_name()` rather than entering the waiting queue for that name. (Since 2.54)
        #[doc(alias = "G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE")]
        const DO_NOT_QUEUE = ffi::G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE as u32;
    }
}

impl fmt::Display for BusNameOwnerFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for BusNameOwnerFlags {
    type GlibType = ffi::GBusNameOwnerFlags;

    fn into_glib(self) -> ffi::GBusNameOwnerFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GBusNameOwnerFlags> for BusNameOwnerFlags {
    unsafe fn from_glib(value: ffi::GBusNameOwnerFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for BusNameOwnerFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_bus_name_owner_flags_get_type()) }
    }
}

impl glib::value::ValueType for BusNameOwnerFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for BusNameOwnerFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for BusNameOwnerFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used in `g_bus_watch_name()`.
    #[doc(alias = "GBusNameWatcherFlags")]
    pub struct BusNameWatcherFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_BUS_NAME_WATCHER_FLAGS_NONE")]
        const NONE = ffi::G_BUS_NAME_WATCHER_FLAGS_NONE as u32;
        /// If no-one owns the name when
        /// beginning to watch the name, ask the bus to launch an owner for the
        /// name.
        #[doc(alias = "G_BUS_NAME_WATCHER_FLAGS_AUTO_START")]
        const AUTO_START = ffi::G_BUS_NAME_WATCHER_FLAGS_AUTO_START as u32;
    }
}

impl fmt::Display for BusNameWatcherFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for BusNameWatcherFlags {
    type GlibType = ffi::GBusNameWatcherFlags;

    fn into_glib(self) -> ffi::GBusNameWatcherFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GBusNameWatcherFlags> for BusNameWatcherFlags {
    unsafe fn from_glib(value: ffi::GBusNameWatcherFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for BusNameWatcherFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_bus_name_watcher_flags_get_type()) }
    }
}

impl glib::value::ValueType for BusNameWatcherFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for BusNameWatcherFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for BusNameWatcherFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when calling a [`ConverterExtManual::convert()`][crate::prelude::ConverterExtManual::convert()].
    #[doc(alias = "GConverterFlags")]
    pub struct ConverterFlags: u32 {
        /// No flags.
        #[doc(alias = "G_CONVERTER_NO_FLAGS")]
        const NONE = ffi::G_CONVERTER_NO_FLAGS as u32;
        /// At end of input data
        #[doc(alias = "G_CONVERTER_INPUT_AT_END")]
        const INPUT_AT_END = ffi::G_CONVERTER_INPUT_AT_END as u32;
        /// Flush data
        #[doc(alias = "G_CONVERTER_FLUSH")]
        const FLUSH = ffi::G_CONVERTER_FLUSH as u32;
    }
}

impl fmt::Display for ConverterFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for ConverterFlags {
    type GlibType = ffi::GConverterFlags;

    fn into_glib(self) -> ffi::GConverterFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GConverterFlags> for ConverterFlags {
    unsafe fn from_glib(value: ffi::GConverterFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for ConverterFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_converter_flags_get_type()) }
    }
}

impl glib::value::ValueType for ConverterFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for ConverterFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for ConverterFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used in [`DBusConnection::call()`][crate::DBusConnection::call()] and similar APIs.
    #[doc(alias = "GDBusCallFlags")]
    pub struct DBusCallFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_DBUS_CALL_FLAGS_NONE")]
        const NONE = ffi::G_DBUS_CALL_FLAGS_NONE as u32;
        /// The bus must not launch
        /// an owner for the destination name in response to this method
        /// invocation.
        #[doc(alias = "G_DBUS_CALL_FLAGS_NO_AUTO_START")]
        const NO_AUTO_START = ffi::G_DBUS_CALL_FLAGS_NO_AUTO_START as u32;
        /// the caller is prepared to
        /// wait for interactive authorization. Since 2.46.
        #[doc(alias = "G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION")]
        const ALLOW_INTERACTIVE_AUTHORIZATION = ffi::G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION as u32;
    }
}

impl fmt::Display for DBusCallFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DBusCallFlags {
    type GlibType = ffi::GDBusCallFlags;

    fn into_glib(self) -> ffi::GDBusCallFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GDBusCallFlags> for DBusCallFlags {
    unsafe fn from_glib(value: ffi::GDBusCallFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DBusCallFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_dbus_call_flags_get_type()) }
    }
}

impl glib::value::ValueType for DBusCallFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DBusCallFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DBusCallFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Capabilities negotiated with the remote peer.
    #[doc(alias = "GDBusCapabilityFlags")]
    pub struct DBusCapabilityFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_DBUS_CAPABILITY_FLAGS_NONE")]
        const NONE = ffi::G_DBUS_CAPABILITY_FLAGS_NONE as u32;
        /// The connection
        /// supports exchanging UNIX file descriptors with the remote peer.
        #[doc(alias = "G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING")]
        const UNIX_FD_PASSING = ffi::G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING as u32;
    }
}

impl fmt::Display for DBusCapabilityFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DBusCapabilityFlags {
    type GlibType = ffi::GDBusCapabilityFlags;

    fn into_glib(self) -> ffi::GDBusCapabilityFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GDBusCapabilityFlags> for DBusCapabilityFlags {
    unsafe fn from_glib(value: ffi::GDBusCapabilityFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DBusCapabilityFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_dbus_capability_flags_get_type()) }
    }
}

impl glib::value::ValueType for DBusCapabilityFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DBusCapabilityFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DBusCapabilityFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when creating a new [`DBusConnection`][crate::DBusConnection].
    #[doc(alias = "GDBusConnectionFlags")]
    pub struct DBusConnectionFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_DBUS_CONNECTION_FLAGS_NONE")]
        const NONE = ffi::G_DBUS_CONNECTION_FLAGS_NONE as u32;
        /// Perform authentication against server.
        #[doc(alias = "G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT")]
        const AUTHENTICATION_CLIENT = ffi::G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT as u32;
        /// Perform authentication against client.
        #[doc(alias = "G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER")]
        const AUTHENTICATION_SERVER = ffi::G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER as u32;
        /// When
        /// authenticating as a server, allow the anonymous authentication
        /// method.
        #[doc(alias = "G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS")]
        const AUTHENTICATION_ALLOW_ANONYMOUS = ffi::G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS as u32;
        /// Pass this flag if connecting to a peer that is a
        /// message bus. This means that the Hello() method will be invoked as part of the connection setup.
        #[doc(alias = "G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION")]
        const MESSAGE_BUS_CONNECTION = ffi::G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION as u32;
        /// If set, processing of D-Bus messages is
        /// delayed until [`DBusConnection::start_message_processing()`][crate::DBusConnection::start_message_processing()] is called.
        #[doc(alias = "G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING")]
        const DELAY_MESSAGE_PROCESSING = ffi::G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING as u32;
        /// When authenticating
        /// as a server, require the UID of the peer to be the same as the UID of the server. (Since: 2.68)
        #[doc(alias = "G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER")]
        const AUTHENTICATION_REQUIRE_SAME_USER = ffi::G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER as u32;
    }
}

impl fmt::Display for DBusConnectionFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DBusConnectionFlags {
    type GlibType = ffi::GDBusConnectionFlags;

    fn into_glib(self) -> ffi::GDBusConnectionFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GDBusConnectionFlags> for DBusConnectionFlags {
    unsafe fn from_glib(value: ffi::GDBusConnectionFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DBusConnectionFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_dbus_connection_flags_get_type()) }
    }
}

impl glib::value::ValueType for DBusConnectionFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DBusConnectionFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DBusConnectionFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags describing the behavior of a [`DBusInterfaceSkeleton`][crate::DBusInterfaceSkeleton] instance.
    #[doc(alias = "GDBusInterfaceSkeletonFlags")]
    pub struct DBusInterfaceSkeletonFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_DBUS_INTERFACE_SKELETON_FLAGS_NONE")]
        const NONE = ffi::G_DBUS_INTERFACE_SKELETON_FLAGS_NONE as u32;
        /// Each method invocation is handled in
        ///  a thread dedicated to the invocation. This means that the method implementation can use blocking IO
        ///  without blocking any other part of the process. It also means that the method implementation must
        ///  use locking to access data structures used by other threads.
        #[doc(alias = "G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD")]
        const HANDLE_METHOD_INVOCATIONS_IN_THREAD = ffi::G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD as u32;
    }
}

impl fmt::Display for DBusInterfaceSkeletonFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DBusInterfaceSkeletonFlags {
    type GlibType = ffi::GDBusInterfaceSkeletonFlags;

    fn into_glib(self) -> ffi::GDBusInterfaceSkeletonFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GDBusInterfaceSkeletonFlags> for DBusInterfaceSkeletonFlags {
    unsafe fn from_glib(value: ffi::GDBusInterfaceSkeletonFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DBusInterfaceSkeletonFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_dbus_interface_skeleton_flags_get_type()) }
    }
}

impl glib::value::ValueType for DBusInterfaceSkeletonFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DBusInterfaceSkeletonFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DBusInterfaceSkeletonFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Message flags used in [`DBusMessage`][crate::DBusMessage].
    #[doc(alias = "GDBusMessageFlags")]
    pub struct DBusMessageFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_DBUS_MESSAGE_FLAGS_NONE")]
        const NONE = ffi::G_DBUS_MESSAGE_FLAGS_NONE as u32;
        /// A reply is not expected.
        #[doc(alias = "G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED")]
        const NO_REPLY_EXPECTED = ffi::G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED as u32;
        /// The bus must not launch an
        /// owner for the destination name in response to this message.
        #[doc(alias = "G_DBUS_MESSAGE_FLAGS_NO_AUTO_START")]
        const NO_AUTO_START = ffi::G_DBUS_MESSAGE_FLAGS_NO_AUTO_START as u32;
        /// If set on a method
        /// call, this flag means that the caller is prepared to wait for interactive
        /// authorization. Since 2.46.
        #[doc(alias = "G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION")]
        const ALLOW_INTERACTIVE_AUTHORIZATION = ffi::G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION as u32;
    }
}

impl fmt::Display for DBusMessageFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DBusMessageFlags {
    type GlibType = ffi::GDBusMessageFlags;

    fn into_glib(self) -> ffi::GDBusMessageFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GDBusMessageFlags> for DBusMessageFlags {
    unsafe fn from_glib(value: ffi::GDBusMessageFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DBusMessageFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_dbus_message_flags_get_type()) }
    }
}

impl glib::value::ValueType for DBusMessageFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DBusMessageFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DBusMessageFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when constructing an instance of a [`DBusProxy`][crate::DBusProxy] derived class.
    #[doc(alias = "GDBusProxyFlags")]
    pub struct DBusProxyFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_DBUS_PROXY_FLAGS_NONE")]
        const NONE = ffi::G_DBUS_PROXY_FLAGS_NONE as u32;
        /// Don't load properties.
        #[doc(alias = "G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES")]
        const DO_NOT_LOAD_PROPERTIES = ffi::G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES as u32;
        /// Don't connect to signals on the remote object.
        #[doc(alias = "G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS")]
        const DO_NOT_CONNECT_SIGNALS = ffi::G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS as u32;
        /// If the proxy is for a well-known name,
        /// do not ask the bus to launch an owner during proxy initialization or a method call.
        /// This flag is only meaningful in proxies for well-known names.
        #[doc(alias = "G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START")]
        const DO_NOT_AUTO_START = ffi::G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START as u32;
        /// If set, the property value for any __invalidated property__ will be (asynchronously) retrieved upon receiving the [`PropertiesChanged`](http://dbus.freedesktop.org/doc/dbus-specification.html`standard`-interfaces-properties) D-Bus signal and the property will not cause emission of the `signal::DBusProxy::g-properties-changed` signal. When the value is received the `signal::DBusProxy::g-properties-changed` signal is emitted for the property along with the retrieved value. Since 2.32.
        #[doc(alias = "G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES")]
        const GET_INVALIDATED_PROPERTIES = ffi::G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES as u32;
        /// If the proxy is for a well-known name,
        /// do not ask the bus to launch an owner during proxy initialization, but allow it to be
        /// autostarted by a method call. This flag is only meaningful in proxies for well-known names,
        /// and only if [`DO_NOT_AUTO_START`][Self::DO_NOT_AUTO_START] is not also specified.
        #[doc(alias = "G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION")]
        const DO_NOT_AUTO_START_AT_CONSTRUCTION = ffi::G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION as u32;
        /// Don't actually send the AddMatch D-Bus
        ///  call for this signal subscription. This gives you more control
        ///  over which match rules you add (but you must add them manually). (Since: 2.72)
        #[cfg(any(feature = "v2_70", feature = "dox"))]
        #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_70")))]
        #[doc(alias = "G_DBUS_PROXY_FLAGS_NO_MATCH_RULE")]
        const NO_MATCH_RULE = ffi::G_DBUS_PROXY_FLAGS_NO_MATCH_RULE as u32;
    }
}

impl fmt::Display for DBusProxyFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DBusProxyFlags {
    type GlibType = ffi::GDBusProxyFlags;

    fn into_glib(self) -> ffi::GDBusProxyFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GDBusProxyFlags> for DBusProxyFlags {
    unsafe fn from_glib(value: ffi::GDBusProxyFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DBusProxyFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_dbus_proxy_flags_get_type()) }
    }
}

impl glib::value::ValueType for DBusProxyFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DBusProxyFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DBusProxyFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when sending `GDBusMessages` on a [`DBusConnection`][crate::DBusConnection].
    #[doc(alias = "GDBusSendMessageFlags")]
    pub struct DBusSendMessageFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_DBUS_SEND_MESSAGE_FLAGS_NONE")]
        const NONE = ffi::G_DBUS_SEND_MESSAGE_FLAGS_NONE as u32;
        /// Do not automatically
        /// assign a serial number from the [`DBusConnection`][crate::DBusConnection] object when
        /// sending a message.
        #[doc(alias = "G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL")]
        const PRESERVE_SERIAL = ffi::G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL as u32;
    }
}

impl fmt::Display for DBusSendMessageFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DBusSendMessageFlags {
    type GlibType = ffi::GDBusSendMessageFlags;

    fn into_glib(self) -> ffi::GDBusSendMessageFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GDBusSendMessageFlags> for DBusSendMessageFlags {
    unsafe fn from_glib(value: ffi::GDBusSendMessageFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DBusSendMessageFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_dbus_send_message_flags_get_type()) }
    }
}

impl glib::value::ValueType for DBusSendMessageFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DBusSendMessageFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DBusSendMessageFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when creating a [`DBusServer`][crate::DBusServer].
    #[doc(alias = "GDBusServerFlags")]
    pub struct DBusServerFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_DBUS_SERVER_FLAGS_NONE")]
        const NONE = ffi::G_DBUS_SERVER_FLAGS_NONE as u32;
        /// All `signal::DBusServer::new-connection`
        /// signals will run in separated dedicated threads (see signal for
        /// details).
        #[doc(alias = "G_DBUS_SERVER_FLAGS_RUN_IN_THREAD")]
        const RUN_IN_THREAD = ffi::G_DBUS_SERVER_FLAGS_RUN_IN_THREAD as u32;
        /// Allow the anonymous
        /// authentication method.
        #[doc(alias = "G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS")]
        const AUTHENTICATION_ALLOW_ANONYMOUS = ffi::G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS as u32;
        /// Require the UID of the
        /// peer to be the same as the UID of the server when authenticating. (Since: 2.68)
        #[doc(alias = "G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER")]
        const AUTHENTICATION_REQUIRE_SAME_USER = ffi::G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER as u32;
    }
}

impl fmt::Display for DBusServerFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DBusServerFlags {
    type GlibType = ffi::GDBusServerFlags;

    fn into_glib(self) -> ffi::GDBusServerFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GDBusServerFlags> for DBusServerFlags {
    unsafe fn from_glib(value: ffi::GDBusServerFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DBusServerFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_dbus_server_flags_get_type()) }
    }
}

impl glib::value::ValueType for DBusServerFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DBusServerFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DBusServerFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when subscribing to signals via [`DBusConnection::signal_subscribe()`][crate::DBusConnection::signal_subscribe()].
    #[doc(alias = "GDBusSignalFlags")]
    pub struct DBusSignalFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_DBUS_SIGNAL_FLAGS_NONE")]
        const NONE = ffi::G_DBUS_SIGNAL_FLAGS_NONE as u32;
        /// Don't actually send the AddMatch
        /// D-Bus call for this signal subscription. This gives you more control
        /// over which match rules you add (but you must add them manually).
        #[doc(alias = "G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE")]
        const NO_MATCH_RULE = ffi::G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE as u32;
        /// Match first arguments that
        /// contain a bus or interface name with the given namespace.
        #[doc(alias = "G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE")]
        const MATCH_ARG0_NAMESPACE = ffi::G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE as u32;
        /// Match first arguments that
        /// contain an object path that is either equivalent to the given path,
        /// or one of the paths is a subpath of the other.
        #[doc(alias = "G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH")]
        const MATCH_ARG0_PATH = ffi::G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH as u32;
    }
}

impl fmt::Display for DBusSignalFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DBusSignalFlags {
    type GlibType = ffi::GDBusSignalFlags;

    fn into_glib(self) -> ffi::GDBusSignalFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GDBusSignalFlags> for DBusSignalFlags {
    unsafe fn from_glib(value: ffi::GDBusSignalFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DBusSignalFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_dbus_signal_flags_get_type()) }
    }
}

impl glib::value::ValueType for DBusSignalFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DBusSignalFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DBusSignalFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when starting a drive.
    #[doc(alias = "GDriveStartFlags")]
    pub struct DriveStartFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_DRIVE_START_NONE")]
        const NONE = ffi::G_DRIVE_START_NONE as u32;
    }
}

impl fmt::Display for DriveStartFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for DriveStartFlags {
    type GlibType = ffi::GDriveStartFlags;

    fn into_glib(self) -> ffi::GDriveStartFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GDriveStartFlags> for DriveStartFlags {
    unsafe fn from_glib(value: ffi::GDriveStartFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for DriveStartFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_drive_start_flags_get_type()) }
    }
}

impl glib::value::ValueType for DriveStartFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for DriveStartFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for DriveStartFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags specifying the behaviour of an attribute.
    #[doc(alias = "GFileAttributeInfoFlags")]
    pub struct FileAttributeInfoFlags: u32 {
        /// no flags set.
        #[doc(alias = "G_FILE_ATTRIBUTE_INFO_NONE")]
        const NONE = ffi::G_FILE_ATTRIBUTE_INFO_NONE as u32;
        /// copy the attribute values when the file is copied.
        #[doc(alias = "G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE")]
        const COPY_WITH_FILE = ffi::G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE as u32;
        /// copy the attribute values when the file is moved.
        #[doc(alias = "G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED")]
        const COPY_WHEN_MOVED = ffi::G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED as u32;
    }
}

impl fmt::Display for FileAttributeInfoFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FileAttributeInfoFlags {
    type GlibType = ffi::GFileAttributeInfoFlags;

    fn into_glib(self) -> ffi::GFileAttributeInfoFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GFileAttributeInfoFlags> for FileAttributeInfoFlags {
    unsafe fn from_glib(value: ffi::GFileAttributeInfoFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for FileAttributeInfoFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_file_attribute_info_flags_get_type()) }
    }
}

impl glib::value::ValueType for FileAttributeInfoFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for FileAttributeInfoFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for FileAttributeInfoFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when copying or moving files.
    #[doc(alias = "GFileCopyFlags")]
    pub struct FileCopyFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_FILE_COPY_NONE")]
        const NONE = ffi::G_FILE_COPY_NONE as u32;
        /// Overwrite any existing files
        #[doc(alias = "G_FILE_COPY_OVERWRITE")]
        const OVERWRITE = ffi::G_FILE_COPY_OVERWRITE as u32;
        /// Make a backup of any existing files.
        #[doc(alias = "G_FILE_COPY_BACKUP")]
        const BACKUP = ffi::G_FILE_COPY_BACKUP as u32;
        /// Don't follow symlinks.
        #[doc(alias = "G_FILE_COPY_NOFOLLOW_SYMLINKS")]
        const NOFOLLOW_SYMLINKS = ffi::G_FILE_COPY_NOFOLLOW_SYMLINKS as u32;
        /// Copy all file metadata instead of just default set used for copy (see [`FileInfo`][crate::FileInfo]).
        #[doc(alias = "G_FILE_COPY_ALL_METADATA")]
        const ALL_METADATA = ffi::G_FILE_COPY_ALL_METADATA as u32;
        /// Don't use copy and delete fallback if native move not supported.
        #[doc(alias = "G_FILE_COPY_NO_FALLBACK_FOR_MOVE")]
        const NO_FALLBACK_FOR_MOVE = ffi::G_FILE_COPY_NO_FALLBACK_FOR_MOVE as u32;
        /// Leaves target file with default perms, instead of setting the source file perms.
        #[doc(alias = "G_FILE_COPY_TARGET_DEFAULT_PERMS")]
        const TARGET_DEFAULT_PERMS = ffi::G_FILE_COPY_TARGET_DEFAULT_PERMS as u32;
    }
}

impl fmt::Display for FileCopyFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FileCopyFlags {
    type GlibType = ffi::GFileCopyFlags;

    fn into_glib(self) -> ffi::GFileCopyFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GFileCopyFlags> for FileCopyFlags {
    unsafe fn from_glib(value: ffi::GFileCopyFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for FileCopyFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_file_copy_flags_get_type()) }
    }
}

impl glib::value::ValueType for FileCopyFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for FileCopyFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for FileCopyFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when an operation may create a file.
    #[doc(alias = "GFileCreateFlags")]
    pub struct FileCreateFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_FILE_CREATE_NONE")]
        const NONE = ffi::G_FILE_CREATE_NONE as u32;
        /// Create a file that can only be
        ///  accessed by the current user.
        #[doc(alias = "G_FILE_CREATE_PRIVATE")]
        const PRIVATE = ffi::G_FILE_CREATE_PRIVATE as u32;
        /// Replace the destination
        ///  as if it didn't exist before. Don't try to keep any old
        ///  permissions, replace instead of following links. This
        ///  is generally useful if you're doing a "copy over"
        ///  rather than a "save new version of" replace operation.
        ///  You can think of it as "unlink destination" before
        ///  writing to it, although the implementation may not
        ///  be exactly like that. This flag can only be used with
        ///  [`FileExt::replace()`][crate::prelude::FileExt::replace()] and its variants, including [`FileExt::replace_contents()`][crate::prelude::FileExt::replace_contents()].
        ///  Since 2.20
        #[doc(alias = "G_FILE_CREATE_REPLACE_DESTINATION")]
        const REPLACE_DESTINATION = ffi::G_FILE_CREATE_REPLACE_DESTINATION as u32;
    }
}

impl fmt::Display for FileCreateFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FileCreateFlags {
    type GlibType = ffi::GFileCreateFlags;

    fn into_glib(self) -> ffi::GFileCreateFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GFileCreateFlags> for FileCreateFlags {
    unsafe fn from_glib(value: ffi::GFileCreateFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for FileCreateFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_file_create_flags_get_type()) }
    }
}

impl glib::value::ValueType for FileCreateFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for FileCreateFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for FileCreateFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags that can be used with [`FileExtManual::measure_disk_usage()`][crate::prelude::FileExtManual::measure_disk_usage()].
    #[doc(alias = "GFileMeasureFlags")]
    pub struct FileMeasureFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_FILE_MEASURE_NONE")]
        const NONE = ffi::G_FILE_MEASURE_NONE as u32;
        /// Report any error encountered
        ///  while traversing the directory tree. Normally errors are only
        ///  reported for the toplevel file.
        #[doc(alias = "G_FILE_MEASURE_REPORT_ANY_ERROR")]
        const REPORT_ANY_ERROR = ffi::G_FILE_MEASURE_REPORT_ANY_ERROR as u32;
        /// Tally usage based on apparent file
        ///  sizes. Normally, the block-size is used, if available, as this is a
        ///  more accurate representation of disk space used.
        ///  Compare with `du --apparent-size`.
        #[doc(alias = "G_FILE_MEASURE_APPARENT_SIZE")]
        const APPARENT_SIZE = ffi::G_FILE_MEASURE_APPARENT_SIZE as u32;
        /// Do not cross mount point boundaries.
        ///  Compare with `du -x`.
        #[doc(alias = "G_FILE_MEASURE_NO_XDEV")]
        const NO_XDEV = ffi::G_FILE_MEASURE_NO_XDEV as u32;
    }
}

impl fmt::Display for FileMeasureFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FileMeasureFlags {
    type GlibType = ffi::GFileMeasureFlags;

    fn into_glib(self) -> ffi::GFileMeasureFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GFileMeasureFlags> for FileMeasureFlags {
    unsafe fn from_glib(value: ffi::GFileMeasureFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for FileMeasureFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_file_measure_flags_get_type()) }
    }
}

impl glib::value::ValueType for FileMeasureFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for FileMeasureFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for FileMeasureFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used to set what a [`FileMonitor`][crate::FileMonitor] will watch for.
    #[doc(alias = "GFileMonitorFlags")]
    pub struct FileMonitorFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_FILE_MONITOR_NONE")]
        const NONE = ffi::G_FILE_MONITOR_NONE as u32;
        /// Watch for mount events.
        #[doc(alias = "G_FILE_MONITOR_WATCH_MOUNTS")]
        const WATCH_MOUNTS = ffi::G_FILE_MONITOR_WATCH_MOUNTS as u32;
        /// Pair DELETED and CREATED events caused
        ///  by file renames (moves) and send a single G_FILE_MONITOR_EVENT_MOVED
        ///  event instead (NB: not supported on all backends; the default
        ///  behaviour -without specifying this flag- is to send single DELETED
        ///  and CREATED events). Deprecated since 2.46: use
        ///  [`WATCH_MOVES`][Self::WATCH_MOVES] instead.
        #[doc(alias = "G_FILE_MONITOR_SEND_MOVED")]
        const SEND_MOVED = ffi::G_FILE_MONITOR_SEND_MOVED as u32;
        /// Watch for changes to the file made
        ///  via another hard link. Since 2.36.
        #[doc(alias = "G_FILE_MONITOR_WATCH_HARD_LINKS")]
        const WATCH_HARD_LINKS = ffi::G_FILE_MONITOR_WATCH_HARD_LINKS as u32;
        /// Watch for rename operations on a
        ///  monitored directory. This causes [`FileMonitorEvent::Renamed`][crate::FileMonitorEvent::Renamed],
        ///  [`FileMonitorEvent::MovedIn`][crate::FileMonitorEvent::MovedIn] and [`FileMonitorEvent::MovedOut`][crate::FileMonitorEvent::MovedOut]
        ///  events to be emitted when possible. Since: 2.46.
        #[doc(alias = "G_FILE_MONITOR_WATCH_MOVES")]
        const WATCH_MOVES = ffi::G_FILE_MONITOR_WATCH_MOVES as u32;
    }
}

impl fmt::Display for FileMonitorFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FileMonitorFlags {
    type GlibType = ffi::GFileMonitorFlags;

    fn into_glib(self) -> ffi::GFileMonitorFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GFileMonitorFlags> for FileMonitorFlags {
    unsafe fn from_glib(value: ffi::GFileMonitorFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for FileMonitorFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_file_monitor_flags_get_type()) }
    }
}

impl glib::value::ValueType for FileMonitorFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for FileMonitorFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for FileMonitorFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when querying a [`FileInfo`][crate::FileInfo].
    #[doc(alias = "GFileQueryInfoFlags")]
    pub struct FileQueryInfoFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_FILE_QUERY_INFO_NONE")]
        const NONE = ffi::G_FILE_QUERY_INFO_NONE as u32;
        /// Don't follow symlinks.
        #[doc(alias = "G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS")]
        const NOFOLLOW_SYMLINKS = ffi::G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS as u32;
    }
}

impl fmt::Display for FileQueryInfoFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for FileQueryInfoFlags {
    type GlibType = ffi::GFileQueryInfoFlags;

    fn into_glib(self) -> ffi::GFileQueryInfoFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GFileQueryInfoFlags> for FileQueryInfoFlags {
    unsafe fn from_glib(value: ffi::GFileQueryInfoFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for FileQueryInfoFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_file_query_info_flags_get_type()) }
    }
}

impl glib::value::ValueType for FileQueryInfoFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for FileQueryInfoFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for FileQueryInfoFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// GIOStreamSpliceFlags determine how streams should be spliced.
    #[doc(alias = "GIOStreamSpliceFlags")]
    pub struct IOStreamSpliceFlags: u32 {
        /// Do not close either stream.
        #[doc(alias = "G_IO_STREAM_SPLICE_NONE")]
        const NONE = ffi::G_IO_STREAM_SPLICE_NONE as u32;
        /// Close the first stream after
        ///  the splice.
        #[doc(alias = "G_IO_STREAM_SPLICE_CLOSE_STREAM1")]
        const CLOSE_STREAM1 = ffi::G_IO_STREAM_SPLICE_CLOSE_STREAM1 as u32;
        /// Close the second stream after
        ///  the splice.
        #[doc(alias = "G_IO_STREAM_SPLICE_CLOSE_STREAM2")]
        const CLOSE_STREAM2 = ffi::G_IO_STREAM_SPLICE_CLOSE_STREAM2 as u32;
        /// Wait for both splice operations to finish
        ///  before calling the callback.
        #[doc(alias = "G_IO_STREAM_SPLICE_WAIT_FOR_BOTH")]
        const WAIT_FOR_BOTH = ffi::G_IO_STREAM_SPLICE_WAIT_FOR_BOTH as u32;
    }
}

impl fmt::Display for IOStreamSpliceFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for IOStreamSpliceFlags {
    type GlibType = ffi::GIOStreamSpliceFlags;

    fn into_glib(self) -> ffi::GIOStreamSpliceFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GIOStreamSpliceFlags> for IOStreamSpliceFlags {
    unsafe fn from_glib(value: ffi::GIOStreamSpliceFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for IOStreamSpliceFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_io_stream_splice_flags_get_type()) }
    }
}

impl glib::value::ValueType for IOStreamSpliceFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for IOStreamSpliceFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for IOStreamSpliceFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when mounting a mount.
    #[doc(alias = "GMountMountFlags")]
    pub struct MountMountFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_MOUNT_MOUNT_NONE")]
        const NONE = ffi::G_MOUNT_MOUNT_NONE as u32;
    }
}

impl fmt::Display for MountMountFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for MountMountFlags {
    type GlibType = ffi::GMountMountFlags;

    fn into_glib(self) -> ffi::GMountMountFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GMountMountFlags> for MountMountFlags {
    unsafe fn from_glib(value: ffi::GMountMountFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for MountMountFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_mount_mount_flags_get_type()) }
    }
}

impl glib::value::ValueType for MountMountFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for MountMountFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for MountMountFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when an unmounting a mount.
    #[doc(alias = "GMountUnmountFlags")]
    pub struct MountUnmountFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_MOUNT_UNMOUNT_NONE")]
        const NONE = ffi::G_MOUNT_UNMOUNT_NONE as u32;
        /// Unmount even if there are outstanding
        ///  file operations on the mount.
        #[doc(alias = "G_MOUNT_UNMOUNT_FORCE")]
        const FORCE = ffi::G_MOUNT_UNMOUNT_FORCE as u32;
    }
}

impl fmt::Display for MountUnmountFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for MountUnmountFlags {
    type GlibType = ffi::GMountUnmountFlags;

    fn into_glib(self) -> ffi::GMountUnmountFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GMountUnmountFlags> for MountUnmountFlags {
    unsafe fn from_glib(value: ffi::GMountUnmountFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for MountUnmountFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_mount_unmount_flags_get_type()) }
    }
}

impl glib::value::ValueType for MountUnmountFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for MountUnmountFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for MountUnmountFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// GOutputStreamSpliceFlags determine how streams should be spliced.
    #[doc(alias = "GOutputStreamSpliceFlags")]
    pub struct OutputStreamSpliceFlags: u32 {
        /// Do not close either stream.
        #[doc(alias = "G_OUTPUT_STREAM_SPLICE_NONE")]
        const NONE = ffi::G_OUTPUT_STREAM_SPLICE_NONE as u32;
        /// Close the source stream after
        ///  the splice.
        #[doc(alias = "G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE")]
        const CLOSE_SOURCE = ffi::G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE as u32;
        /// Close the target stream after
        ///  the splice.
        #[doc(alias = "G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET")]
        const CLOSE_TARGET = ffi::G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET as u32;
    }
}

impl fmt::Display for OutputStreamSpliceFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for OutputStreamSpliceFlags {
    type GlibType = ffi::GOutputStreamSpliceFlags;

    fn into_glib(self) -> ffi::GOutputStreamSpliceFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GOutputStreamSpliceFlags> for OutputStreamSpliceFlags {
    unsafe fn from_glib(value: ffi::GOutputStreamSpliceFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for OutputStreamSpliceFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_output_stream_splice_flags_get_type()) }
    }
}

impl glib::value::ValueType for OutputStreamSpliceFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for OutputStreamSpliceFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for OutputStreamSpliceFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

#[cfg(any(feature = "v2_60", feature = "dox"))]
bitflags! {
    /// Flags to modify lookup behavior.
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
    #[doc(alias = "GResolverNameLookupFlags")]
    pub struct ResolverNameLookupFlags: u32 {
        /// default behavior (same as [`ResolverExt::lookup_by_name()`][crate::prelude::ResolverExt::lookup_by_name()])
        #[doc(alias = "G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT")]
        const DEFAULT = ffi::G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT as u32;
        /// only resolve ipv4 addresses
        #[doc(alias = "G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY")]
        const IPV4_ONLY = ffi::G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY as u32;
        /// only resolve ipv6 addresses
        #[doc(alias = "G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY")]
        const IPV6_ONLY = ffi::G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY as u32;
    }
}

#[cfg(any(feature = "v2_60", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
impl fmt::Display for ResolverNameLookupFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[cfg(any(feature = "v2_60", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
#[doc(hidden)]
impl IntoGlib for ResolverNameLookupFlags {
    type GlibType = ffi::GResolverNameLookupFlags;

    fn into_glib(self) -> ffi::GResolverNameLookupFlags {
        self.bits()
    }
}

#[cfg(any(feature = "v2_60", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
#[doc(hidden)]
impl FromGlib<ffi::GResolverNameLookupFlags> for ResolverNameLookupFlags {
    unsafe fn from_glib(value: ffi::GResolverNameLookupFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

#[cfg(any(feature = "v2_60", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
impl StaticType for ResolverNameLookupFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_resolver_name_lookup_flags_get_type()) }
    }
}

#[cfg(any(feature = "v2_60", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
impl glib::value::ValueType for ResolverNameLookupFlags {
    type Type = Self;
}

#[cfg(any(feature = "v2_60", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
unsafe impl<'a> FromValue<'a> for ResolverNameLookupFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

#[cfg(any(feature = "v2_60", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_60")))]
impl ToValue for ResolverNameLookupFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// GResourceLookupFlags determine how resource path lookups are handled.
    #[doc(alias = "GResourceLookupFlags")]
    pub struct ResourceLookupFlags: u32 {
        /// No flags set.
        #[doc(alias = "G_RESOURCE_LOOKUP_FLAGS_NONE")]
        const NONE = ffi::G_RESOURCE_LOOKUP_FLAGS_NONE as u32;
    }
}

impl fmt::Display for ResourceLookupFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for ResourceLookupFlags {
    type GlibType = ffi::GResourceLookupFlags;

    fn into_glib(self) -> ffi::GResourceLookupFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GResourceLookupFlags> for ResourceLookupFlags {
    unsafe fn from_glib(value: ffi::GResourceLookupFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for ResourceLookupFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_resource_lookup_flags_get_type()) }
    }
}

impl glib::value::ValueType for ResourceLookupFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for ResourceLookupFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for ResourceLookupFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags used when creating a binding. These flags determine in which
    /// direction the binding works. The default is to synchronize in both
    /// directions.
    #[doc(alias = "GSettingsBindFlags")]
    pub struct SettingsBindFlags: u32 {
        /// Equivalent to `G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET`
        #[doc(alias = "G_SETTINGS_BIND_DEFAULT")]
        const DEFAULT = ffi::G_SETTINGS_BIND_DEFAULT as u32;
        /// Update the [`glib::Object`][crate::glib::Object] property when the setting changes.
        ///  It is an error to use this flag if the property is not writable.
        #[doc(alias = "G_SETTINGS_BIND_GET")]
        const GET = ffi::G_SETTINGS_BIND_GET as u32;
        /// Update the setting when the [`glib::Object`][crate::glib::Object] property changes.
        ///  It is an error to use this flag if the property is not readable.
        #[doc(alias = "G_SETTINGS_BIND_SET")]
        const SET = ffi::G_SETTINGS_BIND_SET as u32;
        /// Do not try to bind a "sensitivity" property to the writability of the setting
        #[doc(alias = "G_SETTINGS_BIND_NO_SENSITIVITY")]
        const NO_SENSITIVITY = ffi::G_SETTINGS_BIND_NO_SENSITIVITY as u32;
        /// When set in addition to [`GET`][Self::GET], set the [`glib::Object`][crate::glib::Object] property
        ///  value initially from the setting, but do not listen for changes of the setting
        #[doc(alias = "G_SETTINGS_BIND_GET_NO_CHANGES")]
        const GET_NO_CHANGES = ffi::G_SETTINGS_BIND_GET_NO_CHANGES as u32;
        /// When passed to [`SettingsExtManual::bind()`][crate::prelude::SettingsExtManual::bind()], uses a pair of mapping functions that invert
        ///  the boolean value when mapping between the setting and the property. The setting and property must both
        ///  be booleans. You cannot pass this flag to [`SettingsExtManual::bind_with_mapping()`][crate::prelude::SettingsExtManual::bind_with_mapping()].
        #[doc(alias = "G_SETTINGS_BIND_INVERT_BOOLEAN")]
        const INVERT_BOOLEAN = ffi::G_SETTINGS_BIND_INVERT_BOOLEAN as u32;
    }
}

impl fmt::Display for SettingsBindFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for SettingsBindFlags {
    type GlibType = ffi::GSettingsBindFlags;

    fn into_glib(self) -> ffi::GSettingsBindFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GSettingsBindFlags> for SettingsBindFlags {
    unsafe fn from_glib(value: ffi::GSettingsBindFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for SettingsBindFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_settings_bind_flags_get_type()) }
    }
}

impl glib::value::ValueType for SettingsBindFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for SettingsBindFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for SettingsBindFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags to define the behaviour of a [`Subprocess`][crate::Subprocess].
    ///
    /// Note that the default for stdin is to redirect from `/dev/null`. For
    /// stdout and stderr the default are for them to inherit the
    /// corresponding descriptor from the calling process.
    ///
    /// Note that it is a programmer error to mix 'incompatible' flags. For
    /// example, you may not request both [`STDOUT_PIPE`][Self::STDOUT_PIPE] and
    /// [`STDOUT_SILENCE`][Self::STDOUT_SILENCE].
    #[doc(alias = "GSubprocessFlags")]
    pub struct SubprocessFlags: u32 {
        /// No flags.
        #[doc(alias = "G_SUBPROCESS_FLAGS_NONE")]
        const NONE = ffi::G_SUBPROCESS_FLAGS_NONE as u32;
        /// create a pipe for the stdin of the
        ///  spawned process that can be accessed with
        ///  [`Subprocess::stdin_pipe()`][crate::Subprocess::stdin_pipe()].
        #[doc(alias = "G_SUBPROCESS_FLAGS_STDIN_PIPE")]
        const STDIN_PIPE = ffi::G_SUBPROCESS_FLAGS_STDIN_PIPE as u32;
        /// stdin is inherited from the
        ///  calling process.
        #[doc(alias = "G_SUBPROCESS_FLAGS_STDIN_INHERIT")]
        const STDIN_INHERIT = ffi::G_SUBPROCESS_FLAGS_STDIN_INHERIT as u32;
        /// create a pipe for the stdout of the
        ///  spawned process that can be accessed with
        ///  [`Subprocess::stdout_pipe()`][crate::Subprocess::stdout_pipe()].
        #[doc(alias = "G_SUBPROCESS_FLAGS_STDOUT_PIPE")]
        const STDOUT_PIPE = ffi::G_SUBPROCESS_FLAGS_STDOUT_PIPE as u32;
        /// silence the stdout of the spawned
        ///  process (ie: redirect to `/dev/null`).
        #[doc(alias = "G_SUBPROCESS_FLAGS_STDOUT_SILENCE")]
        const STDOUT_SILENCE = ffi::G_SUBPROCESS_FLAGS_STDOUT_SILENCE as u32;
        /// create a pipe for the stderr of the
        ///  spawned process that can be accessed with
        ///  [`Subprocess::stderr_pipe()`][crate::Subprocess::stderr_pipe()].
        #[doc(alias = "G_SUBPROCESS_FLAGS_STDERR_PIPE")]
        const STDERR_PIPE = ffi::G_SUBPROCESS_FLAGS_STDERR_PIPE as u32;
        /// silence the stderr of the spawned
        ///  process (ie: redirect to `/dev/null`).
        #[doc(alias = "G_SUBPROCESS_FLAGS_STDERR_SILENCE")]
        const STDERR_SILENCE = ffi::G_SUBPROCESS_FLAGS_STDERR_SILENCE as u32;
        /// merge the stderr of the spawned
        ///  process with whatever the stdout happens to be. This is a good way
        ///  of directing both streams to a common log file, for example.
        #[doc(alias = "G_SUBPROCESS_FLAGS_STDERR_MERGE")]
        const STDERR_MERGE = ffi::G_SUBPROCESS_FLAGS_STDERR_MERGE as u32;
        /// spawned processes will inherit the
        ///  file descriptors of their parent, unless those descriptors have
        ///  been explicitly marked as close-on-exec. This flag has no effect
        ///  over the "standard" file descriptors (stdin, stdout, stderr).
        #[doc(alias = "G_SUBPROCESS_FLAGS_INHERIT_FDS")]
        const INHERIT_FDS = ffi::G_SUBPROCESS_FLAGS_INHERIT_FDS as u32;
        /// if path searching is
        ///  needed when spawning the subprocess, use the `PATH` in the launcher
        ///  environment. (Since: 2.72)
        #[cfg(any(feature = "v2_72", feature = "dox"))]
        #[cfg_attr(feature = "dox", doc(cfg(feature = "v2_72")))]
        #[doc(alias = "G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP")]
        const SEARCH_PATH_FROM_ENVP = ffi::G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP as u32;
    }
}

impl fmt::Display for SubprocessFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for SubprocessFlags {
    type GlibType = ffi::GSubprocessFlags;

    fn into_glib(self) -> ffi::GSubprocessFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GSubprocessFlags> for SubprocessFlags {
    unsafe fn from_glib(value: ffi::GSubprocessFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for SubprocessFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_subprocess_flags_get_type()) }
    }
}

impl glib::value::ValueType for SubprocessFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for SubprocessFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for SubprocessFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// A set of flags describing TLS certification validation. This can be
    /// used to describe why a particular certificate was rejected (for
    /// example, in `signal::TlsConnection::accept-certificate`).
    ///
    /// GLib guarantees that if certificate verification fails, at least one
    /// flag will be set, but it does not guarantee that all possible flags
    /// will be set. Accordingly, you may not safely decide to ignore any
    /// particular type of error. For example, it would be incorrect to mask
    /// [`EXPIRED`][Self::EXPIRED] if you want to allow expired certificates,
    /// because this could potentially be the only error flag set even if
    /// other problems exist with the certificate.
    #[doc(alias = "GTlsCertificateFlags")]
    pub struct TlsCertificateFlags: u32 {
        /// The signing certificate authority is
        ///  not known.
        #[doc(alias = "G_TLS_CERTIFICATE_UNKNOWN_CA")]
        const UNKNOWN_CA = ffi::G_TLS_CERTIFICATE_UNKNOWN_CA as u32;
        /// The certificate does not match the
        ///  expected identity of the site that it was retrieved from.
        #[doc(alias = "G_TLS_CERTIFICATE_BAD_IDENTITY")]
        const BAD_IDENTITY = ffi::G_TLS_CERTIFICATE_BAD_IDENTITY as u32;
        /// The certificate's activation time
        ///  is still in the future
        #[doc(alias = "G_TLS_CERTIFICATE_NOT_ACTIVATED")]
        const NOT_ACTIVATED = ffi::G_TLS_CERTIFICATE_NOT_ACTIVATED as u32;
        /// The certificate has expired
        #[doc(alias = "G_TLS_CERTIFICATE_EXPIRED")]
        const EXPIRED = ffi::G_TLS_CERTIFICATE_EXPIRED as u32;
        /// The certificate has been revoked
        ///  according to the [`TlsConnection`][crate::TlsConnection]'s certificate revocation list.
        #[doc(alias = "G_TLS_CERTIFICATE_REVOKED")]
        const REVOKED = ffi::G_TLS_CERTIFICATE_REVOKED as u32;
        /// The certificate's algorithm is
        ///  considered insecure.
        #[doc(alias = "G_TLS_CERTIFICATE_INSECURE")]
        const INSECURE = ffi::G_TLS_CERTIFICATE_INSECURE as u32;
        /// Some other error occurred validating
        ///  the certificate
        #[doc(alias = "G_TLS_CERTIFICATE_GENERIC_ERROR")]
        const GENERIC_ERROR = ffi::G_TLS_CERTIFICATE_GENERIC_ERROR as u32;
        /// the combination of all of the above
        ///  flags
        #[doc(alias = "G_TLS_CERTIFICATE_VALIDATE_ALL")]
        const VALIDATE_ALL = ffi::G_TLS_CERTIFICATE_VALIDATE_ALL as u32;
    }
}

impl fmt::Display for TlsCertificateFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for TlsCertificateFlags {
    type GlibType = ffi::GTlsCertificateFlags;

    fn into_glib(self) -> ffi::GTlsCertificateFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GTlsCertificateFlags> for TlsCertificateFlags {
    unsafe fn from_glib(value: ffi::GTlsCertificateFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for TlsCertificateFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_tls_certificate_flags_get_type()) }
    }
}

impl glib::value::ValueType for TlsCertificateFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for TlsCertificateFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for TlsCertificateFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Flags for [`TlsDatabaseExt::verify_chain()`][crate::prelude::TlsDatabaseExt::verify_chain()].
    #[doc(alias = "GTlsDatabaseVerifyFlags")]
    pub struct TlsDatabaseVerifyFlags: u32 {
        /// No verification flags
        #[doc(alias = "G_TLS_DATABASE_VERIFY_NONE")]
        const NONE = ffi::G_TLS_DATABASE_VERIFY_NONE as u32;
    }
}

impl fmt::Display for TlsDatabaseVerifyFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for TlsDatabaseVerifyFlags {
    type GlibType = ffi::GTlsDatabaseVerifyFlags;

    fn into_glib(self) -> ffi::GTlsDatabaseVerifyFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GTlsDatabaseVerifyFlags> for TlsDatabaseVerifyFlags {
    unsafe fn from_glib(value: ffi::GTlsDatabaseVerifyFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for TlsDatabaseVerifyFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_tls_database_verify_flags_get_type()) }
    }
}

impl glib::value::ValueType for TlsDatabaseVerifyFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for TlsDatabaseVerifyFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for TlsDatabaseVerifyFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

bitflags! {
    /// Various flags for the password.
    #[doc(alias = "GTlsPasswordFlags")]
    pub struct TlsPasswordFlags: u32 {
        /// No flags
        #[doc(alias = "G_TLS_PASSWORD_NONE")]
        const NONE = ffi::G_TLS_PASSWORD_NONE as u32;
        /// The password was wrong, and the user should retry.
        #[doc(alias = "G_TLS_PASSWORD_RETRY")]
        const RETRY = ffi::G_TLS_PASSWORD_RETRY as u32;
        /// Hint to the user that the password has been
        ///  wrong many times, and the user may not have many chances left.
        #[doc(alias = "G_TLS_PASSWORD_MANY_TRIES")]
        const MANY_TRIES = ffi::G_TLS_PASSWORD_MANY_TRIES as u32;
        /// Hint to the user that this is the last try to get
        ///  this password right.
        #[doc(alias = "G_TLS_PASSWORD_FINAL_TRY")]
        const FINAL_TRY = ffi::G_TLS_PASSWORD_FINAL_TRY as u32;
        /// For PKCS `11`, the user PIN is required.
        ///  Since: 2.70.
        #[doc(alias = "G_TLS_PASSWORD_PKCS11_USER")]
        const PKCS11_USER = ffi::G_TLS_PASSWORD_PKCS11_USER as u32;
        /// For PKCS `11`, the security officer
        ///  PIN is required. Since: 2.70.
        #[doc(alias = "G_TLS_PASSWORD_PKCS11_SECURITY_OFFICER")]
        const PKCS11_SECURITY_OFFICER = ffi::G_TLS_PASSWORD_PKCS11_SECURITY_OFFICER as u32;
        /// For PKCS `11`, the context-specific
        ///  PIN is required. Since: 2.70.
        #[doc(alias = "G_TLS_PASSWORD_PKCS11_CONTEXT_SPECIFIC")]
        const PKCS11_CONTEXT_SPECIFIC = ffi::G_TLS_PASSWORD_PKCS11_CONTEXT_SPECIFIC as u32;
    }
}

impl fmt::Display for TlsPasswordFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

#[doc(hidden)]
impl IntoGlib for TlsPasswordFlags {
    type GlibType = ffi::GTlsPasswordFlags;

    fn into_glib(self) -> ffi::GTlsPasswordFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GTlsPasswordFlags> for TlsPasswordFlags {
    unsafe fn from_glib(value: ffi::GTlsPasswordFlags) -> Self {
        Self::from_bits_truncate(value)
    }
}

impl StaticType for TlsPasswordFlags {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::g_tls_password_flags_get_type()) }
    }
}

impl glib::value::ValueType for TlsPasswordFlags {
    type Type = Self;
}

unsafe impl<'a> FromValue<'a> for TlsPasswordFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    unsafe fn from_value(value: &'a glib::Value) -> Self {
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for TlsPasswordFlags {
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}