f-spot r3653 - in trunk: . icons src src/Query src/Widgets



Author: sdelcroix
Date: Sat Feb  9 21:15:19 2008
New Revision: 3653
URL: http://svn.gnome.org/viewvc/f-spot?rev=3653&view=rev

Log:
2008-02-09  Stephane Delcroix  <sdelcroix novell com>

	* src/f-spot.glade:
	* src/Widgets/Rating.cs:
	* src/QueryWidget.cs:
	* src/Updater.cs:
	* src/PhotoQuery.cs:
	* src/MainWindow.cs:
	* src/Query/RatingRange.cs: disabling the "Unrated" concept

	* icons/Makefile.am:
	* icons/rating-junk-16.png:
	* icons/rating-unrated-16.png:
	* icons/rating-junk-bold-16.png: removing unused icons


Removed:
   trunk/icons/rating-junk-16.png
   trunk/icons/rating-junk-bold-16.png
   trunk/icons/rating-unrated-16.png
Modified:
   trunk/ChangeLog
   trunk/icons/Makefile.am
   trunk/src/MainWindow.cs
   trunk/src/PhotoQuery.cs
   trunk/src/Query/RatingRange.cs
   trunk/src/QueryWidget.cs
   trunk/src/Updater.cs
   trunk/src/Widgets/Rating.cs
   trunk/src/f-spot.glade

Modified: trunk/icons/Makefile.am
==============================================================================
--- trunk/icons/Makefile.am	(original)
+++ trunk/icons/Makefile.am	Sat Feb  9 21:15:19 2008
@@ -33,11 +33,8 @@
 	actions,object-rotate-right-24.png	\
 	actions,object-rotate-right-32.png	\
 	actions,rating-blank-16.png		\
-	actions,rating-junk-16.png		\
-	actions,rating-junk-bold-16.png		\
 	actions,rating-rated-16.png		\
 	actions,rating-rated-gray-16.png	\
-	actions,rating-unrated-16.png		\
 	actions,red-eye-remove-16.png		\
 	actions,red-eye-remove-22.png		\
 	actions,red-eye-remove-24.png		\

Modified: trunk/src/MainWindow.cs
==============================================================================
--- trunk/src/MainWindow.cs	(original)
+++ trunk/src/MainWindow.cs	Sat Feb  9 21:15:19 2008
@@ -105,7 +105,6 @@
 	[Glade.Widget] MenuItem clear_rating_filter;
 
 	[Glade.Widget] CheckMenuItem find_untagged;
-	[Glade.Widget] CheckMenuItem find_unrated;
 	
 	[Glade.Widget] MenuItem last_roll;
 	[Glade.Widget] MenuItem select_rolls;
@@ -2159,8 +2158,6 @@
 	{
 		if (find_untagged.Active != query.Untagged)
 			find_untagged.Active = query.Untagged;
-		if (find_unrated.Active != query.Unrated)
-			find_unrated.Active = query.Unrated;
 		
 		clear_date_range.Sensitive = (query.Range != null);
 		clear_rating_filter.Sensitive = (query.RatingRange != null);
@@ -2554,25 +2551,14 @@
 	}
 
 	void HandleSetRatingFilter (object sender, EventArgs args) {
-		query.Unrated = false;
-		find_unrated.Active = false;
 		RatingFilter.Set set_command = new RatingFilter.Set (query, main_window);
 		set_command.Execute ();
 	}
 
 	public void HandleClearRatingFilter (object sender, EventArgs args) {
 		query.RatingRange = null;
-		query.Unrated = false;
-		find_unrated.Active = false;
 	}
 
-	void HandleFindUnrated (object sender, EventArgs args) {
-		if (query.Unrated == find_unrated.Active)
-			return;
-
-		query.Unrated = !query.Unrated;
-	}	
-	
 	void HandleFindUntagged (object sender, EventArgs args) {
 		if (query.Untagged == find_untagged.Active)
 			return;

Modified: trunk/src/PhotoQuery.cs
==============================================================================
--- trunk/src/PhotoQuery.cs	(original)
+++ trunk/src/PhotoQuery.cs	Sat Feb  9 21:15:19 2008
@@ -161,19 +161,6 @@
 			}
 		}
 
