From ceab392e71e9d1fd24d47b3b8438c7989c5d1904 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Thu, 11 Mar 2021 11:55:16 +0100 Subject: [PATCH] gtk: manually implement MediaStream::gerror --- gtk4/Gir.toml | 5 +---- gtk4/src/auto/media_stream.rs | 11 ----------- gtk4/src/media_stream.rs | 12 ++++++++++++ 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/gtk4/Gir.toml b/gtk4/Gir.toml index 775f3c374ae6..0ce87e1d5f47 100644 --- a/gtk4/Gir.toml +++ b/gtk4/Gir.toml @@ -1390,14 +1390,11 @@ generate_builder = true name = "Gtk.MediaStream" status = "generate" manual_traits = ["MediaStreamExtManual"] - [[object.function]] - name = "gerror" - ignore = true # TODO: figure out error's ownership [[object.function]] name = "error_valist" ignore = true # not useful for bindings [[object.function]] - name = "error" + pattern = "gerror|error" manual = true [[object]] diff --git a/gtk4/src/auto/media_stream.rs b/gtk4/src/auto/media_stream.rs index a056687fcfa5..7212774eaea2 100644 --- a/gtk4/src/auto/media_stream.rs +++ b/gtk4/src/auto/media_stream.rs @@ -32,9 +32,6 @@ pub trait MediaStreamExt: 'static { #[doc(alias = "gtk_media_stream_get_ended")] fn get_ended(&self) -> bool; - #[doc(alias = "gtk_media_stream_get_error")] - fn get_error(&self) -> Option; - #[doc(alias = "gtk_media_stream_get_loop")] fn get_loop(&self) -> bool; @@ -165,14 +162,6 @@ impl> MediaStreamExt for O { } } - fn get_error(&self) -> Option { - unsafe { - from_glib_none(ffi::gtk_media_stream_get_error( - self.as_ref().to_glib_none().0, - )) - } - } - fn get_loop(&self) -> bool { unsafe { from_glib(ffi::gtk_media_stream_get_loop( diff --git a/gtk4/src/media_stream.rs b/gtk4/src/media_stream.rs index 3a634f47f2f3..b4a98832c950 100644 --- a/gtk4/src/media_stream.rs +++ b/gtk4/src/media_stream.rs @@ -7,6 +7,9 @@ use glib::IsA; pub trait MediaStreamExtManual: 'static { #[doc(alias = "gtk_media_stream_error")] fn error(&self, domain: glib::Quark, code: i32, message: &str); + + #[doc(alias = "gtk_media_stream_gerror")] + fn gerror(&self, error: &glib::Error); } impl> MediaStreamExtManual for O { @@ -20,4 +23,13 @@ impl> MediaStreamExtManual for O { ) } } + + fn gerror(&self, error: &glib::Error) { + unsafe { + ffi::gtk_media_stream_gerror( + self.as_ref().to_glib_none().0, + mut_override(error.to_glib_full()), + ); + } + } }