[Muine] QuitEvent for plugins and dbus (PATCH)



Hi,

I think a quit event to notify plugins would be very useful (so
plugins can delete files they may have created, etc.). Here is a small
patch to add that functionality into the IPlayer interface and dbus.

http://gps-tsc.upc.es/imatge/_Jrh/muine/muine_quitevent.patch


-- 
Javier Ruiz Hidalgo <javier ruizhidalgo gmail com>
diff -ur muine-0.8.1pre1/DBusLib/Player.cs muine-0.8.1pre1_new/DBusLib/Player.cs
--- muine-0.8.1pre1/DBusLib/Player.cs	2005-01-14 19:58:14.000000000 +0100
+++ muine-0.8.1pre1_new/DBusLib/Player.cs	2005-01-17 11:35:25.000000000 +0100
@@ -50,6 +50,8 @@
 				new SongChangedEventHandler (OnSongChangedEvent);
 			player.StateChangedEvent +=
 				new StateChangedEventHandler (OnStateChangedEvent);
+			player.QuitEvent +=
+				new GenericEventHandler (OnQuitEvent);
 		}
 
 		[Method]
@@ -208,6 +210,14 @@
 				StateChanged (playing);
 		}
 
+		[Signal] public event GenericEventHandler QuitEvent;
+
+		private void OnQuitEvent ()
+		{
+			if (QuitEvent != null)
+				QuitEvent ();
+		}
+
 		private string SongToString (ISong song)
 		{
 			string value = "";
diff -ur muine-0.8.1pre1/PluginLib/IPlayer.cs muine-0.8.1pre1_new/PluginLib/IPlayer.cs
--- muine-0.8.1pre1/PluginLib/IPlayer.cs	2005-01-14 20:55:33.000000000 +0100
+++ muine-0.8.1pre1_new/PluginLib/IPlayer.cs	2005-01-17 11:22:10.000000000 +0100
@@ -98,6 +98,8 @@
 		event GenericEventHandler PlaylistChangedEvent;
 
 		event GenericEventHandler SelectionChangedEvent;
+
+		event GenericEventHandler QuitEvent;
 	}
 
 	public delegate void SongChangedEventHandler (ISong song);
--- muine-0.8.1pre1/src/PlaylistWindow.cs	2005-01-16 15:27:14.000000000 +0100
+++ muine-0.8.1pre1_new/src/PlaylistWindow.cs	2005-01-17 11:23:48.000000000 +0100
@@ -121,6 +121,9 @@
 		// Events :: SelectionChangedEvent (IPlayer)
 		public event GenericEventHandler SelectionChangedEvent;
 
+		// Events :: QuitEvent (IPlayer)
+		public event GenericEventHandler QuitEvent;
+
 		// Internal Classes
 		// Internal Classes :: InvalidSong
 		private class InvalidSong
@@ -431,6 +434,9 @@
 		// Methods :: Public :: Quit (IPlayer)
 		public void Quit ()
 		{
+			if (QuitEvent != null)
+				QuitEvent ();
+
 			Global.Exit ();
 		}
 


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