How to gfile from GtkFileChooserWidget

The FileChooserDialog has the option of getting the gfile when closing the dialog. What do I have to do to get a gfile from clicking a file in the GtkFileChooserWidget?

Is it possible that when the user opens folders to a file. After scrolling to the file or the file is highlighted how do I get the gfile of the file.

I have a button to be clicked when the user wants to get the gfile

I am thinking maybe I need to call GtkFileChooser functions to select the file somehow but I need to write code such that GtkFileChooserWidget tells me the selected file.

You listen to the response signal and then you can call get_file on the dialog

Thats for the dialog
I want for the widget

GtkFileChooserWidget implements the GtkFileChooser interface, just like GtkFileChooserDialog.

True but how do we open a file with The Widget. I I’m trying to get the highlighted file. There seems to be no way to access the file. When I call G_IS_FILE(gtk_file_chooser_get_file((GtkFileChooser*)widget)) this is always. False

g_signal_conect(widget, "response" ... //is invalid for gtk4

//I have a custom button to call a function with

GFile *file = gtk_file_chooser_get_file((GtkFileChooser*)widget);

if(G_IS_FILE) //is always false

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.