Exemplo n.º 1
0
        protected override void LoadIcon(Gtk.Image image, int size)
        {
            Hashtable icons = (Hashtable)all_icons[size];

            if (icons == null)
            {
                all_icons[size] = icons = IconsForSize(size);
            }

            string protocol = Hit.GetFirstProperty("fixme:protocol");

            if (protocol == null)
            {
                protocol = String.Empty;
            }

            if (icons [protocol] != null)
            {
                image.Pixbuf = (Gdk.Pixbuf)icons [protocol];
            }
            else
            {
                image.Pixbuf = WidgetFu.LoadThemeIcon("im", size);
            }
        }
Exemplo n.º 2
0
        private string GetBuddyStatus()
        {
            GalagoTools.Status stat = Beagle.Util.GalagoTools.GetPresence(Hit.GetFirstProperty("fixme:protocol"), Hit.GetFirstProperty("fixme:speakingto"));
            string             str  = null;

            if (stat == GalagoTools.Status.Idle)
            {
                str = String.Format("{0} for {1}", Catalog.GetString("Idle"),
                                    Beagle.Util.GalagoTools.GetIdleTime(Hit.GetFirstProperty("fixme:protocol"),
                                                                        Hit.GetFirstProperty("fixme:speakingto")));
            }
            else
            {
                switch (stat)
                {
                case GalagoTools.Status.Away:
                    str = Catalog.GetString("Away");
                    break;

                case GalagoTools.Status.Offline:
                    str = Catalog.GetString("Offline");
                    break;

                case GalagoTools.Status.Available:
                    str = Catalog.GetString("Available");
                    break;

                case GalagoTools.Status.NoStatus:
                    str = null;
                    break;
                }
            }
            return(str);
        }
Exemplo n.º 3
0
        protected override DetailsPane GetDetails()
        {
            DetailsPane details = new DetailsPane();

            details.AddLabelPair(Catalog.GetString("File:"), Hit.GetFirstProperty("beagle:ExactFilename"));

            string title = Hit.GetFirstProperty("dc:title");

            if (!String.IsNullOrEmpty(title))
            {
                details.AddLabelPair(Catalog.GetString("Title:"), title);
            }

            details.AddLabelPair(Catalog.GetString("Last Edited:"), Utils.NiceLongDate(Timestamp));

            if (Hit ["dc:author"] != null)
            {
                details.AddLabelPair(Catalog.GetString("Author:"), Hit ["dc:author"]);
            }

            details.AddLabelPair(Catalog.GetString("Full Path:"), Hit.Uri.LocalPath);
            details.AddSnippet();

            return(details);
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
0
        protected override DetailsPane GetDetails()
        {
            DetailsPane details = new DetailsPane();

            bool sent = (Utils.GetFirstPropertyOfParent(Hit, "fixme:isSent") != null);

            details.AddLabelPair(Catalog.GetString("Subject:"), SubjectLabel.Text);

            string label = sent ? Catalog.GetString("To:") : Catalog.GetString("From:");

            details.AddLabelPair(label, GetAddress(Hit));

            label = sent ? Catalog.GetString("Date Sent:") : Catalog.GetString("Date Received:");
            details.AddLabelPair(label, Utils.NiceLongDate(Timestamp));

            string folder = Hit.GetFirstProperty("fixme:folder");

            if (folder != null)
            {
                details.AddLabelPair(Catalog.GetString("Folder:"), folder);
            }

            details.AddSnippet();

            return(details);
        }
        public static LibraryTrackInfo HitToTrack(Hit hit)
        {
            uint track_number = 0;
            uint track_count  = 0;
            int  year         = 0;

            try {
                track_number = UInt32.Parse(hit.GetFirstProperty("fixme:tracknumber"));
            } catch { }

            try {
                track_count = UInt32.Parse(hit.GetFirstProperty("fixme:trackcount"));
            } catch { }

            try {
                year = Int32.Parse(hit.GetFirstProperty("fixme:year"));
            } catch { }

            try {
                LibraryTrackInfo track = new LibraryTrackInfo(
                    new SafeUri(hit.Uri),
                    hit.GetFirstProperty("fixme:artist"),
                    hit.GetFirstProperty("fixme:album"),
                    hit.GetFirstProperty("fixme:title"),
                    hit.GetFirstProperty("fixme:genre"),
                    track_number, track_count, year,
                    TimeSpan.Zero, null, RemoteLookupStatus.NoAttempt);

                return(track);
            } catch {
                return(null);
            }
        }
Exemplo n.º 7
0
 private Gdk.Pixbuf GetIcon(int size)
 {
     if (Hit.GetFirstProperty("beagle:Photo") != null)
     {
         Gdk.Pixbuf icon = new Gdk.Pixbuf(Hit.GetFirstProperty("beagle:Photo"));
         return(icon.ScaleSimple(size, size, Gdk.InterpType.Bilinear));
     }
     else
     {
         return(WidgetFu.LoadThemeIcon("stock_person", size));
     }
 }
Exemplo n.º 8
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));
            }
        }
