changeset 2935:6f0eccec978e

applied a patch made by Linus Walleij that fixes the MTP plugin on libmtp >0.3, thanks!
author Cristi Magherusan <majeru@atheme.org>
date Sat, 06 Sep 2008 01:58:02 +0300
parents f1a9098091c7
children a5cb0e914df6
files configure.ac src/mtp_up/mtp.c
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sat Aug 30 18:36:12 2008 +0200
+++ b/configure.ac	Sat Sep 06 01:58:02 2008 +0300
@@ -1397,6 +1397,11 @@
     PKG_CHECK_MODULES(MTP, [libmtp >= 0.1.3], [GENERAL_PLUGINS="$GENERAL_PLUGINS mtp_up" ], [have_mtp_up="no"])
     MTP_LIBS=`pkg-config --libs libmtp`
     MTP_CFLAGS=`pkg-config --cflags libmtp`
+    dnl Check for libmtp 0.3.0+
+    PKG_CHECK_EXISTS(libmtp >= 0.3.0, libmtp_030_pkg=yes, libmtp_030_pkg=no)
+    if test x"$libmtp_030_pkg" = "xyes" ; then
+       AC_DEFINE([HAVE_LIBMTP_030], 1, [indidaces if libmtp 0.3.0 is installed])
+    fi
 else
     have_mtp_up=no
     AC_MSG_RESULT([*** mtp upload plugin disabled by request ***])
--- a/src/mtp_up/mtp.c	Sat Aug 30 18:36:12 2008 +0200
+++ b/src/mtp_up/mtp.c	Sat Sep 06 01:58:02 2008 +0300
@@ -192,12 +192,17 @@
 
     g_free(from_path);
     g_free(tmp);
-    parent_id = mtp_device->default_music_folder;
 
 #if DEBUG
     g_print("Uploading track '%s'\n",filename);
 #endif
+#ifdef HAVE_LIBMTP_030
+    gentrack->parent_id = mtp_device->default_music_folder;
+    ret = LIBMTP_Send_Track_From_File(mtp_device, filename , gentrack, NULL , NULL);
+#else
+    parent_id = mtp_device->default_music_folder;
     ret = LIBMTP_Send_Track_From_File(mtp_device, filename , gentrack, NULL , NULL, parent_id);
+#endif
     LIBMTP_destroy_track_t(gentrack);
     if (ret == 0) 
         g_print("Track upload finished!\n");