python/hypothesis: update to 6.121.0
[oi-userland.git] / components / library / gtk+ / patches / 18-Check-for-attribute-availability-before-accessing-it.patch
blobcdf504b0bb9ce4a1aa46e59c9ddd543e869800f4
1 From: Emmanuele Bassi <ebassi@gnome.org>
2 Date: Mon, 13 Mar 2023 11:49:50 +0000
3 Subject: Check for attribute availability before accessing it
5 Starting from GLib 2.76, the standard attribute getters in the GFileInfo
6 object will warn if the attribute is unset, instead of silently bailing
7 out and returning a default value.
9 Ported to GTK2 by futalas
10 Origin: https://gitlab.gnome.org/GNOME/gtk/-/commit/c1fa916e#note_1852594
11 ---
12 gtk/gtkfilechooserdefault.c | 6 ++++--
13 gtk/gtkfilesystemmodel.c | 7 ++++++-
14 gtk/gtkpathbar.c | 3 ++-
15 3 files changed, 12 insertions(+), 4 deletions(-)
17 diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
18 index c113542..8bacca5 100644
19 --- a/gtk/gtkfilechooserdefault.c
20 +++ b/gtk/gtkfilechooserdefault.c
21 @@ -6378,10 +6378,12 @@ show_and_select_files (GtkFileChooserDefault *impl,
22 if (!_gtk_file_system_model_iter_is_visible (fsmodel, &iter))
24 GFileInfo *info = _gtk_file_system_model_get_info (fsmodel, &iter);
25 + gboolean has_is_hidden = g_file_info_has_attribute (info, "standard::is-hidden");
26 + gboolean has_is_backup = g_file_info_has_attribute (info, "standard::is-backup");
28 if (!enabled_hidden &&
29 - (g_file_info_get_is_hidden (info) ||
30 - g_file_info_get_is_backup (info)))
31 + ((has_is_hidden && g_file_info_get_is_hidden (info)) ||
32 + (has_is_backup && g_file_info_get_is_backup (info))))
34 g_object_set (impl, "show-hidden", TRUE, NULL);
35 enabled_hidden = TRUE;
36 diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
37 index 840f1e8..6d8812b 100644
38 --- a/gtk/gtkfilesystemmodel.c
39 +++ b/gtk/gtkfilesystemmodel.c
40 @@ -444,13 +444,18 @@ static gboolean
41 node_should_be_visible (GtkFileSystemModel *model, guint id, gboolean filtered_out)
43 FileModelNode *node = get_node (model, id);
44 + gboolean has_is_hidden, has_is_backup;
45 gboolean result;
47 if (node->info == NULL)
48 return FALSE;
50 + has_is_hidden = g_file_info_has_attribute (node->info, "standard::is-hidden");
51 + has_is_backup = g_file_info_has_attribute (node->info, "standard::is-backup");
53 if (!model->show_hidden &&
54 - (g_file_info_get_is_hidden (node->info) || g_file_info_get_is_backup (node->info)))
55 + ((has_is_hidden && g_file_info_get_is_hidden (node->info)) ||
56 + (has_is_backup && g_file_info_get_is_backup (node->info))))
57 return FALSE;
59 if (_gtk_file_info_consider_as_directory (node->info))
60 diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
61 index 2813c8e..0f9100a 100644
62 --- a/gtk/gtkpathbar.c
63 +++ b/gtk/gtkpathbar.c
64 @@ -1659,7 +1659,8 @@ gtk_path_bar_get_info_callback (GCancellable *cancellable,
67 display_name = g_file_info_get_display_name (info);
68 - is_hidden = g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info);
69 + is_hidden = g_file_info_get_attribute_boolean (info, "standard::is-hidden") ||
70 + g_file_info_get_attribute_boolean (info, "standard::is-backup");
72 gtk_widget_push_composite_child ();
73 button_data = make_directory_button (file_info->path_bar, display_name,