From 86ba4577e5c84bb8a8d24100ffe6d2a51083a246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Sun, 1 Dec 2024 19:35:29 +0100 Subject: [PATCH] regenerate: more Into> in arg position --- gdk4-macos/src/auto/versions.txt | 2 +- gdk4-macos/sys/versions.txt | 2 +- gdk4-wayland/src/auto/versions.txt | 2 +- gdk4-wayland/sys/versions.txt | 2 +- gdk4-win32/src/auto/versions.txt | 2 +- gdk4-win32/src/auto/win32_display.rs | 4 +- gdk4-win32/sys/versions.txt | 2 +- gdk4-x11/src/auto/functions.rs | 4 +- gdk4-x11/src/auto/versions.txt | 2 +- gdk4-x11/src/auto/x11_device_manager_xi2.rs | 2 +- gdk4-x11/src/auto/x11_device_xi2.rs | 2 +- gdk4-x11/src/auto/x11_display.rs | 12 +- gdk4-x11/src/auto/x11_surface.rs | 4 +- gdk4-x11/sys/versions.txt | 2 +- gdk4/src/auto/app_launch_context.rs | 8 +- gdk4/src/auto/clipboard.rs | 119 +++++++---- gdk4/src/auto/content_provider.rs | 27 ++- gdk4/src/auto/cursor.rs | 12 +- gdk4/src/auto/device.rs | 8 +- gdk4/src/auto/display.rs | 4 +- gdk4/src/auto/display_manager.rs | 4 +- gdk4/src/auto/dmabuf_texture_builder.rs | 12 +- gdk4/src/auto/drop.rs | 27 ++- gdk4/src/auto/memory_texture_builder.rs | 16 +- gdk4/src/auto/surface.rs | 11 +- gdk4/src/auto/toplevel.rs | 6 +- gdk4/src/auto/toplevel_layout.rs | 8 +- gdk4/src/auto/versions.txt | 2 +- gdk4/sys/versions.txt | 2 +- gsk4/src/auto/renderer.rs | 18 +- gsk4/src/auto/repeat_node.rs | 6 +- gsk4/src/auto/shader_args_builder.rs | 7 +- gsk4/src/auto/versions.txt | 2 +- gsk4/sys/versions.txt | 2 +- gtk4/src/auto/about_dialog.rs | 76 ++++--- gtk4/src/auto/accessible.rs | 27 ++- gtk4/src/auto/action_bar.rs | 11 +- gtk4/src/auto/actionable.rs | 8 +- gtk4/src/auto/alert_dialog.rs | 42 ++-- gtk4/src/auto/alternative_trigger.rs | 4 +- gtk4/src/auto/app_chooser_button.rs | 2 +- gtk4/src/auto/app_chooser_dialog.rs | 12 +- gtk4/src/auto/app_chooser_widget.rs | 2 +- gtk4/src/auto/application.rs | 16 +- gtk4/src/auto/application_window.rs | 20 +- gtk4/src/auto/aspect_frame.rs | 8 +- gtk4/src/auto/assistant.rs | 16 +- gtk4/src/auto/assistant_page.rs | 4 +- gtk4/src/auto/at_context.rs | 4 +- gtk4/src/auto/bookmark_list.rs | 10 +- gtk4/src/auto/box_.rs | 18 +- gtk4/src/auto/builder.rs | 29 ++- gtk4/src/auto/builder_list_item_factory.rs | 12 +- gtk4/src/auto/button.rs | 8 +- gtk4/src/auto/calendar.rs | 2 +- gtk4/src/auto/cell_area.rs | 9 +- gtk4/src/auto/cell_area_box.rs | 2 +- gtk4/src/auto/cell_renderer.rs | 18 +- gtk4/src/auto/cell_renderer_combo.rs | 6 +- gtk4/src/auto/cell_renderer_pixbuf.rs | 38 ++-- gtk4/src/auto/cell_renderer_progress.rs | 4 +- gtk4/src/auto/cell_renderer_spin.rs | 10 +- gtk4/src/auto/cell_renderer_text.rs | 48 ++--- gtk4/src/auto/cell_view.rs | 16 +- gtk4/src/auto/center_box.rs | 20 +- gtk4/src/auto/center_layout.rs | 12 +- gtk4/src/auto/check_button.rs | 21 +- gtk4/src/auto/color_button.rs | 2 +- gtk4/src/auto/color_chooser_dialog.rs | 25 ++- gtk4/src/auto/color_chooser_widget.rs | 2 +- gtk4/src/auto/color_dialog.rs | 46 ++-- gtk4/src/auto/color_dialog_button.rs | 2 +- gtk4/src/auto/column_view.rs | 45 ++-- gtk4/src/auto/column_view_cell.rs | 6 +- gtk4/src/auto/column_view_column.rs | 35 +-- gtk4/src/auto/combo_box.rs | 22 +- gtk4/src/auto/combo_box_text.rs | 18 +- gtk4/src/auto/constraint.rs | 20 +- gtk4/src/auto/constraint_guide.rs | 4 +- gtk4/src/auto/css_provider.rs | 4 +- gtk4/src/auto/css_section.rs | 16 +- gtk4/src/auto/dialog.rs | 16 +- gtk4/src/auto/directory_list.rs | 17 +- gtk4/src/auto/drag_icon.rs | 4 +- gtk4/src/auto/drag_source.rs | 20 +- gtk4/src/auto/drawing_area.rs | 2 +- gtk4/src/auto/drop_down.rs | 29 +-- gtk4/src/auto/drop_target_async.rs | 14 +- gtk4/src/auto/editable_label.rs | 2 +- gtk4/src/auto/emoji_chooser.rs | 6 +- gtk4/src/auto/entry.rs | 158 +++++++++----- gtk4/src/auto/entry_completion.rs | 8 +- gtk4/src/auto/event_controller.rs | 8 +- gtk4/src/auto/event_controller_key.rs | 9 +- gtk4/src/auto/expander.rs | 28 ++- gtk4/src/auto/expression.rs | 30 +-- gtk4/src/auto/file_chooser_dialog.rs | 16 +- gtk4/src/auto/file_chooser_native.rs | 28 +-- gtk4/src/auto/file_chooser_widget.rs | 2 +- gtk4/src/auto/file_dialog.rs | 226 ++++++++++++-------- gtk4/src/auto/file_filter.rs | 4 +- gtk4/src/auto/file_launcher.rs | 84 +++++--- gtk4/src/auto/filter_list_model.rs | 12 +- gtk4/src/auto/fixed.rs | 10 +- gtk4/src/auto/flatten_list_model.rs | 4 +- gtk4/src/auto/flow_box.rs | 26 +-- gtk4/src/auto/flow_box_child.rs | 8 +- gtk4/src/auto/font_button.rs | 2 +- gtk4/src/auto/font_chooser.rs | 4 +- gtk4/src/auto/font_chooser_dialog.rs | 25 ++- gtk4/src/auto/font_chooser_widget.rs | 2 +- gtk4/src/auto/font_dialog.rs | 170 +++++++++------ gtk4/src/auto/font_dialog_button.rs | 10 +- gtk4/src/auto/frame.rs | 32 ++- gtk4/src/auto/functions.rs | 40 ++-- gtk4/src/auto/gesture.rs | 15 +- gtk4/src/auto/gl_area.rs | 9 +- gtk4/src/auto/graphics_offload.rs | 12 +- gtk4/src/auto/grid.rs | 8 +- gtk4/src/auto/grid_view.rs | 27 ++- gtk4/src/auto/header_bar.rs | 17 +- gtk4/src/auto/icon_theme.rs | 13 +- gtk4/src/auto/icon_view.rs | 40 ++-- gtk4/src/auto/im_context.rs | 4 +- gtk4/src/auto/im_multicontext.rs | 4 +- gtk4/src/auto/image.rs | 52 +++-- gtk4/src/auto/info_bar.rs | 2 +- gtk4/src/auto/inscription.rs | 22 +- gtk4/src/auto/label.rs | 31 +-- gtk4/src/auto/level_bar.rs | 13 +- gtk4/src/auto/link_button.rs | 4 +- gtk4/src/auto/list_box.rs | 48 +++-- gtk4/src/auto/list_box_row.rs | 12 +- gtk4/src/auto/list_header.rs | 4 +- gtk4/src/auto/list_item.rs | 4 +- gtk4/src/auto/list_store.rs | 16 +- gtk4/src/auto/list_view.rs | 36 ++-- gtk4/src/auto/lock_button.rs | 54 +++-- gtk4/src/auto/map_list_model.rs | 4 +- gtk4/src/auto/media_controls.rs | 12 +- gtk4/src/auto/media_file.rs | 12 +- gtk4/src/auto/menu_button.rs | 25 ++- gtk4/src/auto/message_dialog.rs | 24 +-- gtk4/src/auto/mount_operation.rs | 12 +- gtk4/src/auto/multi_selection.rs | 4 +- gtk4/src/auto/native_dialog.rs | 4 +- gtk4/src/auto/no_selection.rs | 4 +- gtk4/src/auto/notebook.rs | 35 ++- gtk4/src/auto/notebook_page.rs | 8 +- gtk4/src/auto/overlay.rs | 8 +- gtk4/src/auto/pad_controller.rs | 9 +- gtk4/src/auto/page_setup.rs | 20 +- gtk4/src/auto/page_setup_unix_dialog.rs | 29 +-- gtk4/src/auto/paned.rs | 14 +- gtk4/src/auto/paper_size.rs | 10 +- gtk4/src/auto/password_entry.rs | 12 +- gtk4/src/auto/picture.rs | 34 +-- gtk4/src/auto/popover.rs | 21 +- gtk4/src/auto/popover_menu.rs | 20 +- gtk4/src/auto/popover_menu_bar.rs | 14 +- gtk4/src/auto/print_dialog.rs | 130 ++++++----- gtk4/src/auto/print_operation.rs | 18 +- gtk4/src/auto/print_settings.rs | 24 ++- gtk4/src/auto/print_unix_dialog.rs | 29 +-- gtk4/src/auto/progress_bar.rs | 6 +- gtk4/src/auto/recent_info.rs | 6 +- gtk4/src/auto/recent_manager.rs | 8 +- gtk4/src/auto/revealer.rs | 8 +- gtk4/src/auto/root.rs | 4 +- gtk4/src/auto/scale.rs | 20 +- gtk4/src/auto/scale_button.rs | 4 +- gtk4/src/auto/scrollable.rs | 18 +- gtk4/src/auto/scrollbar.rs | 25 ++- gtk4/src/auto/scrolled_window.rs | 30 ++- gtk4/src/auto/search_bar.rs | 14 +- gtk4/src/auto/search_entry.rs | 10 +- gtk4/src/auto/selection_filter_model.rs | 10 +- gtk4/src/auto/separator.rs | 2 +- gtk4/src/auto/settings.rs | 84 +++++--- gtk4/src/auto/shortcut.rs | 8 +- gtk4/src/auto/shortcut_action.rs | 6 +- gtk4/src/auto/shortcut_label.rs | 2 +- gtk4/src/auto/shortcuts_group.rs | 18 +- gtk4/src/auto/shortcuts_section.rs | 14 +- gtk4/src/auto/shortcuts_shortcut.rs | 32 +-- gtk4/src/auto/shortcuts_window.rs | 24 +-- gtk4/src/auto/single_selection.rs | 6 +- gtk4/src/auto/slice_list_model.rs | 6 +- gtk4/src/auto/snapshot.rs | 22 +- gtk4/src/auto/sort_list_model.rs | 18 +- gtk4/src/auto/spin_button.rs | 26 ++- gtk4/src/auto/spinner.rs | 2 +- gtk4/src/auto/stack.rs | 18 +- gtk4/src/auto/stack_sidebar.rs | 2 +- gtk4/src/auto/stack_switcher.rs | 6 +- gtk4/src/auto/statusbar.rs | 2 +- gtk4/src/auto/string_filter.rs | 7 +- gtk4/src/auto/switch.rs | 2 +- gtk4/src/auto/text.rs | 29 +-- gtk4/src/auto/text_buffer.rs | 16 +- gtk4/src/auto/text_iter.rs | 50 +++-- gtk4/src/auto/text_mark.rs | 4 +- gtk4/src/auto/text_tag.rs | 75 ++++--- gtk4/src/auto/text_view.rs | 37 ++-- gtk4/src/auto/toggle_button.rs | 10 +- gtk4/src/auto/tooltip.rs | 34 +-- gtk4/src/auto/tree_expander.rs | 15 +- gtk4/src/auto/tree_list_row_sorter.rs | 4 +- gtk4/src/auto/tree_model.rs | 16 +- gtk4/src/auto/tree_store.rs | 40 ++-- gtk4/src/auto/tree_view.rs | 105 +++++---- gtk4/src/auto/tree_view_column.rs | 8 +- gtk4/src/auto/uri_launcher.rs | 42 ++-- gtk4/src/auto/versions.txt | 2 +- gtk4/src/auto/video.rs | 33 +-- gtk4/src/auto/viewport.rs | 36 ++-- gtk4/src/auto/volume_button.rs | 4 +- gtk4/src/auto/widget.rs | 93 +++++--- gtk4/src/auto/widget_paintable.rs | 8 +- gtk4/src/auto/window.rs | 69 +++--- gtk4/src/auto/window_controls.rs | 6 +- gtk4/src/auto/window_handle.rs | 8 +- gtk4/sys/versions.txt | 2 +- 223 files changed, 2620 insertions(+), 1762 deletions(-) diff --git a/gdk4-macos/src/auto/versions.txt b/gdk4-macos/src/auto/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gdk4-macos/src/auto/versions.txt +++ b/gdk4-macos/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-macos/sys/versions.txt b/gdk4-macos/sys/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gdk4-macos/sys/versions.txt +++ b/gdk4-macos/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-wayland/src/auto/versions.txt b/gdk4-wayland/src/auto/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gdk4-wayland/src/auto/versions.txt +++ b/gdk4-wayland/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-wayland/sys/versions.txt b/gdk4-wayland/sys/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gdk4-wayland/sys/versions.txt +++ b/gdk4-wayland/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-win32/src/auto/versions.txt b/gdk4-win32/src/auto/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gdk4-win32/src/auto/versions.txt +++ b/gdk4-win32/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-win32/src/auto/win32_display.rs b/gdk4-win32/src/auto/win32_display.rs index 5f2b1b16d0c6..aef3b67e8378 100644 --- a/gdk4-win32/src/auto/win32_display.rs +++ b/gdk4-win32/src/auto/win32_display.rs @@ -27,11 +27,11 @@ impl Win32Display { } #[doc(alias = "gdk_win32_display_set_cursor_theme")] - pub fn set_cursor_theme(&self, name: Option<&str>, size: i32) { + pub fn set_cursor_theme<'a>(&self, name: impl Into>, size: i32) { unsafe { ffi::gdk_win32_display_set_cursor_theme( self.to_glib_none().0, - name.to_glib_none().0, + name.into().to_glib_none().0, size, ); } diff --git a/gdk4-win32/sys/versions.txt b/gdk4-win32/sys/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gdk4-win32/sys/versions.txt +++ b/gdk4-win32/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-x11/src/auto/functions.rs b/gdk4-x11/src/auto/functions.rs index 2b3a94fbd057..34730cc5ee3b 100644 --- a/gdk4-x11/src/auto/functions.rs +++ b/gdk4-x11/src/auto/functions.rs @@ -32,9 +32,9 @@ pub fn x11_get_server_time(surface: &X11Surface) -> u32 { } #[doc(alias = "gdk_x11_set_sm_client_id")] -pub fn x11_set_sm_client_id(sm_client_id: Option<&str>) { +pub fn x11_set_sm_client_id<'a>(sm_client_id: impl Into>) { assert_initialized_main_thread!(); unsafe { - ffi::gdk_x11_set_sm_client_id(sm_client_id.to_glib_none().0); + ffi::gdk_x11_set_sm_client_id(sm_client_id.into().to_glib_none().0); } } diff --git a/gdk4-x11/src/auto/versions.txt b/gdk4-x11/src/auto/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gdk4-x11/src/auto/versions.txt +++ b/gdk4-x11/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4-x11/src/auto/x11_device_manager_xi2.rs b/gdk4-x11/src/auto/x11_device_manager_xi2.rs index bd6b9999fd00..bab813f6060a 100644 --- a/gdk4-x11/src/auto/x11_device_manager_xi2.rs +++ b/gdk4-x11/src/auto/x11_device_manager_xi2.rs @@ -58,7 +58,7 @@ impl X11DeviceManagerXI2Builder { pub fn display(self, display: &impl IsA) -> Self { Self { - builder: self.builder.property("display", display.clone().upcast()), + builder: self.builder.property("display", display.as_ref().clone()), } } diff --git a/gdk4-x11/src/auto/x11_device_xi2.rs b/gdk4-x11/src/auto/x11_device_xi2.rs index 3ac52ad6eaa8..92935353b65d 100644 --- a/gdk4-x11/src/auto/x11_device_xi2.rs +++ b/gdk4-x11/src/auto/x11_device_xi2.rs @@ -53,7 +53,7 @@ impl X11DeviceXI2Builder { pub fn display(self, display: &impl IsA) -> Self { Self { - builder: self.builder.property("display", display.clone().upcast()), + builder: self.builder.property("display", display.as_ref().clone()), } } diff --git a/gdk4-x11/src/auto/x11_display.rs b/gdk4-x11/src/auto/x11_display.rs index 904bb69e3629..c117130f60ad 100644 --- a/gdk4-x11/src/auto/x11_display.rs +++ b/gdk4-x11/src/auto/x11_display.rs @@ -134,11 +134,11 @@ impl X11Display { #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")] #[allow(deprecated)] #[doc(alias = "gdk_x11_display_set_cursor_theme")] - pub fn set_cursor_theme(&self, theme: Option<&str>, size: i32) { + pub fn set_cursor_theme<'a>(&self, theme: impl Into>, size: i32) { unsafe { ffi::gdk_x11_display_set_cursor_theme( self.to_glib_none().0, - theme.to_glib_none().0, + theme.into().to_glib_none().0, size, ); } @@ -222,8 +222,12 @@ impl X11Display { } #[doc(alias = "gdk_x11_display_open")] - pub fn open(display_name: Option<&str>) -> Option { + pub fn open<'a>(display_name: impl Into>) -> Option { assert_initialized_main_thread!(); - unsafe { from_glib_full(ffi::gdk_x11_display_open(display_name.to_glib_none().0)) } + unsafe { + from_glib_full(ffi::gdk_x11_display_open( + display_name.into().to_glib_none().0, + )) + } } } diff --git a/gdk4-x11/src/auto/x11_surface.rs b/gdk4-x11/src/auto/x11_surface.rs index dff4cace4bea..4eccd833b017 100644 --- a/gdk4-x11/src/auto/x11_surface.rs +++ b/gdk4-x11/src/auto/x11_surface.rs @@ -100,12 +100,12 @@ impl X11Surface { } #[doc(alias = "gdk_x11_surface_set_utf8_property")] - pub fn set_utf8_property(&self, name: &str, value: Option<&str>) { + pub fn set_utf8_property<'a>(&self, name: &str, value: impl Into>) { unsafe { ffi::gdk_x11_surface_set_utf8_property( self.to_glib_none().0, name.to_glib_none().0, - value.to_glib_none().0, + value.into().to_glib_none().0, ); } } diff --git a/gdk4-x11/sys/versions.txt b/gdk4-x11/sys/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gdk4-x11/sys/versions.txt +++ b/gdk4-x11/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4/src/auto/app_launch_context.rs b/gdk4/src/auto/app_launch_context.rs index c3c18a945158..9e0c37867b10 100644 --- a/gdk4/src/auto/app_launch_context.rs +++ b/gdk4/src/auto/app_launch_context.rs @@ -37,21 +37,21 @@ pub trait GdkAppLaunchContextExt: IsA + 'static { } #[doc(alias = "gdk_app_launch_context_set_icon")] - fn set_icon(&self, icon: Option<&impl IsA>) { + fn set_icon<'a, P: IsA>(&self, icon: impl Into>) { unsafe { ffi::gdk_app_launch_context_set_icon( self.as_ref().to_glib_none().0, - icon.map(|p| p.as_ref()).to_glib_none().0, + icon.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "gdk_app_launch_context_set_icon_name")] - fn set_icon_name(&self, icon_name: Option<&str>) { + fn set_icon_name<'a>(&self, icon_name: impl Into>) { unsafe { ffi::gdk_app_launch_context_set_icon_name( self.as_ref().to_glib_none().0, - icon_name.to_glib_none().0, + icon_name.into().to_glib_none().0, ); } } diff --git a/gdk4/src/auto/clipboard.rs b/gdk4/src/auto/clipboard.rs index 91fe1874e7be..ee8494824e68 100644 --- a/gdk4/src/auto/clipboard.rs +++ b/gdk4/src/auto/clipboard.rs @@ -45,10 +45,14 @@ impl Clipboard { } #[doc(alias = "gdk_clipboard_read_text_async")] - pub fn read_text_async, glib::Error>) + 'static>( + pub fn read_text_async< + 'a, + P: IsA, + Q: FnOnce(Result, glib::Error>) + 'static, + >( &self, - cancellable: Option<&impl IsA>, - callback: P, + cancellable: impl Into>, + callback: Q, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); @@ -60,10 +64,10 @@ impl Clipboard { "Async operations only allowed if the thread is owning the MainContext" ); - let user_data: Box_> = + let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn read_text_async_trampoline< - P: FnOnce(Result, glib::Error>) + 'static, + Q: FnOnce(Result, glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, @@ -77,16 +81,21 @@ impl Clipboard { } else { Err(from_glib_full(error)) }; - let callback: Box_> = + let callback: Box_> = Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); + let callback: Q = callback.into_inner(); callback(result); } - let callback = read_text_async_trampoline::

