public InfoWindow(Song song, Window w) : base("", w, DialogFlags.DestroyWithParent) { this.HasSeparator = false; Glade.XML glade_xml = new Glade.XML (null, "InfoWindow.glade", "info_contents", null); glade_xml.Autoconnect (this); this.VBox.Add (info_contents); cover_image = new MagicCoverImage (); cover_image_container.Add (cover_image); cover_image.Visible = true; // Gdk.Pixbuf cover = new Gdk.Pixbuf (null, "unknown-cover.png", 66, 66); // cover_image.ChangePixbuf (cover); user_name_label = new UrlLabel (); user_name_label.UrlActivated += new UrlActivatedHandler (OnUrlActivated); user_name_container.Add (user_name_label); user_name_label.SetAlignment ((float) 0.0, (float) 0.5); user_name_label.Visible = true; real_name_label = new UrlLabel (); real_name_label.UrlActivated += new UrlActivatedHandler (OnUrlActivated); real_name_container.Add (real_name_label); real_name_label.SetAlignment ((float) 0.0, (float) 0.5); real_name_label.Visible = true; this.AddButton ("gtk-close", ResponseType.Close); SetSong (song); }
private void SetupUI() { Driver.connection.ConnectionChanged += new FMConnection.ConnectionChangedHandler (OnConnectionChanged); Driver.connection.OperationStarted += new FMConnection.OperationHandler (OnOperationStarted); Driver.connection.OperationFinished += new FMConnection.OperationHandler (OnOperationFinished); Driver.connection.StationChanged += new FMConnection.StationChangedHandler (OnStationChanged); Driver.player.Plist.NewPlaylistReady += new Playlist.NewPlaylistReadyHandler (OnNewPlaylistReady); Driver.connection.MetadataLoaded += new FMConnection.MetadataCompletedHandler (OnMetadataCompleted); Driver.connection.Error += new FMConnection.ErrorHandler (OnError); artist_label = new UrlLabel (); artist_label.SetAlignment ((float) 0.0, (float) 0.5); artist_label.Ellipsize = Pango.EllipsizeMode.End; artist_label.UrlActivated += new UrlActivatedHandler (OnUrlActivated); artist_label.Visible = true; artist_label_container.Add (artist_label); song_label = new UrlLabel (); song_label.SetAlignment ((float) 0.0, (float) 0.5); song_label.Ellipsize = Pango.EllipsizeMode.End; song_label.UrlActivated += new UrlActivatedHandler (OnUrlActivated); song_label.Visible = true; title_label_container.Add (song_label); cover_image = new MagicCoverImage (); cover_image_container.Add (cover_image); cover_image.CoverImageChanged += new MagicCoverImage.CoverImageChangedHandler (set_height_limit); cover_image.Visible = true; love_image = new Image (); love_image.FromPixbuf = new Gdk.Pixbuf (null, "face-smile.png"); love_button.Add (love_image); love_image.Visible = true; hate_image = new Image (); hate_image.FromPixbuf = new Gdk.Pixbuf (null, "face-sad.png"); hate_button.Add (hate_image); hate_image.Visible = true; progress_label.CanFocus = false; progress_label.Visible = false; // Add additional search path IconTheme current_theme = IconTheme.Default; current_theme.AppendSearchPath(Defines.PREFIX+"/share/icons/"); current_theme.PrependSearchPath(Defines.PREFIX+"/share/"+Defines.PACKAGE+"/icons"); tag_button_image.SetFromStock ("tag-new", Gtk.IconSize.Button); info_button_image.SetFromStock ("show-info", Gtk.IconSize.Button); // Create images user_image = new Gdk.Pixbuf (null, "person-image.png"); neighbour_image = new Gdk.Pixbuf (null, "people-image.png"); favourite_image = new Gdk.Pixbuf (null, "favourites-image.png"); recommended_image = new Gdk.Pixbuf (null, "recommended-image.png"); // Create a store for the stations stations = new StationStore (typeof (Gdk.Pixbuf), typeof (String), typeof (bool), typeof (String)); add_station (neighbour_image, Catalog.GetString("Neighbour Station"), FMConnection.MakeUserRadio (Driver.connection.Username, "/neighbours"), true); add_station (user_image, Catalog.GetString("Personal Station"), FMConnection.MakeUserRadio (Driver.connection.Username, "/personal"), Driver.connection.Subscriber); add_station (favourite_image, Catalog.GetString("Favourites Station"), FMConnection.MakeUserRadio (Driver.connection.Username, "/loved"), Driver.connection.Subscriber); add_station (recommended_image, Catalog.GetString("Recommended Music Station"), FMConnection.MakeRecommendedRadio (Driver.connection.Username, Driver.config.RecommendationLevel), true); stations.AppendValues (null, "last-exit:separator", true, null); stations.AppendValues (null, Catalog.GetString("Other Station..."), true, null); // Add the recent stations too foreach (RecentStations.Station s in RecentStations.Recent) { add_custom_station (null, s.name, s.path, true); } if (Driver.connection.Connected == FMConnection.ConnectionState.Disconnected) { station_combo.Sensitive = false; toggle_play_button.Sensitive = false; next_button.Sensitive = false; love_button.Sensitive = false; hate_button.Sensitive = false; tag_button.Sensitive = false; journal_button.Sensitive = false; info_button.Sensitive = false; progress_label.Visible = false; } station_combo.Model = stations; station_combo.RowSeparatorFunc = station_separator_func; CellRenderer pb_render = new CellRendererPixbuf (); station_combo.PackStart (pb_render, false); station_combo.SetAttributes (pb_render, "pixbuf", Column.Pixbuf); station_combo.SetCellDataFunc (pb_render, station_sensitive_func); CellRenderer text_render = new CellRendererText (); station_combo.PackStart (text_render, true); station_combo.SetAttributes (text_render, "text", Column.Name); station_combo.SetCellDataFunc (text_render, station_sensitive_func); // Set default station station_combo.Active = 0; // Such a hassle to block emissions station_combo.Changed += new EventHandler (OnStationComboChanged); //Gdk.Pixbuf cover = new Gdk.Pixbuf (null, "unknown-cover.png", 66, 66); //cover_image.ChangePixbuf (cover); cover_image.ChangePixbuf(null); }