diff options
author | Debarshi Ray <debarshir@gnome.org> | 2018-05-29 17:14:24 +0200 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2018-08-14 08:13:53 +0000 |
commit | c0699c2e3c702b9efd610f4bf364ace9c70a273a (patch) | |
tree | a78d79726144bed601c252e6073042ea9a754bff | |
parent | 9f465f555a6abc7bb03c9b7582f5c58cfe0b7b6c (diff) | |
download | gvfs-c0699c2e3c702b9efd610f4bf364ace9c70a273a.tar.gz |
Remove workaround for directory / folder iconswip/rishi/issue-2
https://gitlab.gnome.org/GNOME/gvfs/issues/2
-rw-r--r-- | daemon/gvfsafpserver.c | 7 | ||||
-rw-r--r-- | daemon/gvfsbackendadmin.c | 11 | ||||
-rw-r--r-- | daemon/gvfsbackendafc.c | 13 | ||||
-rw-r--r-- | daemon/gvfsbackendarchive.c | 9 | ||||
-rw-r--r-- | daemon/gvfsbackendburn.c | 8 | ||||
-rw-r--r-- | daemon/gvfsbackenddav.c | 9 | ||||
-rw-r--r-- | daemon/gvfsbackendgoogle.c | 14 | ||||
-rw-r--r-- | daemon/gvfsbackendgphoto2.c | 15 | ||||
-rw-r--r-- | daemon/gvfsbackendmtp.c | 18 | ||||
-rw-r--r-- | daemon/gvfsbackendnfs.c | 16 | ||||
-rw-r--r-- | daemon/gvfsbackendsftp.c | 12 | ||||
-rw-r--r-- | daemon/gvfsbackendsmb.c | 4 | ||||
-rw-r--r-- | daemon/gvfsdaemonutils.c | 14 |
13 files changed, 65 insertions, 85 deletions
diff --git a/daemon/gvfsafpserver.c b/daemon/gvfsafpserver.c index 18eb874c..615446a3 100644 --- a/daemon/gvfsafpserver.c +++ b/daemon/gvfsafpserver.c @@ -1478,15 +1478,16 @@ g_vfs_afp_server_fill_info (GVfsAfpServer *server, if (directory) { + const char *content_type = "inode/directory"; GIcon *icon; g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY); - g_file_info_set_content_type (info, "inode/directory"); + g_file_info_set_content_type (info, content_type); - icon = g_themed_icon_new ("folder"); + icon = g_content_type_get_icon (content_type); g_file_info_set_icon (info, icon); g_object_unref (icon); - icon = g_themed_icon_new ("folder-symbolic"); + icon = g_content_type_get_symbolic_icon (content_type); g_file_info_set_symbolic_icon (info, icon); g_object_unref (icon); } diff --git a/daemon/gvfsbackendadmin.c b/daemon/gvfsbackendadmin.c index d67353da..ec0f2392 100644 --- a/daemon/gvfsbackendadmin.c +++ b/daemon/gvfsbackendadmin.c @@ -896,13 +896,20 @@ g_vfs_backend_admin_class_init (GVfsBackendAdminClass * klass) static void g_vfs_backend_admin_init (GVfsBackendAdmin *self) { + GIcon *icon; GVfsBackend *backend = G_VFS_BACKEND (self); + const gchar *content_type = "inode/directory"; g_mutex_init (&self->polkit_mutex); g_vfs_backend_set_user_visible (backend, FALSE); - g_vfs_backend_set_icon_name (backend, "folder"); - g_vfs_backend_set_symbolic_icon_name (backend, "folder-symbolic"); + icon = g_content_type_get_icon (content_type); + g_vfs_backend_set_icon (backend, icon); + g_object_unref (icon); + + icon = g_content_type_get_symbolic_icon (content_type); + g_vfs_backend_set_symbolic_icon (backend, icon); + g_object_unref (icon); } #define REQUIRED_CAPS (CAP_TO_MASK(CAP_FOWNER) | \ diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c index 2cafbebb..79c7911a 100644 --- a/daemon/gvfsbackendafc.c +++ b/daemon/gvfsbackendafc.c @@ -1705,8 +1705,8 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self, { if (type == G_FILE_TYPE_DIRECTORY) { - icon = g_themed_icon_new ("folder"); - symbolic_icon = g_themed_icon_new ("folder-symbolic"); + icon = g_content_type_get_icon (content_type); + symbolic_icon = g_content_type_get_symbolic_icon (content_type); } else { @@ -1788,16 +1788,17 @@ g_vfs_backend_afc_set_info_from_app (GVfsBackendAfc *self, { GIcon *icon; GIcon *symbolic_icon; + const gchar *content_type = "inode/directory"; /* content-type */ - g_file_info_set_content_type (info, "inode/directory"); - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, "inode/directory"); + g_file_info_set_content_type (info, content_type); + g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, content_type); g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY); /* icon */ if (app_info == NULL || app_info->icon_path == NULL) { - icon = g_themed_icon_new ("folder"); + icon = g_content_type_get_icon (content_type); g_file_info_set_icon (info, icon); g_object_unref (icon); } @@ -1813,7 +1814,7 @@ g_vfs_backend_afc_set_info_from_app (GVfsBackendAfc *self, } /* symbolic icon */ - symbolic_icon = g_themed_icon_new ("folder-symbolic"); + symbolic_icon = g_content_type_get_symbolic_icon (content_type); g_file_info_set_symbolic_icon (info, symbolic_icon); g_object_unref (symbolic_icon); diff --git a/daemon/gvfsbackendarchive.c b/daemon/gvfsbackendarchive.c index edbd68f6..a9b40084 100644 --- a/daemon/gvfsbackendarchive.c +++ b/daemon/gvfsbackendarchive.c @@ -329,6 +329,7 @@ create_root_file (GVfsBackendArchive *ba) { ArchiveFile *root; GFileInfo *info; + const char *content_type = "inode/directory"; char *s, *display_name; GIcon *icon; @@ -352,8 +353,8 @@ create_root_file (GVfsBackendArchive *ba) g_free (display_name); g_file_info_set_edit_name (info, "/"); - g_file_info_set_content_type (info, "inode/directory"); - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, "inode/directory"); + g_file_info_set_content_type (info, content_type); + g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, content_type); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE); @@ -362,10 +363,10 @@ create_root_file (GVfsBackendArchive *ba) g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, FALSE); - icon = g_themed_icon_new ("folder"); + icon = g_content_type_get_icon (content_type); g_file_info_set_icon (info, icon); g_object_unref (icon); - icon = g_themed_icon_new ("folder-symbolic"); + icon = g_content_type_get_symbolic_icon (content_type); g_file_info_set_symbolic_icon (info, icon); g_object_unref (icon); } diff --git a/daemon/gvfsbackendburn.c b/daemon/gvfsbackendburn.c index 8b38368a..bf28d332 100644 --- a/daemon/gvfsbackendburn.c +++ b/daemon/gvfsbackendburn.c @@ -603,17 +603,19 @@ file_info_from_node (VirtualNode *node, if (node->type == VIRTUAL_NODE_DIRECTORY) { + const char *content_type = "inode/directory"; + g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY); - icon = g_themed_icon_new ("folder"); + icon = g_content_type_get_icon (content_type); g_file_info_set_icon (info, icon); g_object_unref (icon); - icon = g_themed_icon_new ("folder-symbolic"); + icon = g_content_type_get_symbolic_icon (content_type); g_file_info_set_symbolic_icon (info, icon); g_object_unref (icon); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, TRUE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, TRUE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE); - g_file_info_set_content_type (info, "inode/directory"); + g_file_info_set_content_type (info, content_type); } else { diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c index 5572793d..203363d7 100644 --- a/daemon/gvfsbackenddav.c +++ b/daemon/gvfsbackenddav.c @@ -1110,9 +1110,12 @@ ms_response_to_file_info (MsResponse *response, g_file_info_set_file_type (info, file_type); if (file_type == G_FILE_TYPE_DIRECTORY) { - icon = g_themed_icon_new ("folder"); - symbolic_icon = g_themed_icon_new ("folder-symbolic"); - file_info_set_content_type (info, "inode/directory"); + g_clear_pointer (&mime_type, g_free); + mime_type = g_strdup ("inode/directory"); + + icon = g_content_type_get_icon (mime_type); + symbolic_icon = g_content_type_get_symbolic_icon (mime_type); + file_info_set_content_type (info, mime_type); /* Ignore file size for directories. Most of the servers don't report it * for directories anyway. However, some servers report total size of diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c index 2e96cca4..3b82375f 100644 --- a/daemon/gvfsbackendgoogle.c +++ b/daemon/gvfsbackendgoogle.c @@ -987,18 +987,10 @@ build_file_info (GVfsBackendGoogle *self, g_file_info_set_content_type (info, content_type); g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, content_type); - if (file_type == G_FILE_TYPE_DIRECTORY) - { - icon = g_themed_icon_new ("folder"); - symbolic_icon = g_themed_icon_new ("folder-symbolic"); - } - else - { - icon = g_content_type_get_icon (content_type); - symbolic_icon = g_content_type_get_symbolic_icon (content_type); - } - + icon = g_content_type_get_icon (content_type); g_file_info_set_icon (info, icon); + + symbolic_icon = g_content_type_get_symbolic_icon (content_type); g_file_info_set_symbolic_icon (info, symbolic_icon); g_object_unref (icon); diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c index b31bc59e..6d144d3c 100644 --- a/daemon/gvfsbackendgphoto2.c +++ b/daemon/gvfsbackendgphoto2.c @@ -845,18 +845,19 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend, /* handle root directory */ if (strcmp (full_path, gphoto2_backend->ignore_prefix) == 0 || strcmp (full_path, "/") == 0) { + const char *directory_mime_type = "inode/directory"; char *display_name; display_name = compute_display_name (gphoto2_backend); g_file_info_set_display_name (info, display_name); g_file_info_set_name (info, display_name); g_free (display_name); g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY); - g_file_info_set_content_type (info, "inode/directory"); + g_file_info_set_content_type (info, directory_mime_type); g_file_info_set_size (info, 0); - icon = g_themed_icon_new ("folder"); + icon = g_content_type_get_icon (directory_mime_type); g_file_info_set_icon (info, icon); g_object_unref (icon); - icon = g_themed_icon_new ("folder-symbolic"); + icon = g_content_type_get_symbolic_icon (directory_mime_type); g_file_info_set_symbolic_icon (info, icon); g_object_unref (icon); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE); @@ -903,16 +904,18 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend, if (is_folder) { + const char *directory_mime_type = "inode/directory"; + g_file_info_set_name (info, name); g_file_info_set_display_name (info, name); - icon = g_themed_icon_new ("folder"); + icon = g_content_type_get_icon (directory_mime_type); g_file_info_set_icon (info, icon); g_object_unref (icon); - icon = g_themed_icon_new ("folder-symbolic"); + icon = g_content_type_get_symbolic_icon (directory_mime_type); g_file_info_set_symbolic_icon (info, icon); g_object_unref (icon); g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY); - g_file_info_set_content_type (info, "inode/directory"); + g_file_info_set_content_type (info, directory_mime_type); g_file_info_set_size (info, 0); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, gphoto2_backend->can_write); diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c index 7ee95aef..a7be4f3f 100644 --- a/daemon/gvfsbackendmtp.c +++ b/daemon/gvfsbackendmtp.c @@ -1255,24 +1255,22 @@ get_file_info (GVfsBackend *backend, case LIBMTP_FILETYPE_FOLDER: g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, TRUE); g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY); - g_file_info_set_content_type (info, "inode/directory"); - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, - "inode/directory"); - icon = g_themed_icon_new ("folder"); - symbolic_icon = g_themed_icon_new ("folder-symbolic"); + content_type = g_strdup ("inode/directory"); break; default: g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, FALSE); g_file_info_set_file_type (info, G_FILE_TYPE_REGULAR); content_type = g_content_type_guess (file->filename, NULL, 0, NULL); - g_file_info_set_content_type (info, content_type); - g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, - content_type); - icon = g_content_type_get_icon (content_type); - symbolic_icon = g_content_type_get_symbolic_icon (content_type); break; } + g_file_info_set_content_type (info, content_type); + g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, + content_type); + + icon = g_content_type_get_icon (content_type); + symbolic_icon = g_content_type_get_symbolic_icon (content_type); + if (LIBMTP_FILETYPE_IS_IMAGE (file->filetype) || LIBMTP_FILETYPE_IS_VIDEO (file->filetype) || LIBMTP_FILETYPE_IS_AUDIOVIDEO (file->filetype)) { diff --git a/daemon/gvfsbackendnfs.c b/daemon/gvfsbackendnfs.c index 566fda78..b7888cca 100644 --- a/daemon/gvfsbackendnfs.c +++ b/daemon/gvfsbackendnfs.c @@ -472,7 +472,6 @@ static void set_name_info (GFileInfo *info, const char *mimetype, const char *basename, - gboolean is_directory, GFileAttributeMatcher *matcher) { char *free_mimetype = NULL; @@ -514,16 +513,8 @@ set_name_info (GFileInfo *info, GIcon *icon = NULL; GIcon *symbolic_icon = NULL; - if (is_directory) - { - icon = g_themed_icon_new ("folder"); - symbolic_icon = g_themed_icon_new ("folder-symbolic"); - } - else if (mimetype) - { - icon = g_content_type_get_icon (mimetype); - symbolic_icon = g_content_type_get_symbolic_icon (mimetype); - } + icon = g_content_type_get_icon (mimetype); + symbolic_icon = g_content_type_get_symbolic_icon (mimetype); if (icon == NULL) icon = g_themed_icon_new ("text-x-generic"); @@ -1691,7 +1682,6 @@ enumerate_stat_cb (int err, set_name_info (new_info, mimetype, g_file_info_get_name (info), - S_ISDIR (st->nfs_mode), handle->op_job->attribute_matcher); g_file_info_set_is_symlink (new_info, TRUE); @@ -1882,7 +1872,6 @@ enumerate_cb (int err, struct nfs_context *ctx, void *data, void *private_data) set_name_info (info, mimetype, d->name, - type == G_FILE_TYPE_DIRECTORY, op_job->attribute_matcher); if ((g_file_attribute_matcher_matches (op_job->attribute_matcher, @@ -2090,7 +2079,6 @@ stat_cb (int err, struct nfs_context *ctx, void *data, void *private_data) set_name_info (info, mimetype, basename, - S_ISDIR (st->nfs_mode), op_job->attribute_matcher); g_free (basename); diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c index 7818c9e3..a3a0d40e 100644 --- a/daemon/gvfsbackendsftp.c +++ b/daemon/gvfsbackendsftp.c @@ -2500,16 +2500,8 @@ parse_attributes (GVfsBackendSftp *backend, GIcon *icon = NULL; GIcon *symbolic_icon = NULL; - if (S_ISDIR(mode)) - { - icon = g_themed_icon_new ("folder"); - symbolic_icon = g_themed_icon_new ("folder-symbolic"); - } - else if (mimetype) - { - icon = g_content_type_get_icon (mimetype); - symbolic_icon = g_content_type_get_symbolic_icon (mimetype); - } + icon = g_content_type_get_icon (mimetype); + symbolic_icon = g_content_type_get_symbolic_icon (mimetype); if (icon == NULL) icon = g_themed_icon_new ("text-x-generic"); diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c index 9571fa0d..60cd0376 100644 --- a/daemon/gvfsbackendsmb.c +++ b/daemon/gvfsbackendsmb.c @@ -1446,8 +1446,8 @@ set_info_from_stat (GVfsBackendSmb *backend, } else { - icon = g_themed_icon_new ("folder"); - symbolic_icon = g_themed_icon_new ("folder-symbolic"); + icon = g_content_type_get_icon (content_type); + symbolic_icon = g_content_type_get_symbolic_icon (content_type); } } else if (basename != NULL) diff --git a/daemon/gvfsdaemonutils.c b/daemon/gvfsdaemonutils.c index ba668317..47fe042c 100644 --- a/daemon/gvfsdaemonutils.c +++ b/daemon/gvfsdaemonutils.c @@ -201,19 +201,11 @@ gvfs_file_info_populate_content_types (GFileInfo *info, g_file_info_set_content_type (info, mimetype); g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, mimetype); - if (type == G_FILE_TYPE_DIRECTORY) - { - icon = g_themed_icon_new ("folder"); - symbolic_icon = g_themed_icon_new ("folder-symbolic"); - } - else - { - icon = g_content_type_get_icon (mimetype); - symbolic_icon = g_content_type_get_symbolic_icon (mimetype); - } - + icon = g_content_type_get_icon (mimetype); g_file_info_set_icon (info, icon); g_object_unref (icon); + + symbolic_icon = g_content_type_get_symbolic_icon (mimetype); g_file_info_set_symbolic_icon (info, symbolic_icon); g_object_unref (symbolic_icon); |