Rename ObjectExt trait to GstObjectExt

This works around a bug in the compiler with multiple traits having the
same name, but being re-exported with a different one.

https://github.com/gtk-rs/glib/issues/211
This commit is contained in:
Sebastian Dröge 2017-08-01 14:04:42 +01:00
parent 38496eca7d
commit e55c7d4088
8 changed files with 14 additions and 12 deletions

View file

@ -271,7 +271,8 @@ status = "generate"
[[object]] [[object]]
name = "Gst.Object" name = "Gst.Object"
status = "generate" # For renaming the trait...
status = "manual"
[[object.function]] [[object.function]]
name = "set_name" name = "set_name"
[object.function.return] [object.function.return]

View file

@ -2,7 +2,7 @@ extern crate gstreamer as gst;
use gst::*; use gst::*;
extern crate glib; extern crate glib;
use glib::ObjectExt; use glib::*;
use std::env; use std::env;
use std::u64; use std::u64;

View file

@ -3,7 +3,6 @@ use gst::*;
extern crate glib; extern crate glib;
use glib::*; use glib::*;
use glib::ObjectExt;
extern crate gtk; extern crate gtk;
use gtk::prelude::*; use gtk::prelude::*;

View file

@ -2,7 +2,7 @@ extern crate gstreamer as gst;
use gst::*; use gst::*;
extern crate glib; extern crate glib;
use glib::ObjectExt; use glib::*;
use std::env; use std::env;
use std::u64; use std::u64;

View file

@ -43,10 +43,6 @@ mod ghost_pad;
pub use self::ghost_pad::GhostPad; pub use self::ghost_pad::GhostPad;
pub use self::ghost_pad::GhostPadExt; pub use self::ghost_pad::GhostPadExt;
mod object;
pub use self::object::Object;
pub use self::object::ObjectExt;
mod pad; mod pad;
pub use self::pad::Pad; pub use self::pad::Pad;
pub use self::pad::PadExt; pub use self::pad::PadExt;
@ -218,7 +214,6 @@ pub mod traits {
pub use super::DeviceProviderFactoryExt; pub use super::DeviceProviderFactoryExt;
pub use super::ElementExt; pub use super::ElementExt;
pub use super::GhostPadExt; pub use super::GhostPadExt;
pub use super::ObjectExt;
pub use super::PadExt; pub use super::PadExt;
pub use super::PadTemplateExt; pub use super::PadTemplateExt;
pub use super::PipelineExt; pub use super::PipelineExt;

View file

@ -52,6 +52,12 @@ impl Plugin {
} }
} }
pub fn get_name(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_plugin_get_name(self.to_glib_none().0))
}
}
pub fn get_origin(&self) -> Option<String> { pub fn get_origin(&self) -> Option<String> {
unsafe { unsafe {
from_glib_none(ffi::gst_plugin_get_origin(self.to_glib_none().0)) from_glib_none(ffi::gst_plugin_get_origin(self.to_glib_none().0))

View file

@ -47,7 +47,6 @@ mod auto;
pub use auto::*; pub use auto::*;
pub use auto::traits::*; pub use auto::traits::*;
pub use auto::functions::{parse_bin_from_description, parse_launch}; pub use auto::functions::{parse_bin_from_description, parse_launch};
pub use auto::traits::ObjectExt as GstObjectExt;
pub mod miniobject; pub mod miniobject;
pub use miniobject::GstRc; pub use miniobject::GstRc;
@ -71,6 +70,7 @@ pub use query::{Query, QueryRef, QueryView};
pub mod event; pub mod event;
pub use event::{Event, EventRef, EventView}; pub use event::{Event, EventRef, EventView};
mod object;
mod element; mod element;
mod bin; mod bin;
mod bus; mod bus;
@ -81,6 +81,7 @@ mod ghost_pad;
mod child_proxy; mod child_proxy;
mod tag_setter; mod tag_setter;
mod iterator; mod iterator;
pub use object::{Object, GstObjectExt};
pub use element::ElementExtManual; pub use element::ElementExtManual;
pub use bin::BinExtManual; pub use bin::BinExtManual;
pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo, PAD_PROBE_ID_INVALID}; pub use pad::{PadExtManual, PadProbeData, PadProbeId, PadProbeInfo, PAD_PROBE_ID_INVALID};

View file

@ -44,7 +44,7 @@ impl Object {
unsafe impl Send for Object {} unsafe impl Send for Object {}
unsafe impl Sync for Object {} unsafe impl Sync for Object {}
pub trait ObjectExt { pub trait GstObjectExt {
//fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool; //fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool;
fn default_error<'a, P: Into<Option<&'a str>>>(&self, error: &Error, debug: P); fn default_error<'a, P: Into<Option<&'a str>>>(&self, error: &Error, debug: P);
@ -94,7 +94,7 @@ pub trait ObjectExt {
//fn connect_deep_notify<Unsupported or ignored types>(&self, f: F) -> u64; //fn connect_deep_notify<Unsupported or ignored types>(&self, f: F) -> u64;
} }
impl<O: IsA<Object>> ObjectExt for O { impl<O: IsA<Object>> GstObjectExt for O {
//fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool { //fn add_control_binding(&self, binding: /*Ignored*/&ControlBinding) -> bool {
// unsafe { TODO: call ffi::gst_object_add_control_binding() } // unsafe { TODO: call ffi::gst_object_add_control_binding() }
//} //}