summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Bacci <luca.bacci982@gmail.com>2022-05-01 16:41:10 +0200
committerLuca Bacci <luca.bacci982@gmail.com>2022-05-03 12:38:22 +0200
commitf0120700dc872043c6828678870446df82382901 (patch)
tree5ba0485f2bb5697bd294552f18916b1903f72148
parent6b740c86f907e171d5bec227677ccf81b0091d73 (diff)
downloadgtk+-f0120700dc872043c6828678870446df82382901.tar.gz
GtkFileChooserWidget: return empty GListModel in get_files () instead of NULL
-rw-r--r--gtk/gtkfilechooserwidget.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 4c34c49840..34e34734d3 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -5466,7 +5466,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
goto out;
if (!is_well_formed)
- return NULL;
+ goto empty;
if (info.file_from_entry)
{
@@ -5476,7 +5476,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
else if (!file_list_seen)
goto file_list;
else
- return NULL;
+ goto empty;
}
else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view)
goto file_list;
@@ -5508,6 +5508,11 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
}
return G_LIST_MODEL (info.result);
+
+empty:
+
+ g_list_store_remove_all (info.result);
+ return G_LIST_MODEL (info.result);
}
/* Shows or hides the filter widgets */