diff options
author | William Jon McCann <jmccann@redhat.com> | 2012-08-28 20:45:50 -0400 |
---|---|---|
committer | William Jon McCann <jmccann@redhat.com> | 2012-08-30 11:24:19 -0400 |
commit | 5e2d824527f6b6b8e456f1b717f9fd5d95b488ac (patch) | |
tree | e6d224b7e3939b11cea1a9d67ab4d1da71d5d28f | |
parent | c47f093895ceb648429ef4ab85004b9c3941438d (diff) | |
download | gvfs-5e2d824527f6b6b8e456f1b717f9fd5d95b488ac.tar.gz |
Add symbolics support to the backends
https://bugzilla.gnome.org/show_bug.cgi?id=681458
-rw-r--r-- | daemon/gvfsafpserver.c | 8 | ||||
-rw-r--r-- | daemon/gvfsbackendafc.c | 28 | ||||
-rw-r--r-- | daemon/gvfsbackendafp.c | 4 | ||||
-rw-r--r-- | daemon/gvfsbackendafpbrowse.c | 9 | ||||
-rw-r--r-- | daemon/gvfsbackendarchive.c | 5 | ||||
-rw-r--r-- | daemon/gvfsbackendburn.c | 4 | ||||
-rw-r--r-- | daemon/gvfsbackendcdda.c | 1 | ||||
-rw-r--r-- | daemon/gvfsbackendcomputer.c | 16 | ||||
-rw-r--r-- | daemon/gvfsbackenddav.c | 14 | ||||
-rw-r--r-- | daemon/gvfsbackenddnssd.c | 49 | ||||
-rw-r--r-- | daemon/gvfsbackendftp.c | 1 | ||||
-rw-r--r-- | daemon/gvfsbackendgphoto2.c | 50 | ||||
-rw-r--r-- | daemon/gvfsbackendhttp.c | 4 | ||||
-rw-r--r-- | daemon/gvfsbackendlocaltest.c | 1 | ||||
-rw-r--r-- | daemon/gvfsbackendnetwork.c | 46 | ||||
-rw-r--r-- | daemon/gvfsbackendobexftp-fl-parser.c | 16 | ||||
-rw-r--r-- | daemon/gvfsbackendobexftp.c | 38 | ||||
-rw-r--r-- | daemon/gvfsbackendrecent.c | 8 | ||||
-rw-r--r-- | daemon/gvfsbackendsftp.c | 22 | ||||
-rw-r--r-- | daemon/gvfsbackendsmb.c | 33 | ||||
-rw-r--r-- | daemon/gvfsbackendsmbbrowse.c | 30 | ||||
-rw-r--r-- | daemon/gvfsbackendtrash.c | 5 | ||||
-rw-r--r-- | daemon/gvfsdaemonutils.c | 9 | ||||
-rw-r--r-- | daemon/gvfsftpdircache.c | 3 |
24 files changed, 351 insertions, 53 deletions
diff --git a/daemon/gvfsafpserver.c b/daemon/gvfsafpserver.c index 4c68e402..c4af4fc4 100644 --- a/daemon/gvfsafpserver.c +++ b/daemon/gvfsafpserver.c @@ -1498,6 +1498,9 @@ g_vfs_afp_server_fill_info (GVfsAfpServer *server, icon = g_themed_icon_new ("folder"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("folder-symbolic"); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); } else g_file_info_set_file_type (info, G_FILE_TYPE_REGULAR); @@ -1624,8 +1627,11 @@ g_vfs_afp_server_fill_info (GVfsAfpServer *server, icon = g_content_type_get_icon (content_type); g_file_info_set_icon (info, icon); - g_object_unref (icon); + icon = g_content_type_get_symbolic_icon (content_type); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); + g_free (content_type); } diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c index cfee444b..ea6f91f5 100644 --- a/daemon/gvfsbackendafc.c +++ b/daemon/gvfsbackendafc.c @@ -547,14 +547,17 @@ g_vfs_backend_afc_mount (GVfsBackend *backend, if ((self->model != NULL) && (g_str_equal (self->model, "iPod") != FALSE)) { g_vfs_backend_set_icon_name (G_VFS_BACKEND(self), "multimedia-player-apple-ipod-touch"); + g_vfs_backend_set_symbolic_icon_name (G_VFS_BACKEND(self), "multimedia-player-apple-ipod-touch-symbolic"); } else if ((self->model != NULL) && (g_str_equal (self->model, "iPad") != FALSE)) { g_vfs_backend_set_icon_name (G_VFS_BACKEND(self), "computer-apple-ipad"); + g_vfs_backend_set_symbolic_icon_name (G_VFS_BACKEND(self), "computer-apple-ipad-symbolic"); } else { g_vfs_backend_set_icon_name (G_VFS_BACKEND(self), "phone-apple-iphone"); + g_vfs_backend_set_symbolic_icon_name (G_VFS_BACKEND(self), "phone-apple-iphone-symbolic"); } /* Get the major OS version */ @@ -1403,6 +1406,7 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self, { GFileType type = G_FILE_TYPE_REGULAR; GIcon *icon = NULL; + GIcon *symbolic_icon = NULL; gchar *content_type = NULL; char *display_name; char *linktarget = NULL; @@ -1495,11 +1499,13 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self, * seems a little funny to put this in the backends. */ if (g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE) - || g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_STANDARD_ICON)) + || g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_STANDARD_ICON) + || g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON)) { if (type == G_FILE_TYPE_DIRECTORY) { icon = g_themed_icon_new ("folder"); + symbolic_icon = g_themed_icon_new ("folder-symbolic"); } else { @@ -1507,15 +1513,27 @@ g_vfs_backend_afc_set_info_from_afcinfo (GVfsBackendAfc *self, { icon = g_content_type_get_icon (content_type); if (G_IS_THEMED_ICON(icon)) - g_themed_icon_append_name (G_THEMED_ICON(icon), "text-x-generic"); + { + g_themed_icon_append_name (G_THEMED_ICON(icon), "text-x-generic"); + } + + symbolic_icon = g_content_type_get_symbolic_icon (content_type); + if (G_IS_THEMED_ICON(symbolic_icon)) + { + g_themed_icon_append_name (G_THEMED_ICON(symbolic_icon), "text-x-generic-symbolic"); + } } } if (icon == NULL) icon = g_themed_icon_new ("text-x-generic"); + if (symbolic_icon == NULL) + symbolic_icon = g_themed_icon_new ("text-x-generic-symbolic"); g_file_info_set_icon (info, icon); + g_file_info_set_symbolic_icon (info, symbolic_icon); g_object_unref (icon); + g_object_unref (symbolic_icon); } g_free (content_type); @@ -1694,6 +1712,7 @@ g_vfs_backend_afc_set_info_from_app (GVfsBackendAfc *self, AppInfo *app_info) { GIcon *icon; + GIcon *symbolic_icon; /* content-type */ g_file_info_set_content_type (info, "inode/directory"); @@ -1718,6 +1737,11 @@ g_vfs_backend_afc_set_info_from_app (GVfsBackendAfc *self, g_object_unref (icon); } + /* symbolic icon */ + symbolic_icon = g_themed_icon_new ("folder-symbolic"); + g_file_info_set_symbolic_icon (info, symbolic_icon); + g_object_unref (symbolic_icon); + /* hidden ? */ if (app_info && app_info->hidden) g_file_info_set_is_hidden (info, TRUE); diff --git a/daemon/gvfsbackendafp.c b/daemon/gvfsbackendafp.c index 40183898..3d753f70 100644 --- a/daemon/gvfsbackendafp.c +++ b/daemon/gvfsbackendafp.c @@ -1866,6 +1866,9 @@ set_root_info (GVfsBackendAfp *afp_backend, GFileInfo *info) icon = g_vfs_backend_get_icon (G_VFS_BACKEND (afp_backend)); if (icon != NULL) g_file_info_set_icon (info, icon); + icon = g_vfs_backend_get_symbolic_icon (G_VFS_BACKEND (afp_backend)); + if (icon != NULL) + g_file_info_set_symbolic_icon (info, icon); } static void @@ -2067,6 +2070,7 @@ do_mount (GVfsBackend *backend, g_free (display_name); g_vfs_backend_set_icon_name (backend, "folder-remote-afp"); + g_vfs_backend_set_symbolic_icon_name (backend, "folder-remote-symbolic"); g_vfs_backend_set_user_visible (backend, TRUE); g_vfs_job_succeeded (G_VFS_JOB (job)); diff --git a/daemon/gvfsbackendafpbrowse.c b/daemon/gvfsbackendafpbrowse.c index 1f007874..78c07474 100644 --- a/daemon/gvfsbackendafpbrowse.c +++ b/daemon/gvfsbackendafpbrowse.c @@ -245,6 +245,10 @@ fill_info (GFileInfo *info, GVfsAfpVolumeData *vol_data, GVfsBackendAfpBrowse *a g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new_with_default_fallbacks ("folder-remote-symbolic"); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); + mount_spec = g_mount_spec_new ("afp-volume"); g_mount_spec_set (mount_spec, "host", g_network_address_get_hostname (G_NETWORK_ADDRESS (afp_backend->addr))); @@ -379,6 +383,11 @@ try_query_info (GVfsBackend *backend, icon = g_vfs_backend_get_icon (backend); if (icon != NULL) g_file_info_set_icon (info, icon); + + icon = g_vfs_backend_get_symbolic_icon (backend); + if (icon != NULL) + g_file_info_set_symbolic_icon (info, icon); + g_vfs_job_succeeded (G_VFS_JOB (job)); } else diff --git a/daemon/gvfsbackendarchive.c b/daemon/gvfsbackendarchive.c index 4e16b768..30b44557 100644 --- a/daemon/gvfsbackendarchive.c +++ b/daemon/gvfsbackendarchive.c @@ -45,6 +45,7 @@ #include "gvfskeyring.h" #define MOUNT_ICON_NAME "drive-removable-media" +#define MOUNT_SYMBOLIC_ICON_NAME "drive-removable-media-symbolic" /* #define PRINT_DEBUG */ @@ -346,6 +347,9 @@ create_root_file (GVfsBackendArchive *ba) icon = g_themed_icon_new ("folder"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("folder-symbolic"); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); } static void @@ -594,6 +598,7 @@ do_mount (GVfsBackend *backend, g_vfs_backend_set_display_name (backend, g_file_info_get_display_name (info)); g_vfs_backend_set_icon_name (backend, MOUNT_ICON_NAME); + g_vfs_backend_set_symbolic_icon_name (backend, MOUNT_SYMBOLIC_ICON_NAME); create_root_file (archive); create_file_tree (archive, G_VFS_JOB (job)); diff --git a/daemon/gvfsbackendburn.c b/daemon/gvfsbackendburn.c index 9993a24d..b22baa9d 100644 --- a/daemon/gvfsbackendburn.c +++ b/daemon/gvfsbackendburn.c @@ -345,6 +345,7 @@ g_vfs_backend_burn_init (GVfsBackendBurn *burn_backend) /* Translators: This is the name of the backend */ g_vfs_backend_set_display_name (backend, _("Burn")); g_vfs_backend_set_icon_name (backend, "computer"); + g_vfs_backend_set_symbolic_icon_name (backend, "computer-symbolic"); g_vfs_backend_set_user_visible (backend, FALSE); mount_spec = g_mount_spec_new ("burn"); @@ -606,6 +607,9 @@ file_info_from_node (VirtualNode *node, icon = g_themed_icon_new ("folder"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("folder-symbolic"); + 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); diff --git a/daemon/gvfsbackendcdda.c b/daemon/gvfsbackendcdda.c index 9beefa4c..837d103a 100644 --- a/daemon/gvfsbackendcdda.c +++ b/daemon/gvfsbackendcdda.c @@ -466,6 +466,7 @@ do_mount (GVfsBackend *backend, g_free (display_name); g_free (fuse_name); g_vfs_backend_set_icon_name (backend, "media-optical-audio"); + g_vfs_backend_set_symbolic_icon_name (backend, "media-optical-symbolic"); g_vfs_job_succeeded (G_VFS_JOB (job)); diff --git a/daemon/gvfsbackendcomputer.c b/daemon/gvfsbackendcomputer.c index f1ec0011..e79454f9 100644 --- a/daemon/gvfsbackendcomputer.c +++ b/daemon/gvfsbackendcomputer.c @@ -60,6 +60,7 @@ typedef struct { char *filename; char *display_name; GIcon *icon; + GIcon *symbolic_icon; GFile *root; int prio; gchar *unix_device_file; @@ -105,6 +106,8 @@ computer_file_free (ComputerFile *file) g_free (file->display_name); if (file->icon) g_object_unref (file->icon); + if (file->symbolic_icon) + g_object_unref (file->symbolic_icon); if (file->root) g_object_unref (file->root); @@ -128,6 +131,9 @@ computer_file_equal (ComputerFile *a, if (!g_icon_equal (a->icon, b->icon)) return FALSE; + + if (!g_icon_equal (a->symbolic_icon, b->symbolic_icon)) + return FALSE; if ((a->root != NULL && b->root != NULL && !g_file_equal (a->root, b->root)) || @@ -191,6 +197,7 @@ g_vfs_backend_computer_init (GVfsBackendComputer *computer_backend) g_vfs_backend_set_display_name (backend, _("Computer")); g_vfs_backend_set_icon_name (backend, "computer"); + g_vfs_backend_set_symbolic_icon_name (backend, "computer-symbolic"); g_vfs_backend_set_user_visible (backend, FALSE); mount_spec = g_mount_spec_new ("computer"); @@ -439,6 +446,7 @@ recompute_files (GVfsBackendComputer *backend) file->unix_device_file = g_volume_get_identifier (file->volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE); file->icon = g_mount_get_icon (file->mount); + file->symbolic_icon = g_mount_get_symbolic_icon (file->mount); file->display_name = display_name; file->root = g_mount_get_default_location (file->mount); file->can_unmount = g_mount_can_unmount (file->mount); @@ -461,6 +469,7 @@ recompute_files (GVfsBackendComputer *backend) file->unix_device_file = g_volume_get_identifier (file->volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE); file->icon = g_volume_get_icon (file->volume); + file->symbolic_icon = g_volume_get_symbolic_icon (file->volume); file->display_name = display_name; file->can_mount = g_volume_can_mount (file->volume); file->root = NULL; @@ -471,6 +480,7 @@ recompute_files (GVfsBackendComputer *backend) file->unix_device_file = g_drive_get_identifier (file->drive, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE); file->icon = g_drive_get_icon (file->drive); + file->symbolic_icon = g_drive_get_symbolic_icon (file->drive); file->display_name = g_drive_get_name (file->drive); file->can_eject = g_drive_can_eject (file->drive); file->can_mount = ! g_drive_is_media_removable (file->drive) || ! g_drive_is_media_check_automatic (file->drive) || g_drive_has_media (file->drive); @@ -520,6 +530,7 @@ recompute_files (GVfsBackendComputer *backend) file->filename = g_strdup ("root.link"); file->display_name = g_strdup (_("File System")); file->icon = g_themed_icon_new_with_default_fallbacks ("drive-harddisk-system"); + file->symbolic_icon = g_themed_icon_new_with_default_fallbacks ("drive-harddisk-system-symbolic"); file->root = g_file_new_for_path ("/"); file->prio = 0; @@ -661,6 +672,8 @@ file_info_from_file (ComputerFile *file, if (file->icon) g_file_info_set_icon (info, file->icon); + if (file->symbolic_icon) + g_file_info_set_symbolic_icon (info, file->symbolic_icon); if (file->root) { @@ -758,6 +771,9 @@ try_query_info (GVfsBackend *backend, icon = g_themed_icon_new ("computer"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("computer-symbolic"); + 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, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE); diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c index 528c35ad..4a4143be 100644 --- a/daemon/gvfsbackenddav.c +++ b/daemon/gvfsbackenddav.c @@ -990,6 +990,7 @@ ms_response_to_file_info (MsResponse *response, GFileType file_type; char *mime_type; GIcon *icon; + GIcon *symbolic_icon; gboolean have_display_name; basename = ms_response_get_basename (response); @@ -1067,6 +1068,7 @@ ms_response_to_file_info (MsResponse *response, 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"); } else @@ -1075,9 +1077,16 @@ ms_response_to_file_info (MsResponse *response, mime_type = g_content_type_guess (basename, NULL, 0, NULL); icon = g_content_type_get_icon (mime_type); + if (G_IS_THEMED_ICON (icon)) + { + g_themed_icon_append_name (G_THEMED_ICON (icon), "text-x-generic"); + } + symbolic_icon = g_content_type_get_symbolic_icon (mime_type); if (G_IS_THEMED_ICON (icon)) - g_themed_icon_append_name (G_THEMED_ICON (icon), "text-x-generic"); + { + g_themed_icon_append_name (G_THEMED_ICON (symbolic_icon), "text-x-generic-symbolic"); + } file_info_set_content_type (info, mime_type); } @@ -1086,7 +1095,9 @@ ms_response_to_file_info (MsResponse *response, g_file_info_set_display_name (info, basename); g_file_info_set_icon (info, icon); + g_file_info_set_symbolic_icon (info, symbolic_icon); g_object_unref (icon); + g_object_unref (symbolic_icon); g_free (mime_type); g_free (basename); @@ -1937,6 +1948,7 @@ do_mount (GVfsBackend *backend, g_vfs_backend_set_mount_spec (backend, mount_spec); g_vfs_backend_set_icon_name (backend, "folder-remote"); + g_vfs_backend_set_symbolic_icon_name (backend, "folder-remote-symbolic"); g_vfs_backend_dav_setup_display_name (backend); diff --git a/daemon/gvfsbackenddnssd.c b/daemon/gvfsbackenddnssd.c index c955b719..8198604b 100644 --- a/daemon/gvfsbackenddnssd.c +++ b/daemon/gvfsbackenddnssd.c @@ -49,41 +49,49 @@ static struct { char *method; gboolean use_dns_sd_uri; char *icon; + char *symbolic_icon; } dns_sd_types[] = { { "_ftp._tcp", "ftp", FALSE, - "folder-remote-ftp" + "folder-remote-ftp", + "folder-remote-symbolic" }, { "_webdav._tcp", "dav+sd", TRUE, - "folder-remote-dav" + "folder-remote-dav", + "folder-remote-symbolic" }, { "_webdavs._tcp", "davs+sd", TRUE, - "folder-remote-davs"}, + "folder-remote-davs", + "folder-remote-symbolic" + }, { "_sftp-ssh._tcp", "sftp", FALSE, - "folder-remote-ssh" + "folder-remote-ssh", + "folder-remote-symbolic" }, { "_smb._tcp", "smb", FALSE, - "network-server" + "network-server", + "network-server-symbolic" }, { - "_afpovertcp._tcp", - "afp", - FALSE, - "network-server-afp" + "_afpovertcp._tcp", + "afp", + FALSE, + "network-server-afp", + "network-server-symbolic" } }; @@ -100,6 +108,7 @@ typedef struct { char *target_uri; GIcon *icon; + GIcon *symbolic_icon; } LinkFile; static LinkFile root = { "/" }; @@ -192,17 +201,22 @@ get_global_avahi_client (void) } static GIcon * -get_icon_for_type (const char *type) +get_icon_for_type (const char *type, + gboolean use_symbolic) { int i; for (i = 0; i < G_N_ELEMENTS (dns_sd_types); i++) { if (strcmp (type, dns_sd_types[i].type) == 0) - return g_themed_icon_new_with_default_fallbacks (dns_sd_types[i].icon); + { + const char *icon_name; + icon_name = use_symbolic ? dns_sd_types[i].symbolic_icon : dns_sd_types[i].icon; + return g_themed_icon_new_with_default_fallbacks (icon_name); + } } - return g_themed_icon_new ("text-x-generic"); + return g_themed_icon_new (use_symbolic ? "text-x-generic-symbolic" : "text-x-generic"); } static const char * @@ -253,7 +267,8 @@ link_file_new (const char *name, file->name = g_strdup (name); file->type = g_strdup (type); file->domain = g_strdup (domain); - file->icon = get_icon_for_type (type); + file->icon = get_icon_for_type (type, FALSE); + file->symbolic_icon = get_icon_for_type (type, TRUE); uri = g_vfs_get_dns_sd_uri_for_triple (name, type, domain); file->file_name = g_path_get_basename (uri); @@ -342,6 +357,8 @@ link_file_free (LinkFile *file) if (file->icon) g_object_unref (file->icon); + if (file->symbolic_icon) + g_object_unref (file->symbolic_icon); g_slice_free (LinkFile, file); } @@ -412,6 +429,8 @@ file_info_from_file (LinkFile *file, if (file->icon) g_file_info_set_icon (info, file->icon); + if (file->symbolic_icon) + g_file_info_set_symbolic_icon (info, file->symbolic_icon); g_file_info_set_file_type (info, G_FILE_TYPE_SHORTCUT); g_file_info_set_size(info, 0); @@ -499,6 +518,9 @@ try_query_info (GVfsBackend *backend, icon = g_themed_icon_new ("network-workgroup"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("network-workgroup-symbolic"); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); g_free (display_name); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE); @@ -754,6 +776,7 @@ g_vfs_backend_dns_sd_init (GVfsBackendDnsSd *network_backend) g_vfs_backend_set_display_name (backend, _("Dns-SD")); g_vfs_backend_set_stable_name (backend, _("Network")); g_vfs_backend_set_icon_name (backend, "network-workgroup"); + g_vfs_backend_set_symbolic_icon_name (backend, "network-workgroup-symbolic"); g_vfs_backend_set_user_visible (backend, FALSE); resolver_supports_mdns = (avahi_nss_support () > 0); diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c index 23ec4f11..831bcdf3 100644 --- a/daemon/gvfsbackendftp.c +++ b/daemon/gvfsbackendftp.c @@ -639,6 +639,7 @@ try_login: g_vfs_backend_set_display_name (backend, display_name); g_free (display_name); g_vfs_backend_set_icon_name (backend, "folder-remote"); + g_vfs_backend_set_symbolic_icon_name (backend, "folder-remote-symbolic"); ftp->connections = 1; ftp->max_connections = G_MAXUINT; diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c index 75b4b02a..5f0b4353 100644 --- a/daemon/gvfsbackendgphoto2.c +++ b/daemon/gvfsbackendgphoto2.c @@ -192,6 +192,7 @@ struct _GVfsBackendGphoto2 char *hal_name; #endif char *icon_name; + char *symbolic_icon_name; /* whether we can write to the device */ gboolean can_write; @@ -582,6 +583,8 @@ release_device (GVfsBackendGphoto2 *gphoto2_backend) #endif g_free (gphoto2_backend->icon_name); gphoto2_backend->icon_name = NULL; + g_free (gphoto2_backend->symbolic_icon_name); + gphoto2_backend->symbolic_icon_name = NULL; g_free (gphoto2_backend->ignore_prefix); gphoto2_backend->ignore_prefix = NULL; @@ -691,6 +694,23 @@ compute_icon_name (GVfsBackendGphoto2 *gphoto2_backend) return result; } +static char * +compute_symbolic_icon_name (GVfsBackendGphoto2 *gphoto2_backend) +{ + char *result; + + if (gphoto2_backend->symbolic_icon_name == NULL) + { + result = g_strdup_printf ("camera-photo-symbolic"); + } + else + { + result = g_strdup (gphoto2_backend->symbolic_icon_name); + } + + return result; +} + /* ------------------------------------------------------------------------------------------------- */ static char * @@ -767,15 +787,20 @@ setup_for_device (GVfsBackendGphoto2 *gphoto2_backend) if (g_udev_device_has_property (gphoto2_backend->udev_device, "ID_MEDIA_PLAYER_ICON_NAME")) { gphoto2_backend->icon_name = g_strdup (g_udev_device_get_property (gphoto2_backend->udev_device, "ID_MEDIA_PLAYER_ICON_NAME")); + gphoto2_backend->symbolic_icon_name = g_strdup ("multimedia-player-symbolic"); is_media_player = TRUE; } else if (g_udev_device_has_property (gphoto2_backend->udev_device, "ID_MEDIA_PLAYER")) { gphoto2_backend->icon_name = g_strdup ("multimedia-player"); + gphoto2_backend->symbolic_icon_name = g_strdup ("multimedia-player-symbolic"); is_media_player = TRUE; } else + { gphoto2_backend->icon_name = g_strdup ("camera-photo"); + gphoto2_backend->symbolic_icon_name = g_strdup ("camera-photo-symbolic"); + } } else DEBUG ("-> did not find matching udev device"); @@ -982,11 +1007,13 @@ find_udi_for_device (GVfsBackendGphoto2 *gphoto2_backend) /* TODO: should we sniff the files instead? */ if (m == 0) { + gphoto2_backend->symbolic_icon_name = g_strdup ("camera-photo-symbolic"); g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend), camera_x_content_types); } else { + gphoto2_backend->symbolic_icon_name = g_strdup ("multimedia-player-symbolic"); g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend), music_player_x_content_types); } @@ -1133,6 +1160,9 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend, icon = g_themed_icon_new ("folder"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("folder-symbolic"); + 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); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, gphoto2_backend->can_write); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, gphoto2_backend->can_delete); @@ -1182,6 +1212,9 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend, icon = g_themed_icon_new ("folder"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("folder-symbolic"); + 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_size (info, 0); @@ -1269,6 +1302,13 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend, g_file_info_set_icon (info, icon); g_object_unref (icon); } + icon = g_content_type_get_symbolic_icon (mime_type); + DEBUG (" got symbolic icon %p for mime_type '%s'", icon, mime_type); + if (icon != NULL) + { + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); + } g_free (mime_type); if (gp_info.file.fields & GP_FILE_INFO_MTIME) @@ -1682,13 +1722,19 @@ do_mount (GVfsBackend *backend, /* Translator: %s represents the device, e.g. usb:001,042. 'gphoto2' is the name of the backend and shouldn't be translated. */ fuse_name = g_strdup_printf (_("gphoto2 mount on %s"), gphoto2_backend->gphoto2_port); - icon_name = compute_icon_name (gphoto2_backend); display_name = compute_display_name (gphoto2_backend); g_vfs_backend_set_stable_name (backend, fuse_name); g_vfs_backend_set_display_name (backend, display_name); + + icon_name = compute_icon_name (gphoto2_backend); g_vfs_backend_set_icon_name (backend, icon_name); - g_free (display_name); g_free (icon_name); + + icon_name = compute_symbolic_icon_name (gphoto2_backend); + g_vfs_backend_set_symbolic_icon_name (backend, icon_name); + g_free (icon_name); + + g_free (display_name); g_free (fuse_name); gphoto2_backend->can_write = FALSE; diff --git a/daemon/gvfsbackendhttp.c b/daemon/gvfsbackendhttp.c index a4894265..381f3169 100644 --- a/daemon/gvfsbackendhttp.c +++ b/daemon/gvfsbackendhttp.c @@ -606,6 +606,10 @@ file_info_from_message (SoupMessage *msg, icon = g_content_type_get_icon (text); g_file_info_set_icon (info, icon); g_object_unref (icon); + + icon = g_content_type_get_symbolic_icon (text); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); } diff --git a/daemon/gvfsbackendlocaltest.c b/daemon/gvfsbackendlocaltest.c index 339c167c..d1fcc926 100644 --- a/daemon/gvfsbackendlocaltest.c +++ b/daemon/gvfsbackendlocaltest.c @@ -247,6 +247,7 @@ do_mount (GVfsBackend *backend, g_vfs_backend_set_mount_spec (backend, op_backend->mount_spec); g_vfs_backend_set_icon_name (backend, "folder-remote"); + g_vfs_backend_set_symbolic_icon_name (backend, "folder-remote-symbolic"); inject_error (backend, G_VFS_JOB (job), GVFS_JOB_MOUNT); } diff --git a/daemon/gvfsbackendnetwork.c b/daemon/gvfsbackendnetwork.c index 5a52d7a7..bdb9cb9f 100644 --- a/daemon/gvfsbackendnetwork.c +++ b/daemon/gvfsbackendnetwork.c @@ -47,6 +47,7 @@ typedef struct { char *display_name; char *target_uri; GIcon *icon; + GIcon *symbolic_icon; guint num_duplicates; } NetworkFile; @@ -78,6 +79,8 @@ struct _GVfsBackendNetwork /* Icons */ GIcon *workgroup_icon; /* GThemedIcon = "network-workgroup" */ GIcon *server_icon; /* GThemedIcon = "network-server" */ + GIcon *workgroup_symbolic_icon; /* GThemedIcon = "network-workgroup-symbolic" */ + GIcon *server_symbolic_icon; /* GThemedIcon = "network-server-symbolic" */ }; typedef struct _GVfsBackendNetwork GVfsBackendNetwork; @@ -88,7 +91,8 @@ static NetworkFile * network_file_new (const char *file_name, const char *display_name, const char *target_uri, - GIcon *icon) + GIcon *icon, + GIcon *symbolic_icon) { NetworkFile *file; @@ -98,6 +102,7 @@ network_file_new (const char *file_name, file->display_name = g_strdup (display_name); file->target_uri = g_strdup (target_uri); file->icon = g_object_ref (icon); + file->symbolic_icon = g_object_ref (symbolic_icon); return file; } @@ -111,6 +116,8 @@ network_file_free (NetworkFile *file) if (file->icon) g_object_unref (file->icon); + if (file->symbolic_icon) + g_object_unref (file->symbolic_icon); g_slice_free (NetworkFile, file); } @@ -123,6 +130,8 @@ network_file_equal (NetworkFile *a, { if (!g_icon_equal (a->icon, b->icon)) return FALSE; + if (!g_icon_equal (a->symbolic_icon, b->symbolic_icon)) + return FALSE; if ((a->display_name != NULL && b->display_name == NULL) || (a->display_name == NULL && b->display_name != NULL)) @@ -320,8 +329,11 @@ recompute_files (GVfsBackendNetwork *backend) char *workgroup; /* smb:/// root link */ - file = network_file_new ("smb-root", _("Windows Network"), - "smb:///", backend->workgroup_icon); + file = network_file_new ("smb-root", + _("Windows Network"), + "smb:///", + backend->workgroup_icon, + backend->workgroup_symbolic_icon); files = g_list_prepend (files, file); if (backend->current_workgroup == NULL || @@ -369,7 +381,8 @@ recompute_files (GVfsBackendNetwork *backend) file = network_file_new (file_name, g_file_info_get_display_name (info), link_uri, - backend->server_icon); + backend->server_icon, + backend->server_symbolic_icon); files = g_list_prepend (files, file); g_free (link_uri); @@ -427,8 +440,9 @@ recompute_files (GVfsBackendNetwork *backend) "standard::target-uri")); file = network_file_new (file_name, g_file_info_get_display_name (info), - link_uri, - backend->server_icon); + link_uri, + backend->server_icon, + backend->server_symbolic_icon); files = g_list_prepend (files, file); g_free (link_uri); @@ -444,8 +458,11 @@ recompute_files (GVfsBackendNetwork *backend) else { /* "separate": a link to dns-sd://local/ */ - file = network_file_new ("dnssd-local", _("Local Network"), - "dns-sd://local/", backend->workgroup_icon); + file = network_file_new ("dnssd-local", + _("Local Network"), + "dns-sd://local/", + backend->workgroup_icon, + backend->workgroup_symbolic_icon); files = g_list_prepend (files, file); } @@ -466,7 +483,8 @@ recompute_files (GVfsBackendNetwork *backend) file = network_file_new (file_name, domains[i], link_uri, - backend->workgroup_icon); + backend->workgroup_icon, + backend->workgroup_symbolic_icon); files = g_list_prepend (files, file); g_free (link_uri); g_free (file_name); @@ -692,6 +710,8 @@ file_info_from_file (NetworkFile *file, if (file->icon) g_file_info_set_icon (info, file->icon); + if (file->symbolic_icon) + g_file_info_set_symbolic_icon (info, file->symbolic_icon); g_file_info_set_file_type (info, G_FILE_TYPE_SHORTCUT); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE); @@ -764,6 +784,9 @@ try_query_info (GVfsBackend *backend, icon = g_themed_icon_new ("network-workgroup"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("network-workgroup-symbolic"); + 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, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE); @@ -895,6 +918,7 @@ g_vfs_backend_network_init (GVfsBackendNetwork *network_backend) g_vfs_backend_set_display_name (backend, _("Network")); g_vfs_backend_set_stable_name (backend, _("Network")); g_vfs_backend_set_icon_name (backend, "network-workgroup"); + g_vfs_backend_set_symbolic_icon_name (backend, "network-workgroup-symbolic"); g_vfs_backend_set_user_visible (backend, FALSE); mount_spec = g_mount_spec_new ("network"); @@ -903,6 +927,8 @@ g_vfs_backend_network_init (GVfsBackendNetwork *network_backend) network_backend->workgroup_icon = g_themed_icon_new ("network-workgroup"); network_backend->server_icon = g_themed_icon_new ("network-server"); + network_backend->workgroup_symbolic_icon = g_themed_icon_new ("network-workgroup-symbolic"); + network_backend->server_symbolic_icon = g_themed_icon_new ("network-server-symbolic"); } static void @@ -916,6 +942,8 @@ g_vfs_backend_network_finalize (GObject *object) g_object_unref (backend->root_monitor); g_object_unref (backend->workgroup_icon); g_object_unref (backend->server_icon); + g_object_unref (backend->workgroup_symbolic_icon); + g_object_unref (backend->server_symbolic_icon); if (backend->smb_settings) g_object_unref (backend->smb_settings); if (backend->dnssd_settings) diff --git a/daemon/gvfsbackendobexftp-fl-parser.c b/daemon/gvfsbackendobexftp-fl-parser.c index f469990b..5aca2ad8 100644 --- a/daemon/gvfsbackendobexftp-fl-parser.c +++ b/daemon/gvfsbackendobexftp-fl-parser.c @@ -103,6 +103,9 @@ fl_parser_start_node_cb (void *user_data, icon = g_themed_icon_new ("folder"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("folder-symbolic"); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); } else { g_set_error (data->error, G_MARKUP_ERROR, @@ -132,14 +135,25 @@ fl_parser_start_node_cb (void *user_data, if (g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR) { GIcon *icon; + const char *content_type; + + content_type = g_file_info_get_content_type (info); - icon = g_content_type_get_icon (g_file_info_get_content_type (info)); + icon = g_content_type_get_icon (content_type); if (icon != NULL) { if (G_IS_THEMED_ICON (icon)) g_themed_icon_append_name (G_THEMED_ICON (icon), "text-x-generic"); g_file_info_set_icon (info, icon); g_object_unref (icon); } + + icon = g_content_type_get_symbolic_icon (content_type); + if (icon != NULL) { + if (G_IS_THEMED_ICON (icon)) + g_themed_icon_append_name (G_THEMED_ICON (icon), "text-x-generic-symbolic"); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); + } } /* Permissions on folders in OBEX has different semantics than POSIX. diff --git a/daemon/gvfsbackendobexftp.c b/daemon/gvfsbackendobexftp.c index 92f7ba6c..69e32673 100644 --- a/daemon/gvfsbackendobexftp.c +++ b/daemon/gvfsbackendobexftp.c @@ -78,6 +78,7 @@ struct _GVfsBackendObexftp char *display_name; char *bdaddr; char *icon_name; + char *symbolic_icon_name; gint usbintfnum; DBusGConnection *connection; @@ -177,7 +178,9 @@ _is_nokia_3650 (const char *bdaddr) } static char * -_get_bluetooth_name_and_icon (DBusGProxy *device, char **icon_name) +_get_bluetooth_name_and_icon (DBusGProxy *device, + char **icon_name, + char **symbolic_icon_name) { GHashTable *hash; @@ -200,6 +203,9 @@ _get_bluetooth_name_and_icon (DBusGProxy *device, char **icon_name) { *icon_name = g_strdup ("bluetooth"); } + + *symbolic_icon_name = g_strdup ("bluetooth-symbolic"); + g_hash_table_destroy (hash); return name; } @@ -212,7 +218,9 @@ _get_bluetooth_name_and_icon (DBusGProxy *device, char **icon_name) #define DBUS_G_CONNECTION_FROM_CONNECTION(x) ((DBusGConnection*) _DBUS_POINTER_SHIFT(x)) static gchar * -_get_bluetooth_device_properties (const char *bdaddr, char **icon_name) +_get_bluetooth_device_properties (const char *bdaddr, + char **icon_name, + char **symbolic_icon_name) { DBusConnection *conn; DBusGProxy *manager; @@ -256,7 +264,7 @@ _get_bluetooth_device_properties (const char *bdaddr, char **icon_name) { DBusGProxy *device; device = dbus_g_proxy_new_for_name (DBUS_G_CONNECTION_FROM_CONNECTION(conn), "org.bluez", device_path, "org.bluez.Device"); - name = _get_bluetooth_name_and_icon (device, icon_name); + name = _get_bluetooth_name_and_icon (device, icon_name, symbolic_icon_name); g_object_unref (device); } g_object_unref (adapter); @@ -327,7 +335,11 @@ _find_ods_usb_intfnum (DBusGProxy *obex_manager, int device_usb_bus_num, int dev #endif static gint -_get_usb_intfnum_and_properties (DBusGProxy *obex_manager, const char *device, char **display_name, char **icon_name) +_get_usb_intfnum_and_properties (DBusGProxy *obex_manager, + const char *device, + char **display_name, + char **icon_name, + char **symbolic_icon_name) { int usb_bus_num; int usb_device_num; @@ -439,6 +451,8 @@ _get_usb_intfnum_and_properties (DBusGProxy *obex_manager, const char *device, c else *icon_name = "drive-removable-media-usb"; + *symbolic_icon_name = g_strdup ("drive-removable-media-symbolic"); + if (name_from_hal != NULL) *display_name = g_strdup (name_from_hal); else @@ -489,6 +503,7 @@ g_vfs_backend_obexftp_finalize (GObject *object) g_free (backend->display_name); g_free (backend->bdaddr); g_free (backend->icon_name); + g_free (backend->symbolic_icon_name); g_free (backend->files_listing); g_free (backend->directory); @@ -679,6 +694,14 @@ _query_file_info_helper (GVfsBackend *backend, g_file_info_set_icon (info, icon); g_object_unref (icon); } + if (op_backend->symbolic_icon_name) { + GIcon *icon; + + g_vfs_backend_set_icon_name (backend, op_backend->symbolic_icon_name); + icon = g_themed_icon_new (op_backend->symbolic_icon_name); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); + } display = g_strdup_printf (_("%s on %s"), "/", op_backend->display_name); g_file_info_set_display_name (info, display); g_free (display); @@ -881,7 +904,7 @@ do_mount (GVfsBackend *backend, } else { - op_backend->usbintfnum = _get_usb_intfnum_and_properties (op_backend->manager_proxy, device, &op_backend->display_name, &op_backend->icon_name); + op_backend->usbintfnum = _get_usb_intfnum_and_properties (op_backend->manager_proxy, device, &op_backend->display_name, &op_backend->icon_name, &op_backend->symbolic_icon_name); if (op_backend->usbintfnum < 0) { if (op_backend->usbintfnum == -2) @@ -915,11 +938,13 @@ do_mount (GVfsBackend *backend, g_error_free (error); return; } - op_backend->display_name = _get_bluetooth_device_properties (op_backend->bdaddr, &op_backend->icon_name); + op_backend->display_name = _get_bluetooth_device_properties (op_backend->bdaddr, &op_backend->icon_name, &op_backend->symbolic_icon_name); if (!op_backend->display_name) op_backend->display_name = g_strdelimit (g_strdup (op_backend->bdaddr), ":", '-'); if (!op_backend->icon_name) op_backend->icon_name = g_strdup ("bluetooth"); + if (!op_backend->symbolic_icon_name) + op_backend->symbolic_icon_name = g_strdup ("bluetooth-symbolic"); g_debug (" do_mount: %s (%s) mounted\n", op_backend->display_name, op_backend->bdaddr); } else @@ -945,6 +970,7 @@ do_mount (GVfsBackend *backend, g_vfs_backend_set_display_name (G_VFS_BACKEND (op_backend), op_backend->display_name); g_vfs_backend_set_icon_name (G_VFS_BACKEND (op_backend), op_backend->icon_name); + g_vfs_backend_set_symbolic_icon_name (G_VFS_BACKEND (op_backend), op_backend->symbolic_icon_name); obexftp_mount_spec = g_mount_spec_new ("obex"); g_mount_spec_set (obexftp_mount_spec, "host", device); diff --git a/daemon/gvfsbackendrecent.c b/daemon/gvfsbackendrecent.c index dc515f6f..e01bc51a 100644 --- a/daemon/gvfsbackendrecent.c +++ b/daemon/gvfsbackendrecent.c @@ -551,9 +551,12 @@ recent_backend_query_info (GVfsBackend *vfs_backend, 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); - icon = g_themed_icon_new ("document-open-recent-symbolic"); + icon = g_themed_icon_new ("document-open-recent"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("document-open-recent-symbolic"); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); g_vfs_job_succeeded (G_VFS_JOB (job)); } @@ -657,7 +660,8 @@ g_vfs_backend_recent_init (GVfsBackendRecent *backend) /* translators: This is the name of the backend */ g_vfs_backend_set_display_name (vfs_backend, _("Recent")); - g_vfs_backend_set_icon_name (vfs_backend, "document-open-recent-symbolic"); + g_vfs_backend_set_icon_name (vfs_backend, "document-open-recent"); + g_vfs_backend_set_symbolic_icon_name (vfs_backend, "document-open-recent-symbolic"); g_vfs_backend_set_user_visible (vfs_backend, FALSE); mount_spec = g_mount_spec_new ("recent"); diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c index c3d8a650..654ad715 100644 --- a/daemon/gvfsbackendsftp.c +++ b/daemon/gvfsbackendsftp.c @@ -1692,6 +1692,7 @@ do_mount (GVfsBackend *backend, g_free (display_name); g_vfs_backend_set_icon_name (G_VFS_BACKEND (backend), "folder-remote"); + g_vfs_backend_set_symbolic_icon_name (G_VFS_BACKEND (backend), "folder-remote-symbolic"); g_vfs_job_succeeded (G_VFS_JOB (job)); } @@ -2081,7 +2082,6 @@ parse_attributes (GVfsBackendSftp *backend, guint32 mode; gboolean has_uid, free_mimetype; char *mimetype; - GIcon *icon; flags = g_data_input_stream_read_uint32 (reply, NULL, NULL); @@ -2171,19 +2171,33 @@ parse_attributes (GVfsBackendSftp *backend, g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE, mimetype); if (g_file_attribute_matcher_matches (matcher, - G_FILE_ATTRIBUTE_STANDARD_ICON)) + G_FILE_ATTRIBUTE_STANDARD_ICON) + || g_file_attribute_matcher_matches (matcher, + G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON)) { - icon = NULL; + GIcon *icon = NULL; + GIcon *symbolic_icon = NULL; + if (S_ISDIR(mode)) - icon = g_themed_icon_new ("folder"); + { + 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); + } if (icon == NULL) icon = g_themed_icon_new ("text-x-generic"); + if (symbolic_icon == NULL) + symbolic_icon = g_themed_icon_new ("text-x-generic-symbolic"); g_file_info_set_icon (info, icon); + g_file_info_set_symbolic_icon (info, symbolic_icon); g_object_unref (icon); + g_object_unref (symbolic_icon); } diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c index 28f49395..abdab9ca 100644 --- a/daemon/gvfsbackendsmb.c +++ b/daemon/gvfsbackendsmb.c @@ -555,6 +555,7 @@ do_mount (GVfsBackend *backend, g_vfs_backend_set_display_name (backend, display_name); g_free (display_name); g_vfs_backend_set_icon_name (backend, "folder-remote"); + g_vfs_backend_set_symbolic_icon_name (backend, "folder-remote-symbolic"); smb_mount_spec = g_mount_spec_new ("smb-share"); g_mount_spec_set (smb_mount_spec, "share", op_backend->share); @@ -1413,7 +1414,6 @@ set_info_from_stat (GVfsBackendSmb *backend, { GFileType file_type; GTimeVal t; - GIcon *icon; char *content_type; char *display_name; @@ -1488,24 +1488,37 @@ set_info_from_stat (GVfsBackendSmb *backend, if (g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE) || g_file_attribute_matcher_matches (matcher, - G_FILE_ATTRIBUTE_STANDARD_ICON)) + G_FILE_ATTRIBUTE_STANDARD_ICON) || + g_file_attribute_matcher_matches (matcher, + G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON)) { - icon = NULL; + GIcon *icon = NULL; + GIcon *symbolic_icon = NULL; + content_type = NULL; if (S_ISDIR(statbuf->st_mode)) { content_type = g_strdup ("inode/directory"); if (basename != NULL && strcmp (basename, "/") == 0) - icon = g_themed_icon_new ("folder-remote"); + { + icon = g_themed_icon_new ("folder-remote"); + symbolic_icon = g_themed_icon_new ("folder-remote-symbolic"); + } else - icon = g_themed_icon_new ("folder"); + { + icon = g_themed_icon_new ("folder"); + symbolic_icon = g_themed_icon_new ("folder-symbolic"); + } } else if (basename != NULL) { content_type = g_content_type_guess (basename, NULL, 0, NULL); if (content_type) - icon = g_content_type_get_icon (content_type); + { + icon = g_content_type_get_icon (content_type); + symbolic_icon = g_content_type_get_symbolic_icon (content_type); + } } if (content_type) @@ -1516,10 +1529,14 @@ set_info_from_stat (GVfsBackendSmb *backend, if (icon == NULL) icon = g_themed_icon_new ("text-x-generic"); - + if (symbolic_icon == NULL) + symbolic_icon = g_themed_icon_new ("text-x-generic-symbolic"); + g_file_info_set_icon (info, icon); g_object_unref (icon); - } + g_file_info_set_symbolic_icon (info, symbolic_icon); + g_object_unref (symbolic_icon); + } /* Don't trust n_link, uid, gid, etc returned from libsmb, its just made up. These are ok though: */ diff --git a/daemon/gvfsbackendsmbbrowse.c b/daemon/gvfsbackendsmbbrowse.c index 44cda230..f216fa62 100644 --- a/daemon/gvfsbackendsmbbrowse.c +++ b/daemon/gvfsbackendsmbbrowse.c @@ -816,6 +816,7 @@ do_mount (GVfsBackend *backend, const char *debug; int debug_val; char *icon; + char *symbolic_icon; GString *uri; gboolean res; GMountSpec *browse_mount_spec; @@ -889,11 +890,13 @@ do_mount (GVfsBackend *backend, op_backend->server = g_strdup (op_backend->mounted_server); icon = NULL; + symbolic_icon = NULL; if (op_backend->server == NULL) { display_name = g_strdup (_("Windows Network")); browse_mount_spec = g_mount_spec_new ("smb-network"); icon = "network-workgroup"; + symbolic_icon = "network-workgroup-symbolic"; } else { @@ -903,6 +906,7 @@ do_mount (GVfsBackend *backend, browse_mount_spec = g_mount_spec_new ("smb-server"); g_mount_spec_set (browse_mount_spec, "server", op_backend->mounted_server); icon = "network-server"; + symbolic_icon = "network-server-symbolic"; } if (op_backend->user) @@ -914,6 +918,8 @@ do_mount (GVfsBackend *backend, g_free (display_name); if (icon) g_vfs_backend_set_icon_name (backend, icon); + if (symbolic_icon) + g_vfs_backend_set_symbolic_icon_name (backend, symbolic_icon); g_vfs_backend_set_user_visible (backend, FALSE); g_vfs_backend_set_mount_spec (backend, browse_mount_spec); g_mount_spec_unref (browse_mount_spec); @@ -1232,6 +1238,7 @@ get_file_info_from_entry (GVfsBackendSmbBrowse *backend, BrowseEntry *entry, GFi GMountSpec *mount_spec; GString *uri; GIcon *icon; + GIcon *symbolic_icon; g_file_info_set_name (info, entry->name); g_file_info_set_display_name (info, entry->name_utf8); @@ -1242,17 +1249,31 @@ get_file_info_from_entry (GVfsBackendSmbBrowse *backend, BrowseEntry *entry, GFi icon = NULL; if (entry->smbc_type == SMBC_WORKGROUP) - icon = g_themed_icon_new ("network-workgroup"); + { + icon = g_themed_icon_new ("network-workgroup"); + symbolic_icon = g_themed_icon_new ("network-workgroup-symbolic"); + } else if (entry->smbc_type == SMBC_SERVER) - icon = g_themed_icon_new ("network-server"); + { + icon = g_themed_icon_new ("network-server"); + symbolic_icon = g_themed_icon_new ("network-server-symbolic"); + } else - icon = g_themed_icon_new ("folder-remote"); + { + icon = g_themed_icon_new ("folder-remote"); + symbolic_icon = g_themed_icon_new ("folder-remote-symbolic"); + } if (icon) { g_file_info_set_icon (info, icon); g_object_unref (icon); } + if (symbolic_icon) + { + g_file_info_set_symbolic_icon (info, symbolic_icon); + g_object_unref (symbolic_icon); + } mount_spec = NULL; if (backend->server) @@ -1369,6 +1390,9 @@ try_query_info (GVfsBackend *backend, icon = g_vfs_backend_get_icon (backend); if (icon != NULL) g_file_info_set_icon (info, icon); + icon = g_vfs_backend_get_symbolic_icon (backend); + if (icon != NULL) + g_file_info_set_symbolic_icon (info, icon); g_vfs_job_succeeded (G_VFS_JOB (job)); return TRUE; diff --git a/daemon/gvfsbackendtrash.c b/daemon/gvfsbackendtrash.c index 60fb3c2a..7e432d96 100644 --- a/daemon/gvfsbackendtrash.c +++ b/daemon/gvfsbackendtrash.c @@ -759,6 +759,10 @@ trash_backend_query_info (GVfsBackend *vfs_backend, g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new (n_items ? "user-trash-full-symbolic" : "user-trash-symbolic"); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); + g_file_info_set_attribute_uint32 (info, "trash::item-count", n_items); g_vfs_job_succeeded (G_VFS_JOB (job)); @@ -862,6 +866,7 @@ g_vfs_backend_trash_init (GVfsBackendTrash *backend) /* translators: This is the name of the backend */ g_vfs_backend_set_display_name (vfs_backend, _("Trash")); g_vfs_backend_set_icon_name (vfs_backend, "user-trash"); + g_vfs_backend_set_symbolic_icon_name (vfs_backend, "user-trash-symbolic"); g_vfs_backend_set_user_visible (vfs_backend, FALSE); mount_spec = g_mount_spec_new ("trash"); diff --git a/daemon/gvfsdaemonutils.c b/daemon/gvfsdaemonutils.c index 7f6e99f5..660873cf 100644 --- a/daemon/gvfsdaemonutils.c +++ b/daemon/gvfsdaemonutils.c @@ -160,6 +160,7 @@ gvfs_file_info_populate_content_types (GFileInfo *info, char *free_mimetype = NULL; const char *mimetype; GIcon *icon; + GIcon *symbolic_icon; g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (basename != NULL); @@ -197,14 +198,20 @@ gvfs_file_info_populate_content_types (GFileInfo *info, 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"); + { + 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); } g_file_info_set_icon (info, icon); g_object_unref (icon); + g_file_info_set_symbolic_icon (info, symbolic_icon); + g_object_unref (symbolic_icon); g_free (free_mimetype); } diff --git a/daemon/gvfsftpdircache.c b/daemon/gvfsftpdircache.c index 16d63227..72137781 100644 --- a/daemon/gvfsftpdircache.c +++ b/daemon/gvfsftpdircache.c @@ -439,6 +439,9 @@ create_root_file_info (GVfsBackendFtp *ftp) icon = g_themed_icon_new ("folder-remote"); g_file_info_set_icon (info, icon); g_object_unref (icon); + icon = g_themed_icon_new ("folder-remote-symbolic"); + g_file_info_set_symbolic_icon (info, icon); + g_object_unref (icon); return info; } |