
diff -u -r1.246 configure.ac
--- configure.ac	11 Jun 2006 11:12:24 -0000	1.246
+++ configure.ac	17 Jun 2006 17:41:59 -0000
@@ -121,6 +121,26 @@
 fi			  
 AM_CONDITIONAL(USE_IPOD, test x"$use_ipod" = xyes)
 
+dnl mtp support
+
+AC_ARG_WITH(mtp,
+            AC_HELP_STRING([--with-mtp],
+			   [Enable MTP support]),,
+	      with_mtp=auto)
+if test "x$with_mtp" != "xno"; then
+
+	PKG_CHECK_MODULES(MTP, libmtp, have_libmtp=yes, have_libmtp=no)
+	if test "x$have_libmtp" = "xno" -a "x$with_mtp" = "xyes"; then
+	  AC_MSG_ERROR([MTP explicitly requested but libmtp couldn't be found])
+	fi
+	if test "x$have_libmtp" = "xyes"; then
+	  use_mtp=yes
+	  AC_SUBST(MTP_CFLAGS)
+	  AC_SUBST(MTP_LIBS)
+	fi
+fi			  
+AM_CONDITIONAL(USE_MTP, test x"$use_mtp" = xyes)
+
 dnl Database
 AC_ARG_WITH(database,
               AC_HELP_STRING([--with-database=tree|libgda],
@@ -917,6 +937,7 @@
 plugins/sample/Makefile
 plugins/audioscrobbler/Makefile
 plugins/ipod/Makefile
+plugins/mtp/Makefile
 plugins/lirc/Makefile
 plugins/lyrics/Makefile
 plugins/sample-python/Makefile
@@ -988,6 +1009,11 @@
 	AC_MSG_NOTICE([** iPod integration enabled])
 else
 	AC_MSG_NOTICE([   iPod integration disabled])
+fi
+if test x"$use_mtp" = xyes; then
+	AC_MSG_NOTICE([** MTP integration enabled])
+else
+	AC_MSG_NOTICE([   MTP integration disabled])
 fi
 if test x"$enable_daap" = xyes; then
 	AC_MSG_NOTICE([** DAAP (music sharing) support is enabled])

diff -u -r1.8 Makefile.am
--- plugins/Makefile.am	25 May 2006 07:20:47 -0000	1.8
+++ plugins/Makefile.am	17 Jun 2006 17:41:59 -0000
@@ -24,6 +24,10 @@
 SUBDIRS += ipod
 endif
 
+if USE_MTP
+SUBDIRS += mtp
+endif
+
 noinst_LTLIBRARIES = librbplugins.la
 
 librbplugins_la_SOURCES =				\
--- /dev/null	2006-05-22 16:25:23.000000000 +0200
+++ plugins/mtp/Makefile.in	2006-06-15 18:37:48.000000000 +0200
@@ -0,0 +1,723 @@
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AVAHI_CFLAGS = @AVAHI_CFLAGS@
+AVAHI_LIBS = @AVAHI_LIBS@
+AWK = @AWK@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CHECK_CFLAGS = @CHECK_CFLAGS@
+CHECK_LIBS = @CHECK_LIBS@
+CONFIG_STATUS_DEPENDENCIES = @CONFIG_STATUS_DEPENDENCIES@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIR = @DATADIR@
+DATADIRNAME = @DATADIRNAME@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_GLIB_BIN = @DBUS_GLIB_BIN@
+DBUS_LIBS = @DBUS_LIBS@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOC_USER_FORMATS = @DOC_USER_FORMATS@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@
+ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@
+ENABLE_PYTHON_FALSE = @ENABLE_PYTHON_FALSE@
+ENABLE_PYTHON_TRUE = @ENABLE_PYTHON_TRUE@
+ENABLE_SK_FALSE = @ENABLE_SK_FALSE@
+ENABLE_SK_TRUE = @ENABLE_SK_TRUE@
+ENABLE_TRACK_TRANSFER_FALSE = @ENABLE_TRACK_TRANSFER_FALSE@
+ENABLE_TRACK_TRANSFER_TRUE = @ENABLE_TRACK_TRANSFER_TRUE@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GCONFTOOL = @GCONFTOOL@
+GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@
+GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@
+GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@
+GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@
+GDA_CFLAGS = @GDA_CFLAGS@
+GDA_LIBS = @GDA_LIBS@
+GDU_MODULE_VERSION_CHECK_CFLAGS = @GDU_MODULE_VERSION_CHECK_CFLAGS@
+GDU_MODULE_VERSION_CHECK_LIBS = @GDU_MODULE_VERSION_CHECK_LIBS@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GNOME_MEDIA_PROFILES_CFLAGS = @GNOME_MEDIA_PROFILES_CFLAGS@
+GNOME_MEDIA_PROFILES_LIBS = @GNOME_MEDIA_PROFILES_LIBS@
+GSTREAMER_0_10_CFLAGS = @GSTREAMER_0_10_CFLAGS@
+GSTREAMER_0_10_LIBS = @GSTREAMER_0_10_LIBS@
+GSTREAMER_0_8_CFLAGS = @GSTREAMER_0_8_CFLAGS@
+GSTREAMER_0_8_LIBS = @GSTREAMER_0_8_LIBS@
+GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@
+GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@
+HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@
+HAVE_HAL_0_2_FALSE = @HAVE_HAL_0_2_FALSE@
+HAVE_HAL_0_2_TRUE = @HAVE_HAL_0_2_TRUE@
+HAVE_HAL_0_5_FALSE = @HAVE_HAL_0_5_FALSE@
+HAVE_HAL_0_5_TRUE = @HAVE_HAL_0_5_TRUE@
+HAVE_HAL_FALSE = @HAVE_HAL_FALSE@
+HAVE_HAL_TRUE = @HAVE_HAL_TRUE@
+HAVE_LINUX_CDROM_FALSE = @HAVE_LINUX_CDROM_FALSE@
+HAVE_LINUX_CDROM_TRUE = @HAVE_LINUX_CDROM_TRUE@
+HAVE_MUSICBRAINZ_FALSE = @HAVE_MUSICBRAINZ_FALSE@
+HAVE_MUSICBRAINZ_TRUE = @HAVE_MUSICBRAINZ_TRUE@
+HELP_DIR = @HELP_DIR@
+HOWL_CFLAGS = @HOWL_CFLAGS@
+HOWL_LIBS = @HOWL_LIBS@
+HTML_DIR = @HTML_DIR@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@
+INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@
+INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_ICONV = @INTLTOOL_ICONV@
+INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@
+INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_MSGFMT = @INTLTOOL_MSGFMT@
+INTLTOOL_MSGMERGE = @INTLTOOL_MSGMERGE@
+INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@
+INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@
+INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@
+INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@
+INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@
+INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@
+INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@
+INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@
+INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@
+INTLTOOL_XGETTEXT = @INTLTOOL_XGETTEXT@
+INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@
+INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@
+IPOD_CFLAGS = @IPOD_CFLAGS@
+IPOD_LIBS = @IPOD_LIBS@
+IPOD_PHONE_CFLAGS = @IPOD_PHONE_CFLAGS@
+IPOD_PHONE_LIBS = @IPOD_PHONE_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBNAUTILUS_BURN_CFLAGS = @LIBNAUTILUS_BURN_CFLAGS@
+LIBNAUTILUS_BURN_LIBS = @LIBNAUTILUS_BURN_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSEXY_CFLAGS = @LIBSEXY_CFLAGS@
+LIBSEXY_LIBS = @LIBSEXY_LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MDNS_CFLAGS = @MDNS_CFLAGS@
+MDNS_LIBS = @MDNS_LIBS@
+MKDTEMP_MISSING_FALSE = @MKDTEMP_MISSING_FALSE@
+MKDTEMP_MISSING_TRUE = @MKDTEMP_MISSING_TRUE@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MTP_CFLAGS = @MTP_CFLAGS@
+MTP_LIBS = @MTP_LIBS@
+MUSICBRAINZ_CFLAGS = @MUSICBRAINZ_CFLAGS@
+MUSICBRAINZ_LIBS = @MUSICBRAINZ_LIBS@
+NOTIFY_CFLAGS = @NOTIFY_CFLAGS@
+NOTIFY_LIBS = @NOTIFY_LIBS@
+NO_STRICT_ALIASING_CFLAGS = @NO_STRICT_ALIASING_CFLAGS@
+OBJEXT = @OBJEXT@
+OMF_DIR = @OMF_DIR@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGINDIR = @PLUGINDIR@
+PLUGIN_LIBTOOL_FLAGS = @PLUGIN_LIBTOOL_FLAGS@
+POFILES = @POFILES@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+PYGTK_CFLAGS = @PYGTK_CFLAGS@
+PYGTK_CODEGEN = @PYGTK_CODEGEN@
+PYGTK_DEFSDIR = @PYGTK_DEFSDIR@
+PYGTK_H2DEF = @PYGTK_H2DEF@
+PYGTK_LIBS = @PYGTK_LIBS@
+PYTHON = @PYTHON@
+PYTHON_CFLAGS = @PYTHON_CFLAGS@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
+PYTHON_LIBS = @PYTHON_LIBS@
+PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RB_CLIENT_CFLAGS = @RB_CLIENT_CFLAGS@
+RB_CLIENT_LIBS = @RB_CLIENT_LIBS@
+RHYTHMBOX_CFLAGS = @RHYTHMBOX_CFLAGS@
+RHYTHMBOX_LIBS = @RHYTHMBOX_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOUNDSYSTEM_DEPS = @SOUNDSYSTEM_DEPS@
+SOUP_CFLAGS = @SOUP_CFLAGS@
+SOUP_LIBS = @SOUP_LIBS@
+STRIP = @STRIP@
+TOTEM_PLPARSER_CFLAGS = @TOTEM_PLPARSER_CFLAGS@
+TOTEM_PLPARSER_LIBS = @TOTEM_PLPARSER_LIBS@
+USE_AVAHI_FALSE = @USE_AVAHI_FALSE@
+USE_AVAHI_TRUE = @USE_AVAHI_TRUE@
+USE_DAAP_FALSE = @USE_DAAP_FALSE@
+USE_DAAP_TRUE = @USE_DAAP_TRUE@
+USE_GDADB_FALSE = @USE_GDADB_FALSE@
+USE_GDADB_TRUE = @USE_GDADB_TRUE@
+USE_GSTREAMER_0_10_FALSE = @USE_GSTREAMER_0_10_FALSE@
+USE_GSTREAMER_0_10_TRUE = @USE_GSTREAMER_0_10_TRUE@
+USE_GSTREAMER_0_8_FALSE = @USE_GSTREAMER_0_8_FALSE@
+USE_GSTREAMER_0_8_TRUE = @USE_GSTREAMER_0_8_TRUE@
+USE_HOWL_FALSE = @USE_HOWL_FALSE@
+USE_HOWL_TRUE = @USE_HOWL_TRUE@
+USE_IPOD_FALSE = @USE_IPOD_FALSE@
+USE_IPOD_TRUE = @USE_IPOD_TRUE@
+USE_LIBSOUP_FALSE = @USE_LIBSOUP_FALSE@
+USE_LIBSOUP_TRUE = @USE_LIBSOUP_TRUE@
+USE_MTP_FALSE = @USE_MTP_FALSE@
+USE_MTP_TRUE = @USE_MTP_TRUE@
+USE_NLS = @USE_NLS@
+USE_NOTIFY_FALSE = @USE_NOTIFY_FALSE@
+USE_NOTIFY_TRUE = @USE_NOTIFY_TRUE@
+USE_TREEDB_FALSE = @USE_TREEDB_FALSE@
+USE_TREEDB_TRUE = @USE_TREEDB_TRUE@
+VERSION = @VERSION@
+WITH_AUDIOSCROBBLER_FALSE = @WITH_AUDIOSCROBBLER_FALSE@
+WITH_AUDIOSCROBBLER_TRUE = @WITH_AUDIOSCROBBLER_TRUE@
+WITH_DBUS_FALSE = @WITH_DBUS_FALSE@
+WITH_DBUS_TRUE = @WITH_DBUS_TRUE@
+WITH_INTERNAL_LIBSEXY_FALSE = @WITH_INTERNAL_LIBSEXY_FALSE@
+WITH_INTERNAL_LIBSEXY_TRUE = @WITH_INTERNAL_LIBSEXY_TRUE@
+WITH_LIRC_FALSE = @WITH_LIRC_FALSE@
+WITH_LIRC_TRUE = @WITH_LIRC_TRUE@
+WITH_METADATA_HELPER_FALSE = @WITH_METADATA_HELPER_FALSE@
+WITH_METADATA_HELPER_TRUE = @WITH_METADATA_HELPER_TRUE@
+WITH_OLD_DBUS_FALSE = @WITH_OLD_DBUS_FALSE@
+WITH_OLD_DBUS_TRUE = @WITH_OLD_DBUS_TRUE@
+WNOERROR_CFLAGS = @WNOERROR_CFLAGS@
+XGETTEXT = @XGETTEXT@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+plugindir = $(PLUGINDIR)
+plugin_LTLIBRARIES = libmtpdevice.la
+
+libmtpdevice_la_SOURCES = \
+	rb-mtp-plugin.c			\
+	$(top_srcdir)/sources/rb-mtp-source.c	\
+	$(top_srcdir)/sources/rb-mtp-source.h
+
+
+libmtpdevice_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
+libmtpdevice_la_LIBADD = \
+	$(top_builddir)/lib/librb.la			\
+	$(HAL_LIBS)					\
+	$(MTP_LIBS)
+
+
+INCLUDES = \
+        -DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
+	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
+	-I$(top_srcdir) 				\
+	-I$(top_srcdir)/lib                        	\
+	-I$(top_srcdir)/metadata                       	\
+	-I$(top_srcdir)/player                       	\
+	-I$(top_srcdir)/rhythmdb                       	\
+	-I$(top_srcdir)/widgets                    	\
+	-I$(top_srcdir)/sources                    	\
+	-I$(top_srcdir)/iradio                    	\
+	-I$(top_srcdir)/podcast                    	\
+	-I$(top_srcdir)/plugins				\
+	-I$(top_srcdir)/shell				\
+	-DPIXMAP_DIR=\""$(datadir)/pixmaps"\"		\
+	-DSHARE_DIR=\"$(pkgdatadir)\"                   \
+	-DDATADIR=\""$(datadir)"\"			\
+	$(RHYTHMBOX_CFLAGS)				\
+	$(WARN_CFLAGS)					\
+	$(HAL_CFLAGS)					\
+	$(MTP_CFLAGS)					\
+	-D_XOPEN_SOURCE -D_BSD_SOURCE
+
+
+plugin_in_files = mtpdevice.rb-plugin.desktop.in
+
+plugin_DATA = $(plugin_in_files:.rb-plugin.desktop.in=.rb-plugin)
+
+EXTRA_DIST = $(plugin_in_files)
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA)
+subdir = plugins/mtp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(plugin_LTLIBRARIES)
+
+libmtpdevice_la_DEPENDENCIES = $(top_builddir)/lib/librb.la
+am_libmtpdevice_la_OBJECTS = rb-mtp-plugin.lo rb-mtp-source.lo
+libmtpdevice_la_OBJECTS = $(am_libmtpdevice_la_OBJECTS)
+
+DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/rb-mtp-plugin.Plo \
+@AMDEP_TRUE@	./$(DEPDIR)/rb-mtp-source.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
+	$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(libmtpdevice_la_SOURCES)
+DATA = $(plugin_DATA)
+
+DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
+SOURCES = $(libmtpdevice_la_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  plugins/mtp/Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+pluginLTLIBRARIES_INSTALL = $(INSTALL)
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(plugindir)
+	@list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f="`echo $$p | sed -e 's|^.*/||'`"; \
+	    echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(plugindir)/$$f"; \
+	    $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(plugindir)/$$f; \
+	  else :; fi; \
+	done
+
+uninstall-pluginLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+	    p="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(plugindir)/$$p"; \
+	  $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(plugindir)/$$p; \
+	done
+
+clean-pluginLTLIBRARIES:
+	-test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+	@list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" = "$$p" && dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libmtpdevice.la: $(libmtpdevice_la_OBJECTS) $(libmtpdevice_la_DEPENDENCIES) 
+	$(LINK) -rpath $(plugindir) $(libmtpdevice_la_LDFLAGS) $(libmtpdevice_la_OBJECTS) $(libmtpdevice_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rb-mtp-plugin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rb-mtp-source.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+
+.c.obj:
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+
+.c.lo:
+@am__fastdepCC_TRUE@	if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
+@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+rb-mtp-source.o: $(top_srcdir)/sources/rb-mtp-source.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rb-mtp-source.o -MD -MP -MF "$(DEPDIR)/rb-mtp-source.Tpo" \
+@am__fastdepCC_TRUE@	  -c -o rb-mtp-source.o `test -f '$(top_srcdir)/sources/rb-mtp-source.c' || echo '$(srcdir)/'`$(top_srcdir)/sources/rb-mtp-source.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/rb-mtp-source.Tpo" "$(DEPDIR)/rb-mtp-source.Po"; \
+@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/rb-mtp-source.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/sources/rb-mtp-source.c' object='rb-mtp-source.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/rb-mtp-source.Po' tmpdepfile='$(DEPDIR)/rb-mtp-source.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rb-mtp-source.o `test -f '$(top_srcdir)/sources/rb-mtp-source.c' || echo '$(srcdir)/'`$(top_srcdir)/sources/rb-mtp-source.c
+
+rb-mtp-source.obj: $(top_srcdir)/sources/rb-mtp-source.c
+@am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rb-mtp-source.obj -MD -MP -MF "$(DEPDIR)/rb-mtp-source.Tpo" \
+@am__fastdepCC_TRUE@	  -c -o rb-mtp-source.obj `if test -f '$(top_srcdir)/sources/rb-mtp-source.c'; then $(CYGPATH_W) '$(top_srcdir)/sources/rb-mtp-source.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/sources/rb-mtp-source.c'; fi`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/rb-mtp-source.Tpo" "$(DEPDIR)/rb-mtp-source.Po"; \
+@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/rb-mtp-source.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/sources/rb-mtp-source.c' object='rb-mtp-source.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/rb-mtp-source.Po' tmpdepfile='$(DEPDIR)/rb-mtp-source.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rb-mtp-source.obj `if test -f '$(top_srcdir)/sources/rb-mtp-source.c'; then $(CYGPATH_W) '$(top_srcdir)/sources/rb-mtp-source.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/sources/rb-mtp-source.c'; fi`
+
+rb-mtp-source.lo: $(top_srcdir)/sources/rb-mtp-source.c
+@am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rb-mtp-source.lo -MD -MP -MF "$(DEPDIR)/rb-mtp-source.Tpo" \
+@am__fastdepCC_TRUE@	  -c -o rb-mtp-source.lo `test -f '$(top_srcdir)/sources/rb-mtp-source.c' || echo '$(srcdir)/'`$(top_srcdir)/sources/rb-mtp-source.c; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/rb-mtp-source.Tpo" "$(DEPDIR)/rb-mtp-source.Plo"; \
+@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/rb-mtp-source.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@	fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/sources/rb-mtp-source.c' object='rb-mtp-source.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/rb-mtp-source.Plo' tmpdepfile='$(DEPDIR)/rb-mtp-source.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rb-mtp-source.lo `test -f '$(top_srcdir)/sources/rb-mtp-source.c' || echo '$(srcdir)/'`$(top_srcdir)/sources/rb-mtp-source.c
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+pluginDATA_INSTALL = $(INSTALL_DATA)
+install-pluginDATA: $(plugin_DATA)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(plugindir)
+	@list='$(plugin_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " $(pluginDATA_INSTALL) $$d$$p $(DESTDIR)$(plugindir)/$$f"; \
+	  $(pluginDATA_INSTALL) $$d$$p $(DESTDIR)$(plugindir)/$$f; \
+	done
+
+uninstall-pluginDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(plugin_DATA)'; for p in $$list; do \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " rm -f $(DESTDIR)$(plugindir)/$$f"; \
+	  rm -f $(DESTDIR)$(plugindir)/$$f; \
+	done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA)
+
+installdirs:
+	$(mkinstalldirs) $(DESTDIR)$(plugindir) $(DESTDIR)$(plugindir)
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginDATA install-pluginLTLIBRARIES
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-pluginDATA \
+	uninstall-pluginLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-pluginLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am info info-am install \
+	install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-pluginDATA install-pluginLTLIBRARIES install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am \
+	uninstall-pluginDATA uninstall-pluginLTLIBRARIES
+
+
+%.rb-plugin: %.rb-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null	2006-05-22 16:25:23.000000000 +0200
+++ plugins/mtp/Makefile.am	2006-06-10 23:33:27.000000000 +0200
@@ -0,0 +1,47 @@
+plugindir = $(PLUGINDIR)
+plugin_LTLIBRARIES = libmtpdevice.la
+
+libmtpdevice_la_SOURCES = \
+	rb-mtp-plugin.c			\
+	$(top_srcdir)/sources/rb-mtp-source.c	\
+	$(top_srcdir)/sources/rb-mtp-source.h
+	
+libmtpdevice_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
+libmtpdevice_la_LIBADD = 					\
+	$(top_builddir)/lib/librb.la			\
+	$(HAL_LIBS)					\
+	$(MTP_LIBS)
+
+INCLUDES = 						\
+        -DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
+	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
+	-I$(top_srcdir) 				\
+	-I$(top_srcdir)/lib                        	\
+	-I$(top_srcdir)/metadata                       	\
+	-I$(top_srcdir)/player                       	\
+	-I$(top_srcdir)/rhythmdb                       	\
+	-I$(top_srcdir)/widgets                    	\
+	-I$(top_srcdir)/sources                    	\
+	-I$(top_srcdir)/iradio                    	\
+	-I$(top_srcdir)/podcast                    	\
+	-I$(top_srcdir)/plugins				\
+	-I$(top_srcdir)/shell				\
+	-DPIXMAP_DIR=\""$(datadir)/pixmaps"\"		\
+	-DSHARE_DIR=\"$(pkgdatadir)\"                   \
+	-DDATADIR=\""$(datadir)"\"			\
+	$(RHYTHMBOX_CFLAGS)				\
+	$(WARN_CFLAGS)					\
+	$(HAL_CFLAGS)					\
+	$(MTP_CFLAGS)					\
+	-D_XOPEN_SOURCE -D_BSD_SOURCE
+
+plugin_in_files = mtpdevice.rb-plugin.desktop.in
+
+%.rb-plugin: %.rb-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.rb-plugin.desktop.in=.rb-plugin)
+
+EXTRA_DIST = $(plugin_in_files)
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA)
--- /dev/null	2006-05-22 16:25:23.000000000 +0200
+++ plugins/mtp/mtpdevice.rb-plugin.desktop.in	2006-06-10 23:32:49.000000000 +0200
@@ -0,0 +1,8 @@
+[RB Plugin]
+Module=mtpdevice
+IAge=1
+_Name=MTP Support
+_Description=Adds mtp support to Rhythmbox so that it can show an mtp-device content
+Authors=Peter Grundström
+Copyright=(C) 2006 Peter Grundström
+Website=http://www.rhythmbox.org
--- /dev/null	2006-05-22 16:25:23.000000000 +0200
+++ plugins/mtp/rb-mtp-plugin.c	2006-06-17 19:39:57.000000000 +0200
@@ -0,0 +1,346 @@
+/*
+ * rb-mtp-plugin.c
+ * 
+ * Copyright (C) 2006 Peter Grundström <pete@openfestis.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <glib/gi18n-lib.h>
+#include <gmodule.h>
+#include <gtk/gtk.h>
+#include <glib.h>
+#include <glib-object.h>
+#include <libgnomevfs/gnome-vfs.h>
+#include <libmtp.h>
+#ifdef HAVE_HAL_0_5
+#include <hal/libhal.h>
+#include <dbus/dbus.h>
+#endif
+
+#include "rb-source.h"
+#include "rb-mtp-source.h"
+#include "rb-plugin.h"
+#include "rb-debug.h"
+#include "rb-file-helpers.h"
+#include "rb-util.h"
+#include "rb-shell.h"
+
+
+#define RB_TYPE_MTP_PLUGIN		(rb_mtp_plugin_get_type ())
+#define RB_MTP_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_MTP_PLUGIN, RBMtpPlugin))
+#define RB_MTP_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_IPOD_PLUGIN, RBMtpPluginClass))
+#define RB_IS_MTP_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_MTP_PLUGIN))
+#define RB_IS_MTP_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_MTP_PLUGIN))
+#define RB_MTP_PLUGIN_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_MTP_PLUGIN, RBMtpPluginClass))
+
+typedef struct
+{
+	RBPlugin parent;
+
+	RBShell *shell;
+	GtkActionGroup *action_group;
+	guint ui_merge_id;
+
+	GList *mtp_sources;
+	
+	#ifdef HAVE_HAL_0_5
+	LibHalContext *hal_context;
+	DBusConnection *dbus_connection;
+	#endif
+} RBMtpPlugin;
+
+typedef struct
+{
+	RBPluginClass parent_class;
+} RBMtpPluginClass;
+
+
+G_MODULE_EXPORT GType register_rb_plugin (GTypeModule *module);
+GType	rb_mtp_plugin_get_type		(void) G_GNUC_CONST;
+
+static void rb_mtp_plugin_init (RBMtpPlugin *plugin);
+static void rb_mtp_plugin_finalize (GObject *object);
+static void impl_activate (RBPlugin *plugin, RBShell *shell);
+static void impl_deactivate (RBPlugin *plugin, RBShell *shell);
+
+#ifdef HAVE_HAL_0_5
+
+static void rb_mtp_plugin_device_added(LibHalContext *context, const char *udi);
+static void rb_mtp_plugin_device_removed(LibHalContext *context, const char *udi);
+static void rb_mtp_plugin_setup_dbus_hal_connection (RBMtpPlugin *plugin);
+
+#endif
+
+static RBSource * create_source_cb (RBMtpPlugin *plugin,LIBMTP_mtpdevice_t *device, char *udi);
+
+static void  rb_mtp_plugin_eject (GtkAction *action,
+					RBMtpPlugin *plugin);
+
+RB_PLUGIN_REGISTER(RBMtpPlugin, rb_mtp_plugin)
+
+static GtkActionEntry rb_mtp_plugin_actions [] =
+{
+	{ "MTPSourceEject", NULL, N_("_Eject"), NULL,
+	  N_("Eject MTP-device"),
+	  G_CALLBACK (rb_mtp_plugin_eject) }
+};
+
+static void
+rb_mtp_plugin_class_init (RBMtpPluginClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	RBPluginClass *plugin_class = RB_PLUGIN_CLASS (klass);
+
+	object_class->finalize = rb_mtp_plugin_finalize;
+	
+	plugin_class->activate = impl_activate;
+	plugin_class->deactivate = impl_deactivate;
+
+	/* register types used by the plugin */
+	RB_PLUGIN_REGISTER_TYPE(rb_mtp_source);
+}
+
+static void
+rb_mtp_plugin_init (RBMtpPlugin *plugin)
+{
+	rb_debug ("RBMtpPlugin initialising");
+	LIBMTP_Init();
+}
+
+static void
+rb_mtp_plugin_finalize (GObject *object)
+{
+	rb_debug ("RBMtpPlugin finalising");
+
+	G_OBJECT_CLASS (rb_mtp_plugin_parent_class)->finalize (object);
+}
+
+static void
+impl_activate (RBPlugin *bplugin, RBShell *shell)
+{
+	RBMtpPlugin *plugin = RB_MTP_PLUGIN (bplugin);
+	GtkUIManager *uimanager = NULL;
+
+	plugin->shell = shell;
+
+	g_object_get (G_OBJECT (shell),
+		      "ui-manager", &uimanager, 
+		      NULL);
+	
+	//ui
+	
+	plugin->action_group = gtk_action_group_new ("MTPActions");
+	gtk_action_group_set_translation_domain (plugin->action_group,
+						 GETTEXT_PACKAGE);
+	gtk_action_group_add_actions (plugin->action_group,
+				      rb_mtp_plugin_actions, G_N_ELEMENTS (rb_mtp_plugin_actions),
+				      plugin);
+	gtk_ui_manager_insert_action_group (uimanager, plugin->action_group, 0);
+	plugin->ui_merge_id = gtk_ui_manager_add_ui_from_file (uimanager,
+							       rb_file ("mtp-ui.xml"),
+							       NULL);
+							       
+	//device detection
+	
+	rb_mtp_plugin_setup_dbus_hal_connection(plugin);
+
+	uint16_t vid;
+    uint16_t pid;
+
+    LIBMTP_Detect_Descriptor(&vid, &pid);
+    
+	
+	#ifdef HAVE_HAL_0_5
+	int num,i;
+	char **devices = libhal_get_all_devices (plugin->hal_context, &num, NULL);
+	for (i = 0; i < num; i++)
+	{
+		char *tmpudi = devices[i];
+		
+		int vendor_id = libhal_device_get_property_int	(plugin->hal_context, tmpudi, "usb.vendor_id",NULL);
+		int product_id = libhal_device_get_property_int	(plugin->hal_context, tmpudi, "usb.product_id",NULL);
+		
+		if (vid == vendor_id && pid == product_id) {
+			LIBMTP_mtpdevice_t *device = LIBMTP_Get_First_Device();
+			if (device != NULL) {
+				create_source_cb(plugin,device,tmpudi);
+			} else {
+				g_print("Error: could not get a hold on the device. Reset and Restart");
+			}
+		}
+	}
+	#else
+	LIBMTP_mtpdevice_t *device = LIBMTP_Get_First_Device();
+	create_source_cb(plugin,device,NULL);
+	#endif
+
+	g_object_unref (G_OBJECT (uimanager));
+}
+
+static void
+impl_deactivate (RBPlugin *bplugin, RBShell *shell)
+{
+	RBMtpPlugin *plugin = RB_MTP_PLUGIN (bplugin);
+	GtkUIManager *uimanager = NULL;
+	DBusError error;
+
+	g_object_get (G_OBJECT (shell),
+		      "ui-manager", &uimanager, 
+		      NULL);
+
+	gtk_ui_manager_remove_ui (uimanager, plugin->ui_merge_id);
+	gtk_ui_manager_remove_action_group (uimanager, plugin->action_group);
+	
+	g_list_foreach (plugin->mtp_sources, (GFunc)rb_source_delete_thyself, NULL);
+	g_list_free (plugin->mtp_sources);
+	plugin->mtp_sources = NULL;
+	
+	dbus_error_init(&error);
+	libhal_ctx_shutdown(plugin->hal_context, &error);
+	libhal_ctx_free(plugin->hal_context);
+	dbus_connection_disconnect(plugin->dbus_connection);
+	dbus_connection_unref(plugin->dbus_connection);
+	dbus_error_free(&error);
+
+	g_object_unref (G_OBJECT (uimanager));
+}
+
+/*static void
+rb_mtp_plugin_source_deleted (RBmtpSource *source, RBMtpPlugin *plugin)
+{
+	g_print("rb_mtp_plugin_source_deleted");
+	plugin->mtp_sources = g_list_remove (plugin->mtp_sources, source);
+}*/
+
+static RBSource *
+create_source_cb (RBMtpPlugin *plugin, LIBMTP_mtpdevice_t *device, char *udi)
+{
+	RBSource *source;
+	source = RB_SOURCE (rb_mtp_source_new (plugin->shell,device,udi));
+
+	rb_shell_append_source (plugin->shell, source, NULL);
+	plugin->mtp_sources = g_list_prepend (plugin->mtp_sources, source);
+	
+	/*g_signal_connect_object (G_OBJECT (source),
+				"deleted", G_CALLBACK (rb_mtp_plugin_source_deleted),
+				plugin, 0);*/
+		
+	return source;
+}
+
+static void 
+rb_mtp_plugin_eject (GtkAction *action,
+			   RBMtpPlugin *plugin)
+{
+	g_object_unref(plugin);
+}
+
+#ifdef HAVE_HAL_0_5
+
+static void
+rb_mtp_plugin_device_added(LibHalContext *context, const char *udi)
+{
+	RBMtpPlugin *plugin = (RBMtpPlugin *) libhal_ctx_get_user_data(context);
+
+	if (g_list_length(plugin->mtp_sources) > 0) { //only support one device at the time right now.
+		return;
+	}
+
+	LIBMTP_device_entry_t *entries;
+	int numentries;
+	int vendor_id = libhal_device_get_property_int (context, udi, "usb.vendor_id",NULL);
+	int product_id = libhal_device_get_property_int (context, udi, "usb.product_id",NULL);
+
+	int ret = LIBMTP_Get_Supported_Devices_List(&entries, &numentries);
+	if (ret == 0) {
+		int i;
+		for (i = 0; i < numentries; i++) {
+			LIBMTP_device_entry_t * entry = &entries[i];
+	
+			if ((entry->vendor_id==vendor_id) && (entry->product_id == product_id)) { 
+				// It usualy takes a while for the device o set itself up.
+				// Solving that by trying 10 times with some sleep in between.
+				// There is probably a better solution, but this works.
+				int p;
+				for (p = 0;p < 10;p++) {
+					LIBMTP_mtpdevice_t *device = LIBMTP_Get_First_Device();
+					if (device != NULL) {
+						create_source_cb(plugin, device, strdup(udi));
+						break;
+					}
+					usleep(200000);
+				}
+			}
+    	}
+    }
+}
+
+static void
+rb_mtp_plugin_device_removed (LibHalContext *context, const char *udi)
+{
+	RBMtpPlugin *plugin = (RBMtpPlugin *) libhal_ctx_get_user_data(context);
+	g_print ("längden %i", g_list_length(plugin->mtp_sources));
+
+	GList* list = plugin->mtp_sources;
+	GList *tmp;
+	
+	for (tmp = list; tmp != NULL; tmp = tmp->next) {
+		RBSource *source = (RBSource *)tmp->data;
+		g_print("udi %s\n", udi);
+		g_print("source %i", (int)source);
+		if (source != NULL && rb_mtp_source_is_udi(RB_MTP_SOURCE(source),udi) != 0) { //testa här utan att tabort
+			g_print("that is the one\n");
+			plugin->mtp_sources = g_list_remove (plugin->mtp_sources, source);
+			rb_source_delete_thyself(source);
+			break;
+		}
+	}
+}
+
+static void
+rb_mtp_plugin_setup_dbus_hal_connection (RBMtpPlugin *plugin)
+{
+	DBusError error;
+
+	dbus_error_init(&error);
+
+	if (!(plugin->dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error))) {
+		g_print("error: dbus_bus_get: %s: %s\n", error.name, error.message);
+		return;
+	}
+
+	// fprintf(stderr, "connected to: %s\n", dbus_bus_get_unique_name(conn));
+	if (!(plugin->hal_context = libhal_ctx_new())) return;
+	if (!libhal_ctx_set_dbus_connection(plugin->hal_context, plugin->dbus_connection)) return;
+	if (!libhal_ctx_init(plugin->hal_context, &error)) {
+		g_print("error: libhal_ctx_init: %s: %s\n", error.name, error.message);
+		return;
+	}
+
+	libhal_ctx_set_device_added(plugin->hal_context,rb_mtp_plugin_device_added);
+	libhal_ctx_set_device_removed(plugin->hal_context,rb_mtp_plugin_device_removed);
+	libhal_ctx_set_user_data(plugin->hal_context, (void *)plugin);
+
+	dbus_error_free(&error);
+}
+
+#endif
+
--- /dev/null	2006-05-22 16:25:23.000000000 +0200
+++ sources/rb-mtp-source.h	2006-06-16 12:11:04.000000000 +0200
@@ -0,0 +1,57 @@
+/*
+ *  arch-tag: Header for mtp source object
+ *
+ *  Copyright (C) 2006 Peter Grundström  <pete@openfestis.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifndef __RB_MTP_SOURCE_H
+#define __RB_MTP_SOURCE_H
+
+#include "rb-shell.h"
+#include "rb-browser-source.h"
+#include "rhythmdb.h"
+#include <libmtp.h>
+
+G_BEGIN_DECLS
+
+#define RB_TYPE_MTP_SOURCE         (rb_mtp_source_get_type ())
+#define RB_MTP_SOURCE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_MTP_SOURCE, RBmtpSource))
+#define RB_MTP_SOURCE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_MTP_SOURCE, RBmtpSourceClass))
+#define RB_IS_MTP_SOURCE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_MTP_SOURCE))
+#define RB_IS_MTP_SOURCE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_MTP_SOURCE))
+#define RB_MTP_SOURCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_MTP_SOURCE, RBmtpSourceClass))
+
+typedef struct
+{
+	RBBrowserSource parent;
+} RBmtpSource;
+
+typedef struct
+{
+	RBBrowserSourceClass parent;
+} RBmtpSourceClass;
+
+RBBrowserSource * rb_mtp_source_new (RBShell *shell,LIBMTP_mtpdevice_t *device, char *udi);
+GType		rb_mtp_source_get_type		(void);
+GType		rb_mtp_source_register_type (GTypeModule *module);
+
+gboolean rb_mtp_source_is_udi(RBmtpSource *source, const char *udi);
+
+G_END_DECLS
+
+#endif /* __RB_MTP_SOURCE_H */
--- /dev/null	2006-05-22 16:25:23.000000000 +0200
+++ sources/rb-mtp-source.c	2006-06-17 18:55:00.000000000 +0200
@@ -0,0 +1,531 @@
+/*
+ *  arch-tag: Implementation of mtp source object
+ *
+ *  Copyright (C) 2006 Peter Grundström  <pete@openfestis.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
+ *
+ */
+
+#include <config.h>
+
+
+#include <gtk/gtktreeview.h>
+#include <string.h>
+#include "rhythmdb.h"
+#include <libgnome/gnome-i18n.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
+#include <libgnomevfs/gnome-vfs-volume.h>
+#include <libgnomevfs/gnome-vfs-volume-monitor.h>
+#include "eel-gconf-extensions.h"
+#include "rb-mtp-source.h"
+#include "rb-debug.h"
+#include "rb-file-helpers.h"
+#include "rb-plugin.h"
+#include "rb-static-playlist-source.h"
+#include "rb-util.h"
+#include "rb-refstring.h"
+#include "rhythmdb.h"
+
+static GObject *rb_mtp_source_constructor (GType type, 
+					    guint n_construct_properties,
+					    GObjectConstructParam *construct_properties);
+static void rb_mtp_source_dispose (GObject *object);
+
+static GObject *rb_mtp_source_constructor (GType type, guint n_construct_properties,
+			       GObjectConstructParam *construct_properties);
+static void rb_mtp_source_dispose (GObject *object);
+
+static void rb_mtp_load_tracks (RBmtpSource*);
+static void impl_delete_thyself (RBSource *source);
+static void impl_delete (RBSource *asource);
+static void impl_paste (RBSource *source, GList *entries);
+static gboolean impl_receive_drag (RBSource *source, GtkSelectionData *data);
+static gboolean impl_show_popup (RBSource *source);
+
+typedef struct
+{
+	LIBMTP_mtpdevice_t *device;
+	GHashTable *entry_map;
+	char *udi;
+} RBmtpSourcePrivate;
+
+
+RB_PLUGIN_DEFINE_TYPE(RBmtpSource, 
+		      rb_mtp_source, 
+		      RB_TYPE_BROWSER_SOURCE)
+
+#define MTP_SOURCE_GET_PRIVATE(o)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), RB_TYPE_MTP_SOURCE, RBmtpSourcePrivate))
+
+static void
+rb_mtp_source_class_init (RBmtpSourceClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	RBSourceClass *source_class = RB_SOURCE_CLASS (klass);
+
+	object_class->constructor = rb_mtp_source_constructor;
+	object_class->dispose = rb_mtp_source_dispose;
+
+	source_class->impl_show_popup = impl_show_popup;
+	source_class->impl_delete_thyself = impl_delete_thyself;
+	source_class->impl_can_delete = (RBSourceFeatureFunc) rb_true_function;
+   	source_class->impl_delete = impl_delete;
+   	source_class->impl_can_move_to_trash = (RBSourceFeatureFunc) rb_false_function;
+	source_class->impl_can_paste = (RBSourceFeatureFunc) rb_true_function;
+  	source_class->impl_paste = impl_paste;
+  	source_class->impl_receive_drag = impl_receive_drag;
+
+	source_class->impl_can_rename = (RBSourceFeatureFunc) rb_true_function;
+
+	g_type_class_add_private (klass, sizeof (RBmtpSourcePrivate));
+}
+
+static void
+rb_mtp_source_init (RBmtpSource *source)
+{
+	RBmtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+	priv = G_TYPE_INSTANCE_GET_PRIVATE (source, 
+						    RB_TYPE_MTP_SOURCE, 
+						    RBmtpSourcePrivate);
+}
+
+static GObject *
+rb_mtp_source_constructor (GType type, guint n_construct_properties,
+			    GObjectConstructParam *construct_properties)
+{
+	RBmtpSource *source;
+	RBEntryView *tracks;
+	RBmtpSourcePrivate *priv;
+
+	source = RB_MTP_SOURCE (G_OBJECT_CLASS (rb_mtp_source_parent_class)->
+			constructor (type, n_construct_properties, construct_properties));
+	priv = MTP_SOURCE_GET_PRIVATE (source);
+	
+	tracks = rb_source_get_entry_view (RB_SOURCE (source));
+	rb_entry_view_append_column (tracks, RB_ENTRY_VIEW_COL_RATING, FALSE);
+	rb_entry_view_append_column (tracks, RB_ENTRY_VIEW_COL_TITLE, TRUE);
+
+	gint size;
+	GtkIconTheme *theme;
+	GdkPixbuf *pixbuf;
+	
+	theme = gtk_icon_theme_get_default ();
+	gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &size, NULL);
+	pixbuf = gtk_icon_theme_load_icon (theme, "multimedia-player", size, 0, NULL);
+
+	rb_source_set_pixbuf (RB_SOURCE (source), pixbuf);
+	g_object_unref (pixbuf);
+
+	return G_OBJECT (source);
+}
+
+static void 
+rb_mtp_source_dispose (GObject *object)
+{
+	RBmtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (object);
+
+	if (priv->entry_map) {
+		g_hash_table_destroy (priv->entry_map);
+		priv->entry_map = NULL;
+ 	}
+
+	G_OBJECT_CLASS (rb_mtp_source_parent_class)->dispose (object);
+}
+
+RBBrowserSource *
+rb_mtp_source_new (RBShell *shell, LIBMTP_mtpdevice_t *device, char *udi)
+{
+	RBmtpSource *source;
+	RhythmDBEntryType entry_type;
+
+	entry_type =  rhythmdb_entry_register_type (NULL);
+	
+	source = RB_MTP_SOURCE (g_object_new (RB_TYPE_MTP_SOURCE,
+						"entry-type", entry_type,
+			  			"shell",shell,
+			  			"visibility", TRUE,
+			  			"sourcelist-group", RB_SOURCELIST_GROUP_REMOVABLE,
+						NULL));
+
+	RBmtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+	priv->device = device;
+	priv->udi = udi;
+
+	rb_mtp_load_tracks (source);
+
+	rb_shell_register_entry_type_for_source (shell, RB_SOURCE(source), entry_type);
+
+	return RB_BROWSER_SOURCE (source);
+}
+
+static void 
+entry_set_string_prop (RhythmDB *db, RhythmDBEntry *entry,
+		       RhythmDBPropType propid, const char *str)
+{
+	GValue value = {0,};
+
+	if (!str)
+		str = _("Unknown");
+
+	g_value_init (&value, G_TYPE_STRING);
+	g_value_set_static_string (&value, str);
+	rhythmdb_entry_set_uninserted (RHYTHMDB (db), entry, propid, &value);
+	g_value_unset (&value);
+}
+
+static void
+add_mtp_track_to_db (RBmtpSource *source, RhythmDB *db, LIBMTP_track_t *track)
+{	
+	RhythmDBEntry *entry;
+	RhythmDBEntryType entry_type;
+	RBmtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+
+	/* Set URI */
+	g_object_get (G_OBJECT (source), "entry-type", &entry_type, 
+		      NULL);
+
+	entry = rhythmdb_entry_new (RHYTHMDB (db), entry_type, track->filename);
+
+	if (entry == NULL) {
+		rb_debug ("cannot create entry %s", track->filename);
+		return;
+	}
+
+	/* Set track number */
+	if (track->tracknumber != 0) {
+		GValue value = {0, };
+		g_value_init (&value, G_TYPE_ULONG);
+		g_value_set_ulong (&value, track->tracknumber);
+		rhythmdb_entry_set_uninserted (RHYTHMDB (db), entry, 
+					       RHYTHMDB_PROP_TRACK_NUMBER, 
+					       &value);
+		g_value_unset (&value);
+	}
+		
+	/* Set length */
+	if (track->duration != 0) {
+		GValue value = {0, };
+		g_value_init (&value, G_TYPE_ULONG);
+		g_value_set_ulong (&value, track->duration/1000);
+		rhythmdb_entry_set_uninserted (RHYTHMDB (db), entry, 
+					       RHYTHMDB_PROP_DURATION, 
+					       &value);
+		g_value_unset (&value);
+	}
+		
+	/* Set file size */
+	if (track->filesize != 0) {
+		GValue value = {0, };
+		g_value_init (&value, G_TYPE_UINT64);
+		g_value_set_uint64 (&value, track->filesize);
+		rhythmdb_entry_set_uninserted (RHYTHMDB (db), entry, 
+					       RHYTHMDB_PROP_FILE_SIZE, 
+					       &value);
+		g_value_unset (&value);
+	}
+		
+	/* Set title */		
+	entry_set_string_prop (RHYTHMDB (db), entry, 
+			       RHYTHMDB_PROP_TITLE, track->title);
+		
+	/* Set album, artist and genre from MTP */
+	entry_set_string_prop (RHYTHMDB (db), entry, 
+			       RHYTHMDB_PROP_ARTIST, track->artist);
+		
+	entry_set_string_prop (RHYTHMDB (db), entry, 
+			       RHYTHMDB_PROP_ALBUM, track->album);
+		
+	entry_set_string_prop (RHYTHMDB (db), entry, 
+			       RHYTHMDB_PROP_GENRE, track->genre);
+
+
+	g_hash_table_insert (priv->entry_map, entry, track);
+
+	rhythmdb_commit (RHYTHMDB (db));
+}
+
+static gboolean
+load_mtp_db_idle_cb (RBmtpSource* source)
+{
+	RBShell *shell;
+	RhythmDB *db;
+	RBmtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+  
+  	g_object_get (G_OBJECT (source), "shell", &shell, NULL);
+  	g_object_get (G_OBJECT (shell), "db", &db, NULL);
+  	g_object_unref (G_OBJECT (shell));
+  
+  	g_assert (db != NULL);
+
+	LIBMTP_track_t *tracks = LIBMTP_Get_Tracklisting(priv->device);
+	if (tracks == NULL) {
+		rb_debug("No tracks.\n");
+	} else {
+		LIBMTP_track_t *track, *tmp = NULL;
+		for (track = tracks; track != NULL; track = track->next) {
+			add_mtp_track_to_db (source, db, track);
+			tmp = track;
+		}
+	}
+
+	g_object_unref (G_OBJECT (db));
+	return FALSE;
+}
+
+static void
+rb_mtp_load_tracks (RBmtpSource *source)
+{
+	RBmtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+	RBShell *shell;
+  
+  	g_object_get (G_OBJECT (source), "shell", &shell, NULL);
+  	g_object_unref (G_OBJECT (shell));
+
+	priv->entry_map = g_hash_table_new (g_direct_hash, g_direct_equal);
+	if ((priv->device != NULL) && (priv->entry_map != NULL)) {
+		/* FIXME: we could set a different icon depending on the iPod
+		 * model
+		 */
+		char* name = LIBMTP_Get_Ownername(priv->device);
+		g_object_set (RB_SOURCE (source), 
+			      "name", name, 
+			      NULL);
+		g_free(name);
+		g_idle_add ((GSourceFunc)load_mtp_db_idle_cb, source);
+	}
+}
+
+static void
+impl_delete_thyself (RBSource *source)
+{
+	RBmtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+	
+	LIBMTP_track_t *tracks = LIBMTP_Get_Tracklisting(priv->device);
+	if (tracks == NULL) {
+		rb_debug("No tracks.\n");
+	} else {
+		LIBMTP_track_t *track, *tmp = NULL;
+		for (track = tracks; track != NULL; track = track->next) {
+			LIBMTP_destroy_track_t(tmp);
+			tmp = track;
+		}
+		LIBMTP_destroy_track_t(tmp);
+	}
+
+	LIBMTP_Release_Device(priv->device);
+	priv->device = NULL;
+	
+	if(priv->udi != NULL) {
+		g_free(priv->udi);
+		priv->udi = NULL;
+	}
+
+	RB_SOURCE_CLASS (rb_mtp_source_parent_class)->impl_delete_thyself (source);
+}
+
+static char *
+gdate_to_char (GDate* date)
+{
+	char tmp[80];
+    snprintf(tmp, sizeof(tmp)-1, "%2i%2i%2iT0000.0", g_date_get_year(date),g_date_get_month(date),g_date_get_day(date));
+    tmp[sizeof(tmp)-1] = '\0';
+    return strdup(tmp);
+}
+
+static LIBMTP_track_t *
+add_track_to_mtp (LIBMTP_mtpdevice_t *device, RhythmDBEntry *entry)
+{
+	LIBMTP_track_t *trackmeta = LIBMTP_new_track_t();
+    
+	const char *mimetype = rhythmdb_entry_get_string(entry,RHYTHMDB_PROP_MIMETYPE);
+	rb_debug("Sending track:\n");
+	rb_debug("Codec:     %s\n", mimetype);
+  
+	if (!strcasecmp(mimetype,"audio/mpeg") || !strcasecmp(mimetype,"application/x-id3")) {
+		trackmeta->filetype = LIBMTP_FILETYPE_MP3;
+	}  else if (!strcasecmp(mimetype,"audio/x-wav")) {
+		trackmeta->filetype = LIBMTP_FILETYPE_WAV;
+	} else if (!strcasecmp(mimetype,"application/ogg")) {
+		trackmeta->filetype = LIBMTP_FILETYPE_OGG;
+	} else if (!strcasecmp(mimetype,"audio/mp4")) {
+		trackmeta->filetype = LIBMTP_FILETYPE_MP4;
+	} else if (!strcasecmp(mimetype,"audio/x-ms-wma") || !strcasecmp(mimetype,"audio/x-ms-asf")) {
+		trackmeta->filetype = LIBMTP_FILETYPE_WMA;
+	} else {
+		g_debug("Not a valid codec: \"%s\"\n", mimetype);
+		g_debug("Supported formats: MP3, WAV, OGG, MP4, WMA\n");
+	}
+		
+	trackmeta->title	= rhythmdb_entry_dup_string(entry,RHYTHMDB_PROP_TITLE);
+    trackmeta->album	= rhythmdb_entry_dup_string(entry,RHYTHMDB_PROP_ALBUM);
+	trackmeta->artist	= rhythmdb_entry_dup_string(entry,RHYTHMDB_PROP_ARTIST);
+	trackmeta->genre	= rhythmdb_entry_dup_string(entry,RHYTHMDB_PROP_GENRE);
+	trackmeta->filename = g_path_get_basename (gnome_vfs_get_local_path_from_uri (rhythmdb_entry_get_string(entry,RHYTHMDB_PROP_LOCATION)));
+	GDate d;
+	g_date_set_julian(&d,rhythmdb_entry_get_ulong(entry,RHYTHMDB_PROP_DATE));
+	trackmeta->date	= gdate_to_char(&d);
+	trackmeta->tracknumber = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TRACK_NUMBER);
+	trackmeta->duration = rhythmdb_entry_get_ulong(entry,RHYTHMDB_PROP_DURATION) * 1000;
+	trackmeta->filesize = rhythmdb_entry_get_uint64(entry,RHYTHMDB_PROP_FILE_SIZE);
+
+	const char *filename = gnome_vfs_get_local_path_from_uri (rhythmdb_entry_get_string(entry,RHYTHMDB_PROP_LOCATION));
+	LIBMTP_Send_Track_From_File(device, filename, trackmeta, NULL, NULL, 0);
+	
+	return trackmeta;
+}
+
+static void
+impl_paste (RBSource *source, GList *entries)
+{
+	GList *l;
+	RBShell *shell;
+	RhythmDB *db;
+	RBmtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+  
+  	g_object_get (G_OBJECT (source), "shell", &shell, NULL);
+  	g_object_get (G_OBJECT (shell), "db", &db, NULL);
+  	g_object_unref (G_OBJECT (shell));
+
+	for (l = entries; l != NULL; l = l->next) {
+		RhythmDBEntry *entry;
+		RhythmDBEntryType entry_type;
+
+		entry = (RhythmDBEntry *)l->data;
+		entry_type = rhythmdb_entry_get_entry_type (entry);
+		
+		//FIXME: if you add a playlist, dont just ad the tracks, add a playlist to.
+		
+		if (entry_type == RHYTHMDB_ENTRY_TYPE_IRADIO_STATION ||
+		    entry_type == RHYTHMDB_ENTRY_TYPE_PODCAST_FEED )
+			continue;
+		
+		LIBMTP_track_t *track = add_track_to_mtp(priv->device,entry);
+		
+		add_mtp_track_to_db(RB_MTP_SOURCE(source),db,track);
+	}
+}
+
+static gboolean
+impl_receive_drag (RBSource *asource, GtkSelectionData *data)
+{
+	RBBrowserSource *source = RB_BROWSER_SOURCE (asource);
+	GList *list, *i;
+	GList *entries = NULL;
+	RBShell *shell;
+	RhythmDB *db;
+
+	rb_debug ("parsing uri list");
+	list = rb_uri_list_parse ((const char *) data->data);
+
+  	g_object_get (G_OBJECT (source), "shell", &shell, NULL);
+  	g_object_get (G_OBJECT (shell), "db", &db, NULL);
+  	g_object_unref (G_OBJECT (shell));
+
+	for (i = list; i != NULL; i = g_list_next (i)) {
+		if (i->data != NULL) {
+			char *uri = i->data;
+			RhythmDBEntry *entry;
+
+			entry = rhythmdb_entry_lookup_by_location (db, uri);
+
+			if (entry == NULL) {
+				/* add to the library */
+				g_print ("Where does that come from?\n");
+			} else {
+				/* add to list of entries to copy */
+				entries = g_list_prepend (entries, entry);
+			}
+
+			g_free (uri);
+		}
+	}
+	g_object_unref (db);
+	g_list_free (list);
+
+	if (entries) {
+		entries = g_list_reverse (entries);
+		if (rb_source_can_paste (asource))
+			rb_source_paste (asource, entries);
+		g_list_free (entries);
+	}
+
+	return TRUE;
+}
+
+static void
+impl_delete (RBSource *asource)
+{
+	GList *sel, *tem;
+	RBEntryView *tracks;
+	RBShell *shell;
+	RhythmDB *db;
+	RBmtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (asource);
+	RBmtpSource *source = RB_MTP_SOURCE (asource);
+	LIBMTP_mtpdevice_t *device = priv->device;
+
+  	g_object_get (G_OBJECT (source), "shell", &shell, NULL);
+  	g_object_get (G_OBJECT (shell), "db", &db, NULL);
+  	g_object_unref (G_OBJECT (shell));
+
+	tracks = rb_source_get_entry_view (RB_SOURCE (asource));
+	sel = rb_entry_view_get_selected_entries (tracks);
+	for (tem = sel; tem != NULL; tem = tem->next) {
+		RhythmDBEntry *entry;
+		const gchar *uri;
+		LIBMTP_track_t *track;
+
+		entry = (RhythmDBEntry *)tem->data;
+		uri = rhythmdb_entry_get_string (entry, 
+						 RHYTHMDB_PROP_LOCATION);
+		track = g_hash_table_lookup (priv->entry_map, entry);
+		if (track == NULL) {
+			g_warning ("Couldn't find track on mtp-device! (%s)", uri);
+			continue;
+		}
+		LIBMTP_Delete_File(device, track->item_id);
+		LIBMTP_destroy_track_t(track);
+
+		g_hash_table_remove (priv->entry_map, entry);
+		
+		rhythmdb_entry_delete(db,entry);
+		rhythmdb_commit (db);
+	}
+
+	g_list_free (sel);
+}
+
+static gboolean
+impl_show_popup (RBSource *source)
+{
+	_rb_source_show_popup (RB_SOURCE (source), "/MTPSourcePopup");
+	return TRUE;
+}
+
+gboolean
+rb_mtp_source_is_udi(RBmtpSource *source, const char *udi)
+{
+	if (source == NULL) {
+		return FALSE;
+	}
+	RBmtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
+	if (priv == NULL) {
+		return FALSE;
+	}
+	if (!strcmp(udi,priv->udi)) {
+		return TRUE;
+	}
+	return FALSE;
+}
+
--- /dev/null	2006-05-22 16:25:23.000000000 +0200
+++ data/ui/mtp-ui.xml	2006-06-12 19:49:07.000000000 +0200
@@ -0,0 +1,5 @@
+<ui>
+  <popup name="MTPSourcePopup">
+    <menuitem name="MTPSrcPopupEject" action="MTPSourceEject"/>
+  </popup>
+</ui>
