Re: [API 2.4] FileChooserButton directory selection



2013-02-08 11:04, Yann Leydier skrev:
Hi,

I put a FileChooserButton in an Assistant, in directory selection mode. When I display the next page of the Assistant, I print the content of the button to the console.

At runtime, when I click the button, if I go into the folder and click OK, then get_current_folder() and get_filename() will print my home directory. However, if I select the directory (just ONE click, so that the dialog does not display what's inside the directory), then get_current_folder() will print my home directory and get_filename() will print the directory I selected!

This looks similar to this bug: https://bugzilla.gnome.org/show_bug.cgi?id=683708

The bug appeared after I updated from Ubuntu 10.10 to the latest Mint. 6 months ago, any way of selecting a directory created the right output with get_current_folder()!

Does anyone has an explanation to this behaviour, and perhaps a workaround?

Thanks,
yann
_______________________________________________
As is noticed in the bug you refer to, it all depends on which version of gtk+ you use. Which version do you use?

I tested with a modified version of the example program
http://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/buttons/filechooserbutton
and gtk+-3.0 versions 3.4.2 and 3.7.7 (3.7.7 downloaded from the git repository 2013-01-20), Ubuntu 12.04.

In both cases the results are

1. Go to a folder by a number of double clicks, don't select a folder, click Open: both get_filename() and get_current_folder() return the folder I've gone to.

2. Go to a folder by a number of double clicks, select a folder by single-clicking it, click Open:
  get_filename() returns the selected folder,
get_current_folder() returns the folder I've gone to, i.e. the folder above the selected one (an empty string, if the number of double-clicks is zero).

This behaviour seems quite reasonable. The description of get_filename() says "If the file chooser is in folder mode, this function returns the selected folder."

But I suppose the "API 2.4" in the subject line means that you use gtkmm 2 and gtk+ 2.

Kjell



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]