The signal you're listening to, only gets emitted when the view-folder in the file chooser changes, not when selecting a folder inside a parent folder, the same goes for get_current_folder()
, it will tell you which folder you're looking at rather than which you selected. So what happened in your code is that the double-click first changed the current folder and then "pressed" OK.
It would seem more fit to listen to the file-set
signal of the FileChooserButton
, though I'm not 100% sure how you check if the user clicked on any button/exited the dialogue. To get what is selected, provided that you only allow for selecting one thing at a time, you could use the FileChooser
's get_filename()
(or get_filenames()
if you allow multi-select). Unfortunately I can't test the solution, because I'm on the wrong computer, but it should lead you in the right direction at least.
As a side-note, I find it easier to simply invoke run()
of the FileChooserDialog
when I need the dialogue and catch what it returns as the response (what button was clicked) and then use get_filename()
.