openbsd-ports/x11/gtk+3/patches/patch-gtk_gtkplacessidebar_c
2022-03-04 07:57:18 +00:00

46 lines
1.4 KiB
Plaintext

unveil(2): check if the XDG directories exist before showing them on the sidebar
Index: gtk/gtkplacessidebar.c
--- gtk/gtkplacessidebar.c.orig
+++ gtk/gtkplacessidebar.c
@@ -657,6 +657,7 @@ add_special_dirs (GtkPlacesSidebar *sidebar)
*/
if (path == NULL ||
path_is_home_dir (path) ||
+ !g_file_test (path, G_FILE_TEST_IS_DIR) ||
g_list_find_custom (dirs, path, (GCompareFunc) g_strcmp0) != NULL)
continue;
@@ -709,7 +710,8 @@ get_desktop_directory_uri (void)
/* "To disable a directory, point it to the homedir."
* See http://freedesktop.org/wiki/Software/xdg-user-dirs
*/
- if (path_is_home_dir (name))
+ if ((name == NULL) || path_is_home_dir (name) ||
+ !g_file_test (name, G_FILE_TEST_IS_DIR))
return NULL;
return g_filename_to_uri (name, NULL, NULL);
@@ -1091,6 +1093,11 @@ update_places (GtkPlacesSidebar *sidebar)
/* home folder */
home_uri = get_home_directory_uri ();
+#if defined(__OpenBSD__)
+ if (!g_file_test (home_uri, G_FILE_TEST_IS_DIR))
+ goto skip_home;
+#endif
+
start_icon = g_themed_icon_new_with_default_fallbacks (ICON_NAME_HOME);
add_place (sidebar, PLACES_BUILT_IN,
SECTION_COMPUTER,
@@ -1100,6 +1107,9 @@ update_places (GtkPlacesSidebar *sidebar)
g_object_unref (start_icon);
g_free (home_uri);
+#if defined(__OpenBSD__)
+skip_home:
+#endif
/* desktop */
if (sidebar->show_desktop)
{