jeremyletang / rgtk

GTK+ bindings and wrappers for Rust (DEPRECATED SEE https://github.com/rust-gnome )
GNU Lesser General Public License v3.0
120 stars 22 forks source link

Add text_viewer example #68

Closed bpbp-boop closed 10 years ago

bpbp-boop commented 10 years ago

Hello, I managed to get a new example working by implementing enough of TextView, TextBuffer and ScrolledWindow. Most of the TextView's unsafe FFI is implemented as well.

jeremyletang commented 10 years ago

hey !

Thank you for this PR ! I had planned to do this soon so i'm happy to see this stuff !

Why do you have impl the Widget::destroy / gtk_widget_destroy ? We have not implemented it because we call g_object_unref inside the Drop impl make with the macro impl_drop!() for each widgets, and when there is no more reference on a widget, this one is destroyed by gtk. So why do you need to explicitly destroy a widget ?

bpbp-boop commented 10 years ago

I only needed that for the file chooser. After the signal is received that the user has chosen a file or canceled the file chooser needs to be explicitly closed, or it just hangs around forever.

There might be a better way to deal with that, I am not sure.

jeremyletang commented 10 years ago

hum okay, have you tried to call explicitly the destructor to unref the internal GtkWidget using ::std::mem::drop on the file chooser ::std::men::drop(file_chooser)?

bpbp-boop commented 10 years ago

I just tried that now, it didn't seem to work.

jeremyletang commented 10 years ago

hum okay, so let's merge this like this ! thank you for the help ! ( maybe you want to add you name into the Cargo.toml authors sections ? feel free to add it ! ). Is this okay to merge right now for you ?

bpbp-boop commented 10 years ago

This is good to go, thank you :) I can try and flesh out TextViewer's safe intereface a bit more soon but this doesn't need to wait on that.