public MailMessage(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Conversations; string title = Utils.GetFirstPropertyOfParent(hit, "dc:title"); if (title == null || title == String.Empty) { title = Catalog.GetString("(untitled)"); } Subject.LabelProp = Title = title; From.LabelProp = "<b>" + GetAddress(hit) + "</b>"; try { Timestamp = StringFu.StringToDateTime(Utils.GetFirstPropertyOfParent(hit, "fixme:date")); Date.LabelProp = Utils.NiceShortDate(Timestamp); } catch {} if (Utils.GetFirstPropertyOfParent(Hit, "fixme:client") == "evolution") { AddAction(new TileAction(Catalog.GetString("Send in Mail"), SendInMail)); } if ((Utils.GetFirstPropertyOfParent(hit, "fixme:isSent") == null)) { AddAction(new TileAction(Catalog.GetString("Find Messages From Sender"), Gtk.Stock.Find, FindAllFromSender)); } }
public RSSFeed(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Feed; Title = Hit ["dc:title"]; Description = Hit ["dc:publisher"]; }
public static SafeProcess GetClientProcess(Beagle.Hit hit) { string client = null; SafeProcess p = null; if (hit.ParentUri != null) { client = Utils.GetFirstPropertyOfParent(hit, "fixme:client"); } else { client = hit.GetFirstProperty("fixme:client"); } if (client == "evolution") { p = new SafeProcess(); p.Arguments = new string [2]; p.Arguments [0] = "evolution"; p.Arguments [1] = (hit.ParentUri != null ? hit.EscapedParentUri : hit.EscapedUri); } #if ENABLE_THUNDERBIRD else if (client == "thunderbird") { p = Thunderbird.GetSafeProcess("-viewbeagle", hit.GetFirstProperty("fixme:uri")); } #endif return(p); }
public override bool Validate(Beagle.Hit hit) { if (!base.Validate(hit)) { return(false); } if (hit ["beagle:HitType"] == "File") { // This handles a case when a file with the // message/rfc822 mimetype is indexed without // gmime. Thus we fail to extract any info and // this tile is useless. string subject = hit.GetFirstProperty("dc:title"); if (subject != null && subject != "") { return(true); } return(false); } return(true); }
public Audio(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Audio; // FIXME: Show album art if any. Needs implementation in Beagle.Util string title = Hit.GetFirstProperty("dc:title"); if (String.IsNullOrEmpty(title)) { title = Hit.GetFirstProperty("fixme:title"); } if (!String.IsNullOrEmpty(title)) { Title = title; } string artist = Hit.GetFirstProperty("fixme:artist"); if (!String.IsNullOrEmpty(artist)) { Description = artist; } //AddAction (new TileAction (Catalog.GetString ("Add to Library"), AddToLibrary)); }
public static Tile MakeTile(Beagle.Hit hit, Beagle.Query query) { TileActivator best = null; try { foreach (TileActivator activator in activators) { if (!activator.Validate(hit)) { continue; } if (best == null) { best = activator; continue; } if (activator.Weight > best.Weight) { best = activator; } } if (best != null) { return(best.BuildTile(hit, query)); } } catch (Exception e) { Console.WriteLine("Error instantiating tile:\n{0}", e); } return(null); }
public ThumbnailRequest (Gtk.Image image, string thumbnail_file, Beagle.Hit hit, int size) { Image = image; ThumbnailFile = thumbnail_file; Hit = hit; Size = size; }
public IMLog(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Conversations; Subject.LabelProp = Catalog.GetString("IM Conversation"); string alias = hit.GetFirstProperty("fixme:speakingto_alias"); string name = hit.GetFirstProperty("fixme:speakingto"); if (alias != null && alias != "") { From.LabelProp = "<b>" + alias + "</b>"; } else if (name != null && name != "") { From.LabelProp = "<b>" + name + "</b>"; } else { From.LabelProp = "(unknown)"; } try { string starttime = hit.GetFirstProperty("fixme:starttime"); if (!String.IsNullOrEmpty(starttime)) { Timestamp = StringFu.StringToDateTime(starttime); } Date.LabelProp = Utils.NiceShortDate(Timestamp); } catch {} }
public ThumbnailRequest(Gtk.Image image, string thumbnail_file, Beagle.Hit hit, int size) { Image = image; ThumbnailFile = thumbnail_file; Hit = hit; Size = size; }
public Presentation(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Documents; if (Hit ["fixme:slide-count"] != null) { int count = Int32.Parse(Hit ["fixme:slide-count"]); Description = String.Format(Catalog.GetPluralString("{0} slide", "{0} slides", count), count); } }
public Task(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Calendar; Title = hit.GetFirstProperty("fixme:summary"); if (!String.IsNullOrEmpty(hit.GetFirstProperty("fixme:description"))) { Description = Utils.TrimFirstLine(hit.GetFirstProperty("fixme:description")); } }
public static string GetFirstPropertyOfParent(Beagle.Hit hit, string prop) { if (hit.ParentUri == null) { return(hit.GetFirstProperty(prop)); } else { return(hit.GetFirstProperty("parent:" + prop)); } }
public Contact(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Contact; Title = hit.GetFirstProperty("fixme:Name"); Description = hit.GetFirstProperty("fixme:Email"); if (Hit.GetFirstProperty("fixme:Email") != null) { AddAction(new TileAction(Catalog.GetString("Send Mail"), SendMail)); } }
protected static string GetTitle(Beagle.Hit hit) { string title; title = hit.GetFirstProperty("dc:title"); if (String.IsNullOrEmpty(title)) { title = hit.GetFirstProperty("beagle:ExactFilename"); } return(title); }
public TextDocument(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Documents; if (Hit ["fixme:page-count"] != null) { int count = Int32.Parse(Hit ["fixme:page-count"]); Description = String.Format(Catalog.GetPluralString("{0} page", "{0} pages", count), count); } // These files generally have a default title or an auto-generated title. // So use the filename for these types of files. Title = hit.GetFirstProperty("beagle:ExactFilename"); }
public Calendar(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Calendar; string summary = hit.GetFirstProperty("fixme:summary"); string time = Utils.NiceShortDate(hit.GetFirstProperty("fixme:starttime")); Title = (time == "") ? summary : time + ": " + summary; if (!String.IsNullOrEmpty(hit.GetFirstProperty("fixme:description"))) { Description = Utils.TrimFirstLine(hit.GetFirstProperty("fixme:description")); } }
public Video(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Video; Title = Hit ["beagle:ExactFilename"]; if (!String.IsNullOrEmpty(Hit ["fixme:video:codec"])) { Description = Hit ["fixme:video:codec"]; } if (!String.IsNullOrEmpty(Hit ["fixme:video:width"])) { Description += String.Format(" ({0}x{1})", Hit ["fixme:video:width"], Hit ["fixme:video:height"]); } }
public WebHistory(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Website; string title = hit.GetFirstProperty("dc:title"); if (String.IsNullOrEmpty(title)) { title = Hit.Uri.Host; } Title = title; Description = hit.Uri.ToString(); AddAction(new TileAction("Find more from same host", Gtk.Stock.Find, FindFromHost)); }
protected TileFlat(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Subject = WidgetFu.NewLabel(); WidgetFu.EllipsizeLabel(Subject, 40); HBox.PackStart(Subject, true, true, 3); From = WidgetFu.NewLabel(); From.UseMarkup = true; WidgetFu.EllipsizeLabel(From, 20); HBox.PackStart(From, false, false, 3); Date = WidgetFu.NewLabel(); HBox.PackStart(Date, false, false, 3); HBox.ShowAll(); }
public override bool Validate(Beagle.Hit hit) { if (!base.Validate(hit)) { return(false); } if (hit ["beagle:FileType"] != "documentation") { return(false); } Weight += 2; return(true); }
private static string GetAddress(Beagle.Hit hit) { bool sent = (Utils.GetFirstPropertyOfParent(hit, "fixme:isSent") != null); string address = sent ? Utils.GetFirstPropertyOfParent(hit, "fixme:to") : Utils.GetFirstPropertyOfParent(hit, "fixme:from"); if (address == null) { return(""); } if (address.IndexOf(" <") != -1) { address = address.Substring(0, address.IndexOf(" <")); } return(address); }
public MailAttachment(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Documents; Title = Hit ["fixme:attachment_title"]; if (String.IsNullOrEmpty(Title)) { Title = Catalog.GetString(String.Format("Attachment to \"{0}\"", Hit ["parent:dc:title"])); } Description = Catalog.GetString("Mail attachment"); if ((Utils.GetFirstPropertyOfParent(hit, "fixme:isSent") == null)) { AddAction(new TileAction(Catalog.GetString("Find Messages From Sender"), Gtk.Stock.Find, FindAllFromSender)); } }
public override bool Validate(Beagle.Hit hit) { if (!base.Validate(hit)) { return(false); } string str = hit.GetFirstProperty("fixme:inside_archive"); if (hit.ParentUri == null || str == null || str == "false") { return(false); } Weight += 1; return(true); }
public override Tile BuildTile(Beagle.Hit hit, Beagle.Query query) { if (ditem == IntPtr.Zero) { return(null); } if (hit ["fixme:NoDisplay"] == "true") { return(null); } string notshow = gnome_desktop_item_get_string(ditem, "NotShowIn"); if (notshow != null && notshow.IndexOf("GNOME") != -1) { return(null); } string onlyshow = gnome_desktop_item_get_string(ditem, "OnlyShowIn"); if (onlyshow != null && onlyshow.IndexOf("GNOME") == -1) { return(null); } if (!checked_gconf) { CheckLockdown(); } if (disable_command_line) { string[] categories = hit.GetProperties("fixme:Categories"); if (categories != null && Array.IndexOf(categories, "TerminalEmulator") != -1) { return(null); } } return(new Application(hit, query, ditem)); }
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"); } }
public Image(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Image; Title = Hit ["beagle:ExactFilename"]; if (Hit ["beagle:FilenameExtension"] != null && Hit ["beagle:FilenameExtension"].Length > 0) { Description = Hit ["beagle:FilenameExtension"].Substring(1).ToUpper(); } if (Hit ["fixme:width"] != null && Hit ["fixme:width"] != "") { Description += String.Format(" {0}x{1}", Hit ["fixme:width"], Hit ["fixme:height"]); } Description += String.Format(" ({0})", StringFu.FileLengthToString(Hit.FileInfo.Length)); // AddAction (new TileAction (Catalog.GetString ("Add to Library"), Gtk.Stock.Add, AddToLibrary)); AddAction(new TileAction(Catalog.GetString("Set as Wallpaper"), SetAsWallpaper)); }
public Manpage(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") { path = hit.ParentUri.LocalPath; } else { path = hit.Uri.LocalPath; } Description = hit.GetFirstProperty("dc:subject") ?? Catalog.GetString("Manual page"); }
public Folder(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Group = TileGroup.Folder; Title = Hit ["beagle:ExactFilename"]; EnableOpenWith = true; int n = Hit.DirectoryInfo.GetFileSystemInfos().Length; if (n == 0) { Description = Catalog.GetString("Empty"); } else { Description = String.Format(Catalog.GetPluralString("Contains {0} Item", "Contains {0} Items", n), n); } // FIXME: s/"gtk-info"/Gtk.Stock.Info/ when we can depend on gtk# 2.8 //AddAction (new TileAction (Catalog.GetString ("Show Information"), "gtk-info", ShowInformation)); AddAction(new TileAction(Catalog.GetString("Move to Trash"), Gtk.Stock.Delete, MoveToTrash)); }
public TileTemplate(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Alignment alignment = new Alignment(0.0f, 0.5f, 1.0f, 0.0f); HBox.PackStart(alignment, true, true, 0); VBox vbox = new VBox(false, 0); alignment.Add(vbox); title_label = WidgetFu.NewLabel(); title_label.LineWrap = true; WidgetFu.EllipsizeLabel(title_label, 30); vbox.PackStart(title_label, false, false, 0); desc_label = WidgetFu.NewGrayLabel(); desc_label.NoShowAll = true; WidgetFu.EllipsizeLabel(desc_label, 30); vbox.PackStart(desc_label, false, false, 0); alignment.ShowAll(); }
public TileFile(Beagle.Hit hit, Beagle.Query query) : base(hit, query) { Title = GetTitle(hit); if (Hit.FileInfo != null) { Timestamp = Hit.FileInfo.LastWriteTimeUtc; Description = Utils.NiceShortDate(Timestamp); } AddAction(new TileAction(Catalog.GetString("Reveal in Folder"), RevealInFolder)); AddAction(new TileAction(Catalog.GetString("E-Mail"), Email)); // AddAction (new TileAction (Catalog.GetString ("Instant-Message"), InstantMessage)); AddAction(new TileAction(Catalog.GetString("Move to Trash"), Gtk.Stock.Delete, MoveToTrash)); if (!String.IsNullOrEmpty(Hit.GetFirstProperty("dc:author"))) { AddAction(new TileAction(Catalog.GetString("Find Documents From Same Author"), Gtk.Stock.Find, FindSameAuthor)); } EnableOpenWith = true; }
public virtual bool Validate(Beagle.Hit hit) { if (flavors.Count < 1) { return(false); } Weight = 0; HitFlavor best = null; foreach (HitFlavor flavor in flavors) { if (!flavor.IsMatch(hit)) { continue; } if (best == null) { best = flavor; continue; } if (flavor.Weight > best.Weight) { best = flavor; } } if (best != null) { Weight += best.Weight; return(true); } return(false); }