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

Commit 9b355ca

Browse files
Generate bindings for atk::Live enum with correct version
1 parent e933792 commit 9b355ca

File tree

5 files changed

+149
-0
lines changed

5 files changed

+149
-0
lines changed

atk/Gir.toml

+5
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ name = "Atk.Image"
8787
status = "generate"
8888
trait_name = "AtkImageExt" # duplicate with gtk
8989

90+
[[object]]
91+
name = "Atk.Live"
92+
status = "generate"
93+
version = "2.50"
94+
9095
[[object]]
9196
name = "Atk.Misc"
9297
status = "generate"

atk/src/auto/enums.rs

+134
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,140 @@ impl From<Layer> for glib::Value {
258258
}
259259
}
260260

261+
#[cfg(feature = "v2_50")]
262+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
263+
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
264+
#[non_exhaustive]
265+
#[doc(alias = "AtkLive")]
266+
pub enum Live {
267+
#[doc(alias = "ATK_LIVE_NONE")]
268+
None,
269+
#[doc(alias = "ATK_LIVE_POLITE")]
270+
Polite,
271+
#[doc(alias = "ATK_LIVE_ASSERTIVE")]
272+
Assertive,
273+
#[doc(hidden)]
274+
__Unknown(i32),
275+
}
276+
277+
#[cfg(feature = "v2_50")]
278+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
279+
impl fmt::Display for Live {
280+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
281+
write!(
282+
f,
283+
"Live::{}",
284+
match *self {
285+
Self::None => "None",
286+
Self::Polite => "Polite",
287+
Self::Assertive => "Assertive",
288+
_ => "Unknown",
289+
}
290+
)
291+
}
292+
}
293+
294+
#[cfg(feature = "v2_50")]
295+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
296+
#[doc(hidden)]
297+
impl IntoGlib for Live {
298+
type GlibType = ffi::AtkLive;
299+
300+
#[inline]
301+
fn into_glib(self) -> ffi::AtkLive {
302+
match self {
303+
Self::None => ffi::ATK_LIVE_NONE,
304+
Self::Polite => ffi::ATK_LIVE_POLITE,
305+
Self::Assertive => ffi::ATK_LIVE_ASSERTIVE,
306+
Self::__Unknown(value) => value,
307+
}
308+
}
309+
}
310+
311+
#[cfg(feature = "v2_50")]
312+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
313+
#[doc(hidden)]
314+
impl FromGlib<ffi::AtkLive> for Live {
315+
#[inline]
316+
unsafe fn from_glib(value: ffi::AtkLive) -> Self {
317+
skip_assert_initialized!();
318+
319+
match value {
320+
ffi::ATK_LIVE_NONE => Self::None,
321+
ffi::ATK_LIVE_POLITE => Self::Polite,
322+
ffi::ATK_LIVE_ASSERTIVE => Self::Assertive,
323+
value => Self::__Unknown(value),
324+
}
325+
}
326+
}
327+
328+
#[cfg(feature = "v2_50")]
329+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
330+
impl StaticType for Live {
331+
#[inline]
332+
fn static_type() -> glib::Type {
333+
unsafe { from_glib(ffi::atk_live_get_type()) }
334+
}
335+
}
336+
337+
#[cfg(feature = "v2_50")]
338+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
339+
impl glib::HasParamSpec for Live {
340+
type ParamSpec = glib::ParamSpecEnum;
341+
type SetValue = Self;
342+
type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
343+
344+
fn param_spec_builder() -> Self::BuilderFn {
345+
|name, default_value| Self::ParamSpec::builder_with_default(name, default_value)
346+
}
347+
}
348+
349+
#[cfg(feature = "v2_50")]
350+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
351+
impl glib::value::ValueType for Live {
352+
type Type = Self;
353+
}
354+
355+
#[cfg(feature = "v2_50")]
356+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
357+
unsafe impl<'a> glib::value::FromValue<'a> for Live {
358+
type Checker = glib::value::GenericValueTypeChecker<Self>;
359+
360+
#[inline]
361+
unsafe fn from_value(value: &'a glib::Value) -> Self {
362+
skip_assert_initialized!();
363+
from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
364+
}
365+
}
366+
367+
#[cfg(feature = "v2_50")]
368+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
369+
impl ToValue for Live {
370+
#[inline]
371+
fn to_value(&self) -> glib::Value {
372+
let mut value = glib::Value::for_value_type::<Self>();
373+
unsafe {
374+
glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
375+
}
376+
value
377+
}
378+
379+
#[inline]
380+
fn value_type(&self) -> glib::Type {
381+
Self::static_type()
382+
}
383+
}
384+
385+
#[cfg(feature = "v2_50")]
386+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
387+
impl From<Live> for glib::Value {
388+
#[inline]
389+
fn from(v: Live) -> Self {
390+
skip_assert_initialized!();
391+
ToValue::to_value(&v)
392+
}
393+
}
394+
261395
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
262396
#[non_exhaustive]
263397
#[doc(alias = "AtkRelationType")]

atk/src/auto/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ pub use self::text_range::TextRange;
9898
mod enums;
9999
pub use self::enums::CoordType;
100100
pub use self::enums::Layer;
101+
#[cfg(feature = "v2_50")]
102+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
103+
pub use self::enums::Live;
101104
pub use self::enums::RelationType;
102105
pub use self::enums::Role;
103106
#[cfg(feature = "v2_30")]

atk/sys/Gir.toml

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ extra_versions = [
2424
"2.38"
2525
]
2626

27+
[[object]]
28+
name = "Atk.Live"
29+
status = "generate"
30+
version = "2.50"
31+
2732
[[object]]
2833
name = "Atk.StateType"
2934
status = "generate"

atk/sys/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,8 @@ extern "C" {
18271827
//=========================================================================
18281828
// AtkLive
18291829
//=========================================================================
1830+
#[cfg(feature = "v2_50")]
1831+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_50")))]
18301832
pub fn atk_live_get_type() -> GType;
18311833

18321834
//=========================================================================

0 commit comments

Comments
 (0)