-		public bool Unrated {
-			get {
-				return (GetCondition<RatingRange> () != null && GetCondition<RatingRange> () == RatingRange.Unrated);
-			}
-			set {
-				if (value)
-					RatingRange = RatingRange.Unrated;
-				else
-					if (UnSetCondition<RatingRange> ())
-						RequestReload ();
-			}
-		}
-		
 		public void RequestReload ()
 		{
 			if (untagged)

Modified: trunk/src/Query/RatingRange.cs
==============================================================================
--- trunk/src/Query/RatingRange.cs	(original)
+++ trunk/src/Query/RatingRange.cs	Sat Feb  9 21:15:19 2008
@@ -14,17 +14,6 @@
 {
 	public class RatingRange : IQueryCondition
 	{
-		public enum RatingType {
-			Unrated,
-			Rated
-		};
-
-		private RatingType ratetype;
-		public RatingType RateType {
-			get { return ratetype; }
-			set { ratetype = value; }
-		}
-
 		private uint minRating;		
 		public uint MinRating {
 			get { return minRating; }
@@ -37,36 +26,21 @@
 			set { maxRating = value; }
 		}
 
-		RatingRange (RatingType ratetype) {
-			this.ratetype = ratetype;
-		}
-
-		public static RatingRange Unrated = new RatingRange (RatingType.Unrated);
-
 		public RatingRange (uint min_rating)
 		{
-			this.ratetype = RatingType.Rated;
 			this.minRating = min_rating;
 			this.maxRating = System.UInt32.MaxValue;
 		}
 
 		public RatingRange (uint min_rating, uint max_rating)
 		{
-			this.ratetype = RatingType.Rated;
 			this.minRating = min_rating;
 			this.maxRating = max_rating;
 		}
 
 		public string SqlClause ()
 		{
-			switch (this.ratetype) {
-			case (RatingType.Unrated) :
-				return String.Format (" photos.rating is NULL ");
-			case (RatingType.Rated) :
-				return String.Format (" photos.rating >= {0} AND photos.rating <= {1} ", minRating, maxRating);
-			default :
-				return String.Empty;
-			}
+			return String.Format (" photos.rating >= {0} AND photos.rating <= {1} ", minRating, maxRating);
 		}
 	}
 }

Modified: trunk/src/QueryWidget.cs
==============================================================================
--- trunk/src/QueryWidget.cs	(original)
+++ trunk/src/QueryWidget.cs	Sat Feb  9 21:15:19 2008
@@ -11,7 +11,6 @@
 	        Gtk.HBox box;
 		Gtk.Label label;
 		Gtk.Label untagged;
-		Gtk.Label unrated;
 		Gtk.Label rated;
 		Gtk.Label comma1_label;
 		Gtk.Label comma2_label;
@@ -50,10 +49,6 @@
 			comma1_label.Visible = false;
 			box.PackStart (comma1_label, false, false, 0);
 
-			unrated = new Gtk.Label (Catalog.GetString ("Unrated photos"));
-			unrated.Visible = false;
-			box.PackStart (unrated, false, false, 0);
-
 			rated = new Gtk.Label (Catalog.GetString ("Rated photos"));
 			rated.Visible = false;
 			box.PackStart (rated, false, false, 0);
@@ -108,7 +103,6 @@
 			if (query.Untagged)
 				return;
 
-			query.Unrated = false;
 			query.RatingRange = null;
 			logic_widget.Clear = true;
 			logic_widget.UpdateQuery ();
@@ -131,19 +125,18 @@
 			if (query.ExtraCondition == null)
 				logic_widget.Clear = true;
 
-			if (!logic_widget.Clear || query.Untagged || (query.RollSet != null) || query.Unrated || (query.RatingRange != null)) {
+			if (!logic_widget.Clear || query.Untagged || (query.RollSet != null) || (query.RatingRange != null)) {
 		                ShowBar ();
 			} else {
 				HideBar ();
 			}
 
 			untagged.Visible = query.Untagged;
-			unrated.Visible = query.Unrated;
-			rated.Visible = (query.RatingRange != null) && !query.Unrated;
+			rated.Visible = (query.RatingRange != null);
 			warning_box.Visible = (query.Count < 1);
 			rollfilter.Visible = (query.RollSet != null);
-			comma1_label.Visible = (untagged.Visible && (unrated.Visible || rated.Visible));
-			comma2_label.Visible = (!untagged.Visible && (unrated.Visible || rated.Visible) && rollfilter.Visible) || 
+			comma1_label.Visible = (untagged.Visible && rated.Visible);
+			comma2_label.Visible = (!untagged.Visible && rated.Visible && rollfilter.Visible) || 
 					       (untagged.Visible && rollfilter.Visible);
 
 		}

Modified: trunk/src/Updater.cs
==============================================================================
--- trunk/src/Updater.cs	(original)
+++ trunk/src/Updater.cs	Sat Feb  9 21:15:19 2008
@@ -236,7 +236,12 @@
 			});
 			
 			// Update to version 13.0
