beagle r4438 - in trunk/beagle/search: . Tiles
- From: llipka svn gnome org
- To: svn-commits-list gnome org
- Subject: beagle r4438 - in trunk/beagle/search: . Tiles
- Date: Sat, 2 Feb 2008 15:02:30 +0000 (GMT)
Author: llipka
Date: Sat Feb 2 15:02:29 2008
New Revision: 4438
URL: http://svn.gnome.org/viewvc/beagle?rev=4438&view=rev
Log:
Add a docbook tile and move the manpage tile. Searching documentation is still disabled by default and can be enabled by passing --search-docs option to beagle-search.
Added:
trunk/beagle/search/Tiles/Docbook.cs
trunk/beagle/search/Tiles/Manpage.cs
- copied, changed from r4429, /trunk/beagle/search/Tiles/Documentation.cs
Removed:
trunk/beagle/search/Tiles/Documentation.cs
Modified:
trunk/beagle/search/Makefile.am
trunk/beagle/search/Tiles/AssemblyInfo.cs
Modified: trunk/beagle/search/Makefile.am
==============================================================================
--- trunk/beagle/search/Makefile.am (original)
+++ trunk/beagle/search/Makefile.am Sat Feb 2 15:02:29 2008
@@ -61,7 +61,7 @@
$(srcdir)/Tiles/CApplet.cs \
$(srcdir)/Tiles/Calendar.cs \
$(srcdir)/Tiles/Contact.cs \
- $(srcdir)/Tiles/Documentation.cs \
+ $(srcdir)/Tiles/Docbook.cs \
$(srcdir)/Tiles/File.cs \
$(srcdir)/Tiles/Folder.cs \
$(srcdir)/Tiles/HitFlavor.cs \
@@ -69,6 +69,7 @@
$(srcdir)/Tiles/Image.cs \
$(srcdir)/Tiles/MailMessage.cs \
$(srcdir)/Tiles/MailAttachment.cs \
+ $(srcdir)/Tiles/Manpage.cs \
$(srcdir)/Tiles/Note.cs \
$(srcdir)/Tiles/Presentation.cs \
$(srcdir)/Tiles/RSSFeed.cs \
Modified: trunk/beagle/search/Tiles/AssemblyInfo.cs
==============================================================================
--- trunk/beagle/search/Tiles/AssemblyInfo.cs (original)
+++ trunk/beagle/search/Tiles/AssemblyInfo.cs Sat Feb 2 15:02:29 2008
@@ -35,13 +35,14 @@
typeof (CalendarActivator),
typeof (CAppletActivator),
typeof (ContactActivator),
- typeof (DocumentationActivator),
+ typeof (DocbookActivator),
typeof (FileActivator),
typeof (FolderActivator),
typeof (ImageActivator),
typeof (IMLogActivator),
typeof (MailAttachmentActivator),
typeof (MailMessageActivator),
+ typeof (ManpageActivator),
typeof (NoteActivator),
typeof (PresentationActivator),
typeof (RSSFeedActivator),
Added: trunk/beagle/search/Tiles/Docbook.cs
==============================================================================
--- (empty file)
+++ trunk/beagle/search/Tiles/Docbook.cs Sat Feb 2 15:02:29 2008
@@ -0,0 +1,80 @@
+//
+// Docbook.cs
+//
+// Copyright (C) 2007 Lukas Lipka <lukaslipka gmail com>
+//
+
+using System;
+using Mono.Unix;
+
+using Beagle.Util;
+
+namespace Search.Tiles {
+
+ public class DocbookActivator : TileActivator {
+
+ public DocbookActivator () : base ()
+ {
+ AddSupportedFlavor (new HitFlavor (null, "DocbookEntry", null));
+ }
+
+ public override bool Validate (Beagle.Hit hit)
+ {
+ if (! base.Validate (hit))
+ return false;
+
+ // FIXME: We should be using the users locale and
+ // if we fail to find a result fallback to the C locale.
+ // However, there is no easy way of doing this now.
+ // Environment.GetEnvironmentVariable ("LANG"))
+
+ if (String.IsNullOrEmpty (hit ["fixme:language"]))
+ return true;
+
+ if (hit ["fixme:language"] == "C" || hit ["fixme:language"] == "en")
+ return true;
+
+ return false;
+ }
+
+ public override Tile BuildTile (Beagle.Hit hit, Beagle.Query query)
+ {
+ return new Docbook (hit, query);
+ }
+ }
+
+ 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")))
+ Title = hit.GetFirstProperty ("dc:title");
+ else
+ Title = hit.GetFirstProperty ("beagle:ExactFilename");
+
+ if (hit ["beagle:IsChild"] == "true")
+ Description = hit.GetFirstProperty ("parent:beagle:Filename");
+ else
+ Description = hit.GetFirstProperty ("beagle:Filename");
+ }
+
+ protected override void LoadIcon (Gtk.Image image, int size)
+ {
+ image.Pixbuf = WidgetFu.LoadThemeIcon ("gtk-help", size);
+ }
+
+ public override void Open ()
+ {
+ SafeProcess p = new SafeProcess ();
+ p.Arguments = new string [] { "yelp", Hit.Uri.LocalPath };
+
+ try {
+ p.Start ();
+ } catch {
+ Console.WriteLine ("Failed to start '{0}'", p.Arguments [0]);
+ }
+ }
+ }
+}
Copied: trunk/beagle/search/Tiles/Manpage.cs (from r4429, /trunk/beagle/search/Tiles/Documentation.cs)
==============================================================================
--- /trunk/beagle/search/Tiles/Documentation.cs (original)
+++ trunk/beagle/search/Tiles/Manpage.cs Sat Feb 2 15:02:29 2008
@@ -1,5 +1,5 @@
//
-// Documentation.cs
+// Manpage.cs
//
// Copyright (C) 2007 Lukas Lipka <lukaslipka gmail com>
//
@@ -11,9 +11,9 @@
namespace Search.Tiles {
- public class DocumentationActivator : TileActivator {
+ public class ManpageActivator : TileActivator {
- public DocumentationActivator () : base ()
+ public ManpageActivator () : base ()
{
AddSupportedFlavor (new HitFlavor (null, "File", null));
}
@@ -33,15 +33,15 @@
public override Tile BuildTile (Beagle.Hit hit, Beagle.Query query)
{
- return new Documentation (hit, query);
+ return new Manpage (hit, query);
}
}
- public class Documentation : TileTemplate {
+ public class Manpage : TileTemplate {
string path = null;
- public Documentation (Beagle.Hit hit, Beagle.Query query) : base (hit, query)
+ public Manpage (Beagle.Hit hit, Beagle.Query query) : base (hit, query)
{
if (! String.IsNullOrEmpty (hit.GetFirstProperty ("dc:title")))
Title = hit.GetFirstProperty ("dc:title");
@@ -53,7 +53,7 @@
else
path = hit.Uri.LocalPath;
- Description = hit.GetFirstProperty ("dc:subject") ?? Catalog.GetString ("Documentation");
+ Description = hit.GetFirstProperty ("dc:subject") ?? Catalog.GetString ("Manual page");
}
protected override void LoadIcon (Gtk.Image image, int size)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]