Gtk.FileChooser.prototype.set_uri
function set_uri(uri:String):Boolean { // Gjs wrapper for gtk_file_chooser_set_uri() }
Sets the file referred to by uri as the current file for the file chooser, by changing to the URI's parent folder and actually selecting the URI in the list. If the chooser is Gtk.FileChooserAction.save mode, the URI's base name will also appear in the dialog's file name entry.
Note that the URI must exist, or nothing will be done except for the directory change.
You should use this function only when implementing a <guimenuitem>File/Save As...</guimenuitem> dialog for which you already have a file name to which the user may save. For example, whenthe user opens an existing file and then does <guimenuitem>File/Save As...</guimenuitem> on it to save a copy or a modified version. If you don't have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this: |[ if (document_is_new) { /* the user just created a new document */ gtk_file_chooser_set_current_name (chooser, "Untitled document"); } else { /* the user edited an existing document */ gtk_file_chooser_set_uri (chooser, existing_uri); } ]|
In the first case, the file chooser will present the user with useful suggestions as to where to save his new file. In the second case, the file's existing location is already known, so the file chooser will use it.
Since 2.4
- uri
the URI to set as current
- Returns
Not useful.