-			//AddUpdate (new Version (0,0),delegate () {
+			AddUpdate (new Version (13,0), delegate () {
+				Execute ("UPDATE photos SET rating = 0 WHERE rating IS NULL");
+			});
+
+			// Update to version 14.0
+			//AddUpdate (new Version (14,0),delegate () {
 			//	do update here
 			//});
 		}

Modified: trunk/src/Widgets/Rating.cs
==============================================================================
--- trunk/src/Widgets/Rating.cs	(original)
+++ trunk/src/Widgets/Rating.cs	Sat Feb  9 21:15:19 2008
@@ -28,18 +28,22 @@
 		bool editable;
 
 		protected static int max_rating = 5;
-		protected static int min_rating = 1;
 		static Pixbuf icon_rated;
 		static Pixbuf icon_blank;
-		static Pixbuf icon_throw;
-		static Pixbuf icon_throwed;
-		static Pixbuf icon_unrated;
 
 		public event EventHandler Changed;
 		
-		public Rating () : this (-1, true) {} //Default value is NotRated, editable
-		public Rating (bool editable) : this (-1, editable) {}
-		public Rating (int rating) : this (rating, true) {} 
+		public Rating () : this (0, true)
+		{
+		}
+
+		public Rating (bool editable) : this (0, editable)
+		{
+		}
+
+		public Rating (int rating) : this (rating, true)
+		{
+		} 
 
 		public Rating (int rating, bool editable)
 		{
@@ -54,12 +58,8 @@
 			
 			display_pixbuf = new Pixbuf (Gdk.Colorspace.Rgb, true, 8, Width, Height);
 			
-			// Start display transparent
 			display_pixbuf.Fill (0xffffff00);
-			
 			DrawRating (DisplayPixbuf, Value);
-			
-			// DirectionChanged
 			Add (new Gtk.Image (display_pixbuf));
 			
 			ShowAll ();
@@ -86,26 +86,15 @@
 			// Clean pixbuf
 			pbuf.Fill (0xffffff00);
 			
-			if (val == -1 || (mouse_over && val != 0)) //NotRated or MouseOver
-				IconThrow.CopyArea (0, 0, IconRated.Width, IconRated.Height, 
-						pbuf, 0, 0);
-			if (val == 0) //Throwed
-				IconThrowed.CopyArea (0, 0, IconRated.Width, IconRated.Height, 
-						pbuf, 0, 0);
 			//Stars
 			for (int i = 0; i < MaxRating; i ++)
-				if (i <= val - MinRating)
+				if (i <= val - 1)
 					IconRated.CopyArea (0, 0, IconRated.Width, IconRated.Height, 
 							pbuf, (i + 1) * IconRated.Width, 0);
 				else {
-					if (!mouse_over && val != -1)
-						continue;
 					IconNotRated.CopyArea (0, 0, IconRated.Width, IconRated.Height, 
 							pbuf, (i + 1) * IconRated.Width, 0);
 				}
-			//Unrate button
-			IconUnrated.CopyArea (0, 0, IconUnrated.Width, IconUnrated.Height,
-							pbuf, (max_rating - min_rating + 2) * IconUnrated.Width, 0); 
 		}
 
 		public void SetValueFromPosition (int x)
@@ -118,10 +107,7 @@
 			//System.Console.WriteLine ("Rating from position >>{0}<<", (int) (x / (double)(IconRated.Width)));
 			int pos = (int) (x / (double) IconRated.Width);
 			
-			if (pos == NumLevels - 1)
-				return -1;
-			else
-				return pos;
+			return pos;
 		}
 		
 		private void HandleMouseEnter (object sender, EventArgs args)
@@ -173,7 +159,7 @@
 					return true;
 				}
 				
