f-spot r3963 - in trunk/src: . JobScheduler Utils



Author: sdelcroix
Date: Wed May 21 09:09:52 2008
New Revision: 3963
URL: http://svn.gnome.org/viewvc/f-spot?rev=3963&view=rev

Log:
moving Log in the Utils ns, some gendarme fixes here and there

Modified:
   trunk/src/GroupAdaptor.cs
   trunk/src/JobScheduler/IntervalHeap.cs
   trunk/src/JobScheduler/Scheduler.cs
   trunk/src/Makefile.am
   trunk/src/PhotoImageView.cs
   trunk/src/Utils/ConsoleCrayon.cs
   trunk/src/Utils/GnomeUtil.cs
   trunk/src/Utils/Log.cs
   trunk/src/Utils/ScreenSaver.cs
   trunk/src/main.cs

Modified: trunk/src/GroupAdaptor.cs
==============================================================================
--- trunk/src/GroupAdaptor.cs	(original)
+++ trunk/src/GroupAdaptor.cs	Wed May 21 09:09:52 2008
@@ -1,4 +1,4 @@
-
+using FSpot.Utils;
 
 namespace FSpot {
 	public interface ILimitable {

Modified: trunk/src/JobScheduler/IntervalHeap.cs
==============================================================================
--- trunk/src/JobScheduler/IntervalHeap.cs	(original)
+++ trunk/src/JobScheduler/IntervalHeap.cs	Wed May 21 09:09:52 2008
@@ -187,12 +187,12 @@
             return -1;
         }
         
-        private int GetLeftChildIndex(int index)
+        private static int GetLeftChildIndex(int index)
         {
             return index * 2 + 1;
         }
         
-        private int GetParentIndex(int index)
+        private static int GetParentIndex(int index)
         {
             return (index - 1) / 2;
         }
@@ -275,9 +275,14 @@
             public int Priority { 
                 get { return priority; }
             }
+	
+	   public override int GetHashCode ()
+	   {
+		return priority.GetHashCode () ^ item.GetHashCode ();
+	   }
         }
         
-        private class SyncIntervalHeap : IntervalHeap<T>
+        private sealed class SyncIntervalHeap : IntervalHeap<T>
         {
             private IntervalHeap<T> heap;
             
@@ -349,7 +354,7 @@
             }
         }
     
-        private class IntervalHeapEnumerator : IEnumerator<T>, IEnumerator
+        private sealed class IntervalHeapEnumerator : IEnumerator<T>, IEnumerator
         {
             private IntervalHeap<T> heap;
             private int index;
@@ -402,4 +407,4 @@
         }
     }
 }
- 
\ No newline at end of file
+ 

Modified: trunk/src/JobScheduler/Scheduler.cs
==============================================================================
--- trunk/src/JobScheduler/Scheduler.cs	(original)
+++ trunk/src/JobScheduler/Scheduler.cs	Wed May 21 09:09:52 2008
@@ -213,7 +213,7 @@
                     
                 lock(this_mutex) {
                     if(disposed) {
-                        Console.WriteLine("execution thread destroyed, dispose requested");
+                        FSpot.Utils.Log.Debug ("execution thread destroyed, dispose requested");
                         return;
                     }
                 

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Wed May 21 09:09:52 2008
@@ -273,7 +273,8 @@
 	$(GCONF_PKG)				\
 	$(LINK_DBUS)
 
-JOBSCHEDULER_ASSEMBLIES =
+JOBSCHEDULER_ASSEMBLIES =			\
+	-r:FSpot.Utils.dll
 
 WIDGETS_ASSEMBLIES =				\
 	-pkg:gtk-sharp-2.0			\
@@ -372,7 +373,7 @@
 	@echo -e "\n*** Compiling $@"
 	$(CSC_LIB) -out:$@ $(EXTRAFLAGS) $(UTILS_CSFILES) $(UTILS_ASSEMBLIES)
 
-FSpot.JobScheduler.dll: $(JOBSCHEUDLER_CSFILES)
+FSpot.JobScheduler.dll: $(JOBSCHEDULER_CSFILES) FSpot.Utils.dll
 	@echo -e "\n*** Compiling $@"
 	$(CSC_LIB) -out:$@ $(EXTRAFLAGS) $(JOBSCHEDULER_CSFILES) $(JOBSCHEDULER_ASSEMBLIES)
 

Modified: trunk/src/PhotoImageView.cs
==============================================================================
--- trunk/src/PhotoImageView.cs	(original)
+++ trunk/src/PhotoImageView.cs	Wed May 21 09:09:52 2008
@@ -1,5 +1,6 @@
 using System;
 using FSpot.Editors;
+using FSpot.Utils;
 
 namespace FSpot {
 	public enum ProgressType {

Modified: trunk/src/Utils/ConsoleCrayon.cs
==============================================================================
--- trunk/src/Utils/ConsoleCrayon.cs	(original)
+++ trunk/src/Utils/ConsoleCrayon.cs	Wed May 21 09:09:52 2008
@@ -28,7 +28,7 @@
 
 using System;
 
-namespace FSpot
+namespace FSpot.Utils
 {
     public static class ConsoleCrayon
     {
@@ -194,6 +194,7 @@
 
 #region Tests
 
+#if FALSE
         public static void Test ()
         {
             TestSelf ();
@@ -244,7 +245,7 @@
                 Console.WriteLine ();
             }
         }
-
+#endif
 #endregion
 
     }

Modified: trunk/src/Utils/GnomeUtil.cs
==============================================================================
--- trunk/src/Utils/GnomeUtil.cs	(original)
+++ trunk/src/Utils/GnomeUtil.cs	Wed May 21 09:09:52 2008
@@ -24,7 +24,7 @@
 			try {
 				Gnome.Url.Show (url);
 			} catch (Exception ge) {
-		       		System.Console.WriteLine (ge.ToString ());
+		       		Log.Exception (ge);
 		       	}
 		}
 	
@@ -43,11 +43,11 @@
 						filename,
 						link_id,
 						screen);
-			} catch {
-				Console.WriteLine (Mono.Unix.Catalog.GetString ("The \"F-Spot Manual\" could " +
+			} catch (Exception e) {
+				Log.Exception (Mono.Unix.Catalog.GetString ("The \"F-Spot Manual\" could " +
 						"not be found.  Please verify " +
 						"that your installation has been " +
-						"completed successfully."));
+						"completed successfully."), e);
 			}
 		}
 

