private void OnTogglePlayButtonClicked(object o, EventArgs args) { ToggleButton t = o as ToggleButton; TreeIter iter; if (internal_toggle == true) { internal_toggle = false; return; } if (t.Active == false) { Driver.player.Stop (); artist_label.Markup = ""; song_label.Markup = ""; this.Title = "Last Exit"; 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; trayicon.CanShowPopup = false; // FIXME: Need a blank cover. //Gdk.Pixbuf cover = new Gdk.Pixbuf (null, "unknown-cover.png", 66, 66); //cover_image.ChangePixbuf (cover); cover_image.ChangePixbuf(null); return; } if (station_combo.GetActiveIter (out iter)) { string path = (string) station_combo.Model.GetValue (iter, (int) Column.Path); if (path != null) { Driver.connection.ChangeStation (path); } else { FindStation dialog = new FindStation (this); dialog.Visible = true; } } }
private void OnStationComboChanged(object o, EventArgs args) { ComboBox combo = o as ComboBox; TreeIter iter; if (internal_change == true) { return; } if (combo.GetActiveIter (out iter)) { string path = (string) combo.Model.GetValue (iter, (int) Column.Path); if (path != null) { Driver.connection.ChangeStation (path); } else { FindStation dialog = new FindStation (this); dialog.Visible = true; } } }
private void OnError(int errno) { switch (errno) { case 1: show_error_message (Catalog.GetString("There is not enough content to play this station.")); break; case 2: show_error_message (Catalog.GetString("This group does not have enough members for radio.")); break; case 3: show_error_message (Catalog.GetString("This artist does not have enough fans for radio.")); break; case 4: show_error_message (Catalog.GetString("This item is not available for streaming.")); break; case 5: show_error_message (Catalog.GetString("This feature is only available to subscribers.")); break; case 6: show_error_message (Catalog.GetString("There are not enough neighbours for this radio.")); break; case 7: show_error_message (Catalog.GetString("This stream has stopped.")); break; case 8: show_error_message (Catalog.GetString("There is no such a group.")); break; case 9: show_error_message (Catalog.GetString("There is no such an artist.")); break; default: break; } // All these errors require a new station to be selected FindStation dialog = new FindStation (this); dialog.Visible = true; }
private void OnSpecialKeysPressed(object o, SpecialKey key) { switch (key) { case SpecialKey.AudioPlay: if(Driver.player.Playing == true) { // We are playing so stop playing Driver.player.Stop(); toggle_play_button.Active = false; artist_label.Markup = ""; song_label.Markup = ""; this.Title = "Last Exit"; trayicon.CanShowPopup = false; // FIXME: Need a blank cover. //Gdk.Pixbuf cover = new Gdk.Pixbuf (null, "unknown-cover.png", 66, 66); //cover_image.ChangePixbuf (cover); cover_image.ChangePixbuf(null); } else { // We were paused so play TreeIter iter; if (station_combo.GetActiveIter (out iter)) { string path = (string) station_combo.Model.GetValue (iter, (int) Column.Path); if (path != null) { Driver.connection.ChangeStation (path); } else { FindStation dialog = new FindStation (this); dialog.Visible = true; } } } break; case SpecialKey.AudioNext: Driver.connection.Skip(); break; } }
private void Search(FindStation.SearchType type, string description) { FMRequest fmr = new FMRequest (); string url, base_url; base_url = Driver.connection.BaseUrl; switch (type) { case FindStation.SearchType.SoundsLike: url = "http://" + base_url + "/1.0/get.php?resource=artist&document=similar&format=xml&artist=" + description; break; case FindStation.SearchType.TaggedAs: url = "http://" + base_url + "/1.0/tag/" + description + "/search.xml?showtop10=1"; break; case FindStation.SearchType.User: url = "http://" + base_url + "/1.0/user/" + description + "/profile.xml"; break; case FindStation.SearchType.Neighbour: url = "http://" + base_url + "/1.0/user/" + Driver.connection.Username + "/neighbours.xml"; break; case FindStation.SearchType.Group: url = "http://" + base_url + "/1.0/group/" + description + "/weeklychartlist.xml"; break; default: url = ""; break; } fmr.Closure = (object) type; fmr.RequestCompleted += new FMRequest.RequestCompletedHandler (FindStationCompleted); fmr.DoRequest (url); Driver.connection.DoOperationStarted (); }