Recently I wanted to test if my app is easily convertible to GTK4 from GTK3, but looks that there are a lot of problems with conversion.
I checked and found only a few entries from Gtk – 4.0: Migrating from GTK 3.x to GTK 4, so it is possible that I missed some.
I prepared some conversion tips for my project but not know if all things are proper, and errors which I couldn’t fix.
What happened to gtk4::WindowPosition ? - missing in gtk4-rs source
gtk4::main_quit don’t exits, use
resize is missing, xlib is required now(not sure about api) - TODO I used this for fitting window size to content, maybe similar method exists?
run is missing in Dialog - probably needs to implemented as closure
children dialog no longer returns childrens, can’t find alternative version of this function
connect_button_release_event in Button are missing
FileChooserDialog::with_buttons is missing
connect_delete_event missing in Window
set_relative_to is missing in Popup (probably should exists but only for MenuButton widgets)
with_label_from_widget missing in CheckButton
hide_on_delete missing on Window
connect_clicked missing on CheckButton
add in Box, cannot add grid (
append will work?)
show_all method is missing - all widgets are visible by default so remove all occurrences of this - TODO Probably some usages of show_all should be changed to only show
Treepath no longer can be displayed with
set_select_function don’t need to be boxed
buffer.text() returns valid text, so
match can be removed around such statements
CheckButton, groups needs to be implemented manually
use gtk4::prelude::*; with
use gtk4::prelude::*;use gtk4::prelude::*;use gtk::Inhibit; - looks that now this isn’t in prelude, probably can be added also in GTK3
.get( - TreeModel - this will broke examples from below
.buffer() - TextView always return valid thing
.path(&iter) - Treemodel, looks that always return valid thing
model.path(¤t_iter) as above
window_main.set_title(Some("Czkawka")) - title can be empty