summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2017-03-17 09:35:34 +0100
committerOndrej Holy <oholy@redhat.com>2017-03-23 11:24:16 +0100
commitf2f39758482a71eff4da399f47ae702ef1fa2857 (patch)
tree02975ba3e97bb296d3bc5971ed366228e4e4d3a2 /common
parentfc0b1aeb035b0552918cc5f3ad1beb30f3062ec1 (diff)
downloadgvfs-f2f39758482a71eff4da399f47ae702ef1fa2857.tar.gz
gphoto2: Fix x-content-types setup
Commit 60f96c8 broke x-content-types setup, because is_media_player is always FALSE. Let's introduce g_vfs_backend_set_x_content_types helper and set x-content-types properly. This issue was revealed by coverity scan.
Diffstat (limited to 'common')
-rw-r--r--common/gvfsgphoto2utils.c12
-rw-r--r--common/gvfsgphoto2utils.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/common/gvfsgphoto2utils.c b/common/gvfsgphoto2utils.c
index 8608e515..3b882e7c 100644
--- a/common/gvfsgphoto2utils.c
+++ b/common/gvfsgphoto2utils.c
@@ -140,3 +140,15 @@ g_vfs_get_volume_symbolic_icon (GUdevDevice *device)
else
return g_strdup ("camera-photo-symbolic");
}
+
+char **
+g_vfs_get_x_content_types (GUdevDevice *device)
+{
+ char *camera_x_content_types[] = {"x-content/image-dcf", NULL};
+ char *media_player_x_content_types[] = {"x-content/audio-player", NULL};
+
+ if (g_udev_device_has_property (device, "ID_MEDIA_PLAYER"))
+ return g_strdupv (media_player_x_content_types);
+ else
+ return g_strdupv (camera_x_content_types);
+}
diff --git a/common/gvfsgphoto2utils.h b/common/gvfsgphoto2utils.h
index d8f9d405..ab0ff1cc 100644
--- a/common/gvfsgphoto2utils.h
+++ b/common/gvfsgphoto2utils.h
@@ -26,5 +26,6 @@
char * g_vfs_get_volume_name (GUdevDevice *device, const char *device_id);
char * g_vfs_get_volume_icon (GUdevDevice *device);
char * g_vfs_get_volume_symbolic_icon (GUdevDevice *device);
+char **g_vfs_get_x_content_types (GUdevDevice *device);
#endif