Skip to content

Commit

Permalink
gtk: manually implement MediaStream::gerror
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Mar 11, 2021
1 parent 970d1bb commit ceab392
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
5 changes: 1 addition & 4 deletions gtk4/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
11 changes: 0 additions & 11 deletions gtk4/src/auto/media_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<glib::Error>;

#[doc(alias = "gtk_media_stream_get_loop")]
fn get_loop(&self) -> bool;

Expand Down Expand Up @@ -165,14 +162,6 @@ impl<O: IsA<MediaStream>> MediaStreamExt for O {
}
}

fn get_error(&self) -> Option<glib::Error> {
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(
Expand Down
12 changes: 12 additions & 0 deletions gtk4/src/media_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<O: IsA<MediaStream>> MediaStreamExtManual for O {
Expand All @@ -20,4 +23,13 @@ impl<O: IsA<MediaStream>> 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()),
);
}
}
}

0 comments on commit ceab392

Please sign in to comment.