[banshee] Mtp: Fix file type in sync with libmtp > 1.1.0 (bgo#688540)



commit de85d6a2fbcf0b88f8b7024aefc5397b69efea09
Author: IBBoard <dev ibboard co uk>
Date:   Sat Jan 5 09:24:28 2013 +0000

    Mtp: Fix file type in sync with libmtp > 1.1.0 (bgo#688540)
    
    libmtp 1.1.0 added a new file type at the beginning of the FileType
    enum. Update the enum to match and made it conditional based on the
    detected libmtp features.
    
    Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>

 build/m4/banshee/dap-mtp.m4       |    9 +++++++++
 src/Libraries/Mtp/Makefile.am     |    4 ++++
 src/Libraries/Mtp/Mtp/FileType.cs |    5 +++++
 3 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/build/m4/banshee/dap-mtp.m4 b/build/m4/banshee/dap-mtp.m4
index 0721b92..264d32b 100644
--- a/build/m4/banshee/dap-mtp.m4
+++ b/build/m4/banshee/dap-mtp.m4
@@ -21,10 +21,19 @@ AC_DEFUN([BANSHEE_CHECK_DAP_MTP],
 				LIBMTP_HAS_MODDATE=yes,
 				LIBMTP_HAS_MODDATE=no,
 				[[#include <libmtp.h>]])
+
+		AC_MSG_CHECKING([whether LIBMTP_FILETYPE_FOLDER enum value is defined])
+		AC_COMPUTE_INT([LIBMTP_HAS_FOLDER], [LIBMTP_FILETYPE_FOLDER], [#include <libmtp.h>], LIBMTP_HAS_FOLDER=no)
+		if test "x$LIBMTP_HAS_FOLDER" = "xno"; then
+			AC_MSG_RESULT([no])
+		else
+			AC_MSG_RESULT([yes])
+		fi
 	fi
 
 	AM_CONDITIONAL(ENABLE_MTP, test "x$enable_libmtp" = "xyes")
 	AM_CONDITIONAL(LIBMTP_TRACK_STRUCT_HAS_MODDATE, [test "$LIBMTP_HAS_MODDATE" = "yes"])
+	AM_CONDITIONAL(LIBMTP_FILETYPE_ENUM_HAS_FOLDER, [test "$LIBMTP_HAS_FOLDER" = "0"])
 	AC_CHECK_SIZEOF(time_t)
 	AM_CONDITIONAL(LIBMTP_SIZEOF_TIME_T_64, [test "x$ac_cv_sizeof_time_t" = "x8"])
 ])
diff --git a/src/Libraries/Mtp/Makefile.am b/src/Libraries/Mtp/Makefile.am
index d52fbc2..d219070 100644
--- a/src/Libraries/Mtp/Makefile.am
+++ b/src/Libraries/Mtp/Makefile.am
@@ -8,6 +8,10 @@ if LIBMTP_TRACK_STRUCT_HAS_MODDATE
 BUILD_DEFINES += "-define:LIBMTP_TRACK_HAS_MODDATE"
 endif
 
+if LIBMTP_FILETYPE_ENUM_HAS_FOLDER
+BUILD_DEFINES += "-define:LIBMTP_FILETYPE_ENUM_HAS_FOLDER"
+endif
+
 if LIBMTP_SIZEOF_TIME_T_64
 BUILD_DEFINES += "-define:LIBMTP_SIZEOF_TIME_T_64"
 endif
diff --git a/src/Libraries/Mtp/Mtp/FileType.cs b/src/Libraries/Mtp/Mtp/FileType.cs
index bfb2dcf..d48baba 100644
--- a/src/Libraries/Mtp/Mtp/FileType.cs
+++ b/src/Libraries/Mtp/Mtp/FileType.cs
@@ -33,6 +33,9 @@ namespace Mtp
 {
     public enum FileType
     {
+#if LIBMTP_FILETYPE_ENUM_HAS_FOLDER
+        FOLDER,
+#endif
         WAV,
         MP3,
         WMA,
@@ -74,6 +77,8 @@ namespace Mtp
         MHT,
         JP2,
         JPX,
+        ALBUM,
+        PLAYLIST,
         UNKNOWN
     }
 }



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