hipo r146 - in branches/bgarret: . src



Author: bgarret
Date: Thu Feb  7 10:26:57 2008
New Revision: 146
URL: http://svn.gnome.org/viewvc/hipo?rev=146&view=rev

Log:
2008-02-07  Benoit Garret  <benoit garret_gnome gadz org>

        * src/PlaylistSource.cs:
        * src/SourceList.cs:
        * src/Tools.cs:
        * src/TracksContainer.cs:

        Fix a stupid mistake in the logging.
        Add more comments.



Modified:
   branches/bgarret/ChangeLog
   branches/bgarret/src/PlaylistSource.cs
   branches/bgarret/src/SourceList.cs
   branches/bgarret/src/Tools.cs
   branches/bgarret/src/TracksContainer.cs

Modified: branches/bgarret/src/PlaylistSource.cs
==============================================================================
--- branches/bgarret/src/PlaylistSource.cs	(original)
+++ branches/bgarret/src/PlaylistSource.cs	Thu Feb  7 10:26:57 2008
@@ -47,7 +47,7 @@
 			playlist.TrackRemoved += OnTrackRemoved;
 			
 			// source list right click menu
-			// don't connect the handlers now
+			// don't connect the handlers now but only when the source is selected
 			ActionEntry[] entries =  {
 				
 				new ActionEntry ("RenamePlaylist",
@@ -216,6 +216,9 @@
 				Saviour.Instance.Save ();
 		}
 		
+		// there is only one copy of the menu widget in the UIManager
+		// add and remove right click menu handlers as the source is selected or deselected
+		// TODO: find an easy way to have one copy of the menu widget per instance
 		protected override void AddEventHandlers ()
 		{
 			Tools.Log (this, 3, "Hooking {0} source menu event handlers", this.Name);

Modified: branches/bgarret/src/SourceList.cs
==============================================================================
--- branches/bgarret/src/SourceList.cs	(original)
+++ branches/bgarret/src/SourceList.cs	Thu Feb  7 10:26:57 2008
@@ -66,6 +66,8 @@
 			// initialize playlist list
 			sources = new List<ISource>();
 			
+			// TODO: find a way to work around the redrawing bugs
+			// TODO: the count column goes off-limits when the count gains a number
 			// create the columns, treeview, etc
 			view = new TreeView ();
 			view.HeadersVisible = false;

Modified: branches/bgarret/src/Tools.cs
==============================================================================
--- branches/bgarret/src/Tools.cs	(original)
+++ branches/bgarret/src/Tools.cs	Thu Feb  7 10:26:57 2008
@@ -35,25 +35,36 @@
 			}
 		}
 		
+		// TODO: a call for better logging (use the three levels, find out which messages are important and which ones are not)
 		public static void Log (object o, int level, string message)
 		{
-			if (logLevel < 0)
+			Log (o.ToString (), level, message);
+		}
+		
+		public static void Log (object o, int level, string format, params object[] args)
+		{
+			Log (o, level, String.Format (format, args));
+		}
+		
+		private static void Log (string header, int level, string format, params object[] args)
+		{
+			Log (header, level, String.Format (format, args));
+		}
+		
+		private static void Log (string header, int level, string message)
+		{
+			if (logLevel > 0)
 			{
 				if (level < 1)
 					level = 1;
 				if (level > 3)
 					level = 3;
 				
-				if (logLevel > level)
-					Console.WriteLine ("{0}: {1}", o, message);
+				if (logLevel >= level)
+					Console.WriteLine ("{0}: {1}", header, message);
 			}
 		}
 		
-		public static void Log (object o, int level, string format, params object[] args)
-		{
-			Log (o, level, String.Format (format, args));
-		}
-		
 		public static int LogLevel
 		{
 			get {

Modified: branches/bgarret/src/TracksContainer.cs
==============================================================================
--- branches/bgarret/src/TracksContainer.cs	(original)
+++ branches/bgarret/src/TracksContainer.cs	Thu Feb  7 10:26:57 2008
@@ -240,6 +240,7 @@
 				
 				foreach (Track track in tracks)
 				{
+					Tools.Log (this, 3, "Added {0}:{1}:{2}", track.Id, track.Title, track.FileName);
 					store.AppendValues (track);
 				}
 			}



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