gtk-rs / gir

Tool to generate rust bindings and user API for glib-based libraries
https://gtk-rs.org/gir/book/
MIT License
236 stars 107 forks source link

Failure to ignore a class when passed in a container #201

Closed gkoz closed 8 years ago

gkoz commented 8 years ago
[options]
girs_dir = "gir-files"
library = "Gio"
version = "2.0"
min_cfg_version = "2.32"
target_path = "."
work_mode = "normal"
external_libraries = [
    "GLib",
    "GObject",
]

generate = [
    "Gio.AppInfo",
    "Gio.AppLaunchContext",
]
    pub fn get_display<T: IsA<AppInfo>>(&self, info: &T, files: &[File]) -> Option<String> {
        unsafe {
            from_glib_full(ffi::g_app_launch_context_get_display(self.to_glib_none().0, info.to_glib_none().0, files.to_glib_none().0))
        }
    }
EPashkin commented 8 years ago

Its really normal. GFile belong to Gio and so don't checked for ignored as we though that all other classes in MAIN_NAMESPACE will be manual. https://github.com/gtk-rs/gir/blob/master/src/analysis/rust_type.rs#L92-L101. We can add checks in MAIN_NAMESPACE also, but then we need add many manuals to .gir.

gkoz commented 8 years ago

I haven't ever noticed a manual default for classes and the relevant piece seems https://github.com/gtk-rs/gir/blob/7446646734536d4c072d750219e1c04f7d3013be/src/analysis/rust_type.rs#L177-L198 wherein ignored classes in parameters return error but not inside a container. Perhaps the check on line 180 should be moved to the rust_type_full function.

EPashkin commented 8 years ago

Manual not defaults for object in main namespace, it just not checked for ignored in rust_type_full. Argee that adding `/Ignored/ better placed there.