private bool MaybeShowTeaserInPodcasts() { var manager = ServiceManager.SourceManager; var podcast_src = manager.Sources.FirstOrDefault(s => s.UniqueId == "PodcastSource-PodcastLibrary"); if (podcast_src != null) { var show = CreateSchema <bool> ("show_miro_guide_teaser_in_podcasts", true, null, null); if (show.Get()) { var msg = new SourceMessage(podcast_src) { CanClose = true, Text = Catalog.GetString("Discover interesting podcasts in the Miro Guide podcast directory!") }; msg.SetIconName("miro-guide-source"); msg.AddAction(new MessageAction(Catalog.GetString("Open Miro Guide"), delegate { manager.SetActiveSource(this); } )); msg.Updated += delegate { if (msg.IsHidden) { show.Set(false); } }; teaser = msg; podcast_src.PushMessage(msg); } return(true); } return(false); }
public bool Unmap() { StopPlayingDisc(); foreach (TrackInfo track in DiscModel) { track.CanPlay = false; } OnUpdated(); SourceMessage eject_message = new SourceMessage(this); eject_message.FreezeNotify(); eject_message.IsSpinning = true; eject_message.CanClose = false; // Translators: {0} is the type of disc, "Audio CD" or "DVD" eject_message.Text = String.Format(Catalog.GetString("Ejecting {0}..."), GenericName.ToLower()); eject_message.ThawNotify(); PushMessage(eject_message); ThreadPool.QueueUserWorkItem(delegate { try { DiscModel.Volume.Unmount(); DiscModel.Volume.Eject(); ThreadAssist.ProxyToMain(delegate { Service.UnmapDiscVolume(DiscModel.Volume.Uuid); Dispose(); }); } catch (Exception e) { ThreadAssist.ProxyToMain(delegate { ClearMessages(); eject_message.IsSpinning = false; eject_message.SetIconName("dialog-error"); // Translators: {0} is the type of disc, "Audio CD" or "DVD". {1} is the error message. eject_message.Text = String.Format(Catalog.GetString("Could not eject {0}: {1}"), GenericName.ToLower(), e.Message); PushMessage(eject_message); foreach (TrackInfo track in Model) { track.CanPlay = true; } OnUpdated(); }); Log.Exception(e); } }); return(true); }
public bool Unmap() { StopPlayingDisc(); foreach (TrackInfo track in disc_model) { track.CanPlay = false; } OnUpdated(); SourceMessage eject_message = new SourceMessage(this); eject_message.FreezeNotify(); eject_message.IsSpinning = true; eject_message.CanClose = false; eject_message.Text = Catalog.GetString("Ejecting audio CD..."); eject_message.ThawNotify(); PushMessage(eject_message); ThreadPool.QueueUserWorkItem(delegate { try { disc_model.Volume.Unmount(); disc_model.Volume.Eject(); ThreadAssist.ProxyToMain(delegate { service.UnmapDiscVolume(disc_model.Volume.Uuid); Dispose(); }); } catch (Exception e) { ThreadAssist.ProxyToMain(delegate { ClearMessages(); eject_message.IsSpinning = false; eject_message.SetIconName("dialog-error"); eject_message.Text = String.Format(Catalog.GetString("Could not eject audio CD: {0}"), e.Message); PushMessage(eject_message); foreach (TrackInfo track in disc_model) { track.CanPlay = true; } OnUpdated(); }); Log.Exception(e); } }); return(true); }
private void OnMetadataQueryFinished(object o, EventArgs args) { if (disc_model.Title != Name) { Name = disc_model.Title; OnUpdated(); } if (disc_model.MetadataQuerySuccess) { DestroyQueryMessage(); if (DiscIsPlaying) { ServiceManager.PlayerEngine.TrackInfoUpdated(); } if (AudioCdService.AutoRip.Get()) { BeginAutoRip(); } return; } if (query_message == null) { return; } query_message.FreezeNotify(); query_message.IsSpinning = false; query_message.SetIconName("dialog-error"); query_message.Text = Catalog.GetString("Could not fetch metadata for CD."); query_message.CanClose = true; query_message.ThawNotify(); }
private void ShowResponseMessage() { getting_response = true; if (response_message == null) { response_message = new SourceMessage(this); response_message.CanClose = false; response_message.IsSpinning = false; response_message.SetIconName(null); response_message.IsHidden = false; } PushMessage(response_message); response_message.FreezeNotify(); response_message.ClearActions(); string status_name = String.Format("<i>{0}</i>", GLib.Markup.EscapeText(Name)); string message = String.Format(AddinManager.CurrentLocalizer.GetString("{0} is requesting to browse your library"), Contact.Name); response_message.Text = String.Format(GLib.Markup.EscapeText(message), status_name); response_message.AddAction(new MessageAction(AddinManager.CurrentLocalizer.GetString("Accept"), delegate { tube_manager.AcceptBrowseRequest(); ResetResponseMessage(); })); response_message.AddAction(new MessageAction(AddinManager.CurrentLocalizer.GetString("Reject"), delegate { tube_manager.RejectBrowseRequest(); ResetResponseMessage(); })); response_message.ThawNotify(); TelepathyNotification.Create().Show(Contact.Name, AddinManager.CurrentLocalizer.GetString("is requesting to browse your Banshee library")); // show notify bubble every 30 seconds System.Timers.Timer notify_timer = new System.Timers.Timer(30000); notify_timer.Elapsed += (o, a) => { if (!getting_response) { notify_timer.Stop(); } else { TelepathyNotification.Create().Show(Contact.Name, AddinManager.CurrentLocalizer.GetString("is requesting to browse your Banshee library")); } }; notify_timer.AutoReset = true; notify_timer.Start(); // pulse source every 5 seconds NotifyUser(); System.Timers.Timer timer = new System.Timers.Timer(5000); timer.Elapsed += (o, a) => { if (!getting_response) { timer.Stop(); notify_timer.Stop(); } else { NotifyUser(); } }; timer.AutoReset = true; timer.Start(); }