Exemplo n.º 9
0
        public void FindAllFromSender()
        {
            SafeProcess p    = new SafeProcess();
            string      addr = Hit.GetFirstProperty("fixme:from_address");

            p.Arguments = new string [] { "beagle-search", String.Format("mailfromaddr:{0}", addr) };
            try {
                p.Start();
            } catch (Exception e) {
                Console.WriteLine("Error launching new search: " + e.Message);
            }
        }
Exemplo n.º 10
0
        public override void Open()
        {
            SafeProcess p = GetClientProcess(Hit.GetFirstProperty("fixme:client"), Hit.EscapedUri);

            if (p == null)
            {
                Console.WriteLine("Opening contact '{0}' is unsupported!", Hit.EscapedUri);
                return;
            }

            try {
                p.Start();
            } catch (SafeProcessException e) {
                Console.WriteLine(e.Message);
            }
        }
Exemplo n.º 11
0
        public void FindSameAuthor()
        {
            SafeProcess p      = new SafeProcess();
            string      author = Hit.GetFirstProperty("dc:author");

            if (String.IsNullOrEmpty(author))
            {
                author = Hit.GetFirstProperty("dc:creator");
            }
            p.Arguments = new string [] { "beagle-search", String.Format("author:{0} OR creator:{0}", author) };
            try {
                p.Start();
            } catch (Exception e) {
                Console.WriteLine("Error launching new search: " + e.Message);
            }
        }
Exemplo n.º 12
0
        protected override DetailsPane GetDetails()
        {
            DetailsPane details = new DetailsPane();

            details.AddLabelPair(Catalog.GetString("Title:"), Title);
            details.AddLabelPair(Catalog.GetString("Last Edited:"), Utils.NiceLongDate(Timestamp));

            if (!String.IsNullOrEmpty(Hit.GetFirstProperty("note:tag")))
            {
                string tags = String.Join(", ", Hit.GetProperties("note:tag"));
                details.AddLabelPair(Catalog.GetString("Tags:"), tags);
            }

            details.AddSnippet();

            return(details);
        }
Exemplo n.º 13
0
        protected override void LoadIcon(Gtk.Image image, int size)
        {
            // The File tile doesn't respect the icon size because
            // 48 is too small for thumbnails

            if (!thumbnailer.SetThumbnailIcon(image, Hit, size))
            {
                base.LoadIcon(image, size);
            }

            // FIXME: Multiple emblems
            string emblem = Hit.GetFirstProperty("nautilus:emblem");

            if (String.IsNullOrEmpty(emblem))
            {
                return;
            }

            Gdk.Pixbuf emblem_pixbuf = WidgetFu.LoadThemeIcon("emblem-" + emblem, 24);

            if (emblem_pixbuf == null)
            {
                return;
            }

            Gdk.Pixbuf icon = image.Pixbuf.Copy();

            // If the icon itself is smaller than our requested
            // emblem, just display the icon.

            if ((icon.Height < emblem_pixbuf.Height || icon.Width < emblem_pixbuf.Width) ||
                (icon.Height < (emblem_pixbuf.Height * 2) && icon.Width < (emblem_pixbuf.Width * 2)))
            {
                icon.Dispose();
                emblem_pixbuf.Dispose();
                return;
            }

            emblem_pixbuf.Composite(icon, 0, 0, emblem_pixbuf.Width, emblem_pixbuf.Height,
                                    0, 0, 1, 1, Gdk.InterpType.Bilinear, 255);
            emblem_pixbuf.Dispose();

            image.Pixbuf.Dispose();
            image.Pixbuf = icon;
        }
Exemplo n.º 14
0
        protected override DetailsPane GetDetails()
        {
            DetailsPane details = new DetailsPane();

            details.AddLabelPair(Catalog.GetString("Title:"), Title);

            if (!String.IsNullOrEmpty(Description))
            {
                details.AddLabelPair(Catalog.GetString("Description:"), Description);
            }

            if (!String.IsNullOrEmpty(Hit.GetFirstProperty("fixme:starttime")))
            {
                details.AddLabelPair(Catalog.GetString("Date:"), Utils.NiceShortDate(Hit.GetFirstProperty("fixme:starttime")));
            }

            return(details);
        }
Exemplo n.º 15
0
        protected override DetailsPane GetDetails()
        {
            DetailsPane details = new DetailsPane();

            details.AddTitleLabel(Title);

            string org          = Hit.GetFirstProperty("fixme:Org");
            string title        = Hit.GetFirstProperty("fixme:Title");
            string email        = Hit.GetFirstProperty("fixme:Email");
            string mobile_phone = Hit.GetFirstProperty("fixme:MobilePhone");
            string work_phone   = Hit.GetFirstProperty("fixme:BusinessPhone");
            string home_phone   = Hit.GetFirstProperty("fixme:HomePhone");

            if (org != null && org != "")
            {
                details.AddTextLabel(org);
            }
            if (title != null && title != "")
            {
                details.AddTextLabel(title);
            }

            details.AddNewLine();

            if (email != null && email != "")
            {
                details.AddLabelPair(Catalog.GetString("E-Mail:"), email);
            }
            if (mobile_phone != null && mobile_phone != "")
            {
                details.AddLabelPair(Catalog.GetString("Mobile Phone:"), mobile_phone);
            }
            if (work_phone != null && work_phone != "")
            {
                details.AddLabelPair(Catalog.GetString("Work Phone:"), work_phone);
            }
            if (home_phone != null && home_phone != "")
            {
                details.AddLabelPair(Catalog.GetString("Home Phone:"), home_phone);
            }

            return(details);
        }
