Skip to content

Don't skip Option for nullable collections #2064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gdk4-macos/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
2 changes: 1 addition & 1 deletion gdk4-macos/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
2 changes: 1 addition & 1 deletion gdk4-wayland/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
2 changes: 1 addition & 1 deletion gdk4-wayland/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
2 changes: 1 addition & 1 deletion gdk4-win32/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
2 changes: 1 addition & 1 deletion gdk4-win32/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
2 changes: 1 addition & 1 deletion gdk4-x11/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
2 changes: 1 addition & 1 deletion gdk4-x11/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
4 changes: 2 additions & 2 deletions gdk4/src/auto/content_formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ glib::wrapper! {

impl ContentFormats {
#[doc(alias = "gdk_content_formats_new")]
pub fn new(mime_types: &[&str]) -> ContentFormats {
pub fn new(mime_types: Option<&[&str]>) -> ContentFormats {
assert_initialized_main_thread!();
let n_mime_types = mime_types.len() as _;
let n_mime_types = mime_types.map(|arr| arr.len()).unwrap_or(0) as _;
unsafe {
from_glib_full(ffi::gdk_content_formats_new(
mime_types.to_glib_none().0,
Expand Down
4 changes: 2 additions & 2 deletions gdk4/src/auto/content_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ impl ContentProvider {
}

#[doc(alias = "gdk_content_provider_new_union")]
pub fn new_union(providers: &[ContentProvider]) -> ContentProvider {
pub fn new_union(providers: Option<&[ContentProvider]>) -> ContentProvider {
assert_initialized_main_thread!();
let n_providers = providers.len() as _;
let n_providers = providers.map(|arr| arr.len()).unwrap_or(0) as _;
unsafe {
from_glib_full(ffi::gdk_content_provider_new_union(
providers.to_glib_full(),
Expand Down
2 changes: 1 addition & 1 deletion gdk4/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
2 changes: 1 addition & 1 deletion gdk4/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
4 changes: 2 additions & 2 deletions gsk4/src/auto/gl_shader_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ impl GLShaderNode {
shader: &GLShader,
bounds: &graphene::Rect,
args: &glib::Bytes,
children: &[RenderNode],
children: Option<&[RenderNode]>,
) -> GLShaderNode {
skip_assert_initialized!();
let n_children = children.len() as _;
let n_children = children.map(|arr| arr.len()).unwrap_or(0) as _;
unsafe {
from_glib_full(ffi::gsk_gl_shader_node_new(
shader.to_glib_none().0,
Expand Down
4 changes: 2 additions & 2 deletions gsk4/src/auto/stroke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ impl Stroke {
}

#[doc(alias = "gsk_stroke_set_dash")]
pub fn set_dash(&self, dash: &[f32]) {
let n_dash = dash.len() as _;
pub fn set_dash(&self, dash: Option<&[f32]>) {
let n_dash = dash.map(|arr| arr.len()).unwrap_or(0) as _;
unsafe {
ffi::gsk_stroke_set_dash(
mut_override(self.to_glib_none().0),
Expand Down
2 changes: 1 addition & 1 deletion gsk4/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
2 changes: 1 addition & 1 deletion gsk4/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
6 changes: 3 additions & 3 deletions gtk4/src/auto/icon_theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl IconTheme {
pub fn lookup_icon(
&self,
icon_name: &str,
fallbacks: &[&str],
fallbacks: Option<&[&str]>,
size: i32,
scale: i32,
direction: TextDirection,
Expand All @@ -166,15 +166,15 @@ impl IconTheme {

#[doc(alias = "gtk_icon_theme_set_resource_path")]
#[doc(alias = "resource-path")]
pub fn set_resource_path(&self, path: &[&str]) {
pub fn set_resource_path(&self, path: Option<&[&str]>) {
unsafe {
ffi::gtk_icon_theme_set_resource_path(self.to_glib_none().0, path.to_glib_none().0);
}
}

#[doc(alias = "gtk_icon_theme_set_search_path")]
#[doc(alias = "search-path")]
pub fn set_search_path(&self, path: &[&std::path::Path]) {
pub fn set_search_path(&self, path: Option<&[&std::path::Path]>) {
unsafe {
ffi::gtk_icon_theme_set_search_path(self.to_glib_none().0, path.to_glib_none().0);
}
Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/auto/scale_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl ScaleButton {
pub const NONE: Option<&'static ScaleButton> = None;

#[doc(alias = "gtk_scale_button_new")]
pub fn new(min: f64, max: f64, step: f64, icons: &[&str]) -> ScaleButton {
pub fn new(min: f64, max: f64, step: f64, icons: Option<&[&str]>) -> ScaleButton {
assert_initialized_main_thread!();
unsafe {
Widget::from_glib_none(ffi::gtk_scale_button_new(
Expand Down
4 changes: 2 additions & 2 deletions gtk4/src/auto/string_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ glib::wrapper! {

impl StringList {
#[doc(alias = "gtk_string_list_new")]
pub fn new(strings: &[&str]) -> StringList {
pub fn new(strings: Option<&[&str]>) -> StringList {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those two don't make sense to have as nullable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'll update this later. Need to move to something else

assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gtk_string_list_new(strings.to_glib_none().0)) }
}
Expand Down Expand Up @@ -54,7 +54,7 @@ impl StringList {
}

#[doc(alias = "gtk_string_list_splice")]
pub fn splice(&self, position: u32, n_removals: u32, additions: &[&str]) {
pub fn splice(&self, position: u32, n_removals: u32, additions: Option<&[&str]>) {
unsafe {
ffi::gtk_string_list_splice(
self.to_glib_none().0,
Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
8 changes: 4 additions & 4 deletions gtk4/src/string_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{prelude::*, StringList};
impl FromIterator<&'static str> for StringList {
fn from_iter<I: IntoIterator<Item = &'static str>>(iter: I) -> Self {
assert_initialized_main_thread!();
StringList::new(iter.into_iter().collect::<Vec<_>>().as_slice())
StringList::new(Some(iter.into_iter().collect::<Vec<_>>().as_slice()))
}
}

Expand All @@ -14,15 +14,15 @@ impl Extend<&'static str> for StringList {
self.splice(
self.n_items(),
0,
iter.into_iter().collect::<Vec<_>>().as_slice(),
Some(iter.into_iter().collect::<Vec<_>>().as_slice()),
);
}
}

impl FromIterator<String> for StringList {
fn from_iter<I: IntoIterator<Item = String>>(iter: I) -> Self {
assert_initialized_main_thread!();
let string_list = StringList::new(&[]);
let string_list = StringList::new(None);
for s in iter {
string_list.append(&s);
}
Expand All @@ -40,7 +40,7 @@ impl Extend<String> for StringList {

impl Default for StringList {
fn default() -> Self {
Self::new(&[])
Self::new(None)
}
}

Expand Down
2 changes: 1 addition & 1 deletion gtk4/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ b2a1c6f9b362)
Generated by gir (https://github.com/gtk-rs/gir @ 9e6d0758f347)
from gir-files (https://github.com/gtk-rs/gir-files @ f5f1ab94657c)
Loading