[f-spot] Hide the picture tags in tag_view depending upon the tag icon preference



commit fa7657dc6686c324de69468920b9a8d142f674cc
Author: Iain Churcher <iain linux coding googlemail com>
Date:   Wed Jun 30 16:24:57 2010 +0200

    Hide the picture tags in tag_view depending upon the tag icon preference
    
    https://bugzilla.gnome.org/show_bug.cgi?id=604270

 src/MainWindow.cs      |    2 ++
 src/PhotoView.cs       |    1 +
 src/Widgets/TagView.cs |   23 ++++++++++++++++++-----
 3 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/src/MainWindow.cs b/src/MainWindow.cs
index 4a6cff8..29b1f77 100644
--- a/src/MainWindow.cs
+++ b/src/MainWindow.cs
@@ -1517,6 +1517,8 @@ namespace FSpot
 			
 			if (old_size != TagsIconSize) {
 				tag_selection_widget.ColumnsAutosize();
+				if (photo_view != null)
+					photo_view.UpdateTagView ();
 				Preferences.Set (Preferences.TAG_ICON_SIZE, TagsIconSize);
 			}
 		}
diff --git a/src/PhotoView.cs b/src/PhotoView.cs
index fa7eb56..46db068 100644
--- a/src/PhotoView.cs
+++ b/src/PhotoView.cs
@@ -205,6 +205,7 @@ namespace FSpot {
 
 		public void UpdateTagView ()
 		{
+			tag_view.DrawTags ();
 			tag_view.QueueDraw ();
 		}
 	
diff --git a/src/Widgets/TagView.cs b/src/Widgets/TagView.cs
index 0c63c24..00ddda9 100644
--- a/src/Widgets/TagView.cs
+++ b/src/Widgets/TagView.cs
@@ -19,6 +19,12 @@ public class TagView : EventBox {
 	private Tag [] tags;
 	private static int TAG_ICON_VSPACING = 5;
 	
+	private bool HideTags {
+		get { 
+			return (FSpot.Preferences.Get<int> (FSpot.Preferences.TAG_ICON_SIZE) == (int) Tag.IconSize.Hidden); 
+		}
+	}
+
 
 	public TagView ()
 	{
@@ -34,7 +40,7 @@ public class TagView : EventBox {
 		set {
 			photo = value;
 
-			if (photo != null && photo.Tags != null) {
+			if (photo != null && photo.Tags != null && !HideTags) {
 				SetSizeRequest ((thumbnail_size + TAG_ICON_VSPACING) * photo.Tags.Length,
 						thumbnail_size);
 			} else {
@@ -58,9 +64,18 @@ public class TagView : EventBox {
 		if (photo != null)
 			tags = photo.Tags;
 
-		if (tags == null)
+		if (tags == null || HideTags) {
+			SetSizeRequest(0,thumbnail_size);
 			return base.OnExposeEvent (args);
-
+		}
+		
+		DrawTags();
+		
+		return base.OnExposeEvent (args);
+	}
+	
+	public void DrawTags()
+	{
 		SetSizeRequest ((thumbnail_size + TAG_ICON_VSPACING) * tags.Length,
 				thumbnail_size);
 
@@ -100,8 +115,6 @@ public class TagView : EventBox {
 		}
 
         this.TooltipText =  String.Join (", ", names);
-
-		return base.OnExposeEvent (args);
 	}
 }
 }



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