Closed bvinc closed 6 years ago
@bvinc Sorry for long wait for review.
Thanks for PR, but now this type of error better solved by patching .gir files. Ex. adding to https://github.com/gtk-rs/gir-files/blob/master/fix.sh this
xmlstarlet ed -P -L \
-u '//_:class[@name="IconTheme"]/_:method//_:parameter[@name="icon_names"]/_:array/@c:type' -v "gchar const* *" \
Gtk-3.0.gir
can fix generation 2 function in sys
pub fn gtk_icon_theme_choose_icon(icon_theme: *mut GtkIconTheme, icon_names: *mut *const c_char, size: c_int, flags: GtkIconLookupFlags) -> *mut GtkIconInfo;
pub fn gtk_icon_theme_choose_icon_for_scale(icon_theme: *mut GtkIconTheme, icon_names: *mut *const c_char, size: c_int, scale: c_int, flags: GtkIconLookupFlags) -> *mut GtkIconInfo;
and allow generate functions in gtk
fn choose_icon(&self, icon_names: &[&str], size: i32, flags: IconLookupFlags) -> Option<IconInfo> {
unsafe {
from_glib_full(ffi::gtk_icon_theme_choose_icon(self.to_glib_none().0, icon_names.to_glib_none().0, size, flags.to_glib()))
}
}
#[cfg(any(feature = "v3_10", feature = "dox"))]
fn choose_icon_for_scale(&self, icon_names: &[&str], size: i32, scale: i32, flags: IconLookupFlags) -> Option<IconInfo> {
unsafe {
from_glib_full(ffi::gtk_icon_theme_choose_icon_for_scale(self.to_glib_none().0, icon_names.to_glib_none().0, size, scale, flags.to_glib()))
}
}
PS. It better be "gchar const const" in .gir, but glib need fix for support it too.
Edit: fixed sys functions, it was actually *mut *const c_char
, same as in this PR
Fixed with gtk-rs/gir-files#23
@bvinc So you don't want update this PR with right version? 😉
Issue #92
These sys functions have the wrong definition because the GIR files have incorrect array tags due to issue 189 in gi-introspection. It occurs when the C function definition uses the
[]
operator in a parameter. I've searched through header files and these are the only functions that I could find. It's possible that I missed some though.