-
Notifications
You must be signed in to change notification settings - Fork 132
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
[GTK4] Migrate DirectoryDialog from GtkFileChooser to GtkFileDialog #1421
Conversation
Contributes to #652 |
Looks promising.Please ping me in 2 weeks if I haven't reviewed it yet as we are in a freeze now. |
03cea78
to
e3d777a
Compare
92f1acf
to
f8a2840
Compare
The FileChooser has been marked as deprecated with GTK 4.10 with the FileDialog being its replacement. Using this new API poses a challenge, as it requires the usage of the AsyncReadyCallback mechanism in order to respond to the closure of the dialog. Once the dialog has been opened via gtk_file_dialog_select_folder(), it is necessary to call gtk_file_dialog_select_folder_finish() from within the callback method. This method also returns the selected folder, which has to be cached until after the dialog has been closed. Following native methods have been added to GTK4: - gtk_file_dialog_new - gtk_file_dialog_select_folder - gtk_file_dialog_select_folder_finish - gtk_file_dialog_set_initial_folder
f8a2840
to
d4e0a6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a local change as commented it is all fine.
/** | ||
* @param self cast=(GtkFileDialog *) | ||
* @param result cast=(GAsyncResult *) | ||
* @param error cast=(GError *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be '(GError **)'. What you have here fails with
gtk4.c:737:103: error: passing argument 3 of ‘gtk_file_dialog_select_folder_finish’ from incompatible pointer type [-Wincompatible-pointer-types]
737 | rc = (jlong)gtk_file_dialog_select_folder_finish((GtkFileDialog *)arg0, (GAsyncResult *)arg1, (GError *)lparg2);
| ^~~~~~~~~~~~~~~~
| |
| GError * {aka struct _GError *}
In file included from /usr/include/gtk-4.0/gtk/gtk.h:134,
from gtk4.h:23,
from gtk4_structs.h:18,
from gtk4.c:19:
/usr/include/gtk-4.0/gtk/gtkfiledialog.h:118:77: note: expected ‘GError **’ {aka ‘struct _GError **’} but argument is of type ‘GError *’ {aka ‘struct _GError *’}
118 | GError **error);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~
|
||
import org.eclipse.swt.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this unused import.
Fixed version is in #1473 in order to get this one in while I am at it. |
My apologies for the belated response. The past few days have been a little hectic... |
NP, Thanks again for the patch and keep'em coming! I would love to see the GTK 4 port shape better and better. |
The FileChooser has been marked as deprecated with GTK 4.10 with the FileDialog being its replacement. Using this new API poses a challenge, as it requires the usage of the AsyncReadyCallback mechanism in order to respond to the closure of the dialog.
Once the dialog has been opened via gtk_file_dialog_select_folder(), it is necessary to call gtk_file_dialog_select_folder_finish() from within the callback method. This method also returns the selected folder, which has to be cached until after the dialog has been closed.
Following native methods have been added to GTK4: