gtk2/gtk2-check-attribute.patch
Dominique Leuenberger 9d6e1117be Accepting request 1129912 from home:polslinux:branches:GNOME:Factory
- Add gtk2-check-attribute.patch (bsc#1217622): check for attribute
  availability before accessing it.
  Starting from GLib 2.76, the standard attribute getters in the
  GFileInfo object will warn if the attribute is unset, instead of
  silently bailing out and returning a default value.

OBS-URL: https://build.opensuse.org/request/show/1129912
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk2?expand=0&rev=296
2023-11-30 07:43:57 +00:00

55 lines
2.5 KiB
Diff

diff -ru orig/gtk/gtkfilechooserdefault.c mod/gtk/gtkfilechooserdefault.c
--- orig/gtk/gtkfilechooserdefault.c 2020-12-21 02:09:37.000000000 +0100
+++ mod/gtk/gtkfilechooserdefault.c 2023-11-29 13:03:45.032522071 +0100
@@ -6378,10 +6378,12 @@
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;
diff -ru orig/gtk/gtkfilesystemmodel.c mod/gtk/gtkfilesystemmodel.c
--- orig/gtk/gtkfilesystemmodel.c 2020-12-21 02:09:37.000000000 +0100
+++ mod/gtk/gtkfilesystemmodel.c 2023-11-29 13:03:50.525885624 +0100
@@ -444,13 +444,18 @@
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))
diff -ru orig/gtk/gtkpathbar.c mod/gtk/gtkpathbar.c
--- orig/gtk/gtkpathbar.c 2020-12-21 02:09:37.000000000 +0100
+++ mod/gtk/gtkpathbar.c 2023-11-29 13:03:55.749247694 +0100
@@ -1659,7 +1659,8 @@
}
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,