mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-14 20:51:07 +00:00
Merge branch 'backport-mr-4678-gtk-4-6' into 'gtk-4-6'
GtkFileChooserWidget: fixes for NULL vs empty GListModel See merge request GNOME/gtk!4684
This commit is contained in:
commit
045446c3da
@ -5448,7 +5448,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
* So we want the selection to be "bar/foo.txt". Jump to the case for the
|
||||
* filename entry to see if that is the case.
|
||||
*/
|
||||
if (info.result == NULL && impl->location_entry)
|
||||
if (g_list_model_get_n_items (G_LIST_MODEL (info.result)) == 0 && impl->location_entry)
|
||||
goto file_entry;
|
||||
}
|
||||
else if (impl->location_entry &&
|
||||
@ -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;
|
||||
@ -5497,7 +5497,7 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
* then we fall back to the current directory
|
||||
*/
|
||||
if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
|
||||
info.result == NULL)
|
||||
g_list_model_get_n_items (G_LIST_MODEL (info.result)) == 0)
|
||||
{
|
||||
GFile *current_folder;
|
||||
|
||||
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user