beagle r4801 - trunk/beagle/search/Beagle.Search.Tiles



Author: dbera
Date: Fri Jul  4 22:28:44 2008
New Revision: 4801
URL: http://svn.gnome.org/viewvc/beagle?rev=4801&view=rev

Log:
Slightly alter the information for hits in beagle-search.
* For .doc, .odt, .pdf like office documents, often the document title property is incorrectly set or some autogenerated garbage. Instead of showing the title in the tile, use the filename.
* Always show the filename in the details pane; sometimes when the path is long, it is cut-off and it becomes hard to determine which file it is. Show title of the hit if it exists.


Modified:
   trunk/beagle/search/Beagle.Search.Tiles/File.cs
   trunk/beagle/search/Beagle.Search.Tiles/TextDocument.cs

Modified: trunk/beagle/search/Beagle.Search.Tiles/File.cs
==============================================================================
--- trunk/beagle/search/Beagle.Search.Tiles/File.cs	(original)
+++ trunk/beagle/search/Beagle.Search.Tiles/File.cs	Fri Jul  4 22:28:44 2008
@@ -173,7 +173,12 @@
 		{
 			DetailsPane details = new DetailsPane ();
 
-			details.AddLabelPair (Catalog.GetString ("Title:"), GetTitle (Hit));
+			details.AddLabelPair (Catalog.GetString ("File:"), hit.GetFirstProperty ("beagle:ExactFilename"));
+
+			string title = hit.GetFirstProperty ("dc:title");
+			if (! String.IsNullOrEmpty (title))
+				details.AddLabelPair (Catalog.GetString ("Title:"), title);
+
 			details.AddLabelPair (Catalog.GetString ("Last Edited:"), Utils.NiceLongDate (Timestamp));
 
 			if (Hit ["dc:author"] != null)
@@ -184,7 +189,7 @@
 
 			return details;
 		}
-		
+
 		public void FindSameAuthor()
 		{
 			SafeProcess p = new SafeProcess ();

Modified: trunk/beagle/search/Beagle.Search.Tiles/TextDocument.cs
==============================================================================
--- trunk/beagle/search/Beagle.Search.Tiles/TextDocument.cs	(original)
+++ trunk/beagle/search/Beagle.Search.Tiles/TextDocument.cs	Fri Jul  4 22:28:44 2008
@@ -40,6 +40,18 @@
 			
 		}
 		
-		
+		// These files generally have a default title or an auto-generated title.
+		// So use the filename for these types of files.
+		protected static string GetTitle (Beagle.Hit hit, bool get_parent)
+		{
+			string title;
+
+			if (get_parent)
+				title = Utils.GetFirstPropertyOfParent (hit, "beagle:ExactFilename");
+			else
+				title = hit.GetFirstProperty ("beagle:ExactFilename");
+
+			return title;
+		}
 	}
 }



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