Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

glib/translate: take advantage of Rust Option & Result types #11

Merged
merged 14 commits into from
Nov 6, 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
6 changes: 3 additions & 3 deletions atk/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ manual_traits = ["EditableTextExtManual"]
[[object.function]]
name = "insert_text"
# Expected pointer, received integer
ignore = true
manual = true

[[object]]
name = "Atk.Image"
Expand Down Expand Up @@ -110,10 +110,10 @@ status = "generate"
manual_traits = ["TableExtManual"]
[[object.function]]
name = "get_selected_columns"
ignore = true
manual = true
[[object.function]]
name = "get_selected_rows"
ignore = true
manual = true

[[object]]
name = "Atk.Text"
Expand Down
3 changes: 2 additions & 1 deletion atk/src/auto/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,11 @@ impl<O: IsA<Text>> TextExt for O {

fn get_character_at_offset(&self, offset: i32) -> char {
unsafe {
from_glib(atk_sys::atk_text_get_character_at_offset(
std::convert::TryFrom::try_from(atk_sys::atk_text_get_character_at_offset(
self.as_ref().to_glib_none().0,
offset,
))
.expect("conversion from an invalid Unicode value attempted")
}
}

Expand Down
2 changes: 1 addition & 1 deletion atk/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 @ 7670e3d)
Generated by gir (https://github.com/gtk-rs/gir @ cea2f7c)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
14 changes: 9 additions & 5 deletions atk/sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-dependencies]
system-deps = "1.3"
system-deps = "2.0"

[dependencies]
libc = "0.2"
Expand Down Expand Up @@ -40,7 +40,11 @@ features = ["dox"]
name = "atk"
version = "2.14"

[package.metadata.system-deps.atk.feature-versions]
v2_30 = "2.30"
v2_32 = "2.32"
v2_34 = "2.34"
[package.metadata.system-deps.atk.v2_30]
version = "2.30"

[package.metadata.system-deps.atk.v2_32]
version = "2.32"

[package.metadata.system-deps.atk.v2_34]
version = "2.34"
2 changes: 1 addition & 1 deletion atk/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 @ 7670e3d)
Generated by gir (https://github.com/gtk-rs/gir @ cea2f7c)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
26 changes: 13 additions & 13 deletions gdk-pixbuf/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ status = "generate"
[[object.function]]
name = "get_pixels"
#manual array without length
ignore = true
manual = true
[[object.function]]
name = "get_pixels_with_length"
#manual as get_pixels
Expand All @@ -48,59 +48,59 @@ status = "generate"
[[object.function]]
name = "new_from_file"
#manual is_windows_utf8
ignore = true
manual = true
[[object.function]]
name = "new"
[object.function.return]
nullable = true
[[object.function]]
name = "new_from_file_at_size"
#manual is_windows_utf8
ignore = true
manual = true
[[object.function]]
name = "new_from_file_at_scale"
#manual is_windows_utf8
ignore = true
manual = true
[[object.function]]
name = "new_from_stream_async"
# wrong async return
ignore = true
manual = true
[[object.function]]
name = "new_from_stream_at_scale_async"
# wrong return and don't generated
ignore = true
manual = true
[[object.function]]
name = "get_file_info"
# wrong return
ignore = true
manual = true
[[object.function]]
name = "get_file_info_async"
# wrong async return
ignore = true
manual = true
[[object.function]]
name = "save_to_bufferv"
# manual complex param
ignore = true
manual = true
[[object.function]]
name = "save_to_streamv"
# manual complex param
ignore = true
manual = true
[[object.function]]
name = "savev"
# manual complex param
ignore = true
manual = true
[[object.function]]
name = "save_to_streamv_async"
# manual complex param
ignore = true
manual = true

[[object]]
name = "GdkPixbuf.PixbufAnimation"
status = "generate"
[[object.function]]
name = "get_iter"
# TimeVal misses memory management functions
ignore = true
manual = true

[[object]]
name = "GdkPixbuf.PixbufFormat"
Expand Down
8 changes: 0 additions & 8 deletions gdk-pixbuf/src/auto/pixbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,6 @@ impl Pixbuf {
}
}

//pub fn get_property_pixels(&self) -> /*Unimplemented*/Fundamental: Pointer {
// unsafe {
// let mut value = Value::from_type(</*Unknown type*/ as StaticType>::static_type());
// gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"pixels\0".as_ptr() as *const _, value.to_glib_none_mut().0);
// value.get().expect("Return Value for property `pixels` getter").unwrap()
// }
//}

#[cfg(any(feature = "v2_36_8", feature = "dox"))]
pub fn calculate_rowstride(
colorspace: Colorspace,
Expand Down
2 changes: 1 addition & 1 deletion gdk-pixbuf/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 @ 7670e3d)
Generated by gir (https://github.com/gtk-rs/gir @ cea2f7c)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
18 changes: 12 additions & 6 deletions gdk-pixbuf/sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-dependencies]
system-deps = "1.3"
system-deps = "2.0"

[dependencies]
libc = "0.2"
Expand Down Expand Up @@ -44,8 +44,14 @@ features = ["dox"]
name = "gdk-pixbuf-2.0"
version = "2.30"

[package.metadata.system-deps.gdk_pixbuf_2_0.feature-versions]
v2_32 = "2.32"
v2_36 = "2.36"
v2_36_8 = "2.36.8"
v2_40 = "2.40"
[package.metadata.system-deps.gdk_pixbuf_2_0.v2_32]
version = "2.32"

[package.metadata.system-deps.gdk_pixbuf_2_0.v2_36]
version = "2.36"

[package.metadata.system-deps.gdk_pixbuf_2_0.v2_36_8]
version = "2.36.8"

[package.metadata.system-deps.gdk_pixbuf_2_0.v2_40]
version = "2.40"
2 changes: 1 addition & 1 deletion gdk-pixbuf/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 @ 7670e3d)
Generated by gir (https://github.com/gtk-rs/gir @ cea2f7c)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
30 changes: 15 additions & 15 deletions gdk/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ status = "generate"
ignore = true # cannot be used as is
[[object.function]]
name = "get_history"
ignore = true # need to call "free_history" function by hand
manual = true # need to call "free_history" function by hand
[[object.property]]
name = "tool"
version = "3.22"
Expand Down Expand Up @@ -302,7 +302,7 @@ status = "generate"
[[object.function]]
name = "get_refresh_info"
#wrong gir: no out parameters
ignore = true
manual = true

[[object]]
name = "Gdk.FrameTimings"
Expand All @@ -311,35 +311,35 @@ version = "3.8"
[[object.function]]
name = "get_predicted_presentation_time"
# Use an `Option` for the return value
ignore = true
manual = true
[[object.function]]
name = "get_presentation_time"
# Use an `Option` for the return value
ignore = true
manual = true
[[object.function]]
name = "get_refresh_interval"
# Use an `Option` for the return value
ignore = true
manual = true

[[object]]
name = "Gdk.Keymap"
status = "generate"
[[object.function]]
name = "get_entries_for_keycode"
# Invalid generation of Vec<KeymapKey>
ignore = true
manual = true
[[object.function]]
name = "get_entries_for_keyval"
# Invalid generation of Vec<KeymapKey>
ignore = true
manual = true
[[object.function]]
name = "add_virtual_modifiers"
# Invalid usage of "&mut ModifierType"
ignore = true
manual = true
[[object.function]]
name = "map_virtual_modifiers"
# Invalid usage of "&mut ModifierType"
ignore = true
manual = true

[[object]]
name = "Gdk.Monitor"
Expand Down Expand Up @@ -368,11 +368,11 @@ status = "generate"
nullable = false
[[object.function]]
name = "get_font_options"
ignore = true
manual = true
[[object.function]]
name = "get_setting"
# bool return value signals success
ignore = true
manual = true

[[object]]
name = "Gdk.Seat"
Expand Down Expand Up @@ -401,14 +401,14 @@ status = "generate"
manual_traits = ["WindowExtManual"]
[[object.function]]
name = "new"
ignore = true
manual = true
[[object.function]]
pattern = "[gs]et_background_pattern"
ignore = true
manual = true
doc_trait_name = "WindowExtManual"
[[object.function]]
pattern = "[gs]et_user_data"
ignore = true
manual = true
doc_trait_name = "WindowExtManual"
[[object.function]]
name = "get_effective_toplevel"
Expand Down Expand Up @@ -440,7 +440,7 @@ manual_traits = ["WindowExtManual"]
version = "3.18"
[[object.function]]
name = "create_similar_surface"
ignore = true
manual = true
[[object.function]]
name = "set_opaque_region"
[[object.function.parameter]]
Expand Down
8 changes: 0 additions & 8 deletions gdk/src/auto/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,6 @@ impl Screen {
}
}

