summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooserbutton.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2013-02-13 12:12:50 -0600
committerFederico Mena Quintero <federico@gnome.org>2013-02-13 18:01:39 -0600
commitc8403f697edef57f33c66d3d8deb1488db86d949 (patch)
tree53f2247df17f136c8a52f3879e7254719601bd93 /gtk/gtkfilechooserbutton.c
parent90a034d80066135504de4e97b1a06c28fe20178a (diff)
downloadgtk+-c8403f697edef57f33c66d3d8deb1488db86d949.tar.gz
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>
Diffstat (limited to 'gtk/gtkfilechooserbutton.c')
-rw-r--r--gtk/gtkfilechooserbutton.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index eefabc7370..252cd64e1a 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -726,10 +726,18 @@ gtk_file_chooser_button_get_files (GtkFileChooser *chooser)
{
GSList *result;
+ result = NULL;
+
if (priv->selection_while_inactive)
result = g_slist_prepend (NULL, g_object_ref (priv->selection_while_inactive));
- else
- result = NULL;
+ else if (gtk_file_chooser_get_action (GTK_FILE_CHOOSER (priv->dialog)) == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ {
+ /* 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;
}