filechooserbutton: In SELECT_FOLDER mode, consider an empty selection to mean current_folder
If the user didn't explicitly select anything, BUT the file chooser button has a current_folder set, do the same as what GtkFileChooserDefault would do: return the current folder as the selection. This makes the tests in tests/filechooser pass! Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
parent
90a034d800
commit
c8403f697e
@ -726,10 +726,18 @@ gtk_file_chooser_button_get_files (GtkFileChooser *chooser)
|
|||||||
{
|
{
|
||||||
GSList *result;
|
GSList *result;
|
||||||
|
|
||||||
|
result = NULL;
|
||||||
|
|
||||||
if (priv->selection_while_inactive)
|
if (priv->selection_while_inactive)
|
||||||
result = g_slist_prepend (NULL, g_object_ref (priv->selection_while_inactive));
|
result = g_slist_prepend (NULL, g_object_ref (priv->selection_while_inactive));
|
||||||
else
|
else if (gtk_file_chooser_get_action (GTK_FILE_CHOOSER (priv->dialog)) == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
|
||||||
result = NULL;
|
{
|
||||||
|
/* If there is no "real" selection in SELECT_FOLDER mode, then we'll just return
|
||||||
|
* the current folder, since that is what GtkFileChooserDefault would do.
|
||||||
|
*/
|
||||||
|
if (priv->current_folder_while_inactive)
|
||||||
|
result = g_slist_prepend (NULL, g_object_ref (priv->current_folder_while_inactive));
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user