Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit 818121b

Browse files
committed
Manually bind ParamFlags
Remove meaningless flags and add user-defined flags.
1 parent 4d3d370 commit 818121b

File tree

5 files changed

+45
-42
lines changed

5 files changed

+45
-42
lines changed

glib/Gir_GObject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ trust_return_value_nullability = true
1212

1313
generate = [
1414
"GObject.BindingFlags",
15-
"GObject.ParamFlags",
1615
"GObject.SignalFlags",
1716
]
1817

@@ -22,6 +21,7 @@ ignore = [
2221
manual = [
2322
"GObject.Object",
2423
"GObject.Value",
24+
"GObject.ParamFlags",
2525
]
2626

2727
[[object]]

glib/src/gobject/auto/flags.rs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -68,45 +68,6 @@ impl SetValue for BindingFlags {
6868
}
6969
}
7070

71-
bitflags! {
72-
pub struct ParamFlags: u32 {
73-
const READABLE = 1;
74-
const WRITABLE = 2;
75-
const READWRITE = 3;
76-
const CONSTRUCT = 4;
77-
const CONSTRUCT_ONLY = 8;
78-
const LAX_VALIDATION = 16;
79-
const STATIC_NAME = 32;
80-
const PRIVATE = 32;
81-
const STATIC_NICK = 64;
82-
const STATIC_BLURB = 128;
83-
const EXPLICIT_NOTIFY = 1073741824;
84-
const DEPRECATED = 2147483648;
85-
}
86-
}
87-
88-
impl fmt::Display for ParamFlags {
89-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
90-
<Self as fmt::Debug>::fmt(self, f)
91-
}
92-
}
93-
94-
#[doc(hidden)]
95-
impl ToGlib for ParamFlags {
96-
type GlibType = gobject_ffi::GParamFlags;
97-
98-
fn to_glib(&self) -> gobject_ffi::GParamFlags {
99-
self.bits()
100-
}
101-
}
102-
103-
#[doc(hidden)]
104-
impl FromGlib<gobject_ffi::GParamFlags> for ParamFlags {
105-
unsafe fn from_glib(value: gobject_ffi::GParamFlags) -> ParamFlags {
106-
ParamFlags::from_bits_truncate(value)
107-
}
108-
}
109-
11071
bitflags! {
11172
pub struct SignalFlags: u32 {
11273
const RUN_FIRST = 1;

glib/src/gobject/auto/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pub use self::binding::Binding;
77

88
mod flags;
99
pub use self::flags::BindingFlags;
10-
pub use self::flags::ParamFlags;
1110
pub use self::flags::SignalFlags;
1211

1312
#[doc(hidden)]

glib/src/gobject/flags.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Take a look at the license at the top of the repository in the LICENSE file.
2+
3+
use crate::translate::*;
4+
5+
bitflags::bitflags! {
6+
pub struct ParamFlags: u32 {
7+
const READABLE = 1;
8+
const WRITABLE = 2;
9+
const READWRITE = 3;
10+
const CONSTRUCT = 4;
11+
const CONSTRUCT_ONLY = 8;
12+
const LAX_VALIDATION = 16;
13+
const USER_0 = 128;
14+
const USER_1 = 256;
15+
const USER_2 = 1024;
16+
const USER_3 = 2048;
17+
const USER_4 = 4096;
18+
const USER_5 = 8192;
19+
const USER_6 = 16384;
20+
const USER_7 = 32768;
21+
const USER_8 = 65536;
22+
const EXPLICIT_NOTIFY = 1073741824;
23+
const DEPRECATED = 2147483648;
24+
}
25+
}
26+
27+
#[doc(hidden)]
28+
impl ToGlib for ParamFlags {
29+
type GlibType = gobject_ffi::GParamFlags;
30+
31+
fn to_glib(&self) -> gobject_ffi::GParamFlags {
32+
self.bits()
33+
}
34+
}
35+
36+
#[doc(hidden)]
37+
impl FromGlib<gobject_ffi::GParamFlags> for ParamFlags {
38+
unsafe fn from_glib(value: gobject_ffi::GParamFlags) -> ParamFlags {
39+
ParamFlags::from_bits_truncate(value)
40+
}
41+
}

glib/src/gobject/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
//! GObject bindings
44
5-
pub mod auto;
5+
mod auto;
66
mod binding;
7+
mod flags;
78

89
pub use self::auto::*;
10+
pub use self::flags::*;
911
//pub use self::auto::functions::*;

0 commit comments

Comments
 (0)