//pub fn get_property_font_options(&self) -> /*Unimplemented*/Fundamental: Pointer {
// unsafe {
// let mut value = Value::from_type(</*Unknown type*/ as StaticType>::static_type());
// gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"font-options\0".as_ptr() as *const _, value.to_glib_none_mut().0);
// value.get().expect("Return Value for property `font-options` getter").unwrap()
// }
//}

pub fn get_default() -> Option<Screen> {
assert_initialized_main_thread!();
unsafe { from_glib_none(gdk_sys::gdk_screen_get_default()) }
Expand Down
2 changes: 1 addition & 1 deletion gdk/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 @ 7670e3d)
Generated by gir (https://github.com/gtk-rs/gir @ cea2f7c)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
22 changes: 15 additions & 7 deletions gdk/sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-dependencies]
pkg-config = "0.3.7"
system-deps = "1.3"
system-deps = "2.0"

[dependencies]
libc = "0.2"
Expand Down Expand Up @@ -55,9 +55,17 @@ features = ["dox"]
name = "gdk-3.0"
version = "3.14"

[package.metadata.system-deps.gdk_3_0.feature-versions]
v3_16 = "3.16"
v3_18 = "3.18"
v3_20 = "3.20"
v3_22 = "3.22"
v3_24 = "3.24"
[package.metadata.system-deps.gdk_3_0.v3_16]
version = "3.16"