-				if (ek.KeyValue >= (48 + MinRating) &&
+				if (ek.KeyValue >= (48 + 1) &&
 				       ek.KeyValue <= (48 + MaxRating) &&
 				       ek.KeyValue <= 59) {
 					Value = (int) ek.KeyValue - 48;
@@ -260,11 +246,12 @@
 			get { return rating; }
 			
 			set {
+				//Console.WriteLine ("Set Rating to >>{0}<<", value);
 				// Same rating
 				if (rating == value)
 					return;
 				// Remove.trash.1-5 rating
-				if (value >= -1 && value <= max_rating) {
+				if (value >= 0 && value <= max_rating) {
 					rating = value;
 					OnChanged ();
 				}
@@ -284,25 +271,10 @@
 			get { return max_rating; }
 		}
 		
-		public int MinRating {
-			get { return min_rating; }
-		}
-		
 		public virtual int NumLevels {
-			get { return max_rating - min_rating + 3; }
+			get { return max_rating + 1; }
 		}
 		
-		public Pixbuf IconUnrated {
-			get {
-				if (icon_unrated == null)
-					icon_unrated = GtkUtil.TryLoadIcon (FSpot.Global.IconTheme, "rating-unrated", 16, (Gtk.IconLookupFlags)0);
-
-				return icon_unrated;
-			}
-
-			set { icon_unrated = value; }
-		}
-
 		public virtual Pixbuf IconRated {
 			get {
 				if (icon_rated == null)
@@ -325,28 +297,6 @@
 			set { icon_blank = value; }
 		}
 		
-		public virtual Pixbuf IconThrow {
-			get {
-				if (icon_throw == null)
-					icon_throw = GtkUtil.TryLoadIcon (FSpot.Global.IconTheme, "rating-junk", 16, (Gtk.IconLookupFlags)0);
-				
-				return icon_throw;
-			}
-			
-			set { icon_throw = value; }
-		}
-		
-		public virtual Pixbuf IconThrowed {
-			get {
-				if (icon_throwed == null)
-					icon_throwed = GtkUtil.TryLoadIcon (FSpot.Global.IconTheme, "rating-junk-bold", 16, (Gtk.IconLookupFlags)0);
-				
-				return icon_throwed;
-			}
-			
-			set { icon_throw = value; }
-		}
-		
 		public virtual int Width {
 			get { return IconRated.Width * NumLevels; }
 		}
@@ -361,21 +311,30 @@
 		static Pixbuf icon_rated_small;
 		static Pixbuf icon_blank_small;
 		
-		public RatingSmall () : base (-1) {}
-		public RatingSmall (int rating) : base (rating) {}
-		public RatingSmall (bool editable) : base (editable) {}
-		public RatingSmall (int rating, bool editable) : base (rating, editable) {}
+		public RatingSmall () : base (0)
+		{
+		}
+
+		public RatingSmall (int rating) : base (rating) 
+		{
+		}
+
+		public RatingSmall (bool editable) : base (editable)
+		{
+		}
+
+		public RatingSmall (int rating, bool editable) : base (rating, editable)
+		{
+		}
 
 		public override void DrawRating (Pixbuf pbuf, int val)
 		{
 			// Clean pixbuf
 			pbuf.Fill (0xffffff00);
 			
-			if (val == -1) //NotRated
-				return;
 			//Stars
-			for (int i = 0; i < MaxRating; i ++)
-				if (i <= val - MinRating)
+			for (int i = 1; i < MaxRating; i ++)
+				if (i <= val - 1)
 					IconRated.CopyArea (0, 0, IconRated.Width, IconRated.Height, 
 							pbuf, i * IconRated.Width, 0);
 				else
@@ -402,7 +361,7 @@
 		}
 		
 		public override int NumLevels {
-			get { return max_rating - min_rating + 1; }
+			get { return max_rating; }
 		}
 	}
 }

Modified: trunk/src/f-spot.glade
==============================================================================
--- trunk/src/f-spot.glade	(original)
+++ trunk/src/f-spot.glade	Sat Feb  9 21:15:19 2008
@@ -3712,16 +3712,6 @@
 				  </child>
 
 				  <child>
-				    <widget class="GtkCheckMenuItem" id="find_unrated">
-				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">_Unrated Photos</property>
-				      <property name="use_underline">True</property>
-				      <property name="active">False</property>
-				      <signal name="activate" handler="HandleFindUnrated"/>
-				    </widget>
-				  </child>
-
-				  <child>
 				    <widget class="GtkMenuItem" id="clear_rating_filter">
 				      <property name="visible">True</property>
 				      <property name="label" translatable="yes">_Clear Rating Filter</property>



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