Skip to content

Commit deb2b5e

Browse files
committed
Fix Gtk enum property types for older Gtk 3 versions
It appears that older Gtk 3 versions don't accept G_TYPE_ENUM as a valid GValue type because they consider it to be abstract, so we have to dynamically fetch the type of each enum with the corresponding 'gtk_my_enum_get_type()' functions.
1 parent e59d91e commit deb2b5e

File tree

177 files changed

+758
-368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+758
-368
lines changed

Sources/Gtk/Generated/AccessibleAutocomplete.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ public enum AccessibleAutocomplete: GValueRepresentableEnum {
2222
/// appears after the caret in the input.
2323
case both
2424

25-
/// Converts a Gtk value to its corresponding swift representation.
25+
public static var type: GType {
26+
gtk_accessible_autocomplete_get_type()
27+
}
28+
2629
public init(from gtkEnum: GtkAccessibleAutocomplete) {
2730
switch gtkEnum {
2831
case GTK_ACCESSIBLE_AUTOCOMPLETE_NONE:
@@ -38,7 +41,6 @@ public enum AccessibleAutocomplete: GValueRepresentableEnum {
3841
}
3942
}
4043

41-
/// Converts the value to its corresponding Gtk representation.
4244
public func toGtk() -> GtkAccessibleAutocomplete {
4345
switch self {
4446
case .none:

Sources/Gtk/Generated/AccessibleInvalidState.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ public enum AccessibleInvalidState: GValueRepresentableEnum {
1818
/// A spelling error was detected
1919
case spelling
2020

21-
/// Converts a Gtk value to its corresponding swift representation.
21+
public static var type: GType {
22+
gtk_accessible_invalid_state_get_type()
23+
}
24+
2225
public init(from gtkEnum: GtkAccessibleInvalidState) {
2326
switch gtkEnum {
2427
case GTK_ACCESSIBLE_INVALID_FALSE:
@@ -34,7 +37,6 @@ public enum AccessibleInvalidState: GValueRepresentableEnum {
3437
}
3538
}
3639

37-
/// Converts the value to its corresponding Gtk representation.
3840
public func toGtk() -> GtkAccessibleInvalidState {
3941
switch self {
4042
case .false_:

Sources/Gtk/Generated/AccessibleProperty.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ public enum AccessibleProperty: GValueRepresentableEnum {
7070
/// of aria-valuenow for a range widget. Value type: string
7171
case valueText
7272

73-
/// Converts a Gtk value to its corresponding swift representation.
73+
public static var type: GType {
74+
gtk_accessible_property_get_type()
75+
}
76+
7477
public init(from gtkEnum: GtkAccessibleProperty) {
7578
switch gtkEnum {
7679
case GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE:
@@ -116,7 +119,6 @@ public enum AccessibleProperty: GValueRepresentableEnum {
116119
}
117120
}
118121

119-
/// Converts the value to its corresponding Gtk representation.
120122
public func toGtk() -> GtkAccessibleProperty {
121123
switch self {
122124
case .autocomplete:

Sources/Gtk/Generated/AccessibleRelation.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ public enum AccessibleRelation: GValueRepresentableEnum {
6969
/// set of listitems or treeitems. Value type: integer
7070
case setSize
7171

72-
/// Converts a Gtk value to its corresponding swift representation.
72+
public static var type: GType {
73+
gtk_accessible_relation_get_type()
74+
}
75+
7376
public init(from gtkEnum: GtkAccessibleRelation) {
7477
switch gtkEnum {
7578
case GTK_ACCESSIBLE_RELATION_ACTIVE_DESCENDANT:
@@ -113,7 +116,6 @@ public enum AccessibleRelation: GValueRepresentableEnum {
113116
}
114117
}
115118

116-
/// Converts the value to its corresponding Gtk representation.
117119
public func toGtk() -> GtkAccessibleRelation {
118120
switch self {
119121
case .activeDescendant:

Sources/Gtk/Generated/AccessibleRole.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ public enum AccessibleRole: GValueRepresentableEnum {
188188
/// Abstract role for windows.
189189
case window
190190

191-
/// Converts a Gtk value to its corresponding swift representation.
191+
public static var type: GType {
192+
gtk_accessible_role_get_type()
193+
}
194+
192195
public init(from gtkEnum: GtkAccessibleRole) {
193196
switch gtkEnum {
194197
case GTK_ACCESSIBLE_ROLE_ALERT:
@@ -352,7 +355,6 @@ public enum AccessibleRole: GValueRepresentableEnum {
352355
}
353356
}
354357

355-
/// Converts the value to its corresponding Gtk representation.
356358
public func toGtk() -> GtkAccessibleRole {
357359
switch self {
358360
case .alert:

Sources/Gtk/Generated/AccessibleSort.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ public enum AccessibleSort: GValueRepresentableEnum {
1515
/// descending has been applied.
1616
case other
1717

18-
/// Converts a Gtk value to its corresponding swift representation.
18+
public static var type: GType {
19+
gtk_accessible_sort_get_type()
20+
}
21+
1922
public init(from gtkEnum: GtkAccessibleSort) {
2023
switch gtkEnum {
2124
case GTK_ACCESSIBLE_SORT_NONE:
@@ -31,7 +34,6 @@ public enum AccessibleSort: GValueRepresentableEnum {
3134
}
3235
}
3336

34-
/// Converts the value to its corresponding Gtk representation.
3537
public func toGtk() -> GtkAccessibleSort {
3638
switch self {
3739
case .none:

Sources/Gtk/Generated/AccessibleState.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ public enum AccessibleState: GValueRepresentableEnum {
3434
/// is selected. Value type: boolean or undefined
3535
case selected
3636

37-
/// Converts a Gtk value to its corresponding swift representation.
37+
public static var type: GType {
38+
gtk_accessible_state_get_type()
39+
}
40+
3841
public init(from gtkEnum: GtkAccessibleState) {
3942
switch gtkEnum {
4043
case GTK_ACCESSIBLE_STATE_BUSY:
@@ -58,7 +61,6 @@ public enum AccessibleState: GValueRepresentableEnum {
5861
}
5962
}
6063

61-
/// Converts the value to its corresponding Gtk representation.
6264
public func toGtk() -> GtkAccessibleState {
6365
switch self {
6466
case .busy:

Sources/Gtk/Generated/AccessibleTristate.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ public enum AccessibleTristate: GValueRepresentableEnum {
1616
/// The state is `mixed`
1717
case mixed
1818

19-
/// Converts a Gtk value to its corresponding swift representation.
19+
public static var type: GType {
20+
gtk_accessible_tristate_get_type()
21+
}
22+
2023
public init(from gtkEnum: GtkAccessibleTristate) {
2124
switch gtkEnum {
2225
case GTK_ACCESSIBLE_TRISTATE_FALSE:
@@ -30,7 +33,6 @@ public enum AccessibleTristate: GValueRepresentableEnum {
3033
}
3134
}
3235

33-
/// Converts the value to its corresponding Gtk representation.
3436
public func toGtk() -> GtkAccessibleTristate {
3537
switch self {
3638
case .false_:

Sources/Gtk/Generated/Align.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ public enum Align: GValueRepresentableEnum {
3131
/// Align the widget according to the baseline.
3232
case baseline
3333

34-
/// Converts a Gtk value to its corresponding swift representation.
34+
public static var type: GType {
35+
gtk_align_get_type()
36+
}
37+
3538
public init(from gtkEnum: GtkAlign) {
3639
switch gtkEnum {
3740
case GTK_ALIGN_FILL:
@@ -49,7 +52,6 @@ public enum Align: GValueRepresentableEnum {
4952
}
5053
}
5154

52-
/// Converts the value to its corresponding Gtk representation.
5355
public func toGtk() -> GtkAlign {
5456
switch self {
5557
case .fill:

Sources/Gtk/Generated/ArrowType.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ public enum ArrowType: GValueRepresentableEnum {
1515
/// No arrow.
1616
case none
1717

18-
/// Converts a Gtk value to its corresponding swift representation.
18+
public static var type: GType {
19+
gtk_arrow_type_get_type()
20+
}
21+
1922
public init(from gtkEnum: GtkArrowType) {
2023
switch gtkEnum {
2124
case GTK_ARROW_UP:
@@ -33,7 +36,6 @@ public enum ArrowType: GValueRepresentableEnum {
3336
}
3437
}
3538

36-
/// Converts the value to its corresponding Gtk representation.
3739
public func toGtk() -> GtkArrowType {
3840
switch self {
3941
case .up:

0 commit comments

Comments
 (0)