Exemple #1
0
        public RecommendationPane(ContextPage contextPage)
            : base()
        {
            this.context_page = contextPage;
            main_box = this;
            main_box.BorderWidth = 5;

            artist_box = new TitledList (Catalog.GetString ("Recommended Artists"));
            artist_box.ShowAll ();
            similar_artists_view = new TileView (2);
            similar_artists_view_sw = new Gtk.ScrolledWindow ();
            similar_artists_view_sw.SetPolicy (PolicyType.Never, PolicyType.Automatic);
            similar_artists_view_sw.Add (similar_artists_view);
            similar_artists_view_sw.ShowAll ();
            artist_box.PackStart (similar_artists_view_sw, true, true, 0);

            album_box  = new TitledList (null);
            album_box.TitleWidthChars = 25;
            album_box.SizeAllocated += OnSideSizeAllocated;
            album_list = new VBox ();
            album_box.PackStart (album_list, false, false, 0);

            track_box  = new TitledList (null);
            track_box.SizeAllocated += OnSideSizeAllocated;
            track_box.TitleWidthChars = 25;
            track_list = new VBox ();
            track_box.PackStart (track_list, true, true, 0);

            no_artists_pane = new MessagePane ();
            no_artists_pane.NoShowAll = true;
            no_artists_pane.Visible = false;
            string no_results_message;

            if (!ApplicationContext.Debugging) {
                no_artists_pane.HeaderIcon = IconThemeUtils.LoadIcon (48, "face-sad", Stock.DialogError);
                no_results_message = Catalog.GetString("No similar artists found");
            } else {
                no_artists_pane.HeaderIcon = Gdk.Pixbuf.LoadFromResource ("no-results.png");
                no_results_message = "No one likes your music, fool!";
            }

            no_artists_pane.HeaderMarkup = String.Format ("<big><b>{0}</b></big>", GLib.Markup.EscapeText (no_results_message));
            artist_box.PackEnd (no_artists_pane, true, true, 0);

            main_box.PackStart (artist_box, true, true, 5);
            main_box.PackStart (new VSeparator (), false, false, 0);
            main_box.PackStart (album_box, false, false, 5);
            main_box.PackStart (new VSeparator (), false, false, 0);
            main_box.PackStart (track_box, false, false, 5);

            no_artists_pane.Hide ();
        }
        public void Refresh ()
        {
            tile_map.Clear ();

            if (contacts_view == null) {
                contacts_view = new TileView (1);
            }

            if (contacts == null) {
                contacts = new TitledList (AddinManager.CurrentLocalizer.GetString ("Contacts"));
                contacts.PackStart (contacts_view, true, true, 0);
                contacts_view.Show ();

                contacts.StyleSet += delegate {
                    contacts_view.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
                    contacts_view.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
                };
            }

            while (main_box.Children.Length != 0) {
                main_box.Remove (main_box.Children[0]);
            }

            main_box.PackStart (contacts, false, false, 0);

            contacts_view.ClearWidgets ();
            foreach (Connection conn in source.TelepathyService.GetActiveConnections ()) {
                AppendToList (conn);
            }

            ShowAll ();
        }