Skip to content
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

Add some trust_return_value_nullability's for gtk #67

Merged
merged 1 commit into from
Nov 21, 2020
Merged
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
86 changes: 57 additions & 29 deletions gtk4/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
# <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2873>
[[object.function]]
name = "get_program_name"
[object.function.return]
nullable = true
sophie-h marked this conversation as resolved.
Show resolved Hide resolved

[[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
# <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2873>
[[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"
Expand All @@ -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
# <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2873>
[[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
# <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2873>
[[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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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]]
Expand All @@ -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
# <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2873>
[[object.function]]
name = "get_completion"
[object.function.return]
nullable = true

[[object]]
name = "Gtk.EntryBuffer"
Expand Down Expand Up @@ -1145,6 +1170,7 @@ manual_traits = ["IMContextSimpleExtManual"]
name = "Gtk.InfoBar"
status = "generate"
generate_builder = true
trust_return_value_nullability = true

[[object]]
name = "Gtk.KeyvalTrigger"
Expand All @@ -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
# <https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2873>
[[object.function]]
name = "get_extra_menu"
[object.function.return]
nullable = true

[[object]]
name = "Gtk.LevelBar"
Expand Down Expand Up @@ -1254,6 +1287,7 @@ generate_builder = true
name = "Gtk.MessageDialog"
status = "generate"
generate_builder = true
trust_return_value_nullability = true

[[object]]
name = "Gtk.MnemonicTrigger"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions gtk4/src/auto/alternative_trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ impl AlternativeTrigger {
}
}

pub fn get_first(&self) -> Option<ShortcutTrigger> {
pub fn get_first(&self) -> ShortcutTrigger {
unsafe {
from_glib_none(gtk_sys::gtk_alternative_trigger_get_first(
self.to_glib_none().0,
))
}
}

pub fn get_second(&self) -> Option<ShortcutTrigger> {
pub fn get_second(&self) -> ShortcutTrigger {
unsafe {
from_glib_none(gtk_sys::gtk_alternative_trigger_get_second(
self.to_glib_none().0,
Expand Down
4 changes: 2 additions & 2 deletions gtk4/src/auto/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ pub trait DialogExt: 'static {

fn get_content_area(&self) -> Box;

fn get_header_bar(&self) -> Option<HeaderBar>;
fn get_header_bar(&self) -> HeaderBar;

fn get_widget_for_response(&self, response_id: ResponseType) -> Option<Widget>;

Expand Down Expand Up @@ -593,7 +593,7 @@ impl<O: IsA<Dialog>> DialogExt for O {
}
}

fn get_header_bar(&self) -> Option<HeaderBar> {
fn get_header_bar(&self) -> HeaderBar {
unsafe {
from_glib_none(gtk_sys::gtk_dialog_get_header_bar(
self.as_ref().to_glib_none().0,
Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/auto/info_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl InfoBar {
}
}

pub fn add_button(&self, button_text: &str, response_id: ResponseType) -> Option<Button> {
pub fn add_button(&self, button_text: &str, response_id: ResponseType) -> Button {
unsafe {
from_glib_none(gtk_sys::gtk_info_bar_add_button(
self.to_glib_none().0,
Expand Down
6 changes: 3 additions & 3 deletions gtk4/src/auto/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ impl Label {
unsafe { from_glib(gtk_sys::gtk_label_get_justify(self.to_glib_none().0)) }
}

pub fn get_label(&self) -> Option<GString> {
pub fn get_label(&self) -> GString {
unsafe { from_glib_none(gtk_sys::gtk_label_get_label(self.to_glib_none().0)) }
}

pub fn get_layout(&self) -> Option<pango::Layout> {
pub fn get_layout(&self) -> pango::Layout {
unsafe { from_glib_none(gtk_sys::gtk_label_get_layout(self.to_glib_none().0)) }
}

Expand Down Expand Up @@ -153,7 +153,7 @@ impl Label {
}
}

pub fn get_text(&self) -> Option<GString> {
pub fn get_text(&self) -> GString {
unsafe { from_glib_none(gtk_sys::gtk_label_get_text(self.to_glib_none().0)) }
}

Expand Down
2 changes: 1 addition & 1 deletion gtk4/src/auto/message_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl MessageDialog {
// unsafe { TODO: call gtk_sys:gtk_message_dialog_format_secondary_text() }
//}

pub fn get_message_area(&self) -> Option<Widget> {
pub fn get_message_area(&self) -> Widget {
unsafe {
from_glib_none(gtk_sys::gtk_message_dialog_get_message_area(
self.to_glib_none().0,
Expand Down
Loading