diff -r 634e3ce80afe -r 00be546d3b38 ui/gtk/image.c --- a/ui/gtk/image.c Sun Oct 13 11:05:38 2024 +0200 +++ b/ui/gtk/image.c Sun Oct 13 14:02:43 2024 +0200 @@ -117,7 +117,15 @@ } UiIcon* ui_fileicon(size_t size) { - return ui_icon("file", size); + UiIcon *icon = ui_icon("file", size); +#if GTK_MAJOR_VERSION >= 4 + GFile *file = gtk_icon_paintable_get_file(icon->info); + char *path = g_file_get_path(file); + if(!path) { + icon = ui_icon("application-x-generic", size); + } +#endif + return icon; } UiIcon* ui_icon_unscaled(const char *name, int size) { @@ -129,7 +137,8 @@ if(!icon->pixbuf) { GFile *file = gtk_icon_paintable_get_file(icon->info); GError *error = NULL; - icon->pixbuf = gdk_pixbuf_new_from_file(g_file_get_path(file), &error); + char *path = g_file_get_path(file); + icon->pixbuf = gdk_pixbuf_new_from_file(path, &error); } return icon->pixbuf; }