beagle r4474 - in trunk/beagle/search: . Pages Tiles Tray



Author: llipka
Date: Thu Feb 14 21:07:53 2008
New Revision: 4474
URL: http://svn.gnome.org/viewvc/beagle?rev=4474&view=rev

Log:
beagle-search refactoring which will in the end lead us to our DBus instance management implementation. Still needs work.

Added:
   trunk/beagle/search/Driver.cs
      - copied, changed from r4473, /trunk/beagle/search/Search.cs
   trunk/beagle/search/ISearch.cs
Modified:
   trunk/beagle/search/Category.cs
   trunk/beagle/search/DetailsPane.cs
   trunk/beagle/search/Entry.cs
   trunk/beagle/search/GroupView.cs
   trunk/beagle/search/ListCategory.cs
   trunk/beagle/search/Makefile.am
   trunk/beagle/search/NotificationArea.cs
   trunk/beagle/search/Pages/Base.cs
   trunk/beagle/search/Pages/IndexInfo.cs
   trunk/beagle/search/Pages/NoMatch.cs
   trunk/beagle/search/Pages/QuickTips.cs
   trunk/beagle/search/Pages/RootUser.cs
   trunk/beagle/search/Pages/StartDaemon.cs
   trunk/beagle/search/Panes.cs
   trunk/beagle/search/Search.cs
   trunk/beagle/search/SortedTileList.cs
   trunk/beagle/search/Spinner.cs
   trunk/beagle/search/TileCategory.cs
   trunk/beagle/search/Tiles/ActionMenuItem.cs
   trunk/beagle/search/Tiles/Application.cs
   trunk/beagle/search/Tiles/ArchivedFile.cs
   trunk/beagle/search/Tiles/AssemblyInfo.cs
   trunk/beagle/search/Tiles/Audio.cs
   trunk/beagle/search/Tiles/CApplet.cs
   trunk/beagle/search/Tiles/Calendar.cs
   trunk/beagle/search/Tiles/Contact.cs
   trunk/beagle/search/Tiles/Docbook.cs
   trunk/beagle/search/Tiles/File.cs
   trunk/beagle/search/Tiles/Folder.cs
   trunk/beagle/search/Tiles/HitFlavor.cs
   trunk/beagle/search/Tiles/IMLog.cs
   trunk/beagle/search/Tiles/Image.cs
   trunk/beagle/search/Tiles/MailAttachment.cs
   trunk/beagle/search/Tiles/MailMessage.cs
   trunk/beagle/search/Tiles/Manpage.cs
   trunk/beagle/search/Tiles/Note.cs
   trunk/beagle/search/Tiles/OpenWithMenu.cs
   trunk/beagle/search/Tiles/Presentation.cs
   trunk/beagle/search/Tiles/RSSFeed.cs
   trunk/beagle/search/Tiles/Spreadsheet.cs
   trunk/beagle/search/Tiles/Task.cs
   trunk/beagle/search/Tiles/TextDocument.cs
   trunk/beagle/search/Tiles/ThumbnailFactory.cs
   trunk/beagle/search/Tiles/Tile.cs
   trunk/beagle/search/Tiles/TileAction.cs
   trunk/beagle/search/Tiles/TileActivator.cs
   trunk/beagle/search/Tiles/TileFlat.cs
   trunk/beagle/search/Tiles/TileGroup.cs
   trunk/beagle/search/Tiles/TileTemplate.cs
   trunk/beagle/search/Tiles/Utils.cs
   trunk/beagle/search/Tiles/Video.cs
   trunk/beagle/search/Tiles/WebHistory.cs
   trunk/beagle/search/Tray/NotificationArea.cs
   trunk/beagle/search/Tray/TrayIcon.cs
   trunk/beagle/search/TypeFilter.cs
   trunk/beagle/search/UIManager.cs
   trunk/beagle/search/WidgetFu.cs

Modified: trunk/beagle/search/Category.cs
==============================================================================
--- trunk/beagle/search/Category.cs	(original)
+++ trunk/beagle/search/Category.cs	Thu Feb 14 21:07:53 2008
@@ -1,24 +1,34 @@
+//
+// Category.cs
+//
+// Copyright (C) 2008 Lukas Lipka <lukaslipka gmail com>
+//
+
+using System;
+using System.Collections.Generic;
+
 using Gtk;
 using Gdk;
-using System;
-using System.Collections;
+
 using Mono.Unix;
 