Exemplo n.º 16
0
        protected override DetailsPane GetDetails()
        {
            DetailsPane details = new DetailsPane();

            // FIXME: The icon needs a nice frame as in the spec (?)

            details.AddTitleLabel(Title);
            details.AddTextLabel(Description);
            details.AddNewLine();

            string[] tags = Hit.GetProperties("dc:subject");
            if (tags != null && tags.Length > 0)
            {
                details.AddLabelPair(Catalog.GetString("Tags:"), String.Join(", ", tags));
            }

            details.AddLabelPair(Catalog.GetString("Modified:"), Utils.NiceVeryLongDate(Hit.FileInfo.LastWriteTime));
            details.AddLabelPair(Catalog.GetString("Full Path:"), Hit.Uri.LocalPath);

            // Get comments from the image.  FIXME: These should be unified into a single field.
            string comment = Hit.GetFirstProperty("png:comment");

            if (String.IsNullOrEmpty(comment))
            {
                comment = Hit.GetFirstProperty("jfif:Comment");
            }

            if (!String.IsNullOrEmpty(comment))
            {
                details.AddLabelPair(Catalog.GetString("Comment:"), comment);
                //details.AddNewLine ();
                //details.AddTextLabel (comment);
            }

            if (Hit ["fspot:Description"] != null && Hit ["fspot:Description"] != "")
            {
                details.AddNewLine();
                details.AddTextLabel(Hit ["fspot:Description"]);
            }

            return(details);
        }
Exemplo n.º 17
0
        public override void Open()
        {
            // If we are not a feed from Thunderbird just open based on mime
            if (Hit.GetFirstProperty("fixme:client") != "thunderbird")
            {
                base.OpenFromUri(Hit ["dc:identifier"]);
                return;
            }

#if ENABLE_THUNDERBIRD
            // Here's the Thunderbird specific part
            SafeProcess p = Thunderbird.GetSafeProcess("-viewbeagle", Hit.GetFirstProperty("fixme:uri"));

            try {
                p.Start();
            } catch (SafeProcessException e) {
                Console.WriteLine("Unable to run {0}: {1}", p.Arguments [0], e.Message);
            }
#endif
        }
Exemplo n.º 18
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;
        }
Exemplo n.º 19
0
        protected override DetailsPane GetDetails()
        {
            DetailsPane details = new DetailsPane();

            details.AddLabelPair(Catalog.GetString("Title:"), Title);

            if (!String.IsNullOrEmpty(Description))
            {
                details.AddLabelPair(Catalog.GetString("Description:"), Description);
            }

            if (!String.IsNullOrEmpty(Hit.GetFirstProperty("fixme:starttime")))
            {
                Console.WriteLine("1. " + Hit.GetFirstProperty("fixme:starttime"));
                string time = Utils.NiceShortTime(Hit.GetFirstProperty("fixme:starttime"));
                Console.WriteLine("2. " + time);

                if (!String.IsNullOrEmpty(Hit.GetFirstProperty("fixme:endtime")))
                {
                    time = String.Format("{0} - {1}", time, Utils.NiceShortTime(Hit.GetFirstProperty("fixme:endtime")));
                }

                details.AddLabelPair(Catalog.GetString("Time:"), time);
            }

            if (!String.IsNullOrEmpty(Hit.GetFirstProperty("fixme:location")))
            {
                details.AddLabelPair(Catalog.GetString("Location:"), Hit.GetFirstProperty("fixme:location"));
            }

            string[] attendees = Hit.GetProperties("fixme:attendee");
            if (attendees != null && attendees.Length > 0)
            {
                details.AddLabelPair(Catalog.GetString("Attendees:"), String.Join(", ", attendees));
            }

            return(details);
        }
Exemplo n.º 20
0
 private void SendMail()
 {
     OpenFromUri("mailto:" + Hit.GetFirstProperty("fixme:Email"));
 }
Exemplo n.º 21
0
 protected Application(Beagle.Hit hit, Beagle.Query query) : base(hit, query)
 {
     Group       = TileGroup.Application;
     Title       = Hit.GetFirstProperty("fixme:Name");
     Description = Hit ["fixme:Comment"];
 }
Exemplo n.º 22
0
 public TileNote(Beagle.Hit hit, Beagle.Query query) : base(hit, query)
 {
     Title       = Hit.GetFirstProperty("dc:title");
     Description = Utils.NiceShortDate(Timestamp);
 }