[banshee] Mtp: Remove LIBMTP8 conditional compilation



commit 1efe7c2edc4c63ba95823fd3c1a102e4a4f6352f
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date:   Sun Jan 8 15:03:50 2012 +0100

    Mtp: Remove LIBMTP8 conditional compilation
    
    We already require libmtp >= 0.3.0, which provides libmtp.so.8, so we
    don't need to do any #ifdefs for that anymore.
    
    This also fixes bgo#667478, as the configure test was broken for
    libmtp.so.9 provided by libmtp 1.1.

 build/m4/banshee/dap-mtp.m4       |    3 ---
 src/Libraries/Mtp/Makefile.am     |    4 ----
 src/Libraries/Mtp/Mtp/Album.cs    |   19 -------------------
 src/Libraries/Mtp/Mtp/File.cs     |    3 +--
 src/Libraries/Mtp/Mtp/Folder.cs   |   12 +-----------
 src/Libraries/Mtp/Mtp/Playlist.cs |   11 -----------
 src/Libraries/Mtp/Mtp/Track.cs    |   15 ---------------
 7 files changed, 2 insertions(+), 65 deletions(-)
---
diff --git a/build/m4/banshee/dap-mtp.m4 b/build/m4/banshee/dap-mtp.m4
index 5956602..d2a8eee 100644
--- a/build/m4/banshee/dap-mtp.m4
+++ b/build/m4/banshee/dap-mtp.m4
@@ -15,8 +15,6 @@ AC_DEFUN([BANSHEE_CHECK_DAP_MTP],
 	fi
 
 	if test "x$enable_libmtp" = "xyes"; then
-		LIBMTP_SO_MAP=$(basename $(find $($PKG_CONFIG --variable=libdir libmtp) -maxdepth 1 -regex '.*libmtp\.so\.[[0-9]][[0-9]]*$' | sort | tail -n 1))
-		AC_SUBST(LIBMTP_SO_MAP)
 		AC_CHECK_MEMBER([struct LIBMTP_track_struct.modificationdate],
 				LIBMTP_HAS_MODDATE=yes,
 				LIBMTP_HAS_MODDATE=no,
@@ -24,7 +22,6 @@ AC_DEFUN([BANSHEE_CHECK_DAP_MTP],
 	fi
 
 	AM_CONDITIONAL(ENABLE_MTP, test "x$enable_libmtp" = "xyes")
-	AM_CONDITIONAL(LIBMTP_EIGHT, test "x$LIBMTP_SO_MAP" = "xlibmtp.so.8")
 	AM_CONDITIONAL(LIBMTP_TRACK_STRUCT_HAS_MODDATE, [test "$LIBMTP_HAS_MODDATE" = "yes"])
 	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 6a70d13..d357499 100644
--- a/src/Libraries/Mtp/Makefile.am
+++ b/src/Libraries/Mtp/Makefile.am
@@ -2,11 +2,7 @@ ASSEMBLY = Mtp
 TARGET = library
 LINK = $(REF_MTP)
 
-if LIBMTP_EIGHT
-BUILD_DEFINES = "-define:LIBMTP8"
-else
 BUILD_DEFINES = ""
-endif
 
 if LIBMTP_TRACK_STRUCT_HAS_MODDATE
 BUILD_DEFINES += "-define:LIBMTP_TRACK_HAS_MODDATE"
diff --git a/src/Libraries/Mtp/Mtp/Album.cs b/src/Libraries/Mtp/Mtp/Album.cs
index 090ee4d..0f3db93 100644
--- a/src/Libraries/Mtp/Mtp/Album.cs
+++ b/src/Libraries/Mtp/Mtp/Album.cs
@@ -75,16 +75,10 @@ namespace Mtp
 
         public string Composer {
             get {
-#if LIBMTP8
                 return album.composer;
-#else
-                return null;
-#endif
             }
             set {
-#if LIBMTP8
                 album.composer = value;
-#endif
             }
         }
 
@@ -145,11 +139,7 @@ namespace Mtp
 
         protected override int Create ()
         {
-#if LIBMTP8
             return LIBMTP_Create_New_Album (Device.Handle, ref album);
-#else
-            return LIBMTP_Create_New_Album (Device.Handle, ref album, 0);
-#endif
         }
 
         protected override int Update ()
@@ -194,13 +184,8 @@ namespace Mtp
         [DllImport("libmtp.dll")]
         static extern IntPtr LIBMTP_Get_Album (MtpDeviceHandle handle, uint albumId); // LIBMTP_album_t*
 
-#if LIBMTP8
         [DllImport("libmtp.dll")]
         internal static extern int LIBMTP_Create_New_Album (MtpDeviceHandle handle, ref AlbumStruct album);
-#else
-        [DllImport("libmtp.dll")]
-        internal static extern int LIBMTP_Create_New_Album (MtpDeviceHandle handle, ref AlbumStruct album, uint parentId);
-#endif
 
         [DllImport("libmtp.dll")]
         static extern int LIBMTP_Update_Album (MtpDeviceHandle handle, ref AlbumStruct album);
@@ -210,10 +195,8 @@ namespace Mtp
     internal struct AlbumStruct
     {
         public uint album_id;
-#if LIBMTP8
         public uint parent_id;
         public uint storage_id;
-#endif
 
         [MarshalAs(UnmanagedType.LPStr)]
         public string name;
@@ -221,10 +204,8 @@ namespace Mtp
         [MarshalAs(UnmanagedType.LPStr)]
         public string artist;
 
-#if LIBMTP8
         [MarshalAs(UnmanagedType.LPStr)]
         public string composer;
-#endif
 
         [MarshalAs(UnmanagedType.LPStr)]
         public string genre;
diff --git a/src/Libraries/Mtp/Mtp/File.cs b/src/Libraries/Mtp/Mtp/File.cs
index 5af5806..e2adeff 100644
--- a/src/Libraries/Mtp/Mtp/File.cs
+++ b/src/Libraries/Mtp/Mtp/File.cs
@@ -67,9 +67,8 @@ namespace Mtp
 	{
 		public int item_id;
 		public int parent_id;
-#ifdef LIBMTP8
 		public int storage_id;
-#endif
+
 		[MarshalAs(UnmanagedType.LPStr)]public string filename;
 		public long filesize;
 		public FileType filetype;
diff --git a/src/Libraries/Mtp/Mtp/Folder.cs b/src/Libraries/Mtp/Mtp/Folder.cs
index 5fc7dce..80eabbd 100644
--- a/src/Libraries/Mtp/Mtp/Folder.cs
+++ b/src/Libraries/Mtp/Mtp/Folder.cs
@@ -134,11 +134,7 @@ namespace Mtp
 
         internal static uint CreateFolder (MtpDeviceHandle handle, string name, uint parentId)
         {
-#if LIBMTP8
             uint result = LIBMTP_Create_Folder (handle, name, parentId, 0);
-#else
-            uint result = LIBMTP_Create_Folder (handle, name, parentId);
-#endif
             if (result == 0)
             {
                 LibMtpException.CheckErrorStack(handle);
@@ -176,13 +172,8 @@ namespace Mtp
         [DllImport("libmtp.dll")]
         private static extern IntPtr LIBMTP_Find_Folder (IntPtr folderList, uint folderId); // LIBMTP_folder_t*
 
-#if LIBMTP8
         [DllImport("libmtp.dll")]
         private static extern uint LIBMTP_Create_Folder (MtpDeviceHandle handle, string name, uint parentId, uint storageId);
-#else
-        [DllImport("libmtp.dll")]
-        private static extern uint LIBMTP_Create_Folder (MtpDeviceHandle handle, string name, uint parentId);
-#endif
     }
 
     [StructLayout(LayoutKind.Sequential)]
@@ -190,9 +181,8 @@ namespace Mtp
     {
         public uint folder_id;
         public uint parent_id;
-#if LIBMTP8
         public uint storage_id;
-#endif
+
         [MarshalAs(UnmanagedType.LPStr)] public string name;
         public IntPtr sibling; // LIBMTP_folder_t*
         public IntPtr child;   // LIBMTP_folder_t*
diff --git a/src/Libraries/Mtp/Mtp/Playlist.cs b/src/Libraries/Mtp/Mtp/Playlist.cs
index c133c86..554805c 100644
--- a/src/Libraries/Mtp/Mtp/Playlist.cs
+++ b/src/Libraries/Mtp/Mtp/Playlist.cs
@@ -84,13 +84,8 @@ namespace Mtp
 
         protected override int Create ()
         {
-            // TODO replace 0 w/ the folder id of the playlists folder?
-#if LIBMTP8
             playlist.parent_id = Device.PlaylistFolder.FolderId;
             return LIBMTP_Create_New_Playlist (Device.Handle, ref playlist);
-#else
-            return LIBMTP_Create_New_Playlist (Device.Handle, ref playlist, Device.PlaylistFolder.FolderId);
-#endif
         }
 
         protected override int Update ()
@@ -112,11 +107,7 @@ namespace Mtp
         private static extern IntPtr LIBMTP_Get_Playlist_List (MtpDeviceHandle handle); // LIBMTP_playlist_t*
 
         [DllImport("libmtp.dll")]
-#if LIBMTP8
         private static extern int LIBMTP_Create_New_Playlist (MtpDeviceHandle handle, ref PlaylistStruct metadata);
-#else
-        private static extern int LIBMTP_Create_New_Playlist (MtpDeviceHandle handle, ref PlaylistStruct metadata, uint parentHandle);
-#endif
 
         [DllImport("libmtp.dll")]
         private static extern int LIBMTP_Update_Playlist (MtpDeviceHandle handle, ref PlaylistStruct playlist);
@@ -126,10 +117,8 @@ namespace Mtp
     internal struct PlaylistStruct
     {
         public uint playlist_id;
-#if LIBMTP8
         public uint parent_id;
         public uint storage_id;
-#endif
 
         [MarshalAs(UnmanagedType.LPStr)]
         public string Name;
diff --git a/src/Libraries/Mtp/Mtp/Track.cs b/src/Libraries/Mtp/Mtp/Track.cs
index 452ecf8..22e15d3 100644
--- a/src/Libraries/Mtp/Mtp/Track.cs
+++ b/src/Libraries/Mtp/Mtp/Track.cs
@@ -134,12 +134,10 @@ namespace Mtp
             set { trackStruct.usecount = value; }
         }
 
-#if LIBMTP8
         public string Composer {
             get { return trackStruct.composer; }
             set { trackStruct.composer = value; }
         }
-#endif
 
         public Track (string filename, ulong filesize) : this (new TrackStruct (), null)
         {
@@ -216,11 +214,7 @@ namespace Mtp
 
         internal static void SendTrack (MtpDeviceHandle handle, string path, ref TrackStruct metadata, ProgressFunction callback, IntPtr data)
         {
-#if LIBMTP8
             if (LIBMTP_Send_Track_From_File (handle, path, ref metadata, callback, data) != 0)
-#else
-            if (LIBMTP_Send_Track_From_File (handle, path, ref metadata, callback, data, metadata.parent_id) != 0)
-#endif
             {
                 LibMtpException.CheckErrorStack (handle);
                 throw new LibMtpException (ErrorCode.General, "Could not upload the track");
@@ -251,13 +245,8 @@ namespace Mtp
         [DllImport("libmtp.dll")]
         private static extern int LIBMTP_Get_Track_To_File (MtpDeviceHandle handle, uint trackId, string path, ProgressFunction callback, IntPtr data);
 
-#if LIBMTP8
         [DllImport("libmtp.dll")]
         private static extern int LIBMTP_Send_Track_From_File (MtpDeviceHandle handle, string path, ref TrackStruct track, ProgressFunction callback, IntPtr data);
-#else
-        [DllImport("libmtp.dll")]
-        private static extern int LIBMTP_Send_Track_From_File (MtpDeviceHandle handle, string path, ref TrackStruct track, ProgressFunction callback, IntPtr data, uint parentHandle);
-#endif
 
         [DllImport("libmtp.dll")]
         private static extern int LIBMTP_Update_Track_Metadata (MtpDeviceHandle handle, ref TrackStruct metadata);
@@ -274,15 +263,11 @@ namespace Mtp
     {
         public uint item_id;
         public uint parent_id;
-#if LIBMTP8
         public uint storage_id;
-#endif
 
         [MarshalAs(UnmanagedType.LPStr)] public string title;
         [MarshalAs(UnmanagedType.LPStr)] public string artist;
-#if LIBMTP8
         [MarshalAs(UnmanagedType.LPStr)] public string composer;
-#endif
         [MarshalAs(UnmanagedType.LPStr)] public string genre;
         [MarshalAs(UnmanagedType.LPStr)] public string album;
         [MarshalAs(UnmanagedType.LPStr)] public string date;



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