--- src/plugins/dbus-service/dbus-service.py.old	2009-09-20 12:32:46.000000000 +0400
+++ src/plugins/dbus-service/dbus-service.py	2009-09-20 12:41:40.000000000 +0400
@@ -29,200 +29,49 @@
 		totem.Plugin.__init__(self)
 
 	def activate(self, totem):
-		DBusGMainLoop(set_as_default=True)
-		self.notification = Notification("/org/gnome/Totem")
-		self.title = ""
-		self.artist = ""
-		self.album = ""
-		self.duration = 0 # may be usable in future
+		DBusGMainLoop(set_as_default = True)
+		self.notification = Notification()
+		self.null_metadata = {"year" : "", "tracknumber" : "", "location" : "",
+			"title" : "", "album" : "", "time" : "", "genre" : "", "artist" : ""}
+		self.old_metadata = self.null_metadata.copy()
+		self.current_metadata = self.null_metadata.copy()
 		totem.connect("metadata-updated", self.do_update_metadata)
 		totem.connect("notify::playing", self.do_notify)
 
 	def deactivate(self, totem):
-		self.notification.playingStopped()
+		self.notification.TrackChange(self.null_metadata)
 		self.notification.disconnect() # ensure we don't leak our path on the bus
 
-	def do_update_metadata(self, totem, title, artist, album, num):
-		self.title = title
-		self.artist = artist
-		self.album = album
-		if not self.title:
-			self.title = ""
-		if not self.artist:
-			self.artist = ""
-		if not self.album:
-			self.album = ""
-
-	def do_notify(self, totem, status):
+	def do_update_metadata(self, totem, artist, title, album, num):
+		self.current_metadata = self.null_metadata.copy()
+		if title:
+			self.current_metadata["title"] = title
+		if artist:
+			self.current_metadata["artist"] = artist
+		if album:
+			self.current_metadata["album"] = album
 		if totem.is_playing():
-			self.notification.playingStarted(self.title, self.album, self.artist, self.duration)
-		else:
-			self.notification.playingStopped()
-
-class Notification(dbus.service.Object):
-	def __init__(self, path):
-		dbus.service.Object.__init__(self, dbus.SessionBus(), path)
-
-	def disconnect(self):
-		self.remove_from_connection(None, None)
-
-	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="sssu")
-	def playingStarted(self, title, album, artist, duration):
-		pass
-
-	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="")
-	def playingStopped(self):
-                pass
-
-## Totem D-Bus plugin
-## Copyright (C) 2009 Lucky <lucky1.data@gmail.com>
-##
-## 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.
-##
-## Sunday 13th May 2007: Bastien Nocera: Add exception clause.
-## See license_change file for details.
-
-import totem
-import gobject, gtk
-import dbus, dbus.service
-from dbus.mainloop.glib import DBusGMainLoop
-
-class dbusservice(totem.Plugin):
-	def __init__(self):
-		totem.Plugin.__init__(self)
-
-	def activate(self, totem):
-		DBusGMainLoop(set_as_default=True)
-		self.notification = Notification("/org/gnome/Totem")
-		self.title = ""
-		self.artist = ""
-		self.album = ""
-		self.duration = 0 # may be usable in future
-		totem.connect("metadata-updated", self.do_update_metadata)
-		totem.connect("notify::playing", self.do_notify)
-
-	def deactivate(self, totem):
-		self.notification.playingStopped()
-		self.notification.disconnect() # ensure we don't leak our path on the bus
-
-	def do_update_metadata(self, totem, title, artist, album, num):
-		self.title = title
-		self.artist = artist
-		self.album = album
-		if not self.title:
-			self.title = ""
-		if not self.artist:
-			self.artist = ""
-		if not self.album:
-			self.album = ""
+			self.track_change(self.current_metadata)
 
 	def do_notify(self, totem, status):
 		if totem.is_playing():
-			self.notification.playingStarted(self.title, self.album, self.artist, self.duration)
+			self.track_change(self.current_metadata)
 		else:
-			self.notification.playingStopped()
-
-class Notification(dbus.service.Object):
-	def __init__(self, path):
-		dbus.service.Object.__init__(self, dbus.SessionBus(), path)
-
-	def disconnect(self):
-		self.remove_from_connection(None, None)
-
-	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="sssu")
-	def playingStarted(self, title, album, artist, duration):
-		pass
+			self.track_change(self.null_metadata)
 
-	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="")
-	def playingStopped(self):
-                pass
-
-## Totem D-Bus plugin
-## Copyright (C) 2009 Lucky <lucky1.data@gmail.com>
-##
-## 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.
-##
-## Sunday 13th May 2007: Bastien Nocera: Add exception clause.
-## See license_change file for details.
-
-import totem
-import gobject, gtk
-import dbus, dbus.service
-from dbus.mainloop.glib import DBusGMainLoop
-
-class dbusservice(totem.Plugin):
-	def __init__(self):
-		totem.Plugin.__init__(self)
-
-	def activate(self, totem):
-		DBusGMainLoop(set_as_default=True)
-		self.notification = Notification("/org/gnome/Totem")
-		self.title = ""
-		self.artist = ""
-		self.album = ""
-		self.duration = 0 # may be usable in future
-		totem.connect("metadata-updated", self.do_update_metadata)
-		totem.connect("notify::playing", self.do_notify)
-
-	def deactivate(self, totem):
-		self.notification.playingStopped()
-		self.notification.disconnect() # ensure we don't leak our path on the bus
-
-	def do_update_metadata(self, totem, title, artist, album, num):
-		self.title = title
-		self.artist = artist
-		self.album = album
-		if not self.title:
-			self.title = ""
-		if not self.artist:
-			self.artist = ""
-		if not self.album:
-			self.album = ""
-
-	def do_notify(self, totem, status):
-		if totem.is_playing():
-			self.notification.playingStarted(self.title, self.album, self.artist, self.duration)
-		else:
-			self.notification.playingStopped()
+	def track_change(self, metadata):
+		if self.old_metadata != metadata:
+			self.old_metadata = metadata.copy()
+			self.notification.TrackChange(metadata)
 
 class Notification(dbus.service.Object):
-	def __init__(self, path):
-		dbus.service.Object.__init__(self, dbus.SessionBus(), path)
+	def __init__(self):
+		dbus.service.Object.__init__(self, dbus.SessionBus(), "/org/gnome/Totem")
 
 	def disconnect(self):
 		self.remove_from_connection(None, None)
 
-	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="sssu")
-	def playingStarted(self, title, album, artist, duration):
+	@dbus.service.signal(dbus_interface = "org.freedesktop.MediaPlayer")
+	def TrackChange(self, trackinfo):
 		pass
 
-	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="")
-	def playingStopped(self):
-                pass
-
