Get the current folder in a file chooser dialog



How do I get the current folder of a file selected in a GtkFileChooser when the file is selected in the Recenttly used section?

My code is this:

open_dialog = gtk_file_chooser_dialog_new(
  "Open",
  GTK_WINDOW(data->window1),
  GTK_FILE_CHOOSER_ACTION_OPEN,
  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
  GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
  NULL);

if (gtk_dialog_run(GTK_DIALOG(open_dialog)) == GTK_RESPONSE_ACCEPT)
  {
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(open_dialog));

    default_folder_for_saving = g_string_sized_new(BUFFER_SIZE_1K);
default_folder_for_saving->str = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(open_dialog));

default_folder_for_saving->str is a path if I select the file browsing my hard disk, but if I select the file from the Recently used section the gtk_file_chooser_get_current_folder erturns NULL.
How do I get the path of the file in this second case?

Thanks in advance.
--
Regards,
Manuel Ferrero
R&D department

Reer SpA        
Tel.  +39 011 2482215
Fax. +39 011 859867

L'utilizzo non autorizzato del presente messaggio e' vietato e potrebbe costituire reato.
Se il presente messaggio non e' a Lei indirizzato, il suo contenuto non deve essere considerato
come trasmesso o autorizzato dalla Reer SpA; in tale caso Le saremmo grati se, via e-mail,
ce ne comunicasse l'errata ricezione.

The unauthorized use of this e-mail is prohibited and could constitute an offence.
If you are not the intended recipient of this message its contents shall be understood as neither
given nor endorsed by Reer SpA. Please notify Reer SpA by e-mail immediately in that case.




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