Beispiel #1
0
        protected override void PopulateTemplate()
        {
            base.PopulateTemplate();

            Template["nice_duration"] = "(" +
                                        StringFu.DurationToPrettyString(
                StringFu.StringToDateTime(Hit ["fixme:endtime"]),
                StringFu.StringToDateTime(Hit ["fixme:starttime"])) + ")";
            if (Template ["nice_duration"] == "()")
            {
                Template ["nice_duration"] = "";
            }

            if (email != null)
            {
                Template ["SendMailAction"] = Catalog.GetString("Send Mail");
            }

            // FIXME: This is a temporary hack until gaim supports other protocols than AIM via gaim-remote
            if (Hit ["fixme:protocol"] == "aim")
            {
                Template ["SendIMAction"] = Catalog.GetString("Send IM");
            }

            speaking_alias = (Hit ["fixme:speakingto_alias"] != null) ? Hit ["fixme:speakingto_alias"] : Hit ["fixme:speakingto"];

            // FIXME: Hack to figure out if the conversation is taken place in a chat room
            if (Hit["fixme:speakingto"].EndsWith(".chat"))
            {
                Template["title"] = String.Format(Catalog.GetString("Conversation in {0}"), speaking_alias.Replace(".chat", ""));
            }
            else
            {
                Template["title"] = String.Format(Catalog.GetString("Conversation with {0}"), speaking_alias);
            }

            if (Hit ["fixme:speakingto_icon"] != null && File.Exists(Hit ["fixme:speakingto_icon"]))
            {
                Template["Icon"] = StringFu.PathToQuotedFileUri(Hit ["fixme:speakingto_icon"]);
            }
            else
            {
                Template["Icon"] = Images.GetHtmlSource("gnome-gaim.png", "image/png");
            }

#if ENABLE_GALAGO
            if (Hit ["fixme:protocol"] == "aim")
            {
                string status = GalagoTools.GetPresence(Hit ["fixme:protocol"], Hit["fixme:speakingto"]);
                if (status != null && status != "")
                {
                    Template ["Presence"] = status;
                }
            }
#endif
        }
Beispiel #2
0
        protected override void PopulateTemplate()
        {
            base.PopulateTemplate();

            string photo_filename = Hit["beagle:Photo"];

            if (photo_filename != null)
            {
                System.Console.WriteLine("photo: {0}", photo_filename);
                string height = "";

                try {
                    // bad hack to scale the image
                    Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(photo_filename);
                    if (pixbuf.Width > pixbuf.Height)
                    {
                        if (pixbuf.Width > 80)
                        {
                            height = "width=\"80\"";
                        }
                    }
                    else
                    {
                        if (pixbuf.Height > 80)
                        {
                            height = "height=\"80\"";
                        }
                    }
                } catch {
                }

                Template["size_adjustment"] = height;
                Template["Icon"]            = StringFu.PathToQuotedFileUri(photo_filename);
            }
            else
            {
                Template["size_adjustment"] = "";
                Template["Icon"]            = default_contact_icon_data;
            }

            if (Hit["fixme:ImAim"] != null)
            {
                Template["CanSendIm"] = "";
            }

#if ENABLE_GALAGO
            if (Hit ["fixme:ImAim"] != null)
            {
                string status = GalagoTools.GetPresence("aim", Hit ["fixme:ImAim"]);
                if (status != null && status != "")
                {
                    Template ["Presence"] = status;
                }
            }
#endif
        }
        protected override void PopulateTemplate()
        {
            base.PopulateTemplate();

            bool   sent = (GetHitProperty(Hit, "fixme:isSent") != null);
            string str  = GetHitProperty(Hit, "dc:title");

            if (str == null)
            {
                str = String.Format("<i>{0}</i>", Catalog.GetString("No Subject"));
            }

            if (GetHitProperty(Hit, "_IsDeleted") != null)
            {
                str = "<strike>" + str + "</strike>";
            }

            Template["Icon"]    = GetMailIcon();
            Template["Subject"] = str;
            Template["ToFrom"]  = sent ? Catalog.GetString("To") : Catalog.GetString("From");

            // Limit the number of recipients to 3, so the
            // tile doesn't look terrible.
            if (sent)
            {
                string[] values = Hit.GetProperties("fixme:to");

                if (values != null)
                {
                    StringBuilder sb = new StringBuilder();
                    int           i;

                    for (i = 0; i < 3 && i < values.Length; i++)
                    {
                        if (i != 0)
                        {
                            sb.Append(", ");
                        }

                        sb.Append(values [i]);
                    }

                    if (i < values.Length)
                    {
                        sb.Append(", ...");
                    }

                    Template["Who"] = sb.ToString();
                }
            }
            else
            {
                Template["Who"] = GetHitProperty(Hit, "fixme:from");
            }

            Template["Folder"]       = GetHitProperty(Hit, "fixme:folder");
            Template["Account"]      = GetHitProperty(Hit, "fixme:account");
            Template["SentReceived"] = sent ? Catalog.GetString("Sent") : Catalog.GetString("Received");
            Template["When"]         = GetHitProperty(Hit, "fixme:date");

            if (GetHitProperty(Hit, "fixme:client") == "evolution")
            {
                Template ["CanReply"] = "";
            }

            // FIXME: Gross attachment rendering
            if (IsAttachment(Hit))
            {
                Template["Subject"]      = Hit ["fixme:attachment_title"] + " [" + Catalog.GetString("Email attachment") + "]";
                Template["EmailSubject"] = str;
                string path = GnomeFu.GetMimeIconPath(Hit.MimeType);
                Template["Icon"] = Images.GetHtmlSource(path, Hit.MimeType);
            }

            if (GetHitProperty(Hit, "fixme:isFlagged") != null)
            {
                Template["FollowupIcon"] = Images.GetHtmlSourceForStock("stock_mail-priority-high", 16);
            }
            if (GetHitProperty(Hit, "fixme:hasAttachments") != null)
            {
                Template["AttachmentIcon"] = Images.GetHtmlSourceForStock("stock_attach", 16);
            }

#if ENABLE_EVO_SHARP
            GetImNames(Template["Who"]);

            if (aim_name != null)
            {
                Template["CanSendIm"] = "";
            }
#endif

#if ENABLE_GALAGO
#if ENABLE_EVO_SHARP
            if (aim_name != null)
            {
                string status = GalagoTools.GetPresence("aim", aim_name);
                if (status != null && status != "")
                {
                    Template ["Presence"] = status;
                }
            }
#endif
#endif
        }