; + let callback = read_text_async_trampoline::; unsafe { ffi::gdk_clipboard_read_text_async( self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, + cancellable + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, Some(callback), Box_::into_raw(user_data) as *mut _, ); @@ -108,10 +117,14 @@ impl Clipboard { } #[doc(alias = "gdk_clipboard_read_texture_async")] - pub fn read_texture_async, glib::Error>) + 'static>( + pub fn read_texture_async< + 'a, + P: IsA, + Q: FnOnce(Result, glib::Error>) + 'static, + >( &self, - cancellable: Option<&impl IsA>, - callback: P, + cancellable: impl Into>, + callback: Q, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); @@ -123,10 +136,10 @@ impl Clipboard { "Async operations only allowed if the thread is owning the MainContext" ); - let user_data: Box_> = + let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn read_texture_async_trampoline< - P: FnOnce(Result, glib::Error>) + 'static, + Q: FnOnce(Result, glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, @@ -140,16 +153,21 @@ impl Clipboard { } else { Err(from_glib_full(error)) }; - let callback: Box_> = + let callback: Box_> = Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); + let callback: Q = callback.into_inner(); callback(result); } - let callback = read_texture_async_trampoline::

; + let callback = read_texture_async_trampoline::; unsafe { ffi::gdk_clipboard_read_texture_async( self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, + cancellable + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, Some(callback), Box_::into_raw(user_data) as *mut _, ); @@ -168,12 +186,16 @@ impl Clipboard { } #[doc(alias = "gdk_clipboard_read_value_async")] - pub fn read_value_async) + 'static>( + pub fn read_value_async< + 'a, + P: IsA, + Q: FnOnce(Result) + 'static, + >( &self, type_: glib::types::Type, io_priority: glib::Priority, - cancellable: Option<&impl IsA>, - callback: P, + cancellable: impl Into>, + callback: Q, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); @@ -185,10 +207,10 @@ impl Clipboard { "Async operations only allowed if the thread is owning the MainContext" ); - let user_data: Box_> = + let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn read_value_async_trampoline< - P: FnOnce(Result) + 'static, + Q: FnOnce(Result) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, @@ -202,18 +224,23 @@ impl Clipboard { } else { Err(from_glib_full(error)) }; - let callback: Box_> = + let callback: Box_> = Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); + let callback: Q = callback.into_inner(); callback(result); } - let callback = read_value_async_trampoline::

; + let callback = read_value_async_trampoline::; unsafe { ffi::gdk_clipboard_read_value_async( self.to_glib_none().0, type_.into_glib(), io_priority.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, + cancellable + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, Some(callback), Box_::into_raw(user_data) as *mut _, ); @@ -234,15 +261,20 @@ impl Clipboard { } #[doc(alias = "gdk_clipboard_set_content")] - pub fn set_content( + pub fn set_content<'a, P: IsA>( &self, - provider: Option<&impl IsA>, + provider: impl Into>, ) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gdk_clipboard_set_content( self.to_glib_none().0, - provider.map(|p| p.as_ref()).to_glib_none().0 + provider + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0 ), "Can't set new clipboard content" ) @@ -267,11 +299,15 @@ impl Clipboard { } #[doc(alias = "gdk_clipboard_store_async")] - pub fn store_async) + 'static>( + pub fn store_async< + 'a, + P: IsA, + Q: FnOnce(Result<(), glib::Error>) + 'static, + >( &self, io_priority: glib::Priority, - cancellable: Option<&impl IsA>, - callback: P, + cancellable: impl Into>, + callback: Q, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); @@ -283,10 +319,10 @@ impl Clipboard { "Async operations only allowed if the thread is owning the MainContext" ); - let user_data: Box_> = + let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn store_async_trampoline< - P: FnOnce(Result<(), glib::Error>) + 'static, + Q: FnOnce(Result<(), glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, @@ -299,17 +335,22 @@ impl Clipboard { } else { Err(from_glib_full(error)) }; - let callback: Box_> = + let callback: Box_> = Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); + let callback: Q = callback.into_inner(); callback(result); } - let callback = store_async_trampoline::

; + let callback = store_async_trampoline::; unsafe { ffi::gdk_clipboard_store_async( self.to_glib_none().0, io_priority.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, + cancellable + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, Some(callback), Box_::into_raw(user_data) as *mut _, ); diff --git a/gdk4/src/auto/content_provider.rs b/gdk4/src/auto/content_provider.rs index bea48c3f8af7..467f42c6d4d6 100644 --- a/gdk4/src/auto/content_provider.rs +++ b/gdk4/src/auto/content_provider.rs @@ -88,13 +88,17 @@ pub trait ContentProviderExt: IsA + 'static { } #[doc(alias = "gdk_content_provider_write_mime_type_async")] - fn write_mime_type_async) + 'static>( + fn write_mime_type_async< + 'a, + P: IsA, + Q: FnOnce(Result<(), glib::Error>) + 'static, + >( &self, mime_type: &str, stream: &impl IsA, io_priority: glib::Priority, - cancellable: Option<&impl IsA>, - callback: P, + cancellable: impl Into>, + callback: Q, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); @@ -106,10 +110,10 @@ pub trait ContentProviderExt: IsA + 'static { "Async operations only allowed if the thread is owning the MainContext" ); - let user_data: Box_> = + let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn write_mime_type_async_trampoline< - P: FnOnce(Result<(), glib::Error>) + 'static, + Q: FnOnce(Result<(), glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, @@ -126,19 +130,24 @@ pub trait ContentProviderExt: IsA + 'static { } else { Err(from_glib_full(error)) }; - let callback: Box_> = + let callback: Box_> = Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); + let callback: Q = callback.into_inner(); callback(result); } - let callback = write_mime_type_async_trampoline::

; + let callback = write_mime_type_async_trampoline::; unsafe { ffi::gdk_content_provider_write_mime_type_async( self.as_ref().to_glib_none().0, mime_type.to_glib_none().0, stream.as_ref().to_glib_none().0, io_priority.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, + cancellable + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, Some(callback), Box_::into_raw(user_data) as *mut _, ); diff --git a/gdk4/src/auto/cursor.rs b/gdk4/src/auto/cursor.rs index ba7fde592e67..a68381487868 100644 --- a/gdk4/src/auto/cursor.rs +++ b/gdk4/src/auto/cursor.rs @@ -17,23 +17,23 @@ glib::wrapper! { impl Cursor { #[doc(alias = "gdk_cursor_new_from_name")] #[doc(alias = "new_from_name")] - pub fn from_name(name: &str, fallback: Option<&Cursor>) -> Option { + pub fn from_name<'a>(name: &str, fallback: impl Into>) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gdk_cursor_new_from_name( name.to_glib_none().0, - fallback.to_glib_none().0, + fallback.into().to_glib_none().0, )) } } #[doc(alias = "gdk_cursor_new_from_texture")] #[doc(alias = "new_from_texture")] - pub fn from_texture( + pub fn from_texture<'a>( texture: &impl IsA, hotspot_x: i32, hotspot_y: i32, - fallback: Option<&Cursor>, + fallback: impl Into>, ) -> Cursor { skip_assert_initialized!(); unsafe { @@ -41,7 +41,7 @@ impl Cursor { texture.as_ref().to_glib_none().0, hotspot_x, hotspot_y, - fallback.to_glib_none().0, + fallback.into().to_glib_none().0, )) } } @@ -130,7 +130,7 @@ impl CursorBuilder { pub fn texture(self, texture: &impl IsA) -> Self { Self { - builder: self.builder.property("texture", texture.clone().upcast()), + builder: self.builder.property("texture", texture.as_ref().clone()), } } diff --git a/gdk4/src/auto/device.rs b/gdk4/src/auto/device.rs index ef71d92f8c8c..e19be64690f0 100644 --- a/gdk4/src/auto/device.rs +++ b/gdk4/src/auto/device.rs @@ -198,8 +198,12 @@ pub trait DeviceExt: IsA + 'static { ObjectExt::property(self.as_ref(), "n-axes") } - fn set_seat>(&self, seat: Option<&P>) { - ObjectExt::set_property(self.as_ref(), "seat", seat) + fn set_seat<'a, P: IsA>(&self, seat: impl Into>) { + ObjectExt::set_property( + self.as_ref(), + "seat", + seat.into().as_ref().map(|p| p.as_ref()), + ) } #[doc(alias = "changed")] diff --git a/gdk4/src/auto/display.rs b/gdk4/src/auto/display.rs index 3e165b9e25f4..2a4962608600 100644 --- a/gdk4/src/auto/display.rs +++ b/gdk4/src/auto/display.rs @@ -38,9 +38,9 @@ impl Display { } #[doc(alias = "gdk_display_open")] - pub fn open(display_name: Option<&str>) -> Option { + pub fn open<'a>(display_name: impl Into>) -> Option { assert_initialized_main_thread!(); - unsafe { from_glib_none(ffi::gdk_display_open(display_name.to_glib_none().0)) } + unsafe { from_glib_none(ffi::gdk_display_open(display_name.into().to_glib_none().0)) } } } diff --git a/gdk4/src/auto/display_manager.rs b/gdk4/src/auto/display_manager.rs index b059894cd767..4991578891fa 100644 --- a/gdk4/src/auto/display_manager.rs +++ b/gdk4/src/auto/display_manager.rs @@ -41,11 +41,11 @@ impl DisplayManager { } #[doc(alias = "gdk_display_manager_open_display")] - pub fn open_display(&self, name: Option<&str>) -> Option { + pub fn open_display<'a>(&self, name: impl Into>) -> Option { unsafe { from_glib_none(ffi::gdk_display_manager_open_display( self.to_glib_none().0, - name.to_glib_none().0, + name.into().to_glib_none().0, )) } } diff --git a/gdk4/src/auto/dmabuf_texture_builder.rs b/gdk4/src/auto/dmabuf_texture_builder.rs index f53242bb08b4..6d58f9d32199 100644 --- a/gdk4/src/auto/dmabuf_texture_builder.rs +++ b/gdk4/src/auto/dmabuf_texture_builder.rs @@ -138,11 +138,11 @@ impl DmabufTextureBuilder { #[cfg_attr(docsrs, doc(cfg(feature = "v4_16")))] #[doc(alias = "gdk_dmabuf_texture_builder_set_color_state")] #[doc(alias = "color-state")] - pub fn set_color_state(&self, color_state: Option<&ColorState>) { + pub fn set_color_state<'a>(&self, color_state: impl Into>) { unsafe { ffi::gdk_dmabuf_texture_builder_set_color_state( self.to_glib_none().0, - color_state.to_glib_none().0, + color_state.into().to_glib_none().0, ); } } @@ -224,22 +224,22 @@ impl DmabufTextureBuilder { #[doc(alias = "gdk_dmabuf_texture_builder_set_update_region")] #[doc(alias = "update-region")] - pub fn set_update_region(&self, region: Option<&cairo::Region>) { + pub fn set_update_region<'a>(&self, region: impl Into>) { unsafe { ffi::gdk_dmabuf_texture_builder_set_update_region( self.to_glib_none().0, - mut_override(region.to_glib_none().0), + mut_override(region.into().to_glib_none().0), ); } } #[doc(alias = "gdk_dmabuf_texture_builder_set_update_texture")] #[doc(alias = "update-texture")] - pub fn set_update_texture(&self, texture: Option<&impl IsA>) { + pub fn set_update_texture<'a, P: IsA>(&self, texture: impl Into>) { unsafe { ffi::gdk_dmabuf_texture_builder_set_update_texture( self.to_glib_none().0, - texture.map(|p| p.as_ref()).to_glib_none().0, + texture.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } diff --git a/gdk4/src/auto/drop.rs b/gdk4/src/auto/drop.rs index db441535deb2..a6c967d413e7 100644 --- a/gdk4/src/auto/drop.rs +++ b/gdk4/src/auto/drop.rs @@ -64,12 +64,16 @@ impl Drop { } #[doc(alias = "gdk_drop_read_value_async")] - pub fn read_value_async) + 'static>( + pub fn read_value_async< + 'a, + P: IsA, + Q: FnOnce(Result) + 'static, + >( &self, type_: glib::types::Type, io_priority: glib::Priority, - cancellable: Option<&impl IsA>, - callback: P, + cancellable: impl Into>, + callback: Q, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); @@ -81,10 +85,10 @@ impl Drop { "Async operations only allowed if the thread is owning the MainContext" ); - let user_data: Box_> = + let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn read_value_async_trampoline< - P: FnOnce(Result) + 'static, + Q: FnOnce(Result) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, @@ -97,18 +101,23 @@ impl Drop { } else { Err(from_glib_full(error)) }; - let callback: Box_> = + let callback: Box_> = Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); + let callback: Q = callback.into_inner(); callback(result); } - let callback = read_value_async_trampoline::

; + let callback = read_value_async_trampoline::; unsafe { ffi::gdk_drop_read_value_async( self.to_glib_none().0, type_.into_glib(), io_priority.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, + cancellable + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, Some(callback), Box_::into_raw(user_data) as *mut _, ); diff --git a/gdk4/src/auto/memory_texture_builder.rs b/gdk4/src/auto/memory_texture_builder.rs index 07a6b36f50fe..2ebb70fe229f 100644 --- a/gdk4/src/auto/memory_texture_builder.rs +++ b/gdk4/src/auto/memory_texture_builder.rs @@ -104,22 +104,22 @@ impl MemoryTextureBuilder { #[doc(alias = "gdk_memory_texture_builder_set_bytes")] #[doc(alias = "bytes")] - pub fn set_bytes(&self, bytes: Option<&glib::Bytes>) { + pub fn set_bytes<'a>(&self, bytes: impl Into>) { unsafe { ffi::gdk_memory_texture_builder_set_bytes( self.to_glib_none().0, - bytes.to_glib_none().0, + bytes.into().to_glib_none().0, ); } } #[doc(alias = "gdk_memory_texture_builder_set_color_state")] #[doc(alias = "color-state")] - pub fn set_color_state(&self, color_state: Option<&ColorState>) { + pub fn set_color_state<'a>(&self, color_state: impl Into>) { unsafe { ffi::gdk_memory_texture_builder_set_color_state( self.to_glib_none().0, - color_state.to_glib_none().0, + color_state.into().to_glib_none().0, ); } } @@ -150,22 +150,22 @@ impl MemoryTextureBuilder { #[doc(alias = "gdk_memory_texture_builder_set_update_region")] #[doc(alias = "update-region")] - pub fn set_update_region(&self, region: Option<&cairo::Region>) { + pub fn set_update_region<'a>(&self, region: impl Into>) { unsafe { ffi::gdk_memory_texture_builder_set_update_region( self.to_glib_none().0, - mut_override(region.to_glib_none().0), + mut_override(region.into().to_glib_none().0), ); } } #[doc(alias = "gdk_memory_texture_builder_set_update_texture")] #[doc(alias = "update-texture")] - pub fn set_update_texture(&self, texture: Option<&impl IsA>) { + pub fn set_update_texture<'a, P: IsA>(&self, texture: impl Into>) { unsafe { ffi::gdk_memory_texture_builder_set_update_texture( self.to_glib_none().0, - texture.map(|p| p.as_ref()).to_glib_none().0, + texture.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } diff --git a/gdk4/src/auto/surface.rs b/gdk4/src/auto/surface.rs index f5cba7d9e6db..636e2cbd993b 100644 --- a/gdk4/src/auto/surface.rs +++ b/gdk4/src/auto/surface.rs @@ -228,9 +228,12 @@ pub trait SurfaceExt: IsA + 'static { #[doc(alias = "gdk_surface_set_cursor")] #[doc(alias = "cursor")] - fn set_cursor(&self, cursor: Option<&Cursor>) { + fn set_cursor<'a>(&self, cursor: impl Into>) { unsafe { - ffi::gdk_surface_set_cursor(self.as_ref().to_glib_none().0, cursor.to_glib_none().0); + ffi::gdk_surface_set_cursor( + self.as_ref().to_glib_none().0, + cursor.into().to_glib_none().0, + ); } } @@ -258,11 +261,11 @@ pub trait SurfaceExt: IsA + 'static { #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")] #[allow(deprecated)] #[doc(alias = "gdk_surface_set_opaque_region")] - fn set_opaque_region(&self, region: Option<&cairo::Region>) { + fn set_opaque_region<'a>(&self, region: impl Into>) { unsafe { ffi::gdk_surface_set_opaque_region( self.as_ref().to_glib_none().0, - mut_override(region.to_glib_none().0), + mut_override(region.into().to_glib_none().0), ); } } diff --git a/gdk4/src/auto/toplevel.rs b/gdk4/src/auto/toplevel.rs index 2e418a207652..c853738cfbc2 100644 --- a/gdk4/src/auto/toplevel.rs +++ b/gdk4/src/auto/toplevel.rs @@ -45,10 +45,10 @@ pub trait ToplevelExt: IsA + 'static { } #[doc(alias = "gdk_toplevel_begin_resize")] - fn begin_resize( + fn begin_resize<'a, P: IsA>( &self, edge: SurfaceEdge, - device: Option<&impl IsA>, + device: impl Into>, button: i32, x: f64, y: f64, @@ -58,7 +58,7 @@ pub trait ToplevelExt: IsA + 'static { ffi::gdk_toplevel_begin_resize( self.as_ref().to_glib_none().0, edge.into_glib(), - device.map(|p| p.as_ref()).to_glib_none().0, + device.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, button, x, y, diff --git a/gdk4/src/auto/toplevel_layout.rs b/gdk4/src/auto/toplevel_layout.rs index aadf8d03245a..1a4b92c80507 100644 --- a/gdk4/src/auto/toplevel_layout.rs +++ b/gdk4/src/auto/toplevel_layout.rs @@ -94,12 +94,16 @@ impl ToplevelLayout { } #[doc(alias = "gdk_toplevel_layout_set_fullscreen")] - pub fn set_fullscreen(&self, fullscreen: bool, monitor: Option<&impl IsA>) { + pub fn set_fullscreen<'a, P: IsA>( + &self, + fullscreen: bool, + monitor: impl Into>, + ) { unsafe { ffi::gdk_toplevel_layout_set_fullscreen( self.to_glib_none().0, fullscreen.into_glib(), - monitor.map(|p| p.as_ref()).to_glib_none().0, + monitor.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } diff --git a/gdk4/src/auto/versions.txt b/gdk4/src/auto/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gdk4/src/auto/versions.txt +++ b/gdk4/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gdk4/sys/versions.txt b/gdk4/sys/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gdk4/sys/versions.txt +++ b/gdk4/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gsk4/src/auto/renderer.rs b/gsk4/src/auto/renderer.rs index 7025bdfea9a9..bb0c21031177 100644 --- a/gsk4/src/auto/renderer.rs +++ b/gsk4/src/auto/renderer.rs @@ -52,12 +52,12 @@ pub trait GskRendererExt: IsA + 'static { } #[doc(alias = "gsk_renderer_realize")] - fn realize(&self, surface: Option<&gdk::Surface>) -> Result<(), glib::Error> { + fn realize<'a>(&self, surface: impl Into>) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::gsk_renderer_realize( self.as_ref().to_glib_none().0, - surface.to_glib_none().0, + surface.into().to_glib_none().0, &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); @@ -90,27 +90,31 @@ pub trait GskRendererExt: IsA + 'static { } #[doc(alias = "gsk_renderer_render")] - fn render(&self, root: impl AsRef, region: Option<&cairo::Region>) { + fn render<'a>( + &self, + root: impl AsRef, + region: impl Into>, + ) { unsafe { ffi::gsk_renderer_render( self.as_ref().to_glib_none().0, root.as_ref().to_glib_none().0, - region.to_glib_none().0, + region.into().to_glib_none().0, ); } } #[doc(alias = "gsk_renderer_render_texture")] - fn render_texture( + fn render_texture<'a>( &self, root: impl AsRef, - viewport: Option<&graphene::Rect>, + viewport: impl Into>, ) -> gdk::Texture { unsafe { from_glib_full(ffi::gsk_renderer_render_texture( self.as_ref().to_glib_none().0, root.as_ref().to_glib_none().0, - viewport.to_glib_none().0, + viewport.into().to_glib_none().0, )) } } diff --git a/gsk4/src/auto/repeat_node.rs b/gsk4/src/auto/repeat_node.rs index 55a31004491e..f264a3492760 100644 --- a/gsk4/src/auto/repeat_node.rs +++ b/gsk4/src/auto/repeat_node.rs @@ -23,17 +23,17 @@ impl StaticType for RepeatNode { impl RepeatNode { #[doc(alias = "gsk_repeat_node_new")] - pub fn new( + pub fn new<'a>( bounds: &graphene::Rect, child: impl AsRef, - child_bounds: Option<&graphene::Rect>, + child_bounds: impl Into>, ) -> RepeatNode { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gsk_repeat_node_new( bounds.to_glib_none().0, child.as_ref().to_glib_none().0, - child_bounds.to_glib_none().0, + child_bounds.into().to_glib_none().0, )) } } diff --git a/gsk4/src/auto/shader_args_builder.rs b/gsk4/src/auto/shader_args_builder.rs index 50a79e2b44e7..972a36a83475 100644 --- a/gsk4/src/auto/shader_args_builder.rs +++ b/gsk4/src/auto/shader_args_builder.rs @@ -20,12 +20,15 @@ impl ShaderArgsBuilder { #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")] #[allow(deprecated)] #[doc(alias = "gsk_shader_args_builder_new")] - pub fn new(shader: &GLShader, initial_values: Option<&glib::Bytes>) -> ShaderArgsBuilder { + pub fn new<'a>( + shader: &GLShader, + initial_values: impl Into>, + ) -> ShaderArgsBuilder { skip_assert_initialized!(); unsafe { from_glib_full(ffi::gsk_shader_args_builder_new( shader.to_glib_none().0, - initial_values.to_glib_none().0, + initial_values.into().to_glib_none().0, )) } } diff --git a/gsk4/src/auto/versions.txt b/gsk4/src/auto/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gsk4/src/auto/versions.txt +++ b/gsk4/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gsk4/sys/versions.txt b/gsk4/sys/versions.txt index 91ca6c1fea0b..05686e1c6652 100644 --- a/gsk4/sys/versions.txt +++ b/gsk4/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 03ab3b39fbaf) +Generated by gir (https://github.com/gtk-rs/gir @ d65f5843ca8a) from gir-files (https://github.com/gtk-rs/gir-files @ c05f5cc23cb7) diff --git a/gtk4/src/auto/about_dialog.rs b/gtk4/src/auto/about_dialog.rs index fcdc48b3ca77..235c8bff2742 100644 --- a/gtk4/src/auto/about_dialog.rs +++ b/gtk4/src/auto/about_dialog.rs @@ -209,17 +209,23 @@ impl AboutDialog { #[doc(alias = "gtk_about_dialog_set_comments")] #[doc(alias = "comments")] - pub fn set_comments(&self, comments: Option<&str>) { + pub fn set_comments<'a>(&self, comments: impl Into>) { unsafe { - ffi::gtk_about_dialog_set_comments(self.to_glib_none().0, comments.to_glib_none().0); + ffi::gtk_about_dialog_set_comments( + self.to_glib_none().0, + comments.into().to_glib_none().0, + ); } } #[doc(alias = "gtk_about_dialog_set_copyright")] #[doc(alias = "copyright")] - pub fn set_copyright(&self, copyright: Option<&str>) { + pub fn set_copyright<'a>(&self, copyright: impl Into>) { unsafe { - ffi::gtk_about_dialog_set_copyright(self.to_glib_none().0, copyright.to_glib_none().0); + ffi::gtk_about_dialog_set_copyright( + self.to_glib_none().0, + copyright.into().to_glib_none().0, + ); } } @@ -236,9 +242,12 @@ impl AboutDialog { #[doc(alias = "gtk_about_dialog_set_license")] #[doc(alias = "license")] - pub fn set_license(&self, license: Option<&str>) { + pub fn set_license<'a>(&self, license: impl Into>) { unsafe { - ffi::gtk_about_dialog_set_license(self.to_glib_none().0, license.to_glib_none().0); + ffi::gtk_about_dialog_set_license( + self.to_glib_none().0, + license.into().to_glib_none().0, + ); } } @@ -252,69 +261,78 @@ impl AboutDialog { #[doc(alias = "gtk_about_dialog_set_logo")] #[doc(alias = "logo")] - pub fn set_logo(&self, logo: Option<&impl IsA>) { + pub fn set_logo<'a, P: IsA>(&self, logo: impl Into>) { unsafe { ffi::gtk_about_dialog_set_logo( self.to_glib_none().0, - logo.map(|p| p.as_ref()).to_glib_none().0, + logo.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "gtk_about_dialog_set_logo_icon_name")] #[doc(alias = "logo-icon-name")] - pub fn set_logo_icon_name(&self, icon_name: Option<&str>) { + pub fn set_logo_icon_name<'a>(&self, icon_name: impl Into>) { unsafe { ffi::gtk_about_dialog_set_logo_icon_name( self.to_glib_none().0, - icon_name.to_glib_none().0, + icon_name.into().to_glib_none().0, ); } } #[doc(alias = "gtk_about_dialog_set_program_name")] #[doc(alias = "program-name")] - pub fn set_program_name(&self, name: Option<&str>) { + pub fn set_program_name<'a>(&self, name: impl Into>) { unsafe { - ffi::gtk_about_dialog_set_program_name(self.to_glib_none().0, name.to_glib_none().0); + ffi::gtk_about_dialog_set_program_name( + self.to_glib_none().0, + name.into().to_glib_none().0, + ); } } #[doc(alias = "gtk_about_dialog_set_system_information")] #[doc(alias = "system-information")] - pub fn set_system_information(&self, system_information: Option<&str>) { + pub fn set_system_information<'a>(&self, system_information: impl Into>) { unsafe { ffi::gtk_about_dialog_set_system_information( self.to_glib_none().0, - system_information.to_glib_none().0, + system_information.into().to_glib_none().0, ); } } #[doc(alias = "gtk_about_dialog_set_translator_credits")] #[doc(alias = "translator-credits")] - pub fn set_translator_credits(&self, translator_credits: Option<&str>) { + pub fn set_translator_credits<'a>(&self, translator_credits: impl Into>) { unsafe { ffi::gtk_about_dialog_set_translator_credits( self.to_glib_none().0, - translator_credits.to_glib_none().0, + translator_credits.into().to_glib_none().0, ); } } #[doc(alias = "gtk_about_dialog_set_version")] #[doc(alias = "version")] - pub fn set_version(&self, version: Option<&str>) { + pub fn set_version<'a>(&self, version: impl Into>) { unsafe { - ffi::gtk_about_dialog_set_version(self.to_glib_none().0, version.to_glib_none().0); + ffi::gtk_about_dialog_set_version( + self.to_glib_none().0, + version.into().to_glib_none().0, + ); } } #[doc(alias = "gtk_about_dialog_set_website")] #[doc(alias = "website")] - pub fn set_website(&self, website: Option<&str>) { + pub fn set_website<'a>(&self, website: impl Into>) { unsafe { - ffi::gtk_about_dialog_set_website(self.to_glib_none().0, website.to_glib_none().0); + ffi::gtk_about_dialog_set_website( + self.to_glib_none().0, + website.into().to_glib_none().0, + ); } } @@ -810,7 +828,7 @@ impl AboutDialogBuilder { pub fn logo(self, logo: &impl IsA) -> Self { Self { - builder: self.builder.property("logo", logo.clone().upcast()), + builder: self.builder.property("logo", logo.as_ref().clone()), } } @@ -872,13 +890,13 @@ impl AboutDialogBuilder { Self { builder: self .builder - .property("application", application.clone().upcast()), + .property("application", application.as_ref().clone()), } } pub fn child(self, child: &impl IsA) -> Self { Self { - builder: self.builder.property("child", child.clone().upcast()), + builder: self.builder.property("child", child.as_ref().clone()), } } @@ -898,7 +916,7 @@ impl AboutDialogBuilder { Self { builder: self .builder - .property("default-widget", default_widget.clone().upcast()), + .property("default-widget", default_widget.as_ref().clone()), } } @@ -924,7 +942,7 @@ impl AboutDialogBuilder { pub fn display(self, display: &impl IsA) -> Self { Self { - builder: self.builder.property("display", display.clone().upcast()), + builder: self.builder.property("display", display.as_ref().clone()), } } @@ -938,7 +956,7 @@ impl AboutDialogBuilder { Self { builder: self .builder - .property("focus-widget", focus_widget.clone().upcast()), + .property("focus-widget", focus_widget.as_ref().clone()), } } @@ -1012,7 +1030,7 @@ impl AboutDialogBuilder { #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] pub fn titlebar(self, titlebar: &impl IsA) -> Self { Self { - builder: self.builder.property("titlebar", titlebar.clone().upcast()), + builder: self.builder.property("titlebar", titlebar.as_ref().clone()), } } @@ -1020,7 +1038,7 @@ impl AboutDialogBuilder { Self { builder: self .builder - .property("transient-for", transient_for.clone().upcast()), + .property("transient-for", transient_for.as_ref().clone()), } } @@ -1100,7 +1118,7 @@ impl AboutDialogBuilder { Self { builder: self .builder - .property("layout-manager", layout_manager.clone().upcast()), + .property("layout-manager", layout_manager.as_ref().clone()), } } diff --git a/gtk4/src/auto/accessible.rs b/gtk4/src/auto/accessible.rs index 8b971495683d..e68fee04f6aa 100644 --- a/gtk4/src/auto/accessible.rs +++ b/gtk4/src/auto/accessible.rs @@ -178,16 +178,21 @@ pub trait AccessibleExt: IsA + 'static { #[cfg(feature = "v4_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] #[doc(alias = "gtk_accessible_set_accessible_parent")] - fn set_accessible_parent( + fn set_accessible_parent<'a, P: IsA, Q: IsA>( &self, - parent: Option<&impl IsA>, - next_sibling: Option<&impl IsA>, + parent: impl Into>, + next_sibling: impl Into>, ) { unsafe { ffi::gtk_accessible_set_accessible_parent( self.as_ref().to_glib_none().0, - parent.map(|p| p.as_ref()).to_glib_none().0, - next_sibling.map(|p| p.as_ref()).to_glib_none().0, + parent.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, + next_sibling + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, ); } } @@ -195,11 +200,19 @@ pub trait AccessibleExt: IsA + 'static { #[cfg(feature = "v4_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] #[doc(alias = "gtk_accessible_update_next_accessible_sibling")] - fn update_next_accessible_sibling(&self, new_sibling: Option<&impl IsA>) { + fn update_next_accessible_sibling<'a, P: IsA>( + &self, + new_sibling: impl Into>, + ) { unsafe { ffi::gtk_accessible_update_next_accessible_sibling( self.as_ref().to_glib_none().0, - new_sibling.map(|p| p.as_ref()).to_glib_none().0, + new_sibling + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, ); } } diff --git a/gtk4/src/auto/action_bar.rs b/gtk4/src/auto/action_bar.rs index d9d1d0d99054..d0d356bf838f 100644 --- a/gtk4/src/auto/action_bar.rs +++ b/gtk4/src/auto/action_bar.rs @@ -72,11 +72,16 @@ impl ActionBar { } #[doc(alias = "gtk_action_bar_set_center_widget")] - pub fn set_center_widget(&self, center_widget: Option<&impl IsA>) { + pub fn set_center_widget<'a, P: IsA>(&self, center_widget: impl Into>) { unsafe { ffi::gtk_action_bar_set_center_widget( self.to_glib_none().0, - center_widget.map(|p| p.as_ref()).to_glib_none().0, + center_widget + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, ); } } @@ -217,7 +222,7 @@ impl ActionBarBuilder { Self { builder: self .builder - .property("layout-manager", layout_manager.clone().upcast()), + .property("layout-manager", layout_manager.as_ref().clone()), } } diff --git a/gtk4/src/auto/actionable.rs b/gtk4/src/auto/actionable.rs index b2848705be46..902ad64ff341 100644 --- a/gtk4/src/auto/actionable.rs +++ b/gtk4/src/auto/actionable.rs @@ -48,22 +48,22 @@ pub trait ActionableExt: IsA + 'static { #[doc(alias = "gtk_actionable_set_action_name")] #[doc(alias = "action-name")] - fn set_action_name(&self, action_name: Option<&str>) { + fn set_action_name<'a>(&self, action_name: impl Into>) { unsafe { ffi::gtk_actionable_set_action_name( self.as_ref().to_glib_none().0, - action_name.to_glib_none().0, + action_name.into().to_glib_none().0, ); } } #[doc(alias = "gtk_actionable_set_action_target_value")] #[doc(alias = "action-target")] - fn set_action_target_value(&self, target_value: Option<&glib::Variant>) { + fn set_action_target_value<'a>(&self, target_value: impl Into>) { unsafe { ffi::gtk_actionable_set_action_target_value( self.as_ref().to_glib_none().0, - target_value.to_glib_none().0, + target_value.into().to_glib_none().0, ); } } diff --git a/gtk4/src/auto/alert_dialog.rs b/gtk4/src/auto/alert_dialog.rs index f9835f9a2679..34a2dba572b2 100644 --- a/gtk4/src/auto/alert_dialog.rs +++ b/gtk4/src/auto/alert_dialog.rs @@ -34,11 +34,16 @@ impl AlertDialog { } #[doc(alias = "gtk_alert_dialog_choose")] - pub fn choose) + 'static>( + pub fn choose< + 'a, + P: IsA, + Q: IsA, + R: FnOnce(Result) + 'static, + >( &self, - parent: Option<&impl IsA>, - cancellable: Option<&impl IsA>, - callback: P, + parent: impl Into>, + cancellable: impl Into>, + callback: R, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); @@ -50,9 +55,9 @@ impl AlertDialog { "Async operations only allowed if the thread is owning the MainContext" ); - let user_data: Box_> = + let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn choose_trampoline) + 'static>( + unsafe extern "C" fn choose_trampoline) + 'static>( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, @@ -65,28 +70,33 @@ impl AlertDialog { } else { Err(from_glib_full(error)) }; - let callback: Box_> = + let callback: Box_> = Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); + let callback: R = callback.into_inner(); callback(result); } - let callback = choose_trampoline::

; + let callback = choose_trampoline::; unsafe { ffi::gtk_alert_dialog_choose( self.to_glib_none().0, - parent.map(|p| p.as_ref()).to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, + parent.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, + cancellable + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } - pub fn choose_future( + pub fn choose_future<'a, P: IsA + Clone + 'static>( &self, - parent: Option<&(impl IsA + Clone + 'static)>, + parent: impl Into>, ) -> Pin> + 'static>> { - let parent = parent.map(ToOwned::to_owned); + let parent = parent.into().map(ToOwned::to_owned); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.choose( parent.as_ref().map(::std::borrow::Borrow::borrow), @@ -190,11 +200,11 @@ impl AlertDialog { } #[doc(alias = "gtk_alert_dialog_show")] - pub fn show(&self, parent: Option<&impl IsA>) { + pub fn show<'a, P: IsA>(&self, parent: impl Into>) { unsafe { ffi::gtk_alert_dialog_show( self.to_glib_none().0, - parent.map(|p| p.as_ref()).to_glib_none().0, + parent.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } diff --git a/gtk4/src/auto/alternative_trigger.rs b/gtk4/src/auto/alternative_trigger.rs index 2dcc8dee18b7..1dd4296897e0 100644 --- a/gtk4/src/auto/alternative_trigger.rs +++ b/gtk4/src/auto/alternative_trigger.rs @@ -83,13 +83,13 @@ impl AlternativeTriggerBuilder { pub fn first(self, first: &impl IsA) -> Self { Self { - builder: self.builder.property("first", first.clone().upcast()), + builder: self.builder.property("first", first.as_ref().clone()), } } pub fn second(self, second: &impl IsA) -> Self { Self { - builder: self.builder.property("second", second.clone().upcast()), + builder: self.builder.property("second", second.as_ref().clone()), } } diff --git a/gtk4/src/auto/app_chooser_button.rs b/gtk4/src/auto/app_chooser_button.rs index 357a937aacbe..50ca446039cc 100644 --- a/gtk4/src/auto/app_chooser_button.rs +++ b/gtk4/src/auto/app_chooser_button.rs @@ -489,7 +489,7 @@ impl AppChooserButtonBuilder { Self { builder: self .builder - .property("layout-manager", layout_manager.clone().upcast()), + .property("layout-manager", layout_manager.as_ref().clone()), } } diff --git a/gtk4/src/auto/app_chooser_dialog.rs b/gtk4/src/auto/app_chooser_dialog.rs index 0b9b8f52fab5..b50c3d76008e 100644 --- a/gtk4/src/auto/app_chooser_dialog.rs +++ b/gtk4/src/auto/app_chooser_dialog.rs @@ -27,15 +27,15 @@ impl AppChooserDialog { #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] #[doc(alias = "gtk_app_chooser_dialog_new")] - pub fn new( - parent: Option<&impl IsA>, + pub fn new<'a, P: IsA>( + parent: impl Into>, flags: DialogFlags, file: &impl IsA, ) -> AppChooserDialog { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_app_chooser_dialog_new( - parent.map(|p| p.as_ref()).to_glib_none().0, + parent.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, flags.into_glib(), file.as_ref().to_glib_none().0, )) @@ -47,15 +47,15 @@ impl AppChooserDialog { #[allow(deprecated)] #[doc(alias = "gtk_app_chooser_dialog_new_for_content_type")] #[doc(alias = "new_for_content_type")] - pub fn for_content_type( - parent: Option<&impl IsA>, + pub fn for_content_type<'a, P: IsA>( + parent: impl Into>, flags: DialogFlags, content_type: &str, ) -> AppChooserDialog { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_app_chooser_dialog_new_for_content_type( - parent.map(|p| p.as_ref()).to_glib_none().0, + parent.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, flags.into_glib(), content_type.to_glib_none().0, )) diff --git a/gtk4/src/auto/app_chooser_widget.rs b/gtk4/src/auto/app_chooser_widget.rs index 9aea93dbb953..4e5b6427d060 100644 --- a/gtk4/src/auto/app_chooser_widget.rs +++ b/gtk4/src/auto/app_chooser_widget.rs @@ -526,7 +526,7 @@ impl AppChooserWidgetBuilder { Self { builder: self .builder - .property("layout-manager", layout_manager.clone().upcast()), + .property("layout-manager", layout_manager.as_ref().clone()), } } diff --git a/gtk4/src/auto/application.rs b/gtk4/src/auto/application.rs index 5e58259f827d..28ef85d1d790 100644 --- a/gtk4/src/auto/application.rs +++ b/gtk4/src/auto/application.rs @@ -49,7 +49,7 @@ impl ApplicationBuilder { pub fn menubar(self, menubar: &impl IsA) -> Self { Self { - builder: self.builder.property("menubar", menubar.clone().upcast()), + builder: self.builder.property("menubar", menubar.as_ref().clone()), } } @@ -196,18 +196,18 @@ pub trait GtkApplicationExt: IsA + 'static { } #[doc(alias = "gtk_application_inhibit")] - fn inhibit( + fn inhibit<'a, P: IsA>( &self, - window: Option<&impl IsA>, + window: impl Into>, flags: ApplicationInhibitFlags, - reason: Option<&str>, + reason: impl Into>, ) -> u32 { unsafe { ffi::gtk_application_inhibit( self.as_ref().to_glib_none().0, - window.map(|p| p.as_ref()).to_glib_none().0, + window.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, flags.into_glib(), - reason.to_glib_none().0, + reason.into().to_glib_none().0, ) } } @@ -244,11 +244,11 @@ pub trait GtkApplicationExt: IsA + 'static { #[doc(alias = "gtk_application_set_menubar")] #[doc(alias = "menubar")] - fn set_menubar(&self, menubar: Option<&impl IsA>) { + fn set_menubar<'a, P: IsA>(&self, menubar: impl Into>) { unsafe { ffi::gtk_application_set_menubar( self.as_ref().to_glib_none().0, - menubar.map(|p| p.as_ref()).to_glib_none().0, + menubar.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } diff --git a/gtk4/src/auto/application_window.rs b/gtk4/src/auto/application_window.rs index 349e7ca927cd..7506f052bfcc 100644 --- a/gtk4/src/auto/application_window.rs +++ b/gtk4/src/auto/application_window.rs @@ -77,13 +77,13 @@ impl ApplicationWindowBuilder { Self { builder: self .builder - .property("application", application.clone().upcast()), + .property("application", application.as_ref().clone()), } } pub fn child(self, child: &impl IsA) -> Self { Self { - builder: self.builder.property("child", child.clone().upcast()), + builder: self.builder.property("child", child.as_ref().clone()), } } @@ -103,7 +103,7 @@ impl ApplicationWindowBuilder { Self { builder: self .builder - .property("default-widget", default_widget.clone().upcast()), + .property("default-widget", default_widget.as_ref().clone()), } } @@ -129,7 +129,7 @@ impl ApplicationWindowBuilder { pub fn display(self, display: &impl IsA) -> Self { Self { - builder: self.builder.property("display", display.clone().upcast()), + builder: self.builder.property("display", display.as_ref().clone()), } } @@ -143,7 +143,7 @@ impl ApplicationWindowBuilder { Self { builder: self .builder - .property("focus-widget", focus_widget.clone().upcast()), + .property("focus-widget", focus_widget.as_ref().clone()), } } @@ -217,7 +217,7 @@ impl ApplicationWindowBuilder { #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] pub fn titlebar(self, titlebar: &impl IsA) -> Self { Self { - builder: self.builder.property("titlebar", titlebar.clone().upcast()), + builder: self.builder.property("titlebar", titlebar.as_ref().clone()), } } @@ -225,7 +225,7 @@ impl ApplicationWindowBuilder { Self { builder: self .builder - .property("transient-for", transient_for.clone().upcast()), + .property("transient-for", transient_for.as_ref().clone()), } } @@ -305,7 +305,7 @@ impl ApplicationWindowBuilder { Self { builder: self .builder - .property("layout-manager", layout_manager.clone().upcast()), + .property("layout-manager", layout_manager.as_ref().clone()), } } @@ -451,11 +451,11 @@ pub trait ApplicationWindowExt: IsA + 'static { } #[doc(alias = "gtk_application_window_set_help_overlay")] - fn set_help_overlay(&self, help_overlay: Option<&ShortcutsWindow>) { + fn set_help_overlay<'a>(&self, help_overlay: impl Into>) { unsafe { ffi::gtk_application_window_set_help_overlay( self.as_ref().to_glib_none().0, - help_overlay.to_glib_none().0, + help_overlay.into().to_glib_none().0, ); } } diff --git a/gtk4/src/auto/aspect_frame.rs b/gtk4/src/auto/aspect_frame.rs index bbf8c91fa25b..bc128b5a74b9 100644 --- a/gtk4/src/auto/aspect_frame.rs +++ b/gtk4/src/auto/aspect_frame.rs @@ -78,11 +78,11 @@ impl AspectFrame { #[doc(alias = "gtk_aspect_frame_set_child")] #[doc(alias = "child")] - pub fn set_child(&self, child: Option<&impl IsA>) { + pub fn set_child<'a, P: IsA>(&self, child: impl Into>) { unsafe { ffi::gtk_aspect_frame_set_child( self.to_glib_none().0, - child.map(|p| p.as_ref()).to_glib_none().0, + child.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } @@ -259,7 +259,7 @@ impl AspectFrameBuilder { pub fn child(self, child: &impl IsA) -> Self { Self { - builder: self.builder.property("child", child.clone().upcast()), + builder: self.builder.property("child", child.as_ref().clone()), } } @@ -363,7 +363,7 @@ impl AspectFrameBuilder { Self { builder: self .builder - .property("layout-manager", layout_manager.clone().upcast()), + .property("layout-manager", layout_manager.as_ref().clone()), } } diff --git a/gtk4/src/auto/assistant.rs b/gtk4/src/auto/assistant.rs index 9323ff2d84c1..9fd74509d41c 100644 --- a/gtk4/src/auto/assistant.rs +++ b/gtk4/src/auto/assistant.rs @@ -490,13 +490,13 @@ impl AssistantBuilder { Self { builder: self .builder - .property("application", application.clone().upcast()), + .property("application", application.as_ref().clone()), } } pub fn child(self, child: &impl IsA) -> Self { Self { - builder: self.builder.property("child", child.clone().upcast()), + builder: self.builder.property("child", child.as_ref().clone()), } } @@ -516,7 +516,7 @@ impl AssistantBuilder { Self { builder: self .builder - .property("default-widget", default_widget.clone().upcast()), + .property("default-widget", default_widget.as_ref().clone()), } } @@ -542,7 +542,7 @@ impl AssistantBuilder { pub fn display(self, display: &impl IsA) -> Self { Self { - builder: self.builder.property("display", display.clone().upcast()), + builder: self.builder.property("display", display.as_ref().clone()), } } @@ -556,7 +556,7 @@ impl AssistantBuilder { Self { builder: self .builder - .property("focus-widget", focus_widget.clone().upcast()), + .property("focus-widget", focus_widget.as_ref().clone()), } } @@ -630,7 +630,7 @@ impl AssistantBuilder { #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] pub fn titlebar(self, titlebar: &impl IsA) -> Self { Self { - builder: self.builder.property("titlebar", titlebar.clone().upcast()), + builder: self.builder.property("titlebar", titlebar.as_ref().clone()), } } @@ -638,7 +638,7 @@ impl AssistantBuilder { Self { builder: self .builder - .property("transient-for", transient_for.clone().upcast()), + .property("transient-for", transient_for.as_ref().clone()), } } @@ -718,7 +718,7 @@ impl AssistantBuilder { Self { builder: self .builder - .property("layout-manager", layout_manager.clone().upcast()), + .property("layout-manager", layout_manager.as_ref().clone()), } } diff --git a/gtk4/src/auto/assistant_page.rs b/gtk4/src/auto/assistant_page.rs index cd6befbe54b5..554ffadb911f 100644 --- a/gtk4/src/auto/assistant_page.rs +++ b/gtk4/src/auto/assistant_page.rs @@ -57,8 +57,8 @@ impl AssistantPage { } #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] - pub fn set_title(&self, title: Option<&str>) { - ObjectExt::set_property(self, "title", title) + pub fn set_title<'a>(&self, title: impl Into>) { + ObjectExt::set_property(self, "title", title.into()) } #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] diff --git a/gtk4/src/auto/at_context.rs b/gtk4/src/auto/at_context.rs index 34e79926e6f4..cc2ea42fe75c 100644 --- a/gtk4/src/auto/at_context.rs +++ b/gtk4/src/auto/at_context.rs @@ -62,8 +62,8 @@ impl ATContext { ObjectExt::property(self, "display") } - pub fn set_display>(&self, display: Option<&P>) { - ObjectExt::set_property(self, "display", display) + pub fn set_display<'a, P: IsA>(&self, display: impl Into>) { + ObjectExt::set_property(self, "display", display.into().as_ref().map(|p| p.as_ref())) } #[doc(alias = "state-change")] diff --git a/gtk4/src/auto/bookmark_list.rs b/gtk4/src/auto/bookmark_list.rs index 57acb0a13bc7..ca18853411f1 100644 --- a/gtk4/src/auto/bookmark_list.rs +++ b/gtk4/src/auto/bookmark_list.rs @@ -21,15 +21,15 @@ glib::wrapper! { impl BookmarkList { #[doc(alias = "gtk_bookmark_list_new")] - pub fn new( + pub fn new<'a>( filename: Option>, - attributes: Option<&str>, + attributes: impl Into>, ) -> BookmarkList { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_bookmark_list_new( filename.as_ref().map(|p| p.as_ref()).to_glib_none().0, - attributes.to_glib_none().0, + attributes.into().to_glib_none().0, )) } } @@ -54,11 +54,11 @@ impl BookmarkList { #[doc(alias = "gtk_bookmark_list_set_attributes")] #[doc(alias = "attributes")] - pub fn set_attributes(&self, attributes: Option<&str>) { + pub fn set_attributes<'a>(&self, attributes: impl Into>) { unsafe { ffi::gtk_bookmark_list_set_attributes( self.to_glib_none().0, - attributes.to_glib_none().0, + attributes.into().to_glib_none().0, ); } } diff --git a/gtk4/src/auto/box_.rs b/gtk4/src/auto/box_.rs index cb16f488c261..aef35974ed3e 100644 --- a/gtk4/src/auto/box_.rs +++ b/gtk4/src/auto/box_.rs @@ -168,7 +168,7 @@ impl BoxBuilder { Self { builder: self .builder - .property("layout-manager", layout_manager.clone().upcast()), + .property("layout-manager", layout_manager.as_ref().clone()), } } @@ -336,12 +336,16 @@ pub trait BoxExt: IsA + 'static { } #[doc(alias = "gtk_box_insert_child_after")] - fn insert_child_after(&self, child: &impl IsA, sibling: Option<&impl IsA>) { + fn insert_child_after<'a, P: IsA>( + &self, + child: &impl IsA, + sibling: impl Into>, + ) { unsafe { ffi::gtk_box_insert_child_after( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, - sibling.map(|p| p.as_ref()).to_glib_none().0, + sibling.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } @@ -367,12 +371,16 @@ pub trait BoxExt: IsA + 'static { } #[doc(alias = "gtk_box_reorder_child_after")] - fn reorder_child_after(&self, child: &impl IsA, sibling: Option<&impl IsA>) { + fn reorder_child_after<'a, P: IsA>( + &self, + child: &impl IsA, + sibling: impl Into>, + ) { unsafe { ffi::gtk_box_reorder_child_after( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, - sibling.map(|p| p.as_ref()).to_glib_none().0, + sibling.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } diff --git a/gtk4/src/auto/builder.rs b/gtk4/src/auto/builder.rs index 9bf1e521d604..a8ad214978c3 100644 --- a/gtk4/src/auto/builder.rs +++ b/gtk4/src/auto/builder.rs @@ -160,11 +160,11 @@ impl Builder { } #[doc(alias = "gtk_builder_create_closure")] - pub fn create_closure( + pub fn create_closure<'a, P: IsA>( &self, function_name: &str, flags: BuilderClosureFlags, - object: Option<&impl IsA>, + object: impl Into>, ) -> Result, glib::Error> { unsafe { let mut error = std::ptr::null_mut(); @@ -172,7 +172,7 @@ impl Builder { self.to_glib_none().0, function_name.to_glib_none().0, flags.into_glib(), - object.map(|p| p.as_ref()).to_glib_none().0, + object.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { @@ -261,31 +261,42 @@ impl Builder { #[doc(alias = "gtk_builder_set_current_object")] #[doc(alias = "current-object")] - pub fn set_current_object(&self, current_object: Option<&impl IsA>) { + pub fn set_current_object<'a, P: IsA>( + &self, + current_object: impl Into>, + ) { unsafe { ffi::gtk_builder_set_current_object( self.to_glib_none().0, - current_object.map(|p| p.as_ref()).to_glib_none().0, + current_object + .into() + .as_ref() + .map(|p| p.as_ref()) + .to_glib_none() + .0, ); } } #[doc(alias = "gtk_builder_set_scope")] #[doc(alias = "scope")] - pub fn set_scope(&self, scope: Option<&impl IsA>) { + pub fn set_scope<'a, P: IsA>(&self, scope: impl Into>) { unsafe { ffi::gtk_builder_set_scope( self.to_glib_none().0, - scope.map(|p| p.as_ref()).to_glib_none().0, + scope.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "gtk_builder_set_translation_domain")] #[doc(alias = "translation-domain")] - pub fn set_translation_domain(&self, domain: Option<&str>) { + pub fn set_translation_domain<'a>(&self, domain: impl Into>) { unsafe { - ffi::gtk_builder_set_translation_domain(self.to_glib_none().0, domain.to_glib_none().0); + ffi::gtk_builder_set_translation_domain( + self.to_glib_none().0, + domain.into().to_glib_none().0, + ); } } diff --git a/gtk4/src/auto/builder_list_item_factory.rs b/gtk4/src/auto/builder_list_item_factory.rs index 2b07ec973243..645256c8439a 100644 --- a/gtk4/src/auto/builder_list_item_factory.rs +++ b/gtk4/src/auto/builder_list_item_factory.rs @@ -17,14 +17,14 @@ glib::wrapper! { impl BuilderListItemFactory { #[doc(alias = "gtk_builder_list_item_factory_new_from_bytes")] #[doc(alias = "new_from_bytes")] - pub fn from_bytes( - scope: Option<&impl IsA>, + pub fn from_bytes<'a, P: IsA>( + scope: impl Into>, bytes: &glib::Bytes, ) -> BuilderListItemFactory { assert_initialized_main_thread!(); unsafe { ListItemFactory::from_glib_full(ffi::gtk_builder_list_item_factory_new_from_bytes( - scope.map(|p| p.as_ref()).to_glib_none().0, + scope.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, bytes.to_glib_none().0, )) .unsafe_cast() @@ -33,14 +33,14 @@ impl BuilderListItemFactory { #[doc(alias = "gtk_builder_list_item_factory_new_from_resource")] #[doc(alias = "new_from_resource")] - pub fn from_resource( - scope: Option<&impl IsA>, + pub fn from_resource<'a, P: IsA>( + scope: impl Into>, resource_path: &str, ) -> BuilderListItemFactory { assert_initialized_main_thread!(); unsafe { ListItemFactory::from_glib_full(ffi::gtk_builder_list_item_factory_new_from_resource( - scope.map(|p| p.as_ref()).to_glib_none().0, + scope.into().as_ref().map(|p| p.as_ref()).to_glib_none().0, resource_path.to_glib_none().0, )) .unsafe_cast() diff --git a/gtk4/src/auto/button.rs b/gtk4/src/auto/button.rs index 538b6d4c920c..a78ae9b79d05 100644 --- a/gtk4/src/auto/button.rs +++ b/gtk4/src/auto/button.rs @@ -104,7 +104,7 @@ impl ButtonBuilder { pub fn child(self, child: &impl IsA) -> Self { Self { - builder: self.builder.property("child", child.clone().upcast()), + builder: self.builder.property("child", child.as_ref().clone()), } } @@ -208,7 +208,7 @@ impl ButtonBuilder { Self { builder: self .builder - .property("layout-manager", layout_manager.clone().upcast()), + .property("layout-manager", layout_manager.as_ref().clone()), } } @@ -410,11 +410,11 @@ pub trait ButtonExt: IsA