f-spot r3980 - trunk/src
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r3980 - trunk/src
- Date: Fri, 23 May 2008 12:56:28 +0000 (UTC)
Author: sdelcroix
Date: Fri May 23 12:56:28 2008
New Revision: 3980
URL: http://svn.gnome.org/viewvc/f-spot?rev=3980&view=rev
Log:
saving ~1sec at startup
Modified:
trunk/src/Db.cs
trunk/src/DirectoryAdaptor.cs
trunk/src/GroupAdaptor.cs
trunk/src/MainWindow.cs
trunk/src/PhotoStore.cs
trunk/src/PhotoView.cs
trunk/src/TimeAdaptor.cs
trunk/src/main.cs
Modified: trunk/src/Db.cs
==============================================================================
--- trunk/src/Db.cs (original)
+++ trunk/src/Db.cs Fri May 23 12:56:28 2008
@@ -5,6 +5,7 @@
using Banshee.Database;
using System.Diagnostics;
using FSpot;
+using FSpot.Utils;
public class DbItemEventArgs {
private DbItem [] items;
@@ -222,6 +223,7 @@
public void Init (string path, bool create_if_missing)
{
+ uint timer = Log.DebugTimerStart ();
bool new_db = ! File.Exists (path);
this.path = path;
@@ -251,6 +253,7 @@
Database.CommitTransaction ();
empty = new_db;
+ Log.DebugTimerPrint (timer, "Db Initialization took {0}");
}
public void EmitDown () {
Modified: trunk/src/DirectoryAdaptor.cs
==============================================================================
--- trunk/src/DirectoryAdaptor.cs (original)
+++ trunk/src/DirectoryAdaptor.cs Fri May 23 12:56:28 2008
@@ -124,8 +124,8 @@
return 0;
}
- public DirectoryAdaptor (PhotoQuery query)
- : base (query)
+ public DirectoryAdaptor (PhotoQuery query, bool order_ascending)
+ : base (query, order_ascending)
{ }
}
}
Modified: trunk/src/GroupAdaptor.cs
==============================================================================
--- trunk/src/GroupAdaptor.cs (original)
+++ trunk/src/GroupAdaptor.cs Fri May 23 12:56:28 2008
@@ -13,7 +13,7 @@
}
}
- protected bool order_ascending = true;
+ protected bool order_ascending = false;
public bool OrderAscending {
get {
return order_ascending;
@@ -54,8 +54,9 @@
this.query.PreChanged -= HandleQueryChanged;
}
- protected GroupAdaptor (PhotoQuery query)
+ protected GroupAdaptor (PhotoQuery query, bool order_ascending)
{
+ this.order_ascending = order_ascending;
this.query = query;
this.query.PreChanged += HandleQueryChanged;
Modified: trunk/src/MainWindow.cs
==============================================================================
--- trunk/src/MainWindow.cs (original)
+++ trunk/src/MainWindow.cs Fri May 23 12:56:28 2008
@@ -344,7 +344,7 @@
#endif
group_selector = new FSpot.GroupSelector ();
- group_selector.Adaptor = new FSpot.TimeAdaptor (query);
+ group_selector.Adaptor = new FSpot.TimeAdaptor (query, (bool)Preferences.Get (Preferences.GROUP_ADAPTOR_ORDER_ASC));
group_selector.ShowAll ();
@@ -1458,6 +1458,9 @@
public void HandleRatingMenuSelected (int r)
{
+ if (view_mode == ModeType.PhotoView)
+ this.photo_view.UpdateRating(r);
+
uint timer = Log.DebugTimerStart ();
Photo p;
db.BeginTransaction ();
@@ -1467,7 +1470,6 @@
query.Commit (num);
}
db.CommitTransaction ();
- this.photo_view.UpdateRating();
Log.DebugTimerPrint (timer, "HandleRating took {0}");
}
@@ -1739,7 +1741,7 @@
group_selector.Adaptor.GlassSet -= HandleAdaptorGlassSet;
group_selector.Adaptor.Changed -= HandleAdaptorChanged;
- group_selector.Adaptor = new FSpot.TimeAdaptor (query);
+ group_selector.Adaptor = new FSpot.TimeAdaptor (query, reverse_order.Active);
group_selector.Mode = FSpot.GroupSelector.RangeType.Min;
group_selector.Adaptor.GlassSet += HandleAdaptorGlassSet;
@@ -1760,7 +1762,7 @@
group_selector.Adaptor.GlassSet -= HandleAdaptorGlassSet;
group_selector.Adaptor.Changed -= HandleAdaptorChanged;
- group_selector.Adaptor = new FSpot.DirectoryAdaptor (query);
+ group_selector.Adaptor = new FSpot.DirectoryAdaptor (query, reverse_order.Active);
group_selector.Mode = FSpot.GroupSelector.RangeType.Min;
group_selector.Adaptor.GlassSet += HandleAdaptorGlassSet;
Modified: trunk/src/PhotoStore.cs
==============================================================================
--- trunk/src/PhotoStore.cs (original)
+++ trunk/src/PhotoStore.cs Fri May 23 12:56:28 2008
@@ -517,6 +517,7 @@
public Photo [] Query (string query)
{
+ uint timer = Log.DebugTimerStart ("Query: " + query);
SqliteDataReader reader = Database.Query(query);
ArrayList version_list = new ArrayList ();
@@ -562,6 +563,7 @@
//Console.WriteLine ("Skipped Loading Data");
}
+ Log.DebugTimerPrint (timer, "Query took {0}");
return id_list.ToArray (typeof (Photo)) as Photo [];
}
@@ -661,7 +663,6 @@
query_builder.Append (String.Join (" AND ", ((String []) where_clauses.ToArray (typeof(String)))));
}
query_builder.Append (" ORDER BY photos.time");
- Log.DebugFormat ("Query: {0}", query_builder.ToString());
return Query (query_builder.ToString ());
}
}
Modified: trunk/src/PhotoView.cs
==============================================================================
--- trunk/src/PhotoView.cs (original)
+++ trunk/src/PhotoView.cs Fri May 23 12:56:28 2008
@@ -172,9 +172,14 @@
public void UpdateRating ()
{
- rating.Changed -= HandleRatingChanged;
if (Item.IsValid)
- rating.Value = (int)Item.Current.Rating;
+ UpdateRating ((int)Item.Current.Rating);
+ }
+
+ public void UpdateRating (int r)
+ {
+ rating.Changed -= HandleRatingChanged;
+ rating.Value = r;
rating.Changed += HandleRatingChanged;
}
Modified: trunk/src/TimeAdaptor.cs
==============================================================================
--- trunk/src/TimeAdaptor.cs (original)
+++ trunk/src/TimeAdaptor.cs Fri May 23 12:56:28 2008
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using FSpot.Query;
+using FSpot.Utils;
namespace FSpot {
public class TimeAdaptor : GroupAdaptor, FSpot.ILimitable {
@@ -197,6 +198,7 @@
years.Clear ();
Photo [] photos = query.Store.Query ((Tag [])null, null, null, null, null);
+
Array.Sort (query.Photos);
Array.Sort (photos);
@@ -235,8 +237,8 @@
}
- public TimeAdaptor (PhotoQuery query)
- : base (query)
+ public TimeAdaptor (PhotoQuery query, bool order_ascending)
+ : base (query, order_ascending)
{ }
}
}
Modified: trunk/src/main.cs
==============================================================================
--- trunk/src/main.cs (original)
+++ trunk/src/main.cs Fri May 23 12:56:28 2008
@@ -173,7 +173,7 @@
try {
- uint timer = Log.InformationTimerStart ("Initializing DBUs");
+ uint timer = Log.InformationTimerStart ("Initializing DBus");
try {
NDesk.DBus.BusG.Init();
} catch (Exception e) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]