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); }
internal static void SetStatus(SourceMessage status_message, LastfmSource lastfm, bool error, ConnectionState state) { status_message.FreezeNotify(); if (error) { if (state == ConnectionState.NoAccount || state == ConnectionState.InvalidAccount || state == ConnectionState.NotAuthorized) { status_message.AddAction(new MessageAction(Catalog.GetString("Account Settings"), delegate { lastfm.Actions.ShowLoginDialog(); })); } if (state == ConnectionState.NoAccount || state == ConnectionState.InvalidAccount) { status_message.AddAction(new MessageAction(Catalog.GetString("Join Last.fm"), delegate { lastfm.Account.SignUp(); })); } } status_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(); }