Implement GFileIface.set_display_name() for resource files

Resource files cannot be renamed, and GFileIface.set_display_name() is
mandatory.

Fixes: #2705
This commit is contained in:
Emmanuele Bassi 2022-07-30 20:03:42 +01:00
parent a775578b96
commit a9394bd68e

View File

@ -646,6 +646,19 @@ g_resource_file_monitor_file (GFile *file,
return g_object_new (g_resource_file_monitor_get_type (), NULL); return g_object_new (g_resource_file_monitor_get_type (), NULL);
} }
static GFile *
g_resource_file_set_display_name (GFile *file,
const char *display_name,
GCancellable *cancellable,
GError **error)
{
g_set_error_literal (error,
G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
_("Resource files cannot be renamed"));
return NULL;
}
static void static void
g_resource_file_file_iface_init (GFileIface *iface) g_resource_file_file_iface_init (GFileIface *iface)
{ {
@ -664,6 +677,7 @@ g_resource_file_file_iface_init (GFileIface *iface)
iface->get_relative_path = g_resource_file_get_relative_path; iface->get_relative_path = g_resource_file_get_relative_path;
iface->resolve_relative_path = g_resource_file_resolve_relative_path; iface->resolve_relative_path = g_resource_file_resolve_relative_path;
iface->get_child_for_display_name = g_resource_file_get_child_for_display_name; iface->get_child_for_display_name = g_resource_file_get_child_for_display_name;
iface->set_display_name = g_resource_file_set_display_name;
iface->enumerate_children = g_resource_file_enumerate_children; iface->enumerate_children = g_resource_file_enumerate_children;
iface->query_info = g_resource_file_query_info; iface->query_info = g_resource_file_query_info;
iface->query_filesystem_info = g_resource_file_query_filesystem_info; iface->query_filesystem_info = g_resource_file_query_filesystem_info;