OK
On Wed, Dec 06, 2023 at 07:01:28PM +0100, Marc Espie wrote:
> With glib-2.78, gimp has become more or less unusable in large directories.
>
> The culprit is gtk+2 which is end of life.
>
> I found a backport from gtk+3 that fixes the issue.
>
> See comments in patches.
>
> okay ?
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/x11/gtk+2/Makefile,v
> diff -u -p -r1.248 Makefile
> --- Makefile 24 Apr 2023 11:45:24 -0000 1.248
> +++ Makefile 6 Dec 2023 17:59:50 -0000
> @@ -9,7 +9,7 @@ GNOME_PROJECT= gtk+
> PKGNAME-main= gtk+2-${GNOME_VERSION}
> PKGNAME-cups= gtk+2-cups-${GNOME_VERSION}
>
> -REVISION-main= 5
> +REVISION-main= 6
> REVISION-cups= 4
>
> CATEGORIES= x11 devel
> Index: patches/patch-gtk_gtkfilechooserdefault_c
> ===================================================================
> RCS file: patches/patch-gtk_gtkfilechooserdefault_c
> diff -N patches/patch-gtk_gtkfilechooserdefault_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-gtk_gtkfilechooserdefault_c 6 Dec 2023 17:59:50 -0000
> @@ -0,0 +1,20 @@
> +See https://gitlab.gnome.org/GNOME/gimp/-/issues/9994
> +and
> https://gitlab.gnome.org/GNOME/gtk/-/commit/c1fa916e88de20fc61dc06d3ff9f26722effa0df#note_1852594
> +Index: gtk/gtkfilechooserdefault.c
> +--- gtk/gtkfilechooserdefault.c.orig
> ++++ gtk/gtkfilechooserdefault.c
> +@@ -6378,10 +6378,12 @@ show_and_select_files (GtkFileChooserDefault *impl,
> + if (!_gtk_file_system_model_iter_is_visible (fsmodel, &iter))
> + {
> + GFileInfo *info = _gtk_file_system_model_get_info (fsmodel,
> &iter);
> ++ gboolean has_is_hidden = g_file_info_has_attribute (info,
> "standard::is-hidden");
> ++ gboolean has_is_backup = g_file_info_has_attribute (info,
> "standard::is-backup");
> +
> + if (!enabled_hidden &&
> +- (g_file_info_get_is_hidden (info) ||
> +- g_file_info_get_is_backup (info)))
> ++ ((has_is_hidden && g_file_info_get_is_hidden (info)) ||
> ++ (has_is_backup && g_file_info_get_is_backup (info))))
> + {
> + g_object_set (impl, "show-hidden", TRUE, NULL);
> + enabled_hidden = TRUE;
> Index: patches/patch-gtk_gtkfilesystemmodel_c
> ===================================================================
> RCS file: patches/patch-gtk_gtkfilesystemmodel_c
> diff -N patches/patch-gtk_gtkfilesystemmodel_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-gtk_gtkfilesystemmodel_c 6 Dec 2023 17:59:50 -0000
> @@ -0,0 +1,25 @@
> +See https://gitlab.gnome.org/GNOME/gimp/-/issues/9994
> +and
> https://gitlab.gnome.org/GNOME/gtk/-/commit/c1fa916e88de20fc61dc06d3ff9f26722effa0df#note_1852594
> +Index: gtk/gtkfilesystemmodel.c
> +--- gtk/gtkfilesystemmodel.c.orig
> ++++ gtk/gtkfilesystemmodel.c
> +@@ -444,13 +444,18 @@ static gboolean
> + node_should_be_visible (GtkFileSystemModel *model, guint id, gboolean
> filtered_out)
> + {
> + FileModelNode *node = get_node (model, id);
> ++ gboolean has_is_hidden, has_is_backup;
> + gboolean result;
> +
> + if (node->info == NULL)
> + return FALSE;
> ++
> ++ has_is_hidden = g_file_info_has_attribute (node->info,
> "standard::is-hidden");
> ++ has_is_backup = g_file_info_has_attribute (node->info,
> "standard::is-backup");
> +
> + if (!model->show_hidden &&
> +- (g_file_info_get_is_hidden (node->info) || g_file_info_get_is_backup
> (node->info)))
> ++ ((has_is_hidden && g_file_info_get_is_hidden (node->info)) ||
> ++ (has_is_backup && g_file_info_get_is_backup (node->info))))
> + return FALSE;
> +
> + if (_gtk_file_info_consider_as_directory (node->info))
> Index: patches/patch-gtk_gtkpathbar_c
> ===================================================================
> RCS file: patches/patch-gtk_gtkpathbar_c
> diff -N patches/patch-gtk_gtkpathbar_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-gtk_gtkpathbar_c 6 Dec 2023 17:59:50 -0000
> @@ -0,0 +1,15 @@
> +See https://gitlab.gnome.org/GNOME/gimp/-/issues/9994
> +and
> https://gitlab.gnome.org/GNOME/gtk/-/commit/c1fa916e88de20fc61dc06d3ff9f26722effa0df#note_1852594
> +Index: gtk/gtkpathbar.c
> +--- gtk/gtkpathbar.c.orig
> ++++ gtk/gtkpathbar.c
> +@@ -1659,7 +1659,8 @@ gtk_path_bar_get_info_callback (GCancellable *cancella
> + }
> +
> + display_name = g_file_info_get_display_name (info);
> +- is_hidden = g_file_info_get_is_hidden (info) || g_file_info_get_is_backup
> (info);
> ++ is_hidden = g_file_info_get_attribute_boolean (info,
> "standard::is-hidden") ||
> ++ g_file_info_get_attribute_boolean (info,
> "standard::is-backup");
> +
> + gtk_widget_push_composite_child ();
> + button_data = make_directory_button (file_info->path_bar, display_name,
>
--
Antoine