[gvfs/mtp-backend: 25/64] MTP: Add configure check for LIBMTP_GetThumbnail.



commit f0e6adb2341608ed2363f88dcde58e474f7c5622
Author: Philip Langdale <philipl cloudera com>
Date:   Thu Aug 23 12:58:14 2012 -0700

    MTP: Add configure check for LIBMTP_GetThumbnail.

 configure.ac            |    8 ++++++++
 daemon/gvfsbackendmtp.c |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 54ea0bd..2a0504a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -507,6 +507,14 @@ if test "x$enable_libmtp" != "xno" -a "x$msg_gudev" = "xyes"; then
   if test "x$msg_libmtp" = "xyes"; then
     PKG_CHECK_MODULES(LIBMTP, libmtp >= 1.1.0)
     AC_DEFINE(HAVE_LIBMTP, 1, [Define to 1 if libmtp is available])
+
+    save_libs="$LIBS"
+    LIBS="$LIBMTP_LIBS"
+    AC_CHECK_LIB(mtp, LIBMTP_Get_Thumbnail, have_libmtp_get_thumbnail=yes)
+    if test "x$have_libmtp_get_thumbnail" = "xyes"; then
+      AC_DEFINE(HAVE_LIBMTP_GET_THUMBNAIL, 1, [Define to 1 if LIBMTP_Get_Thumbnail is available])
+    fi
+    LIBS="$save_libs"
   fi
 fi
 
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c
index f43c948..485b3b3 100644
--- a/daemon/gvfsbackendmtp.c
+++ b/daemon/gvfsbackendmtp.c
@@ -547,6 +547,7 @@ get_file_info(GVfsBackend *backend, LIBMTP_mtpdevice_t *device, GFileInfo *info,
   }
 
 
+#if HAVE_LIBMTP_GET_THUMBNAIL
   if (LIBMTP_FILETYPE_IS_IMAGE(file->filetype) ||
       LIBMTP_FILETYPE_IS_VIDEO(file->filetype) ||
       LIBMTP_FILETYPE_IS_AUDIOVIDEO(file->filetype)) {
@@ -566,6 +567,7 @@ get_file_info(GVfsBackend *backend, LIBMTP_mtpdevice_t *device, GFileInfo *info,
     g_object_unref (icon);
     g_free (icon_id);
   }
+#endif
 
   g_file_info_set_size (info, file->filesize);
 
@@ -1119,6 +1121,7 @@ do_set_display_name (GVfsBackend *backend,
 }
 
 
+#if HAVE_LIBMTP_GET_THUMBNAIL
 static void
 do_open_icon_for_read (GVfsBackend *backend,
                        GVfsJobOpenIconForRead *job,
@@ -1205,6 +1208,7 @@ do_close_read (GVfsBackend *backend,
   g_byte_array_unref(handle);
   g_vfs_job_succeeded (G_VFS_JOB (job));
 }
+#endif /* HAVE_LIBMTP_GET_THUMBNAIL */
 
 
 /************************************************
@@ -1234,7 +1238,9 @@ g_vfs_backend_mtp_class_init (GVfsBackendMtpClass *klass)
   backend_class->set_display_name = do_set_display_name;
   backend_class->create_dir_monitor = do_create_dir_monitor;
   backend_class->create_file_monitor = do_create_file_monitor;
+#if HAVE_LIBMTP_GET_THUMBNAIL
   backend_class->open_icon_for_read = do_open_icon_for_read;
   backend_class->try_read = try_read;
   backend_class->close_read = do_close_read;
+#endif
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]