Re: GTKFileSelection




On Sep 9, 2004, at 7:48 PM, Brian Thomason wrote:

I am attempting to change the default directory used by gtk_file_selection_new().  I've been browsing through the code and haven't seen an easy way to do this.  In KDE's file selection dialog method they call another method which returns the default path to be used.  If one isn't specified, and the users history contains no entires, the current working directory is used. (just like here with GTK)  Unfortunately, I can't find where this is taking place in gtkfilesel.c or related files.

GtkFileSelection uses the current directory at the time of the widget creation. In the private function cmpl_init_state() the filesel's internal completion state is initialized by calling get_current_dir_utf8(). The filesel's current directory will also be changed after creation if you call gtk_file_selection_set_filename() with a filename that includes a directory path component. The docs for gtk_file_selection_set_filename() say:

 * Sets a default path for the file requestor. If @filename includes a
 * directory path, then the requestor will open with that path as its
 * current working directory.
 *
 * This has the consequence that in order to open the requestor with a
* working directory and an empty filename, @filename must have a trailing
 * directory separator.


I'd also like to change the default behavior of GTKFileChooser as well, which defaults to the Home directory. 

the default implementation (gtkfilechooserdefault.c) has an internal variable named current_folder. i bet if you put a watch on that in gdb you can find where it gets set.

--
I bring the rock, and provided it is fiscally responsible, I will bring the funk as well. And that's fo-shizzle.
	-- Saturday Night Live




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