From: Matthias Clasen Date: Wed, 12 Apr 2023 10:07:30 +0000 (+0200) Subject: filechooserentry: Make filtering work again X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~4^2~10^2~24 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ca12226e7cfb5e9049850eb1f7c18a961be9e815;p=gtk4.git filechooserentry: Make filtering work again We need to look at the filchooser::filtered-out attribute to know which files the filesystem model has filtered away. Fixes: #5743 --- diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index 4f3d2f8c7f..6c50524adb 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -193,28 +193,30 @@ match_func (GtkEntryCompletion *compl, gpointer user_data) { GtkFileChooserEntry *chooser_entry = user_data; + GFileInfo *info; + + gtk_tree_model_get (GTK_TREE_MODEL (chooser_entry->completion_store), + iter, + FILE_INFO_COLUMN, &info, + -1); + + g_assert (info != NULL); + g_object_unref (info); + + if (g_file_info_get_attribute_boolean (info, "filechooser::filtered-out")) + return FALSE; /* If we arrive here, the GtkFileSystemModel's GtkFileFilter already filtered out all * files that don't start with the current prefix, so we manually apply the GtkFileChooser's - * current file filter (e.g. just jpg files) here. */ + * current file filter (e.g. just jpg files) here. + */ if (chooser_entry->current_filter != NULL) { - GFileInfo *info; - - gtk_tree_model_get (GTK_TREE_MODEL (chooser_entry->completion_store), - iter, - FILE_INFO_COLUMN, &info, - -1); - - g_assert (info != NULL); - g_object_unref (info); - /* We always allow navigating into subfolders, so don't ever filter directories */ if (g_file_info_get_file_type (info) != G_FILE_TYPE_REGULAR) return TRUE; g_assert (g_file_info_has_attribute (info, "standard::file")); - return gtk_filter_match (GTK_FILTER (chooser_entry->current_filter), info); }