-namespace Search {
+using Beagle.Search.Tiles;
+
+namespace Beagle.Search {
 
 	public abstract class Category : Container {
 
-		SortedTileList tiles;
-		int page;
+		private SortedTileList tiles = null;
+		private int page = 0;
 
 		protected Gtk.HBox header;
-		Gtk.Label position;
-		Gtk.Button prev, next;
-		Gtk.Expander headerExpander;
-		int fewRows, manyRows, columns;
-		int few, many;
-		bool extended, expanded;
-		ScopeType scope;
+		private Gtk.Label position;
+		private Gtk.Button prev, next;
+		private Gtk.Expander headerExpander;
+		private int fewRows, manyRows, columns;
+		private int few, many;
+		private bool extended, expanded;
+		private ScopeType scope;
 
 		public Category (Tiles.TileGroupInfo info, int columns)
 		{
@@ -49,7 +59,7 @@
 			header.Parent = this;
 			header.SizeRequested += HeaderSizeRequested;
 
-			tiles = new SortedTileList (SortType.Relevance);
+			tiles = new SortedTileList (Beagle.Search.SortType.Relevance);
 			page = 0;
 
 			fewRows = info.Rows;
@@ -76,33 +86,33 @@
 		}
 
 		public bool Expanded {
-			get {
-				return expanded;
-			}
+			get { return expanded; }
 			set {
 				expanded = value;
+
 				if (expanded)
 					ShowTiles (false);
 				else
 					HideTiles ();
+
 				headerExpander.Expanded = expanded;
 			}
 		}
 
 		protected int Columns {
-			get {
-				return columns;
-			}
+			get { return columns; }
 			set {
 				HideTiles ();
+
 				columns = value;
 				few = fewRows * columns;
 				many = manyRows * columns;
+
 				ShowTiles (true);
 			}
 		}
 
-		void HeaderSizeRequested (object obj, Gtk.SizeRequestedArgs args)
+		private void HeaderSizeRequested (object obj, Gtk.SizeRequestedArgs args)
 		{
 			Gtk.Requisition req = args.Requisition;
 			Gtk.Requisition labelReq = headerExpander.ChildRequisition;
@@ -262,13 +272,13 @@
 			}
 		}
 
-		protected IList VisibleTiles {
+		protected IList<Tile> VisibleTiles {
 			get {
 				return tiles.GetRange (FirstVisible, LastVisible - FirstVisible + 1);
 			}
 		}
 
-		public IEnumerable AllTiles {
+		public IEnumerable<Tile> AllTiles {
 			get {
 				return tiles;
 			}
@@ -316,21 +326,17 @@
 		}
 
 		public bool Empty {
-			get {
-				return tiles.Count == 0;
-			}
+			get { return tiles.Count == 0; }
 		}
 
 		public int Count {
-			get {
-				return tiles.Count;
-			}
+			get { return tiles.Count; }
 		}
 
-		public Search.SortType Sort {
+		public SortType SortType {
 			set {
 				HideTiles ();
-				tiles.Sort = value;
+				tiles.SortType = value;
 				ShowTiles (true);
 			}
 		}

Modified: trunk/beagle/search/DetailsPane.cs
==============================================================================
--- trunk/beagle/search/DetailsPane.cs	(original)
+++ trunk/beagle/search/DetailsPane.cs	Thu Feb 14 21:07:53 2008
@@ -1,9 +1,17 @@
 using System;
 
-namespace Search.Tiles {
+using Beagle.Util;
+
+namespace Beagle.Search {
 
 	public class DetailsPane : Gtk.Table {
 
+		private Gtk.Image icon;
+		private Gtk.Label snippet;
+		private Gtk.Tooltips snippet_tip;
+
+		private bool maximized = false;
+
 		public DetailsPane () : base (1, 2, false)
 		{
 			RowSpacing = ColumnSpacing = 6;
@@ -14,21 +22,9 @@
 			icon.Show ();
 			Attach (icon, 0, 1, 0, 1, fill, fill, 6, 0);
 
-			SizeRequested += DetailsSizeRequested;
-		}
-
-		private Gtk.Image icon;
-		public Gtk.Image Icon {
-			get { return icon; }
-		}
-
-		private Gtk.Label snippet;
-		public Gtk.Label Snippet {
-			get { return snippet; }
+			base.SizeRequested += DetailsSizeRequested;
 		}
 
-		bool maximized = false;
-
 		// FIXME: overriding OnSizeRequested directly results in a 0x0 req
 		[GLib.ConnectBefore]
 		private void DetailsSizeRequested (object obj, Gtk.SizeRequestedArgs args)
@@ -87,7 +83,6 @@
 
 		private const Gtk.AttachOptions expand = Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill;
 		private const Gtk.AttachOptions fill = Gtk.AttachOptions.Fill;
-
 		private uint current_row = 0;
 
 		private Gtk.Label AddGrayLabel (string text, uint row, uint column)
@@ -160,8 +155,6 @@
 			return snippet;
 		}
 
-		Gtk.Tooltips snippet_tip;
-
 		public Gtk.Label AddNewLine ()
 		{
 			Gtk.Label label = WidgetFu.NewLabel ("");
@@ -173,10 +166,17 @@
 		public void GotSnippet (string text)
 		{
 			snippet.Markup = text;
-			snippet_tip.SetTip (snippet,
-					    Beagle.Util.StringFu.ConvertSpecialEntities (text.Replace ("<b>", String.Empty).
-											 Replace ("</b>", String.Empty)),
-					    null);
+			
+			string tip = text.Replace ("<b>", String.Empty).Replace ("</b>", String.Empty);
+			snippet_tip.SetTip (snippet, StringFu.ConvertSpecialEntities (tip), null);
+		}
+
+		public Gtk.Image Icon {
+			get { return icon; }
+		}
+
+		public Gtk.Label Snippet {
+			get { return snippet; }
 		}
 	}
 }

Copied: trunk/beagle/search/Driver.cs (from r4473, /trunk/beagle/search/Search.cs)
==============================================================================
--- /trunk/beagle/search/Search.cs	(original)
+++ trunk/beagle/search/Driver.cs	Thu Feb 14 21:07:53 2008
@@ -1,86 +1,60 @@
 //
-// Search.cs
+// Driver.cs
 //
-// Copyright (c) 2006 Novell, Inc.
+// Copyright (C) 2008 Lukas Lipka <lukaslipka gmail com>
 //
 
 using System;
 using System.Reflection;
-using System.Collections;
-using System.Diagnostics;
 
-using Gtk;
+using NDesk.DBus;
 using Mono.Unix;
 
 using Beagle;
 using Beagle.Util;
 
-using Search.Tiles;
-using Search.Tray;
-
 [assembly: AssemblyTitle ("beagle-search")]
 [assembly: AssemblyDescription ("GUI interface to the Beagle search system")]
 
-namespace Search {
-
-	public class MainWindow : Window {
-
-		private Gtk.Button button;
-		private Gtk.Tooltips tips;
-		private Gtk.Notebook pages;
-		private Gtk.Statusbar statusbar;
-
-		private Search.UIManager uim;
-		private Search.NotificationArea notification_area;
-		private Search.GroupView view;
-		private Search.Entry entry;
-		private Search.Spinner spinner;
-		private Search.Panes panes;
-		private Search.Tray.TrayIcon tray;
-
-		private Search.Pages.IndexInfo indexinfo;
-		private Search.Pages.QuickTips quicktips;
-		private Search.Pages.RootUser rootuser;
-		private Search.Pages.StartDaemon startdaemon;
-		private Search.Pages.NoMatch nomatch;
-
-		private uint timeout;
-
-		private string query_text;
-		private Beagle.Query current_query;
-		private Search.ScopeType scope = ScopeType.Everything;
-		private Search.SortType sort = SortType.Modified;
-		private Search.TypeFilter filter = null;
-		private bool show_details = true;
-		private int total_matches = -1;
+namespace Beagle.Search {
 
-		private XKeybinder keybinder = new XKeybinder ();
+	public class Driver {
 
-		public static bool IconEnabled = false;
-		private static bool search_docs = false;
-
-		public static void Main (string [] args)
+		public static void Main (string[] args)
 		{
+			// Set our process name
+
 			SystemInformation.SetProcessName ("beagle-search");
+
+			// Initialize our translations catalog
+			
 			Catalog.Init ("beagle", ExternalStringsHack.LocaleDir);
 
+			// Set up DBus for our GLib main loop
+			
+			BusG.Init ();
+
+			// Parse arguments
+
 			string query = ParseArgs (args);
 
+			// Init Gnome program
+
 			Gnome.Program program = new Gnome.Program ("search", "0.0", Gnome.Modules.UI, args);
 
-			MainWindow window = new MainWindow ();
+			Search window = new Search (query);
 
-			if (query != null && query != "" && !IconEnabled) {
-				window.entry.Text = query;
-				window.Search (true);
-			}
+			//if (query != null && query != "" && !IconEnabled) {
+			//	window.entry.Text = query;
+			//	window.Search (true);
+			//}
 
 			program.Run ();
 		}
 
 		private static string ParseArgs (String[] args)
 		{
-			string query = "";
+			string query = String.Empty;
 			int i = 0;
 
 			while (i < args.Length) {
@@ -95,13 +69,13 @@
 					Environment.Exit (0);
 					break;
 
-				case "--icon":
-					IconEnabled = true;
-					break;
-
-				case "--search-docs":
-					search_docs = true;
-					break;
+					//case "--icon":
+					//IconEnabled = true;
+					//break;
+
+					//case "--search-docs":
+					//search_docs = true;
+					//break;
 
 				// Ignore session management
 				case "--sm-config-prefix":
@@ -142,509 +116,5 @@
 			Console.WriteLine (usage);
 			System.Environment.Exit (0);
 		}
-
-		public MainWindow () : base (WindowType.Toplevel)
-		{
-			Title = Catalog.GetString ("Desktop Search");
-			Icon = WidgetFu.LoadThemeIcon ("system-search", 16);
-
-			DefaultWidth = 700;
-			DefaultHeight = 550;
-			DeleteEvent += OnWindowDelete;
-			
-			VBox vbox = new VBox ();
-			vbox.Spacing = 3;
-
-			uim = new UIManager (this);
-			uim.DomainChanged += OnDomainChanged;
-			uim.ScopeChanged += OnScopeChanged;
-			uim.SortChanged += OnSortChanged;
-			uim.ToggleDetails += OnToggleDetails;
-			uim.ShowQuickTips += OnShowQuickTips;
-			uim.ShowIndexInfo += OnShowIndexInfo;
-			vbox.PackStart (uim.MenuBar, false, false, 0);
-
-			HBox hbox = new HBox (false, 6);
-			
-			Label label = new Label (Catalog.GetString ("_Find:"));
-			hbox.PackStart (label, false, false, 0);
-			
-			entry = new Entry ();
-			entry.Activated += OnEntryActivated;
-			hbox.PackStart (entry, true, true, 0);
-
-			label.MnemonicWidget = entry;
-			uim.FocusSearchEntry += delegate () { entry.GrabFocus (); };
-
-			// The auto search after timeout feauture is now optional
-			// and can be disabled.
-			if (Conf.BeagleSearch.GetOption (Conf.Names.BeagleSearchAutoSearch, true)) {
-				entry.Changed += OnEntryChanged;
-				entry.MoveCursor += OnEntryMoveCursor;
-			}
-
-			button = new Gtk.Button ();
-			Gtk.HBox button_hbox = new Gtk.HBox (false, 2);
-			Gtk.Image icon = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Button);
-			button_hbox.PackStart (icon, false, false, 0);
-			label = new Gtk.Label (Catalog.GetString ("Find Now"));
-			button_hbox.PackStart (label, false, false, 0);
-			button.Add (button_hbox);
-			button.Clicked += OnButtonClicked;
-
-			Gtk.VBox buttonVBox = new Gtk.VBox (false, 0);
-			buttonVBox.PackStart (button, true, false, 0);
-			hbox.PackStart (buttonVBox, false, false, 0);
-
-			spinner = new Spinner ();
-			hbox.PackStart (spinner, false, false, 0);
-
-			HBox padding_hbox = new HBox ();
-			padding_hbox.PackStart (hbox, true, true, 9);
-			vbox.PackStart (padding_hbox, false, true, 6);
-
-			VBox view_box = new VBox (false, 3);
-			vbox.PackStart (view_box, true, true, 0);
-
-			HBox na_padding = new HBox ();
-			view_box.PackStart (na_padding, false, true, 0);
-
-			notification_area = new NotificationArea ();
-			na_padding.PackStart (notification_area, true, true, 3);
-
-			pages = new Gtk.Notebook ();
-			pages.ShowTabs = false;
-			pages.ShowBorder = false;
-			pages.BorderWidth = 3;
-			view_box.PackStart (pages, true, true, 0);
-
-			quicktips = new Pages.QuickTips ();
-			quicktips.Show ();
-			pages.Add (quicktips);
-
-			indexinfo = new Pages.IndexInfo ();
-			indexinfo.Show ();
-			pages.Add (indexinfo);
-
-			rootuser = new Pages.RootUser ();
-			rootuser.Show ();
-			pages.Add (rootuser);
-
-			startdaemon = new Pages.StartDaemon ();
-			startdaemon.DaemonStarted += OnDaemonStarted;
-			startdaemon.Show ();
-			pages.Add (startdaemon);
-
-			panes = new Search.Panes ();
-			panes.Show ();
-			pages.Add (panes);
-
-			view = new GroupView ();
-			view.TileSelected += ShowInformation;
-			view.CategoryToggled += OnCategoryToggled;
-			panes.MainContents = view;
-
-			this.statusbar = new Gtk.Statusbar ();
-			vbox.PackEnd (this.statusbar, false, false, 0);
-			
-			Add (vbox);
-
-			tips = new Gtk.Tooltips ();
-			tips.SetTip (entry, Catalog.GetString ("Type in search terms"), "");
-			tips.SetTip (button, Catalog.GetString ("Start searching"), "");
-			tips.Enable ();
-
-			if (Environment.UserName == "root" &&
-			    ! Conf.Daemon.GetOption (Conf.Names.AllowRoot, false)) {
-				pages.CurrentPage = pages.PageNum (rootuser);
-				entry.Sensitive = button.Sensitive = uim.Sensitive = false;
-			} else {
-				pages.CurrentPage = pages.PageNum (quicktips);
-			}
-
-			if (IconEnabled) {
-				tray = new Search.Tray.TrayIcon ();
-				tray.Clicked += OnTrayActivated;
-				tray.Search += OnTraySearch;
-
-				Config config = Conf.Get (Conf.Names.BeagleSearchConfig);
-				bool binding_ctrl = config.GetOption (Conf.Names.KeyBinding_Ctrl, false);
-				bool binding_alt = config.GetOption (Conf.Names.KeyBinding_Alt, false);
-				string binding_key = config.GetOption (Conf.Names.KeyBinding_Key, "F12");
-
-				string binding = new KeyBinding (binding_key, binding_ctrl, binding_alt).ToString ();
-				string tip_text = Catalog.GetString ("Desktop Search");
-
-				if (binding != String.Empty) {
-					tip_text += String.Format (" ({0})", binding);
-
-					// Attach the hide/show keybinding
-					keybinder.Bind (binding, OnTrayActivated);
-				}
-
-				tray.TooltipText = tip_text;
-			} else {
-				ShowAll ();
-			}
-
-			StartCheckingIndexingStatus ();
-		}
-
-		private void SetWindowTitle (string query)
-		{
-			Title = String.Format ( Catalog.GetString ("Desktop Search: {0}"), query);
-		}
-
-		private int TotalMatches {
-			get { return this.total_matches; }
-			set {
-				if (this.total_matches != -1)
-					this.statusbar.Pop (0);
-
-				this.total_matches = value;
-				
-				if (this.total_matches > -1) {
-					string message;
-					int tile_count = view.TileCount;
-
-					if (tile_count == this.total_matches)
-						message = String.Format (Catalog.GetPluralString ("Showing {0} match", "Showing all {0} matches", this.total_matches), this.total_matches);
-					else
-						message = String.Format (Catalog.GetPluralString ("Showing the top {0} of {1} total matches", "Showing the top {0} of {1} total matches", this.total_matches), view.TileCount, this.total_matches);
-
-					this.statusbar.Push (0, message);
-				}
-			}
-		}
-
-		private void DetachQuery ()
-		{
-			if (current_query != null) {
-				TotalMatches = -1;
-				current_query.HitsAddedEvent -= OnHitsAdded;
-				current_query.HitsSubtractedEvent -= OnHitsSubtracted;
-				current_query.Close ();
-			}
-		}
-
-		// Whether we should grab focus from the text entry
-		private bool grab_focus;
-
-		private void Search (bool grab_focus)
-		{
-			if (timeout != 0) {
-				GLib.Source.Remove (timeout);
-				timeout = 0;
-			}
-
-			string query = query_text = entry.Text;
-			if (query == null || query == "")
-				return;
-
-			SetWindowTitle (query);
-			ShowInformation (null);
-
-			if (tray != null) {
-				tray.AddSearch (query);
-			}
-
-			filter = TypeFilter.MakeFilter (ref query);
-
-			view.Clear ();
-			view.Scope = scope;
-			view.Sort = sort;
-			pages.CurrentPage = pages.PageNum (panes);
-
-			this.grab_focus = grab_focus;
-
-			try {
-				// Clean up our previous query, if any exists.
-				DetachQuery ();
-
-				TotalMatches = 0;
-
-				current_query = new Query ();
-				current_query.AddDomain (QueryDomain.Neighborhood);
-
-				// Don't search documentation by default
-				if (! search_docs) {
-					QueryPart_Property part = new QueryPart_Property ();
-					part.Logic = QueryPartLogic.Prohibited;
-					part.Type = PropertyType.Keyword;
-					part.Key = "beagle:Source";
-					part.Value = "documentation";
-					current_query.AddPart (part);
-				}
-
-				current_query.AddText (query);
-				current_query.HitsAddedEvent += OnHitsAdded;
-				current_query.HitsSubtractedEvent += OnHitsSubtracted;
-				current_query.FinishedEvent += OnFinished;
-
-				current_query.SendAsync ();
-				spinner.Start ();
-			} catch (Beagle.ResponseMessageException) {
-				pages.CurrentPage = pages.PageNum (startdaemon);
-			} catch (Exception e) {
-				Console.WriteLine ("Querying the Beagle daemon failed: {0}", e.Message);
-			}
-		}
-
-		private void OnEntryActivated (object obj, EventArgs args)
-		{
-			Search (true);
-		}
-
-		private void OnDaemonStarted ()
-		{
-			Search (true);
-		}
-
-		private void OnEntryChanged (object obj, EventArgs args)
-		{
-			if (timeout != 0)
-				GLib.Source.Remove (timeout);
-			timeout = GLib.Timeout.Add (1000, OnEntryTimeout);
-		}
-
-		private void OnEntryMoveCursor (object obj, EventArgs args)
-		{
-			if (timeout != 0)
-				GLib.Source.Remove (timeout);
-			timeout = GLib.Timeout.Add (1000, OnEntryTimeout);
-		}
-
-		private bool OnEntryTimeout ()
-		{
-			timeout = 0;
-			Search (false);
-			return false;
-		}
-
-		private void OnButtonClicked (object obj, EventArgs args)
-		{
-			Search (true);
-		}
-
-		private void OnWindowDelete (object o, Gtk.DeleteEventArgs args)
-		{
-			if (IconEnabled) {
-				Hide ();
-				args.RetVal = true;
-			} else {
-				Gtk.Application.Quit ();
-			}
-		}
-
-		private void OnScopeChanged (Search.ScopeType toggled, bool active)
-		{
-			if (active)
-				view.Scope = scope = scope | toggled;
-			else
-				view.Scope = scope = scope ^ toggled;
-			
-			CheckNoMatch ();
-		}
-		
-		private void OnCategoryToggled (ScopeType toggled)
-		{
-			string name =  ScopeType.GetName (typeof (ScopeType), toggled);
-			try {
-				ToggleAction act = (ToggleAction) uim.GetAction ("/ui/MenuBar/Search/Scope/" +  name);
-				act.Active = ! act.Active;
-			}
-			catch (Exception ex) {
-				Console.WriteLine("Exception caught when trying to deactivate menu entry {0}:",name);
-				Console.WriteLine(ex);
-				return;
-			}
-		}
-		
-		private void OnSortChanged (Search.SortType newSort)
-		{
-			view.Sort = sort = newSort;
-		}
-
-		private void OnToggleDetails (bool active)
-		{
-			show_details = active;
-			if (panes.Details != null)
-				panes.ToggleDetails (show_details);
-			else
-				panes.ToggleDetails (false);
-		}
-
-		private void OnShowQuickTips ()
-		{
-			DetachQuery ();
-			pages.CurrentPage = pages.PageNum (quicktips);
-		}
-		
-		private void OnShowIndexInfo ()
-		{
-			DetachQuery ();
-			
-			if (! indexinfo.Refresh ())
-				pages.CurrentPage = pages.PageNum (startdaemon);
-			else
-				pages.CurrentPage = pages.PageNum (indexinfo);
-		}
-		
-		private void OnDomainChanged (QueryDomain domain, bool active)
-		{
-			if (current_query == null)
-				return;
-			
-			// FIXME: Most likely refire the query.
-			// Also keep the setting, so it can be used for future queries
-			// in this running instance.
-			
-			if (active)
-				current_query.AddDomain (domain);
-			else
-				current_query.RemoveDomain (domain);
-		}
-		
-		private void ShowInformation (Tiles.Tile tile)
-		{
-			if (tile != null) {
-				panes.Details = tile.Details;
-				if (tile.Details != null)
-					panes.ToggleDetails (show_details);
-				else
-					panes.ToggleDetails (false);
-			} else {
-				panes.Details = null;
-				panes.ToggleDetails (false);
-			}
-		}
-
-		private void OnFinished (FinishedResponse response)
-		{
-			spinner.Stop ();
-			view.Finished (grab_focus);
-			grab_focus = false;
-
-			CheckNoMatch ();
-		}
-
-		private void OnHitsAdded (HitsAddedResponse response)
-		{
-			foreach (Hit hit in response.Hits) {
-				Tile tile = TileActivatorOrg.MakeTile (hit, current_query);
-
-				if (tile == null) {
-					Console.WriteLine ("No tile found for: {0} ({1})", hit.Uri, hit.Type);
-					continue;
-				}
-
-				if (filter != null && !filter.Filter (tile))
-					continue;
-
-				view.AddHit (tile);
-
-				if (pages.CurrentPageWidget != panes)
-					pages.CurrentPage = pages.PageNum (panes);
-			}
-
-			if (response.NumMatches != -1)
-				TotalMatches += response.NumMatches;
-		}
-
-		private void OnHitsSubtracted (HitsSubtractedResponse response)
-		{
-			foreach (Uri uri in response.Uris)
-				view.SubtractHit (uri);
-
-			TotalMatches -= response.Uris.Count;
-
-			CheckNoMatch ();
-		}
-
-#if ENABLE_AVAHI
-                private void OnUnknownHostFound (object sender, AvahiEventArgs args)
-                {
-			NotificationMessage m = new NotificationMessage ();
-			m.Pixbuf = WidgetFu.LoadThemeIcon ("network-workgroup", 48);
-			m.Title = Catalog.GetString ("There are computers near you running Beagle");
-			m.Message = Catalog.GetString ("You can select to search other computers from the \"Search\" menu.");
-			m.AddAction ("Configure", OnNetworkConfigure);
-			notification_area.Display (m);
-		}
-
-		private void OnNetworkConfigure (object o, EventArgs args)
-		{
-			Process p = new Process ();
-			p.StartInfo.UseShellExecute = false;
-			p.StartInfo.FileName = "beagle-settings";
-			p.StartInfo.Arguments = "--networking";
-
-			try {
-				p.Start ();
-			} catch (Exception e) {
-				Console.WriteLine ("Could not start beagle-settings: {0}", e);
-			}
-                }
-#endif
-
-		private void CheckNoMatch ()
-		{
-			MatchType matches = view.MatchState;
-			if (matches == MatchType.Matched) {
-				pages.CurrentPage = pages.PageNum (panes);
-				return;
-			}
-
-			if (nomatch != null)
-				nomatch.Destroy ();
-			nomatch = new Pages.NoMatch (query_text, matches == MatchType.NoneInScope);
-			nomatch.Show ();
-			pages.Add (nomatch);
-			pages.CurrentPage = pages.PageNum (nomatch);
-		}
-
-		/////////////////////////////////////
-
-		private void OnTrayActivated (object o, EventArgs args)
-		{
-			if (! Visible) {
-				base.ShowAll ();
-				base.Present ();
-				entry.GrabFocus ();
-			} else {
-				base.Hide ();
-			}
-		}
-
-		private void OnTraySearch (string query)
-		{
-			if (!Visible)
-				ShowAll ();
-
-			entry.Text = query;
-			Search (true);
-		}
-
-		//////////////////////////////////////
-
-		private void StartCheckingIndexingStatus ()
-		{
-			InformationalMessagesRequest msg_request = new InformationalMessagesRequest ();
-			msg_request.IndexingStatusEvent += OnIndexingStatusEvent;
-			msg_request.SendAsync ();
-		}
-
-		private void OnIndexingStatusEvent (IndexingStatus status)
-		{
-			if (status == IndexingStatus.Running) {
-				NotificationMessage m = new NotificationMessage ();
-				m.Icon = Gtk.Stock.DialogInfo;
-				m.Title = Catalog.GetString ("Your data is being indexed");
-				m.Message = Catalog.GetString ("The search service is in the process of indexing your data.  Search results may be incomplete until indexing has finished.");
-				notification_area.Display (m);
-			} else {
-				notification_area.Hide ();
-			}
-		}
 	}
 }

Modified: trunk/beagle/search/Entry.cs
==============================================================================
--- trunk/beagle/search/Entry.cs	(original)
+++ trunk/beagle/search/Entry.cs	Thu Feb 14 21:07:53 2008
@@ -1,14 +1,16 @@
 using System;
 using System.Runtime.InteropServices;
 
-namespace Search {
+namespace Beagle.Search {
 
 	public class Entry : Gtk.Entry {
 
-		public Entry (IntPtr raw) : base (raw) {}
+		// FIXME: How about a managed implementation of this?
+		// Anyone? :-)
 
-		[DllImport("libbeagleuiglue.so")]
-		static extern IntPtr search_entry_new ();
+		public Entry (IntPtr raw) : base (raw)
+		{
+		}
 
 		public Entry () : base (IntPtr.Zero)
 		{
@@ -16,16 +18,18 @@
 				CreateNativeObject (new string [0], new GLib.Value[0]);
 				return;
 			}
+
 			Raw = search_entry_new ();
 		}
 
 		[DllImport("libbeagleuiglue.so")]
+		static extern IntPtr search_entry_new ();
+
+		[DllImport("libbeagleuiglue.so")]
 		static extern IntPtr search_entry_get_type();
 
 		public static new GLib.GType GType { 
-			get {
-				return new GLib.GType (search_entry_get_type ());
-			}
+			get { return new GLib.GType (search_entry_get_type ());	}
 		}
 	}
 }

Modified: trunk/beagle/search/GroupView.cs
==============================================================================
--- trunk/beagle/search/GroupView.cs	(original)
+++ trunk/beagle/search/GroupView.cs	Thu Feb 14 21:07:53 2008
@@ -1,14 +1,15 @@
 using System;
 using System.Collections;
 
-using Mono.Posix;
 using Gtk;
+using Mono.Posix;
+
 using Beagle;
-using Search.Tiles;
+using Beagle.Search.Tiles;
 
-namespace Search {
+namespace Beagle.Search {
 
-	public delegate void TileHandler (Tiles.Tile tile);
+	public delegate void TileHandler (Tile tile);
 
 	public enum MatchType {
 		None,
@@ -32,10 +33,10 @@
 			categories = new Hashtable ();
 			tileSizeGroup = new Gtk.SizeGroup (Gtk.SizeGroupMode.Both);			
 
-			foreach (Tiles.TileGroupInfo info in Tiles.Utils.GroupInfo) {
+			foreach (TileGroupInfo info in Utils.GroupInfo) {
 				Category box = null;
 								
-				if (info.Group == Tiles.TileGroup.Conversations)
+				if (info.Group == TileGroup.Conversations)
 					box = new ListCategory (info);
 				else
 					box = new TileCategory (info, tileSizeGroup);
@@ -48,7 +49,7 @@
 			}
 		}
 		
-		public void AddHit (Tiles.Tile tile)
+		public void AddHit (Tile tile)
 		{
 			tile.Show ();
 			tile.Selected += OnTileSelected;
@@ -132,7 +133,7 @@
 				return;
 
 			if (TileSelected != null)
-				TileSelected ((Tiles.Tile)tile);
+				TileSelected ((Tile)tile);
 
 			if (selection != null)
 				selection.State = StateType.Normal;
@@ -163,10 +164,10 @@
 			return (scope & scopetype) == scopetype;
 		}
 
-		public SortType Sort {
+		public SortType SortType {
 			set {
 				foreach (Category category in categories.Values)
-					category.Sort = value;
+					category.SortType = value;
 			}
 		}
 

Added: trunk/beagle/search/ISearch.cs
==============================================================================
--- (empty file)
+++ trunk/beagle/search/ISearch.cs	Thu Feb 14 21:07:53 2008
@@ -0,0 +1,16 @@
+//
+// ISearch.cs
+//
+// Copyright (C) 2008 Lukas Lipka <lukaslipka gmail com>
+//
+
+using System;
+
+using NDesk.DBus;
+using org.freedesktop.DBus;
+
+namespace Beagle.Search {
+
+	public interface ISearch {
+	}
+}

Modified: trunk/beagle/search/ListCategory.cs
==============================================================================
--- trunk/beagle/search/ListCategory.cs	(original)
+++ trunk/beagle/search/ListCategory.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 using System;
 using System.Collections;
 
-namespace Search {
+namespace Beagle.Search {
 
 	public class ListCategory : Category {
 

Modified: trunk/beagle/search/Makefile.am
==============================================================================
--- trunk/beagle/search/Makefile.am	(original)
+++ trunk/beagle/search/Makefile.am	Thu Feb 14 21:07:53 2008
@@ -38,9 +38,11 @@
 
 CSFILES =					\
 	$(srcdir)/Category.cs			\
+	$(srcdir)/Driver.cs			\
 	$(srcdir)/DetailsPane.cs		\
 	$(srcdir)/Entry.cs			\
 	$(srcdir)/GroupView.cs			\
+	$(srcdir)/ISearch.cs			\
 	$(srcdir)/ListCategory.cs		\
 	$(srcdir)/NotificationArea.cs		\
 	$(srcdir)/Panes.cs			\
@@ -111,6 +113,8 @@
 ASSEMBLIES =				\
 	$(BEAGLE_UI_LIBS)		\
 	$(LOCAL_ASSEMBLIES:%=-r:%)	\
+	$(NDESK_DBUS_LIBS)		\
+	$(NDESK_DBUS_GLIB_LIBS)		\
 	-r:Mono.Posix
 
 Search.exe: $(CSFILES) $(TILES) $(PAGES) $(TRAY) $(LOCAL_ASSEMBLIES)

Modified: trunk/beagle/search/NotificationArea.cs
==============================================================================
--- trunk/beagle/search/NotificationArea.cs	(original)
+++ trunk/beagle/search/NotificationArea.cs	Thu Feb 14 21:07:53 2008
@@ -10,7 +10,7 @@
 using Gtk;
 using Mono.Unix;
 
-namespace Search {
+namespace Beagle.Search {
 
 	public class NotificationMessage : HBox {
 

Modified: trunk/beagle/search/Pages/Base.cs
==============================================================================
--- trunk/beagle/search/Pages/Base.cs	(original)
+++ trunk/beagle/search/Pages/Base.cs	Thu Feb 14 21:07:53 2008
@@ -2,7 +2,7 @@
 using System;
 using Mono.Unix;
 
-namespace Search.Pages {
+namespace Beagle.Search.Pages {
 
 	public class Base : EventBox {
 

Modified: trunk/beagle/search/Pages/IndexInfo.cs
==============================================================================
--- trunk/beagle/search/Pages/IndexInfo.cs	(original)
+++ trunk/beagle/search/Pages/IndexInfo.cs	Thu Feb 14 21:07:53 2008
@@ -14,7 +14,7 @@
 
 using Beagle;
 
-namespace Search.Pages {
+namespace Beagle.Search.Pages {
 
 	public class IndexInfo : Base {
 

Modified: trunk/beagle/search/Pages/NoMatch.cs
==============================================================================
--- trunk/beagle/search/Pages/NoMatch.cs	(original)
+++ trunk/beagle/search/Pages/NoMatch.cs	Thu Feb 14 21:07:53 2008
@@ -2,7 +2,7 @@
 using System;
 using Mono.Unix;
 
-namespace Search.Pages {
+namespace Beagle.Search.Pages {
 
 	public class NoMatch : Base {
 

Modified: trunk/beagle/search/Pages/QuickTips.cs
==============================================================================
--- trunk/beagle/search/Pages/QuickTips.cs	(original)
+++ trunk/beagle/search/Pages/QuickTips.cs	Thu Feb 14 21:07:53 2008
@@ -2,7 +2,7 @@
 using System;
 using Mono.Unix;
 
-namespace Search.Pages {
+namespace Beagle.Search.Pages {
 
 	public class QuickTips : Base {
 

Modified: trunk/beagle/search/Pages/RootUser.cs
==============================================================================
--- trunk/beagle/search/Pages/RootUser.cs	(original)
+++ trunk/beagle/search/Pages/RootUser.cs	Thu Feb 14 21:07:53 2008
@@ -2,7 +2,7 @@
 using System;
 using Mono.Unix;
 
-namespace Search.Pages {
+namespace Beagle.Search.Pages {
 
 	public class RootUser : Base {
 

Modified: trunk/beagle/search/Pages/StartDaemon.cs
==============================================================================
--- trunk/beagle/search/Pages/StartDaemon.cs	(original)
+++ trunk/beagle/search/Pages/StartDaemon.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 using Mono.Unix;
 using Gtk;
 
-namespace Search.Pages {
+namespace Beagle.Search.Pages {
 
 	public delegate void DaemonStarted ();
 

Modified: trunk/beagle/search/Panes.cs
==============================================================================
--- trunk/beagle/search/Panes.cs	(original)
+++ trunk/beagle/search/Panes.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 using System;
 using System.Collections;
 
-namespace Search {
+namespace Beagle.Search {
 
 	public class Panes : Gtk.VPaned {
 

Modified: trunk/beagle/search/Search.cs
==============================================================================
--- trunk/beagle/search/Search.cs	(original)
+++ trunk/beagle/search/Search.cs	Thu Feb 14 21:07:53 2008
@@ -2,55 +2,54 @@
 // Search.cs
 //
 // Copyright (c) 2006 Novell, Inc.
+// Copyright (C) 2008 Lukas Lipka <lukaslipka gmail com>
 //
 
 using System;
-using System.Reflection;
 using System.Collections;
 using System.Diagnostics;
 
 using Gtk;
+using NDesk.DBus;
 using Mono.Unix;
 
 using Beagle;
 using Beagle.Util;
 
-using Search.Tiles;
-using Search.Tray;
+using Beagle.Search.Tiles;
+using Beagle.Search.Tray;
 
-[assembly: AssemblyTitle ("beagle-search")]
-[assembly: AssemblyDescription ("GUI interface to the Beagle search system")]
+namespace Beagle.Search {
 
-namespace Search {
-
-	public class MainWindow : Window {
+	public class Search : Window, ISearch {
 
 		private Gtk.Button button;
 		private Gtk.Tooltips tips;
 		private Gtk.Notebook pages;
 		private Gtk.Statusbar statusbar;
 
-		private Search.UIManager uim;
-		private Search.NotificationArea notification_area;
-		private Search.GroupView view;
-		private Search.Entry entry;
-		private Search.Spinner spinner;
-		private Search.Panes panes;
-		private Search.Tray.TrayIcon tray;
-
-		private Search.Pages.IndexInfo indexinfo;
-		private Search.Pages.QuickTips quicktips;
-		private Search.Pages.RootUser rootuser;
-		private Search.Pages.StartDaemon startdaemon;
-		private Search.Pages.NoMatch nomatch;
-
-		private uint timeout;
-
-		private string query_text;
-		private Beagle.Query current_query;
-		private Search.ScopeType scope = ScopeType.Everything;
-		private Search.SortType sort = SortType.Modified;
-		private Search.TypeFilter filter = null;
+		private Beagle.Search.UIManager uim;
+		private Beagle.Search.NotificationArea notification_area;
+		private Beagle.Search.GroupView view;
+		private Beagle.Search.Entry entry;
+		private Beagle.Search.Spinner spinner;
+		private Beagle.Search.Panes panes;
+		private Beagle.Search.Tray.TrayIcon tray;
+
+		private Beagle.Search.Pages.IndexInfo indexinfo;
+		private Beagle.Search.Pages.QuickTips quicktips;
+		private Beagle.Search.Pages.RootUser rootuser;
+		private Beagle.Search.Pages.StartDaemon startdaemon;
+		private Beagle.Search.Pages.NoMatch nomatch;
+
+		private Beagle.Search.ScopeType scope = ScopeType.Everything;
+		private Beagle.Search.SortType sort = SortType.Modified;
+		private Beagle.Search.TypeFilter filter = null;
+
+		private uint timeout_id = 0;
+
+		private Beagle.Query current_query = null;
+		private string query_text = null;
 		private bool show_details = true;
 		private int total_matches = -1;
 
@@ -59,91 +58,7 @@
 		public static bool IconEnabled = false;
 		private static bool search_docs = false;
 
-		public static void Main (string [] args)
-		{
-			SystemInformation.SetProcessName ("beagle-search");
-			Catalog.Init ("beagle", ExternalStringsHack.LocaleDir);
-
-			string query = ParseArgs (args);
-
-			Gnome.Program program = new Gnome.Program ("search", "0.0", Gnome.Modules.UI, args);
-
-			MainWindow window = new MainWindow ();
-
-			if (query != null && query != "" && !IconEnabled) {
-				window.entry.Text = query;
-				window.Search (true);
-			}
-
-			program.Run ();
-		}
-
-		private static string ParseArgs (String[] args)
-		{
-			string query = "";
-			int i = 0;
-
-			while (i < args.Length) {
-				switch (args [i]) {
-				case "--help":
-				case "--usage":
-					PrintUsageAndExit ();
-					return null;
-
-				case "--version":
-					VersionFu.PrintVersion ();
-					Environment.Exit (0);
-					break;
-
-				case "--icon":
-					IconEnabled = true;
-					break;
-
-				case "--search-docs":
-					search_docs = true;
-					break;
-
-				// Ignore session management
-				case "--sm-config-prefix":
-				case "--sm-client-id":
-				case "--screen":
-					// These all take an argument, so
-					// increment i
-					i++;
-					break;
-
-				default:
-					if (args [i].Length < 2 || args [i].Substring (0, 2) != "--") {
-						if (query.Length != 0)
-							query += " ";
-						query += args [i];
-					}
-					break;
-				}
-
-				i++;
-			}
-
-			return query;
-		}
-
-		public static void PrintUsageAndExit ()
-		{
-			VersionFu.PrintHeader ();
-
-			string usage =
-				"Usage: beagle-search [OPTIONS] [<query string>]\n\n" +
-				"Options:\n" +
-				"  --icon\t\t\tAdd an icon to the notification area rather than opening a search window.\n" +
-				"  --search-docs\t\t\tAlso search the system-wide documentation index.\n" +
-				"  --help\t\t\tPrint this usage message.\n" +
-				"  --version\t\t\tPrint version information.\n";
-
-			Console.WriteLine (usage);
-			System.Environment.Exit (0);
-		}
-
-		public MainWindow () : base (WindowType.Toplevel)
+		public Search (string query_text) : base (WindowType.Toplevel)
 		{
 			Title = Catalog.GetString ("Desktop Search");
 			Icon = WidgetFu.LoadThemeIcon ("system-search", 16);
@@ -178,9 +93,10 @@
 
 			// The auto search after timeout feauture is now optional
 			// and can be disabled.
+
 			if (Conf.BeagleSearch.GetOption (Conf.Names.BeagleSearchAutoSearch, true)) {
-				entry.Changed += OnEntryChanged;
-				entry.MoveCursor += OnEntryMoveCursor;
+				entry.Changed += OnEntryResetTimeout;
+				entry.MoveCursor += OnEntryResetTimeout;
 			}
 
 			button = new Gtk.Button ();
@@ -235,7 +151,7 @@
 			startdaemon.Show ();
 			pages.Add (startdaemon);
 
-			panes = new Search.Panes ();
+			panes = new Beagle.Search.Panes ();
 			panes.Show ();
 			pages.Add (panes);
 
@@ -263,7 +179,7 @@
 			}
 
 			if (IconEnabled) {
-				tray = new Search.Tray.TrayIcon ();
+				tray = new Beagle.Search.Tray.TrayIcon ();
 				tray.Clicked += OnTrayActivated;
 				tray.Search += OnTraySearch;
 
@@ -330,11 +246,11 @@
 		// Whether we should grab focus from the text entry
 		private bool grab_focus;
 
-		private void Search (bool grab_focus)
+		private void Query (bool grab_focus)
 		{
-			if (timeout != 0) {
-				GLib.Source.Remove (timeout);
-				timeout = 0;
+			if (timeout_id != 0) {
+				GLib.Source.Remove (timeout_id);
+				timeout_id = 0;
 			}
 
 			string query = query_text = entry.Text;
@@ -352,7 +268,7 @@
 
 			view.Clear ();
 			view.Scope = scope;
-			view.Sort = sort;
+			view.SortType = sort;
 			pages.CurrentPage = pages.PageNum (panes);
 
 			this.grab_focus = grab_focus;
@@ -392,38 +308,33 @@
 
 		private void OnEntryActivated (object obj, EventArgs args)
 		{
-			Search (true);
+			Query (true);
 		}
 
 		private void OnDaemonStarted ()
 		{
-			Search (true);
+			Query (true);
 		}
 
-		private void OnEntryChanged (object obj, EventArgs args)
+		private void OnEntryResetTimeout (object o, EventArgs args)
 		{
-			if (timeout != 0)
-				GLib.Source.Remove (timeout);
-			timeout = GLib.Timeout.Add (1000, OnEntryTimeout);
-		}
+			if (timeout_id != 0)
+				GLib.Source.Remove (timeout_id);
 
-		private void OnEntryMoveCursor (object obj, EventArgs args)
-		{
-			if (timeout != 0)
-				GLib.Source.Remove (timeout);
-			timeout = GLib.Timeout.Add (1000, OnEntryTimeout);
+			timeout_id = GLib.Timeout.Add (1000, OnEntryTimeout);
 		}
 
 		private bool OnEntryTimeout ()
 		{
-			timeout = 0;
-			Search (false);
+			timeout_id = 0;
+			Query (false);
+
 			return false;
 		}
 
 		private void OnButtonClicked (object obj, EventArgs args)
 		{
-			Search (true);
+			Query (true);
 		}
 
 		private void OnWindowDelete (object o, Gtk.DeleteEventArgs args)
@@ -436,12 +347,13 @@
 			}
 		}
 
-		private void OnScopeChanged (Search.ScopeType toggled, bool active)
+		private void OnScopeChanged (ScopeType toggled, bool active)
 		{
-			if (active)
+			if (active) {
 				view.Scope = scope = scope | toggled;
-			else
+			} else {
 				view.Scope = scope = scope ^ toggled;
+			}
 			
 			CheckNoMatch ();
 		}
@@ -449,20 +361,19 @@
 		private void OnCategoryToggled (ScopeType toggled)
 		{
 			string name =  ScopeType.GetName (typeof (ScopeType), toggled);
+
 			try {
 				ToggleAction act = (ToggleAction) uim.GetAction ("/ui/MenuBar/Search/Scope/" +  name);
-				act.Active = ! act.Active;
-			}
-			catch (Exception ex) {
-				Console.WriteLine("Exception caught when trying to deactivate menu entry {0}:",name);
-				Console.WriteLine(ex);
-				return;
+				act.Active = !act.Active;
+			} catch (Exception e) {
+				Console.WriteLine ("Exception caught when trying to deactivate menu entry {0}:",name);
+				Console.WriteLine (e);
 			}
 		}
 		
-		private void OnSortChanged (Search.SortType newSort)
+		private void OnSortChanged (SortType value)
 		{
-			view.Sort = sort = newSort;
+			view.SortType = sort = value;
 		}
 
 		private void OnToggleDetails (bool active)
@@ -622,7 +533,7 @@
 				ShowAll ();
 
 			entry.Text = query;
-			Search (true);
+			Query (true);
 		}
 
 		//////////////////////////////////////

Modified: trunk/beagle/search/SortedTileList.cs
==============================================================================
--- trunk/beagle/search/SortedTileList.cs	(original)
+++ trunk/beagle/search/SortedTileList.cs	Thu Feb 14 21:07:53 2008
@@ -1,27 +1,45 @@
+//
+// SortedTileList.cs
+//
+// Copyright (C) 2008 Lukas Lipka <lukaslipka gmail com>
+//
+
 using System;
 using System.Collections;
+using System.Collections.Generic;
+
+using Beagle.Search.Tiles;
+
+namespace Beagle.Search {
 
-namespace Search {
+	public class SortedTileList : IEnumerable<Tile> {
 
-	public class SortedTileList : IEnumerable, ICloneable {
+		private List<Tile> tiles = null;
 
-		ArrayList tiles;
+		private SortType sort_type;
+		private TileComparer comparer = null;
 
-		public SortedTileList (Search.SortType sort) : this (sort, new ArrayList ()) {}
+		public SortedTileList (SortType sort)
+		{
+			this.tiles = new List<Tile> ();
+			this.SortType = sort;
+		}
 
-		SortedTileList (Search.SortType sort, ArrayList tiles)
+		public SortedTileList (SortType sort, Tile[] tiles_array)
 		{
-			this.tiles = tiles;
-			Sort = sort;
+			this.tiles = new List<Tile> (tiles_array);
+			this.SortType = sort;
 		}
 
-		public int Add (Tiles.Tile tile)
+		public int Add (Tile tile)
 		{
 			int index = tiles.BinarySearch (tile, comparer);
+
 			if (index >= 0)
 				throw new ArgumentException ("duplicate");
 
 			tiles.Insert (~index, tile);
+
 			return ~index;
 		}
 
@@ -30,19 +48,20 @@
 			tiles.Clear ();
 		}
 
-		public bool Contains (Tiles.Tile tile)
+		public bool Contains (Tile tile)
 		{
 			return tiles.Contains (tile);
 		}
 
-		public int IndexOf (Tiles.Tile tile)
+		public int IndexOf (Tile tile)
 		{
 			return tiles.IndexOf (tile);
 		}
 
-		public void Remove (Tiles.Tile tile)
+		public void Remove (Tile tile)
 		{
 			int index = tiles.BinarySearch (tile, comparer);
+			
 			if (index >= 0)
 				tiles.RemoveAt (index);
 		}
@@ -52,95 +71,97 @@
 			tiles.RemoveAt (index);
 		}
 
-		public Tiles.Tile this[int index] {
-			get {
-				return (Tiles.Tile)tiles[index];
-			}
+		public Tile this [int index] {
+			get { return tiles[index]; }
 		}
 
 		public int Count {
-			get {
-				return tiles.Count;
-			}
+			get { return tiles.Count; }
 		}
 
-		public IEnumerator GetEnumerator ()
+		public IEnumerator<Tile> GetEnumerator ()
 		{
 			return tiles.GetEnumerator ();
 		}
 
+
+		IEnumerator IEnumerable.GetEnumerator() {
+			return GetEnumerator();
+		}
+		
 		public object Clone ()
 		{
-			return new SortedTileList (sort, (ArrayList)tiles.Clone ());
+			return new SortedTileList (sort_type, tiles.ToArray ());
 		}
 
-		public IList GetRange (int index, int count)
+		public IList<Tile> GetRange (int index, int count)
 		{
 			return tiles.GetRange (index, count);
 		}
 
-		Search.SortType sort;
-		IComparer comparer;
-
-		public Search.SortType Sort {
-			get {
-				return sort;
-			}
+		public SortType SortType {
+			get { return sort_type; }
 			set {
-				sort = value;
-				switch (sort) {
-				case SortType.Relevance:
-				default:
-					comparer = new RelevanceComparer ();
+				sort_type = value;
+
+				switch (sort_type) {
+					case SortType.Relevance:
+					default:
+						comparer = new RelevanceComparer ();
 					break;
-				case SortType.Name:
-					comparer = new NameComparer ();
+					case SortType.Name:
+						comparer = new NameComparer ();
 					break;
-				case SortType.Modified:
-					comparer = new DateComparer ();
+					case SortType.Modified:
+						comparer = new DateComparer ();
 					break;
 				}
 
 				tiles.Sort (comparer);
 			}
 		}
-	}
-
-	abstract class TileComparer : IComparer {
-		public int Compare (object x, object y)
-		{
-			Tiles.Tile tx = (Tiles.Tile)x, ty = (Tiles.Tile)y;
-			int ret;
-
-			ret = Compare (tx, ty);
-			if (ret == 0)
-				ret = -tx.Timestamp.CompareTo (ty.Timestamp);
-			if (ret == 0)
-				ret = tx.GetHashCode ().CompareTo (ty.GetHashCode ());
-			return ret;
+	
+		private abstract class TileComparer : IComparer<Tile> {
+			
+			public int Compare (Tile x, Tile y)
+			{
+				int ret = TileCompare (x, y);
+				
+				if (ret == 0)
+					ret = -x.Timestamp.CompareTo (y.Timestamp);
+				
+				if (ret == 0)
+					ret = x.GetHashCode ().CompareTo (y.GetHashCode ());
+				
+				return ret;
+			}
+			
+			public abstract int TileCompare (Tile x, Tile y);
 		}
-
-		public abstract int Compare (Tiles.Tile tx, Tiles.Tile ty);
-	}
-
-	class RelevanceComparer : TileComparer {
-		public override int Compare (Tiles.Tile tx, Tiles.Tile ty)
-		{
-			return -tx.Score.CompareTo (ty.Score);
+		
+		private class RelevanceComparer : TileComparer {
+			
+			public override int TileCompare (Tile x, Tile y)
+			{
+				return -x.Score.CompareTo (y.Score);
+			}
 		}
-	}
-
-	class NameComparer : TileComparer {
-		public override int Compare (Tiles.Tile tx, Tiles.Tile ty)
-		{
-			return String.Compare (tx.Title, ty.Title, true);
+		
+		private class NameComparer : TileComparer {
+			
+			public override int TileCompare (Tile x, Tile y)
+			{
+				return String.Compare (x.Title, y.Title, true);
+			}
 		}
-	}
-
-	class DateComparer : TileComparer {
-		public override int Compare (Tiles.Tile tx, Tiles.Tile ty)
-		{
-			return -tx.Timestamp.CompareTo (ty.Timestamp);
+		
+		private class DateComparer : TileComparer {
+			
+			public override int TileCompare (Tile x, Tile y)
+			{
+				return -x.Timestamp.CompareTo (y.Timestamp);
+			}
 		}
 	}
 }
+

Modified: trunk/beagle/search/Spinner.cs
==============================================================================
--- trunk/beagle/search/Spinner.cs	(original)
+++ trunk/beagle/search/Spinner.cs	Thu Feb 14 21:07:53 2008
@@ -1,25 +1,69 @@
+//
+// Spinner.cs
+//
+// Copyright (C) 2008 Lukas Lipka <lukaslipka gmail com>
+
 using System;
+
 using Gtk;
 using Gdk;
 
-namespace Search {
+namespace Beagle.Search {
 
 	public class Spinner : Gtk.Image {
 
-        	private Pixbuf idlePixbuf;
-        	private Pixbuf [] frames;
-        	private int currentFrame;
-        	private uint timeoutId;
+		private IconTheme theme;
+
+        	private Pixbuf idle_pixbuf;
+        	private Pixbuf[] frames;
+
+        	private int current_frame;
+        	private uint timeout_id;
 
-		private const int targetSize = 24;
-		private const int refreshRate = 125;
+		private const int target_size = 24;
+		private const int refresh_rate = 125;
+
+		public Spinner ()
+		{
+		}
 
 		~Spinner ()
 		{
 			Stop ();
 		}
 
-		Gtk.IconTheme theme;
+		public void Start ()
+		{
+			if (!IsRealized)
+				return;
+
+			if (frames == null || frames.Length == 0)
+				return;
+
+			if (timeout_id > 0)
+				return;
+
+			timeout_id = GLib.Timeout.Add (refresh_rate, TimeoutHandler);
+		}
+
+		public void Stop ()
+		{
+			if (timeout_id == 0)
+				return;
+
+			GLib.Source.Remove (timeout_id);
+			timeout_id = 0;
+			
+			Pixbuf = idle_pixbuf;
+		}
+
+        	private bool TimeoutHandler ()
+        	{
+        		Pixbuf = frames [current_frame];
+			current_frame = (current_frame + 1) % frames.Length;
+
+        		return true;
+        	}
 
 		protected override void OnRealized ()
 		{
@@ -27,30 +71,30 @@
 
 			theme = Gtk.IconTheme.GetForScreen (Screen);
 			theme.Changed += ThemeChanged;
+
 			LoadImages ();
 		}
 
-		private void ThemeChanged (object obj, EventArgs args)
+		private void ThemeChanged (object o, EventArgs args)
 		{
 			LoadImages ();
 		}
 
         	private void LoadImages ()
         	{
-			int iconSize = targetSize;
+			int icon_size = target_size;
+
+			// Find available spinner sizes and use the appropriate one
 
-#if false
-			// This code requires gtk-sharp 2.6, which we don't (yet) require
 			foreach (int size in theme.GetIconSizes ("gnome-spinner-rest")) {
-				if (size >= targetSize) {
-					iconSize = size;
+				if (size >= target_size) {
+					icon_size = size;
 					break;
 				}
 			}
-#endif
 
 			try {
-				idlePixbuf = theme.LoadIcon ("gnome-spinner-rest", iconSize, 0);
+				idle_pixbuf = theme.LoadIcon ("gnome-spinner-rest", icon_size, 0);
 			} catch {
 				Console.Error.WriteLine ("Could not load spinner image");
 				frames = null;
@@ -58,73 +102,47 @@
 				return;
 			}
 
-			Gdk.Pixbuf framesPixbuf;
+			Gdk.Pixbuf frames_pixbuf = null;
+
 			try {
-				framesPixbuf = theme.LoadIcon ("gnome-spinner", iconSize, 0);
+				frames_pixbuf = theme.LoadIcon ("gnome-spinner", icon_size, 0);
 			} catch {
 				Console.Error.WriteLine ("Could not load spinner image");
 				frames = null;
-				Pixbuf = idlePixbuf;
+				Pixbuf = idle_pixbuf;
 				return;
 			}
 
-			int frameWidth = idlePixbuf.Width, frameHeight = idlePixbuf.Height;
-        		int width = framesPixbuf.Width, height = framesPixbuf.Height;
-        		if (width % frameWidth != 0 || height % frameHeight != 0) {
-				Console.Error.WriteLine ("Spinner image is wrong size");
+			int frame_width = idle_pixbuf.Width, frame_height = idle_pixbuf.Height;
+        		int width = frames_pixbuf.Width, height = frames_pixbuf.Height;
+
+        		if (width % frame_width != 0 || height % frame_height != 0) {
+				Console.Error.WriteLine ("Spinner images are wrong size");
 				frames = null;
-				Pixbuf = idlePixbuf;
+				Pixbuf = idle_pixbuf;
 				return;
 			}
 
-			int rows = height / frameHeight, cols = width / frameWidth;
+			int rows = height / frame_height, cols = width / frame_width;
 
-        		frames = new Pixbuf[rows * cols];
+        		frames = new Pixbuf [rows * cols];
 
         		for (int y = 0, n = 0; y < rows; y++) {
-        			for (int x = 0; x < cols; x++, n++) {
-        				frames[n] = new Pixbuf (framesPixbuf,
-								x * frameWidth,
-								y * frameHeight,
-								frameWidth,
-								frameHeight);
+        			for (int x = 0; x < cols; x++) {
+        				frames [n++] = new Pixbuf (frames_pixbuf,
+								   x * frame_width,
+								   y * frame_height,
+								   frame_width,
+								   frame_height);
         			}
         		}
 
-        		currentFrame = 0;
-			if (timeoutId != 0)
-				Pixbuf = frames[currentFrame];
-			else
-				Pixbuf = idlePixbuf;
-        	}
-
-		public void Start ()
-		{
-			if (!IsRealized)
-				return;
-			if (frames == null || frames.Length == 0)
-				return;
-			if (timeoutId != 0)
-				return;
-
-			timeoutId = GLib.Timeout.Add (refreshRate, TimeoutHandler);
-		}
-
-		public void Stop ()
-		{
-			if (timeoutId == 0)
-				return;
-
-			GLib.Source.Remove (timeoutId);
-			timeoutId = 0;
-			Pixbuf = idlePixbuf;
-		}
+        		current_frame = 0;
 
-        	private bool TimeoutHandler ()
-        	{
-        		Pixbuf = frames[currentFrame];
-			currentFrame = (currentFrame + 1) % frames.Length;
-        		return true;
+			if (timeout_id != 0)
+				Pixbuf = frames [current_frame];
+			else
+				Pixbuf = idle_pixbuf;
         	}
 	}
 }

Modified: trunk/beagle/search/TileCategory.cs
==============================================================================
--- trunk/beagle/search/TileCategory.cs	(original)
+++ trunk/beagle/search/TileCategory.cs	Thu Feb 14 21:07:53 2008
@@ -2,28 +2,31 @@
 using Gdk;
 using System;
 using System.Collections;
+using System.Collections.Generic;
 
-namespace Search {
+using Beagle.Search.Tiles;
+
+namespace Beagle.Search {
 
 	public class TileCategory : Category {
 
-		Gtk.SizeGroup sizeGroup;
+		Gtk.SizeGroup size_group;
 
-		public TileCategory (Tiles.TileGroupInfo info, Gtk.SizeGroup sizeGroup) : base (info, 2)
+		public TileCategory (Tiles.TileGroupInfo info, Gtk.SizeGroup size_group) : base (info, 2)
 		{
-			this.sizeGroup = sizeGroup;
+			this.size_group = size_group;
 		}
 
 		protected override void OnAdded (Gtk.Widget widget)
 		{
-			sizeGroup.AddWidget (widget);
+			size_group.AddWidget (widget);
 			base.OnAdded (widget);
 		}
 
 		protected override void OnRemoved (Gtk.Widget widget)
 		{
 			base.OnRemoved (widget);
-			sizeGroup.RemoveWidget (widget);
+			size_group.RemoveWidget (widget);
 		}
 
 		protected override void OnSizeRequested (ref Requisition req)
@@ -69,7 +72,7 @@
 			Requisition headerReq, tileReq;
 			Rectangle childAlloc;
 			int col, i, tilesWidth, maxcols;
-			IList tiles = VisibleTiles;
+			IList<Tile> tiles = VisibleTiles;
 
 			base.OnSizeAllocated (allocation);
 

Modified: trunk/beagle/search/Tiles/ActionMenuItem.cs
==============================================================================
--- trunk/beagle/search/Tiles/ActionMenuItem.cs	(original)
+++ trunk/beagle/search/Tiles/ActionMenuItem.cs	Thu Feb 14 21:07:53 2008
@@ -1,7 +1,7 @@
 using System;
 using Gtk;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class ActionMenuItem : ImageMenuItem
 	{

Modified: trunk/beagle/search/Tiles/Application.cs
==============================================================================
--- trunk/beagle/search/Tiles/Application.cs	(original)
+++ trunk/beagle/search/Tiles/Application.cs	Thu Feb 14 21:07:53 2008
@@ -5,7 +5,7 @@
 
 using GConf;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class ApplicationActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/ArchivedFile.cs
==============================================================================
--- trunk/beagle/search/Tiles/ArchivedFile.cs	(original)
+++ trunk/beagle/search/Tiles/ArchivedFile.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class ArchivedFileActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/AssemblyInfo.cs
==============================================================================
--- trunk/beagle/search/Tiles/AssemblyInfo.cs	(original)
+++ trunk/beagle/search/Tiles/AssemblyInfo.cs	Thu Feb 14 21:07:53 2008
@@ -26,7 +26,7 @@
 
 using System;
 
-using Search.Tiles;
+using Beagle.Search.Tiles;
 
 [assembly: TileActivatorTypes (
 	 typeof (ApplicationActivator),

Modified: trunk/beagle/search/Tiles/Audio.cs
==============================================================================
--- trunk/beagle/search/Tiles/Audio.cs	(original)
+++ trunk/beagle/search/Tiles/Audio.cs	Thu Feb 14 21:07:53 2008
@@ -1,7 +1,7 @@
 using System;
 using Mono.Unix;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class AudioActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/CApplet.cs
==============================================================================
--- trunk/beagle/search/Tiles/CApplet.cs	(original)
+++ trunk/beagle/search/Tiles/CApplet.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 using System.Diagnostics;
 using Mono.Posix;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class CAppletActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/Calendar.cs
==============================================================================
--- trunk/beagle/search/Tiles/Calendar.cs	(original)
+++ trunk/beagle/search/Tiles/Calendar.cs	Thu Feb 14 21:07:53 2008
@@ -2,7 +2,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class CalendarActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/Contact.cs
==============================================================================
--- trunk/beagle/search/Tiles/Contact.cs	(original)
+++ trunk/beagle/search/Tiles/Contact.cs	Thu Feb 14 21:07:53 2008
@@ -2,7 +2,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class ContactActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/Docbook.cs
==============================================================================
--- trunk/beagle/search/Tiles/Docbook.cs	(original)
+++ trunk/beagle/search/Tiles/Docbook.cs	Thu Feb 14 21:07:53 2008
@@ -1,7 +1,7 @@
 //
 // Docbook.cs
 //
-// Copyright (C) 2007 Lukas Lipka <lukaslipka gmail com>
+// Copyright (C) 2008 Lukas Lipka <lukaslipka gmail com>
 //
 
 using System;
@@ -9,7 +9,7 @@
 
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class DocbookActivator : TileActivator {
 
@@ -45,8 +45,6 @@
 
 	public class Docbook : TileTemplate {
 
-		string path = null;
-
 		public Docbook (Beagle.Hit hit, Beagle.Query query) : base (hit, query)
 		{
 			if (! String.IsNullOrEmpty (hit.GetFirstProperty ("dc:title")))

Modified: trunk/beagle/search/Tiles/File.cs
==============================================================================
--- trunk/beagle/search/Tiles/File.cs	(original)
+++ trunk/beagle/search/Tiles/File.cs	Thu Feb 14 21:07:53 2008
@@ -4,7 +4,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class FileActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/Folder.cs
==============================================================================
--- trunk/beagle/search/Tiles/Folder.cs	(original)
+++ trunk/beagle/search/Tiles/Folder.cs	Thu Feb 14 21:07:53 2008
@@ -1,7 +1,7 @@
 using System;
 using Mono.Unix;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class FolderActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/HitFlavor.cs
==============================================================================
--- trunk/beagle/search/Tiles/HitFlavor.cs	(original)
+++ trunk/beagle/search/Tiles/HitFlavor.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 using Beagle;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class HitFlavor {
 		

Modified: trunk/beagle/search/Tiles/IMLog.cs
==============================================================================
--- trunk/beagle/search/Tiles/IMLog.cs	(original)
+++ trunk/beagle/search/Tiles/IMLog.cs	Thu Feb 14 21:07:53 2008
@@ -4,7 +4,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class IMLogActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/Image.cs
==============================================================================
--- trunk/beagle/search/Tiles/Image.cs	(original)
+++ trunk/beagle/search/Tiles/Image.cs	Thu Feb 14 21:07:53 2008
@@ -4,7 +4,7 @@
 
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class ImageActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/MailAttachment.cs
==============================================================================
--- trunk/beagle/search/Tiles/MailAttachment.cs	(original)
+++ trunk/beagle/search/Tiles/MailAttachment.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class MailAttachmentActivator : TileActivator {
 
@@ -68,8 +68,9 @@
 		public void FindAllFromSender()
 		{
 			SafeProcess p = new SafeProcess ();
-			string addr = Search.Tiles.Utils.GetFirstPropertyOfParent(Hit,"fixme:from_address");
+			string addr = Beagle.Search.Tiles.Utils.GetFirstPropertyOfParent(Hit,"fixme:from_address");
 			p.Arguments = new string [] { "beagle-search", String.Format ("mailfromaddr:{0}", addr) };
+
 			try {
 				p.Start () ;
 			} catch (Exception e) {

Modified: trunk/beagle/search/Tiles/MailMessage.cs
==============================================================================
--- trunk/beagle/search/Tiles/MailMessage.cs	(original)
+++ trunk/beagle/search/Tiles/MailMessage.cs	Thu Feb 14 21:07:53 2008
@@ -4,7 +4,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class MailMessageActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/Manpage.cs
==============================================================================
--- trunk/beagle/search/Tiles/Manpage.cs	(original)
+++ trunk/beagle/search/Tiles/Manpage.cs	Thu Feb 14 21:07:53 2008
@@ -1,7 +1,7 @@
 //
 // Manpage.cs
 //
-// Copyright (C) 2007 Lukas Lipka <lukaslipka gmail com>
+// Copyright (C) 2008 Lukas Lipka <lukaslipka gmail com>
 //
 
 using System;
@@ -9,7 +9,7 @@
 
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class ManpageActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/Note.cs
==============================================================================
--- trunk/beagle/search/Tiles/Note.cs	(original)
+++ trunk/beagle/search/Tiles/Note.cs	Thu Feb 14 21:07:53 2008
@@ -5,7 +5,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class NoteActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/OpenWithMenu.cs
==============================================================================
--- trunk/beagle/search/Tiles/OpenWithMenu.cs	(original)
+++ trunk/beagle/search/Tiles/OpenWithMenu.cs	Thu Feb 14 21:07:53 2008
@@ -5,7 +5,7 @@
 using Gdk;
 using Gnome.Vfs;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class OpenWithMenu : Gtk.Menu {
 

Modified: trunk/beagle/search/Tiles/Presentation.cs
==============================================================================
--- trunk/beagle/search/Tiles/Presentation.cs	(original)
+++ trunk/beagle/search/Tiles/Presentation.cs	Thu Feb 14 21:07:53 2008
@@ -1,7 +1,7 @@
 using System;
 using Mono.Unix;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class PresentationActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/RSSFeed.cs
==============================================================================
--- trunk/beagle/search/Tiles/RSSFeed.cs	(original)
+++ trunk/beagle/search/Tiles/RSSFeed.cs	Thu Feb 14 21:07:53 2008
@@ -5,7 +5,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class RSSFeedActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/Spreadsheet.cs
==============================================================================
--- trunk/beagle/search/Tiles/Spreadsheet.cs	(original)
+++ trunk/beagle/search/Tiles/Spreadsheet.cs	Thu Feb 14 21:07:53 2008
@@ -1,7 +1,7 @@
 using System;
 using Mono.Posix;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class SpreadsheetActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/Task.cs
==============================================================================
--- trunk/beagle/search/Tiles/Task.cs	(original)
+++ trunk/beagle/search/Tiles/Task.cs	Thu Feb 14 21:07:53 2008
@@ -2,7 +2,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class TaskActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/TextDocument.cs
==============================================================================
--- trunk/beagle/search/Tiles/TextDocument.cs	(original)
+++ trunk/beagle/search/Tiles/TextDocument.cs	Thu Feb 14 21:07:53 2008
@@ -2,7 +2,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class TextDocumentActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/ThumbnailFactory.cs
==============================================================================
--- trunk/beagle/search/Tiles/ThumbnailFactory.cs	(original)
+++ trunk/beagle/search/Tiles/ThumbnailFactory.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 using System.IO;
 using System.Threading;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class ThumbnailFactory : Gtk.Object {
 

Modified: trunk/beagle/search/Tiles/Tile.cs
==============================================================================
--- trunk/beagle/search/Tiles/Tile.cs	(original)
+++ trunk/beagle/search/Tiles/Tile.cs	Thu Feb 14 21:07:53 2008
@@ -9,7 +9,7 @@
 using Beagle;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public abstract class Tile : Gtk.EventBox {
 

Modified: trunk/beagle/search/Tiles/TileAction.cs
==============================================================================
--- trunk/beagle/search/Tiles/TileAction.cs	(original)
+++ trunk/beagle/search/Tiles/TileAction.cs	Thu Feb 14 21:07:53 2008
@@ -1,6 +1,6 @@
 using System;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public delegate void TileActionDelegate ();
 

Modified: trunk/beagle/search/Tiles/TileActivator.cs
==============================================================================
--- trunk/beagle/search/Tiles/TileActivator.cs	(original)
+++ trunk/beagle/search/Tiles/TileActivator.cs	Thu Feb 14 21:07:53 2008
@@ -5,7 +5,7 @@
 
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	// FIXME: Should we call this something else?
 	public abstract class TileActivator : IComparable {

Modified: trunk/beagle/search/Tiles/TileFlat.cs
==============================================================================
--- trunk/beagle/search/Tiles/TileFlat.cs	(original)
+++ trunk/beagle/search/Tiles/TileFlat.cs	Thu Feb 14 21:07:53 2008
@@ -1,7 +1,7 @@
 using System;
 using Gtk;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public abstract class TileFlat : Tile {
 

Modified: trunk/beagle/search/Tiles/TileGroup.cs
==============================================================================
--- trunk/beagle/search/Tiles/TileGroup.cs	(original)
+++ trunk/beagle/search/Tiles/TileGroup.cs	Thu Feb 14 21:07:53 2008
@@ -1,6 +1,6 @@
 using System;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public enum TileGroup {
 		Application,

Modified: trunk/beagle/search/Tiles/TileTemplate.cs
==============================================================================
--- trunk/beagle/search/Tiles/TileTemplate.cs	(original)
+++ trunk/beagle/search/Tiles/TileTemplate.cs	Thu Feb 14 21:07:53 2008
@@ -2,7 +2,7 @@
 
 using Gtk;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public abstract class TileTemplate : Tile {
 

Modified: trunk/beagle/search/Tiles/Utils.cs
==============================================================================
--- trunk/beagle/search/Tiles/Utils.cs	(original)
+++ trunk/beagle/search/Tiles/Utils.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 using Mono.Unix;
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public struct TileGroupInfo {
 		public TileGroup Group;

Modified: trunk/beagle/search/Tiles/Video.cs
==============================================================================
--- trunk/beagle/search/Tiles/Video.cs	(original)
+++ trunk/beagle/search/Tiles/Video.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class VideoActivator : TileActivator {
 

Modified: trunk/beagle/search/Tiles/WebHistory.cs
==============================================================================
--- trunk/beagle/search/Tiles/WebHistory.cs	(original)
+++ trunk/beagle/search/Tiles/WebHistory.cs	Thu Feb 14 21:07:53 2008
@@ -3,7 +3,7 @@
 
 using Beagle.Util;
 
-namespace Search.Tiles {
+namespace Beagle.Search.Tiles {
 
 	public class WebHistoryActivator : TileActivator {
 
@@ -31,7 +31,8 @@
 
 			Title = title;
 			Description = hit.Uri.ToString ();
-			AddAction( new Search.Tiles.TileAction("Find From Same Host",Gtk.Stock.Find,FindFromHost));
+
+			AddAction (new TileAction ("Find more from same host", Gtk.Stock.Find, FindFromHost));
 		}
 
 		// We intentionally use a separate thumbnailer/thread from Tiles.File,

Modified: trunk/beagle/search/Tray/NotificationArea.cs
==============================================================================
--- trunk/beagle/search/Tray/NotificationArea.cs	(original)
+++ trunk/beagle/search/Tray/NotificationArea.cs	Thu Feb 14 21:07:53 2008
@@ -15,7 +15,7 @@
 using Gtk;
 using Gdk;
 
-namespace Search.Tray {
+namespace Beagle.Search.Tray {
 
 	public class NotificationArea : Plug
 	{

Modified: trunk/beagle/search/Tray/TrayIcon.cs
==============================================================================
--- trunk/beagle/search/Tray/TrayIcon.cs	(original)
+++ trunk/beagle/search/Tray/TrayIcon.cs	Thu Feb 14 21:07:53 2008
@@ -12,7 +12,7 @@
 using Gtk;
 using Gdk;
 
-namespace Search.Tray
+namespace Beagle.Search.Tray
 {
 	public delegate void SearchDelegate (string query);
 

Modified: trunk/beagle/search/TypeFilter.cs
==============================================================================
--- trunk/beagle/search/TypeFilter.cs	(original)
+++ trunk/beagle/search/TypeFilter.cs	Thu Feb 14 21:07:53 2008
@@ -3,11 +3,14 @@
 using System.Text.RegularExpressions;
 
 using Mono.Unix;
-using Search.Tiles;
+
+using Beagle.Search.Tiles;
 
 // FIXME: it would be nicer to create QueryParts to do the filtering beagled-side
 
-namespace Search {
+// FIXME: Whoa! This fucking thing is a complete ghetto. Needs a rewrite.
+
+namespace Beagle.Search {
 
 	public class TypeFilter {
 

Modified: trunk/beagle/search/UIManager.cs
==============================================================================
--- trunk/beagle/search/UIManager.cs	(original)
+++ trunk/beagle/search/UIManager.cs	Thu Feb 14 21:07:53 2008
@@ -6,7 +6,8 @@
 using Beagle;
 using Beagle.Util;
 
-namespace Search {
+namespace Beagle.Search {
+
 	[Flags]
 	public enum ScopeType : ushort {
 		Nothing       = 0,
@@ -32,20 +33,20 @@
 
 	public class UIManager : Gtk.UIManager {
 
-		private MainWindow main_window;
+		private Search search = null;
 		
 		private Gtk.ActionGroup actions;
 		private Gtk.RadioActionEntry[] sort_entries;
 		private Gtk.ToggleActionEntry[] scope_entries, view_entries, domain_entries;
 
-		public UIManager (MainWindow main_window)
+		public UIManager (Search search)
 		{
-			this.main_window = main_window;
-			
-			actions = new ActionGroup ("Actions");
+			this.search = search;
+			this.actions = new ActionGroup ("Actions");
 
 			ActionEntry quit_action_entry;
-			if (MainWindow.IconEnabled) {
+
+			if (Search.IconEnabled) {
 				quit_action_entry = new ActionEntry ("Quit", Gtk.Stock.Close,
 								     null, "<control>Q",
 						 		     Catalog.GetString ("Close Desktop Search"),
@@ -246,14 +247,12 @@
 			actions.Add (view_entries);
 
 			InsertActionGroup (actions, 0);
-			main_window.AddAccelGroup (AccelGroup);
+			search.AddAccelGroup (AccelGroup);
 			AddUiFromString (ui_def);
 		}
 
 		public Gtk.MenuBar MenuBar {
-			get {
-				return (Gtk.MenuBar)GetWidget ("/MenuBar");
-			}
+			get { return (Gtk.MenuBar)GetWidget ("/MenuBar"); }
 		}
 
 		private bool sensitive = true;
@@ -341,17 +340,18 @@
 
 		private void OnHideWindow (object obj, EventArgs args)
 		{
-			if (MainWindow.IconEnabled)
-				main_window.Hide ();
+			if (Search.IconEnabled)
+				search.Hide ();
 		}
 
 		private void Quit (object obj, EventArgs args)
 		{
-			if (MainWindow.IconEnabled) {
-				main_window.Hide ();
-			} else {
-				Gtk.Application.Quit ();
-			}
+			if (Search.IconEnabled) {
+				search.Hide ();
+				return;
+			} 
+
+			Gtk.Application.Quit ();
 		}
 
 		private void Help (object obj, EventArgs args)
@@ -361,7 +361,7 @@
 			try {
 				Gnome.Url.Show (address);
 			} catch {
-				HigMessageDialog md = new HigMessageDialog (main_window, Gtk.DialogFlags.DestroyWithParent,
+				HigMessageDialog md = new HigMessageDialog (search, Gtk.DialogFlags.DestroyWithParent,
 									    Gtk.MessageType.Error, Gtk.ButtonsType.Close,
 									    Catalog.GetString ("Couldn't launch web browser"),
 									    Catalog.GetString (String.Format ("Please point your web browser to '{0}' manually", address)));

Modified: trunk/beagle/search/WidgetFu.cs
==============================================================================
--- trunk/beagle/search/WidgetFu.cs	(original)
+++ trunk/beagle/search/WidgetFu.cs	Thu Feb 14 21:07:53 2008
@@ -1,7 +1,7 @@
 using System;
 using System.Runtime.InteropServices;
 
-namespace Search {
+namespace Beagle.Search {
 
 	public static class WidgetFu {
 		



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