示例#1
0
        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);
        }
示例#2
0
        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 {}
        }
示例#3
0
        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));
        }
示例#4
0
        public RSSFeed(Beagle.Hit hit, Beagle.Query query) : base(hit, query)
        {
            Group = TileGroup.Feed;

            Title       = Hit ["dc:title"];
            Description = Hit ["dc:publisher"];
        }
示例#5
0
        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));
            }
        }
示例#6
0
		static private void SetupIndexListener ()
		{
			index_listener_query = new Beagle.Query ();
			index_listener_query.IsIndexListener = true;

			index_listener_query.HitsAddedEvent += OnHitsAdded;
			index_listener_query.HitsSubtractedEvent += OnHitsSubtracted;

			index_listener_query.SendAsync ();
		}
示例#7
0
        static private void SetupIndexListener()
        {
            index_listener_query = new Beagle.Query();
            index_listener_query.IsIndexListener = true;

            index_listener_query.HitsAddedEvent      += OnHitsAdded;
            index_listener_query.HitsSubtractedEvent += OnHitsSubtracted;

            index_listener_query.SendAsync();
        }
示例#8
0
        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);
            }
        }
示例#9
0
        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"));
            }
        }
示例#10
0
        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));
            }
        }
示例#11
0
        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"));
            }
        }
示例#12
0
        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");
        }
示例#13
0
        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));
        }
示例#14
0
        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"]);
            }
        }
示例#15
0
        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();
        }
示例#16
0
        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));
            }
        }
示例#17
0
        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));
        }
示例#18
0
        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");
            }
        }
示例#19
0
        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));
        }
示例#20
0
        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));
        }
示例#21
0
        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");
        }
示例#22
0
        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();
        }
示例#23
0
        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;
        }
示例#24
0
 public override Tile BuildTile(Beagle.Hit hit, Beagle.Query query)
 {
     return(new RSSFeed(hit, query));
 }
示例#25
0
 public override Tile BuildTile(Beagle.Hit hit, Beagle.Query query)
 {
     return(new Folder(hit, query));
 }
示例#26
0
 public TileNote(Beagle.Hit hit, Beagle.Query query) : base(hit, query)
 {
     Title       = Hit.GetFirstProperty("dc:title");
     Description = Utils.NiceShortDate(Timestamp);
 }
示例#27
0
 public override Tile BuildTile(Beagle.Hit hit, Beagle.Query query)
 {
     return(new Contact(hit, query));
 }
示例#28
0
 public TileArchivedFile(Beagle.Hit hit, Beagle.Query query) : base(hit, query)
 {
     Description = String.Format(Catalog.GetString("Inside archive {0}"), Utils.GetFirstPropertyOfParent(hit, "beagle:ExactFilename"));
 }
示例#29
0
        public Application(Beagle.Hit hit, Beagle.Query query, IntPtr ditem) : this(hit, query)
        {
            this.ditem = ditem;
//			AddAction (new TileAction (Catalog.GetString ("Move to trash"), Gtk.Stock.Delete, MoveToTrash));
        }
示例#30
0
 protected Application(Beagle.Hit hit, Beagle.Query query) : base(hit, query)
 {
     Group       = TileGroup.Application;
     Title       = Hit.GetFirstProperty("fixme:Name");
     Description = Hit ["fixme:Comment"];
 }
示例#31
0
 public abstract Tile BuildTile(Beagle.Hit hit, Beagle.Query query);