[package.metadata.system-deps.gdk_3_0.v3_18]
version = "3.18"

[package.metadata.system-deps.gdk_3_0.v3_20]
version = "3.20"

[package.metadata.system-deps.gdk_3_0.v3_22]
version = "3.22"

[package.metadata.system-deps.gdk_3_0.v3_24]
version = "3.24"
2 changes: 1 addition & 1 deletion gdk/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 @ 7670e3d)
Generated by gir (https://github.com/gtk-rs/gir @ cea2f7c)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
2 changes: 1 addition & 1 deletion gdkx11/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 @ 7670e3d)
Generated by gir (https://github.com/gtk-rs/gir @ cea2f7c)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
14 changes: 9 additions & 5 deletions gdkx11/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ features = ["dox"]
name = "gdk-x11-3.0"
version = "3.14"

[package.metadata.system-deps.gdk_x11_3_0.feature-versions]
v3_16 = "3.16"
v3_24 = "3.24"
v3_24_2 = "3.24.2"
[package.metadata.system-deps.gdk_x11_3_0.v3_16]
version = "3.16"

[package.metadata.system-deps.gdk_x11_3_0.v3_24]
version = "3.24"

[package.metadata.system-deps.gdk_x11_3_0.v3_24_2]
version = "3.24.2"

[lib]
name = "gdk_x11_sys"
Expand Down Expand Up @@ -51,7 +55,7 @@ path = "../../cairo/sys"
optional = true

[build-dependencies]
system-deps = "1.3"
system-deps = "2.0"

[dev-dependencies]
shell-words = "1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion gdkx11/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 @ 7670e3d)
Generated by gir (https://github.com/gtk-rs/gir @ cea2f7c)
from gir-files (https://github.com/gtk-rs/gir-files @ 8de1aa1)
Loading