Exemple #1
0
        public AlbumBox(Album album, Lyrics main)
            : base(false, 0)
        {
            this.album = album;
            this.main = main;

            Label name = new Label ();
            Label year = new Label ();

            name.Markup = "<b>" + Utils.ParseMarkup (album.Name) + "</b>";
            year.Markup = "<small>" + album.Year + "</small>";

            name.Ellipsize = Pango.EllipsizeMode.End;
            name.Xalign = 0;
            year.Xalign = 0;

            VBox header = new VBox (false, 0);
            header.PackStart (name, false, false, 0);
            header.PackStart (year, false, false, 0);

            header.BorderWidth = 4;
            box.Add (header);

            this.PackStart (box, false, false, 0);

            //events
            box.Realized += realized;
            box.EnterNotifyEvent += mouse_enter;
            box.LeaveNotifyEvent += mouse_leave;
            box.ButtonReleaseEvent += mouse_clicked;
        }
Exemple #2
0
        /// <summary>
        /// Load the artist search.
        /// </summary>
        public override void Load(XmlDocument doc, QueryInfo query)
        {
            last_query = query;

            foreach (Widget widget in album_box.Children)
                album_box.Remove (widget);

            XmlNodeList list = doc.GetElementsByTagName ("getArtistResponse");
            if (list.Count == 0)
                return;

            string artist = null;
            XmlNodeList albums_node = null;

            //look for artist name
            foreach (XmlNode node in list[0].ChildNodes)
            {
                if (node.Name == "artist")
                {
                    artist = node.InnerText;
                    search_title.Markup = "<b><big><big>" + Utils.ParseMarkup (artist) + "</big></big></b>\n";
                }
                else if (node.Name == "albums")
                    albums_node = node.ChildNodes;
            }

            if (albums_node == null || albums_node.Count == 0)
                return;

            string name = null;
            string year = null;

            album_box.PackStart (new HSeparator (), false, false, 2);

            foreach (XmlNode node in albums_node)
            {
                switch (node.Name)
                {
                    case "album":
                        name = node.InnerText;
                        break;

                    case "year":
                        if (node.InnerText != "0")
                            year = node.InnerText;
                        break;

                    case "songs":
                        Album album = new Album (artist, name, year, node.ChildNodes);

                        album_box.PackStart (new AlbumBox (album, main), false ,false, 0);
                        album_box.PackStart (new HSeparator (), false, false, 2);

                        name = null;
                        year = null;
                        break;
                }
            }
        }