From bfa7137dbeab722e7c469282c2e222baec6f6413 Mon Sep 17 00:00:00 2001 From: Sophie Herold Date: Sat, 21 Nov 2020 16:01:12 +0100 Subject: [PATCH] Add some trust_return_value_nullability's for gtk --- gtk4/Gir.toml | 86 ++++++++++++++++++---------- gtk4/src/auto/alternative_trigger.rs | 4 +- gtk4/src/auto/dialog.rs | 4 +- gtk4/src/auto/info_bar.rs | 2 +- gtk4/src/auto/label.rs | 6 +- gtk4/src/auto/message_dialog.rs | 2 +- gtk4/src/auto/text_buffer.rs | 56 ++++++------------ 7 files changed, 84 insertions(+), 76 deletions(-) diff --git a/gtk4/Gir.toml b/gtk4/Gir.toml index 89c43147dad9..51d8ff84d7bd 100644 --- a/gtk4/Gir.toml +++ b/gtk4/Gir.toml @@ -404,33 +404,50 @@ status = "generate" name = "Gtk.AboutDialog" status = "generate" generate_builder = true +trust_return_value_nullability = true [[object.signal]] name = "activate-link" inhibit = true + # remove_after_upstream_fix + # + [[object.function]] + name = "get_program_name" + [object.function.return] + nullable = true [[object]] name = "Gtk.Actionable" status = "generate" +trust_return_value_nullability = true manual_traits = ["ActionableExtManual"] [[object.property]] #value glib.Variant name = "action-target" ignore = true + # remove_after_upstream_fix + # + [[object.function]] + name = "get_action_target_value" + [object.function.return] + nullable = true [[object]] name = "Gtk.ActionBar" status = "generate" generate_builder = true +trust_return_value_nullability = true [[object]] name = "Gtk.Adjustment" status = "generate" generate_builder = true +trust_return_value_nullability = true [[object]] name = "Gtk.AlternativeTrigger" status = "generate" generate_builder = true +trust_return_value_nullability = true [[object]] name = "Gtk.AppChooserButton" @@ -441,34 +458,51 @@ generate_builder = true name = "Gtk.AppChooserDialog" status = "generate" generate_builder = true - [[object.function]] - name = "get_widget" - [object.function.return] - nullable = false +trust_return_value_nullability = true [[object]] name = "Gtk.AppChooserWidget" status = "generate" generate_builder = true +trust_return_value_nullability = true + # remove_after_upstream_fix + # + [[object.function]] + name = "get_default_text" + [object.function.return] + nullable = true [[object]] name = "Gtk.Application" status = "generate" generate_builder = true +trust_return_value_nullability = true trait_name = "GtkApplicationExt" [[object.function]] name = "new" ignore = true + # remove_after_upstream_fix + # + [[object.function]] + name = "get_menu_by_id" + [object.function.return] + nullable = true + [[object.function]] + name = "get_menubar" + [object.function.return] + nullable = true [[object]] name = "Gtk.ApplicationWindow" status = "generate" generate_builder = true +trust_return_value_nullability = true [[object]] name = "Gtk.AspectFrame" status = "generate" generate_builder = true +trust_return_value_nullability = true [[object]] name = "Gtk.Assistant" @@ -765,16 +799,9 @@ manual_traits = ["ConstraintGuideExtManual"] name = "Gtk.Dialog" status = "generate" generate_builder = true +trust_return_value_nullability = true manual_traits = ["DialogExtManual"] [[object.function]] - name = "add_button" - [object.function.return] - nullable = false - [[object.function]] - name = "get_content_area" - [object.function.return] - nullable = false - [[object.function]] name = "get_response_for_widget" ignore = true doc_trait_name = "DialogExtManual" @@ -842,12 +869,9 @@ manual_traits = ["EditableExtManual"] name = "Gtk.Entry" status = "generate" generate_builder = true +trust_return_value_nullability = true manual_traits = ["EntryExtManual"] [[object.function]] - name = "get_buffer" - [object.function.return] - nullable = false - [[object.function]] name = "get_invisible_char" manual = true [[object.function]] @@ -856,15 +880,16 @@ manual_traits = ["EntryExtManual"] name = "ch" nullable = true [[object.function]] - name = "set_placeholder_text" - [[object.function.parameter]] - name = "text" - nullable = true - [[object.function]] name = "set_tabs" [[object.function.parameter]] name = "tabs" const = true + # remove_after_upstream_fix + # + [[object.function]] + name = "get_completion" + [object.function.return] + nullable = true [[object]] name = "Gtk.EntryBuffer" @@ -1145,6 +1170,7 @@ manual_traits = ["IMContextSimpleExtManual"] name = "Gtk.InfoBar" status = "generate" generate_builder = true +trust_return_value_nullability = true [[object]] name = "Gtk.KeyvalTrigger" @@ -1155,9 +1181,16 @@ generate_builder = true name = "Gtk.Label" status = "generate" generate_builder = true +trust_return_value_nullability = true [[object.signal]] name = "activate-link" inhibit = true + # remove_after_upstream_fix + # + [[object.function]] + name = "get_extra_menu" + [object.function.return] + nullable = true [[object]] name = "Gtk.LevelBar" @@ -1254,6 +1287,7 @@ generate_builder = true name = "Gtk.MessageDialog" status = "generate" generate_builder = true +trust_return_value_nullability = true [[object]] name = "Gtk.MnemonicTrigger" @@ -1639,6 +1673,7 @@ generate_builder = true name = "Gtk.SpinButton" status = "generate" generate_builder = true +trust_return_value_nullability = true manual_traits = ["SpinButtonExtManual"] [[object.function]] name = "get_adjustment" @@ -1727,16 +1762,9 @@ generate_builder = true name = "Gtk.TextBuffer" status = "generate" generate_builder = true +trust_return_value_nullability = true manual_traits = ["TextBufferExtManual"] [[object.function]] - name = "register_deserialize_tagset" - [object.function.return] - nullable = false - [[object.function]] - name = "register_serialize_tagset" - [object.function.return] - nullable = false - [[object.function]] name = "paste_clipboard" [[object.function.parameter]] name = "override_location" diff --git a/gtk4/src/auto/alternative_trigger.rs b/gtk4/src/auto/alternative_trigger.rs index 89df82c116c9..c938de4cd055 100644 --- a/gtk4/src/auto/alternative_trigger.rs +++ b/gtk4/src/auto/alternative_trigger.rs @@ -34,7 +34,7 @@ impl AlternativeTrigger { } } - pub fn get_first(&self) -> Option { + pub fn get_first(&self) -> ShortcutTrigger { unsafe { from_glib_none(gtk_sys::gtk_alternative_trigger_get_first( self.to_glib_none().0, @@ -42,7 +42,7 @@ impl AlternativeTrigger { } } - pub fn get_second(&self) -> Option { + pub fn get_second(&self) -> ShortcutTrigger { unsafe { from_glib_none(gtk_sys::gtk_alternative_trigger_get_second( self.to_glib_none().0, diff --git a/gtk4/src/auto/dialog.rs b/gtk4/src/auto/dialog.rs index 3fd04e9ed802..e00e01cd90ef 100644 --- a/gtk4/src/auto/dialog.rs +++ b/gtk4/src/auto/dialog.rs @@ -541,7 +541,7 @@ pub trait DialogExt: 'static { fn get_content_area(&self) -> Box; - fn get_header_bar(&self) -> Option; + fn get_header_bar(&self) -> HeaderBar; fn get_widget_for_response(&self, response_id: ResponseType) -> Option; @@ -593,7 +593,7 @@ impl> DialogExt for O { } } - fn get_header_bar(&self) -> Option { + fn get_header_bar(&self) -> HeaderBar { unsafe { from_glib_none(gtk_sys::gtk_dialog_get_header_bar( self.as_ref().to_glib_none().0, diff --git a/gtk4/src/auto/info_bar.rs b/gtk4/src/auto/info_bar.rs index fd20b05e733d..67e731a61d40 100644 --- a/gtk4/src/auto/info_bar.rs +++ b/gtk4/src/auto/info_bar.rs @@ -59,7 +59,7 @@ impl InfoBar { } } - pub fn add_button(&self, button_text: &str, response_id: ResponseType) -> Option