public StationStore(Stations stations) : base(typeof(Station)) { this.stations = stations; foreach(Station station in stations.List) { StationGroup group = FindGroupForStation(station); if(group == null) { group = CreateGroup(station.Group); AddNode(group); } group.AddChild(station); } }
public StationStore(Stations stations) : base(typeof(Station)) { this.stations = stations; foreach (Station station in stations.List) { StationGroup group = FindGroupForStation(station); if (group == null) { group = CreateGroup(station.Group); AddNode(group); } group.AddChild(station); } }
public StationDialog(Stations stations, Station station) { glade = new Glade.XML(null, "radio.glade", "StationDialog", "banshee"); glade.Autoconnect(this); dialog = (Dialog)glade.GetWidget("StationDialog"); Banshee.Base.IconThemeUtils.SetWindowIcon(dialog); if (station == null) { is_new = true; station = new Station(); } this.stations = stations; this.station = station; link_store = new LinkStore(station); view = new NodeView(link_store); view.HeadersVisible = true; CellRendererToggle active_renderer = new CellRendererToggle(); active_renderer.Activatable = true; active_renderer.Radio = true; active_renderer.Toggled += OnLinkToggled; view.AppendColumn(Catalog.GetString("Active"), active_renderer, ActiveDataFunc); view.AppendColumn(Catalog.GetString("Type"), new CellRendererText(), TypeDataFunc); view.AppendColumn(Catalog.GetString("Title"), EditTextRenderer(), "text", 1); view.AppendColumn(Catalog.GetString("URI"), EditTextRenderer(), "text", 2); view.Show(); (glade["link_view_container"] as ScrolledWindow).Add(view); group_combo = ComboBoxEntry.NewText(); group_combo.Show(); (glade["group_combo_container"] as Box).PackStart(group_combo, true, true, 0); title_entry.Text = station.Title == null ? String.Empty : station.Title; description_entry.Text = station.Description == null ? String.Empty : station.Description; group_combo.Entry.Text = station.Group == null ? String.Empty : station.Group; foreach (string group in stations.Groups) { group_combo.AppendText(group); } }
public RadioSource(RadioPlugin plugin) : base(Catalog.GetString("Internet Radio"), 150) { this.plugin = plugin; stations_file = Path.Combine(Paths.UserPluginDirectory, "radio-stations.xml"); if(!File.Exists(stations_file)) { string default_xml = Resource.GetFileContents("stations.xml"); TextWriter writer = new StreamWriter(stations_file); writer.Write(default_xml); writer.Close(); } stations = Stations.Load(stations_file); stations.Updated += delegate { view.QueueDraw(); }; store = new StationStore(stations); BuildInterface(); }
public RadioSource(RadioPlugin plugin) : base(Catalog.GetString("Internet Radio"), 150) { this.plugin = plugin; stations_file = Path.Combine(Paths.UserPluginDirectory, "radio-stations.xml"); if (!File.Exists(stations_file)) { string default_xml = Resource.GetFileContents("stations.xml"); TextWriter writer = new StreamWriter(stations_file); writer.Write(default_xml); writer.Close(); } stations = Stations.Load(stations_file); stations.Updated += delegate { view.QueueDraw(); }; store = new StationStore(stations); BuildInterface(); }
public static Stations Load(string path) { XmlSerializer serializer = new XmlSerializer(typeof(Stations)); try { Stations stations; if(File.Exists(path)) { stations = (Stations)serializer.Deserialize(new XmlTextReader(path)); } else { stations = new Stations(); } stations.Path = path; return stations; } catch(Exception e) { Console.WriteLine("Could not deserialize Stations XML file: " + e.Message); Stations stations = new Stations(); stations.Path = path; return stations; } }
public StationDialog(Stations stations, Station station) { glade = new Glade.XML(null, "radio.glade", "StationDialog", "banshee"); glade.Autoconnect(this); dialog = (Dialog)glade.GetWidget("StationDialog"); Banshee.Base.IconThemeUtils.SetWindowIcon(dialog); if(station == null) { is_new = true; station = new Station(); } this.stations = stations; this.station = station; link_store = new LinkStore(station); view = new NodeView(link_store); view.HeadersVisible = true; CellRendererToggle active_renderer = new CellRendererToggle(); active_renderer.Activatable = true; active_renderer.Radio = true; active_renderer.Toggled += OnLinkToggled; view.AppendColumn(Catalog.GetString("Active"), active_renderer, ActiveDataFunc); view.AppendColumn(Catalog.GetString("Type"), new CellRendererText(), TypeDataFunc); view.AppendColumn(Catalog.GetString("Title"), EditTextRenderer(), "text", 1); view.AppendColumn(Catalog.GetString("URI"), EditTextRenderer(), "text", 2); view.Show(); (glade["link_view_container"] as ScrolledWindow).Add(view); group_combo = ComboBoxEntry.NewText(); group_combo.Show(); (glade["group_combo_container"] as Box).PackStart(group_combo, true, true, 0); title_entry.Text = station.Title == null ? String.Empty : station.Title; description_entry.Text = station.Description == null ? String.Empty : station.Description; group_combo.Entry.Text = station.Group == null ? String.Empty : station.Group; foreach(string group in stations.Groups) { group_combo.AppendText(group); } }