[gvfs] MTP: Switch to version based checks for new libmtp features.



commit 5c61c7092d025242c74054f7eacd340d30e0b332
Author: Philip Langdale <philipl overt org>
Date:   Sat Mar 16 22:00:37 2013 -0700

    MTP: Switch to version based checks for new libmtp features.

 configure.ac            |   16 ++++------------
 daemon/gvfsbackendmtp.c |   10 +++++-----
 2 files changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c8f5579..0f5ab9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -544,18 +544,10 @@ if test "x$enable_libmtp" != "xno" -a "x$msg_gudev" = "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
-
-    AC_CHECK_LIB(mtp, LIBMTP_Read_Event, have_libmtp_read_event=yes)
-    if test "x$have_libmtp_read_event" = "xyes"; then
-      AC_DEFINE(HAVE_LIBMTP_READ_EVENT, 1, [Define to 1 if LIBMTP_Read_Event is available])
-    fi
-    LIBS="$save_libs"
+    PKG_CHECK_MODULES(LIBMTP_1_1_5, libmtp >= 1.1.5,
+        AC_DEFINE(HAVE_LIBMTP_1_1_5, 1, [Define to 1 if libmtp 1.1.5 is available]),
+        []
+    )
   fi
 fi
 
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c
index 4c1cdc0..8daa2c2 100644
--- a/daemon/gvfsbackendmtp.c
+++ b/daemon/gvfsbackendmtp.c
@@ -329,7 +329,7 @@ on_uevent (GUdevClient *client, gchar *action, GUdevDevice *device, gpointer use
   DEBUG ("(I) on_uevent done.");
 }
 
-#if HAVE_LIBMTP_READ_EVENT
+#if HAVE_LIBMTP_1_1_5
 static gpointer
 check_event (gpointer user_data)
 {
@@ -482,7 +482,7 @@ do_mount (GVfsBackend *backend,
     op_backend->hb_id =
       g_timeout_add_seconds (900, (GSourceFunc)mtp_heartbeat, op_backend);
 
-#if HAVE_LIBMTP_READ_EVENT
+#if HAVE_LIBMTP_1_1_5
     GWeakRef *event_ref = g_new0 (GWeakRef, 1);
     g_weak_ref_init (event_ref, backend);
     GThread *event_thread = g_thread_new ("events", check_event, event_ref);
@@ -773,7 +773,7 @@ get_file_info (GVfsBackend *backend,
   }
 
 
-#if HAVE_LIBMTP_GET_THUMBNAIL
+#if HAVE_LIBMTP_1_1_5
   if (LIBMTP_FILETYPE_IS_IMAGE (file->filetype) ||
       LIBMTP_FILETYPE_IS_VIDEO (file->filetype) ||
       LIBMTP_FILETYPE_IS_AUDIOVIDEO (file->filetype)) {
@@ -1435,7 +1435,7 @@ do_set_display_name (GVfsBackend *backend,
 }
 
 
-#if HAVE_LIBMTP_GET_THUMBNAIL
+#if HAVE_LIBMTP_1_1_5
 static void
 do_open_icon_for_read (GVfsBackend *backend,
                        GVfsJobOpenIconForRead *job,
@@ -1558,7 +1558,7 @@ 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
+#if HAVE_LIBMTP_1_1_5
   backend_class->open_icon_for_read = do_open_icon_for_read;
   backend_class->try_read = try_read;
   backend_class->close_read = do_close_read;


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