summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2014-09-09 19:03:27 +0100
committerRoss Lagerwall <rosslagerwall@gmail.com>2014-10-13 22:13:29 +0100
commit60f96c8bd48e25ecdec5b9d8d3a3f86bfb119d3e (patch)
tree636e01d5c0d99688636dc768808d44f55d5d944f
parentfeb570c230183052076aad6ae33ca331b721ecad (diff)
downloadgvfs-60f96c8bd48e25ecdec5b9d8d3a3f86bfb119d3e.tar.gz
gphoto2: Improve root dir name and icon handling
Set the name of the root dir and the icon to match the way that the volume monitor sets them. This is visible as the folder title when the root dir of the device is open in Nautilus (or using gvfs-info). https://bugzilla.gnome.org/show_bug.cgi?id=736285
-rw-r--r--daemon/Makefile.am3
-rw-r--r--daemon/gvfsbackendgphoto2.c34
2 files changed, 6 insertions, 31 deletions
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 1ef61398..a6a9ae1e 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -478,7 +478,8 @@ gvfsd_gphoto2_CPPFLAGS += $(HAL_CFLAGS)
endif
if USE_GUDEV
-gvfsd_gphoto2_LDADD = $(libraries) $(GPHOTO2_LIBS) $(GUDEV_LIBS)
+gvfsd_gphoto2_LDADD = $(libraries) $(GPHOTO2_LIBS) $(GUDEV_LIBS) \
+ $(top_builddir)/common/libgvfscommon-gphoto2.la
else
gvfsd_gphoto2_LDADD = $(libraries) $(GPHOTO2_LIBS) $(HAL_LIBS)
endif
diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c
index 645ff94c..39c4f77b 100644
--- a/daemon/gvfsbackendgphoto2.c
+++ b/daemon/gvfsbackendgphoto2.c
@@ -62,6 +62,7 @@
#include "gvfsmonitor.h"
#include "gvfsjobseekwrite.h"
#include "gvfsicon.h"
+#include "gvfsgphoto2utils.h"
/* showing debug traces */
#if 1
@@ -727,19 +728,8 @@ compute_display_name (GVfsBackendGphoto2 *gphoto2_backend)
char *result = NULL;
#ifdef HAVE_GUDEV
- const char *s;
-
- /* the real "nice" and user-visible name is computed in the monitor; just try
- * using the product name here */
if (gphoto2_backend->udev_device != NULL)
- {
- s = g_udev_device_get_sysfs_attr (gphoto2_backend->udev_device, "product");
- if (s == NULL)
- s = g_udev_device_get_property (gphoto2_backend->udev_device, "ID_MODEL");
-
- if (s != NULL)
- result = g_strdup (s);
- }
+ result = g_vfs_get_volume_name (gphoto2_backend->udev_device, "ID_GPHOTO2");
if (result == NULL )
{
/* Translator: %s represents the device, e.g. usb:001,042 */
@@ -791,24 +781,8 @@ setup_for_device (GVfsBackendGphoto2 *gphoto2_backend)
{
DEBUG ("-> sysfs path %s, subsys %s, name %s\n", g_udev_device_get_sysfs_path (gphoto2_backend->udev_device), g_udev_device_get_subsystem (gphoto2_backend->udev_device), g_udev_device_get_name (gphoto2_backend->udev_device));
- /* determine icon name */
- 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");
- }
+ gphoto2_backend->icon_name = g_vfs_get_volume_icon (gphoto2_backend->udev_device);
+ gphoto2_backend->symbolic_icon_name = g_vfs_get_volume_symbolic_icon (gphoto2_backend->udev_device);
}
else
DEBUG ("-> did not find matching udev device\n");