Modified: trunk/src/Utils/Log.cs
==============================================================================
--- trunk/src/Utils/Log.cs	(original)
+++ trunk/src/Utils/Log.cs	Wed May 21 09:09:52 2008
@@ -30,15 +30,15 @@
 using System.Text;
 using System.Collections.Generic;
 
-namespace FSpot
+namespace FSpot.Utils
 {
-    public delegate void LogNotifyHandler (LogNotifyArgs args);
+    public delegate void LogNotifyHandler (LogNotifyEventArgs args);
 
-    public class LogNotifyArgs : EventArgs
+    public class LogNotifyEventArgs : EventArgs
     {
         private LogEntry entry;
         
-        public LogNotifyArgs (LogEntry entry)
+        public LogNotifyEventArgs (LogEntry entry)
         {
             this.entry = entry;
         }
@@ -147,7 +147,7 @@
         {
             LogNotifyHandler handler = Notify;
             if (handler != null) {
-                handler (new LogNotifyArgs (entry));
+                handler (new LogNotifyEventArgs (entry));
             }
         }
         
@@ -398,6 +398,10 @@
             Log.Warning (message ?? "Caught an exception", builder.ToString (), false);
         }
         
+	public static void ExceptionFormat (Exception e, string format, params object [] args)
+	{
+		Exception (String.Format (format, args), e);
+	}
         #endregion
     }
 }

Modified: trunk/src/Utils/ScreenSaver.cs
==============================================================================
--- trunk/src/Utils/ScreenSaver.cs	(original)
+++ trunk/src/Utils/ScreenSaver.cs	Wed May 21 09:09:52 2008
@@ -41,12 +41,12 @@
 			if (inhibited)
 				return cookie;
 
-			Console.WriteLine ("Inhibit screensaver for slideshow");
+			Log.Information ("Inhibit screensaver for slideshow");
 			try {
 				cookie = GnomeScreenSaver.Inhibit ("f-spot", reason);
 				inhibited = true;
 			} catch (Exception ex) {
-				Console.WriteLine ("Error Inhibiting the screenserver: {0}", ex.Message);
+				Log.Exception ("Error Inhibiting the screenserver", ex);
 			}	
 			return cookie;
 		}
@@ -55,12 +55,12 @@
 			if (!inhibited)
 				return;
 
-			Console.WriteLine ("UnInhibit screensaver");
+			Log.Information ("UnInhibit screensaver");
 			try {
 				GnomeScreenSaver.UnInhibit (cookie);
 				inhibited = false;
 			} catch (Exception ex) {
-				Console.WriteLine("Error UnInhibiting the screenserver: {0}", ex.Message);
+				Log.Exception ("Error UnInhibiting the screenserver", ex);
 			}
 		}
 	}

Modified: trunk/src/main.cs
==============================================================================
--- trunk/src/main.cs	(original)
+++ trunk/src/main.cs	Wed May 21 09:09:52 2008
@@ -1,5 +1,4 @@
 using Gtk;
-using GLib;
 using Gnome;
 using System;
 using System.Reflection;



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