Пример #1
0
        public override bool Start()
        {
            if (FileTransfer != null)
            {
                if (base.Start())
                {
                    FileTransfer.Start();
                    TelepathyNotification.Create().Show(FileTransfer.Contact.Name,
                                                        String.Format(AddinManager.CurrentLocalizer.GetString("is sending {0} with Banshee"),
                                                                      FileTransfer.Filename));
                    return(true);
                }
            }

            return(false);
        }
Пример #2
0
        public override bool Start()
        {
            if (State != TransferState.Ready)
            {
                return(false);
            }

            if (FileTransfer != null)
            {
                SetTransferFilename(FileTransfer);
                TelepathyNotification.Create().Show(FileTransfer.Contact.Name,
                                                    String.Format(AddinManager.CurrentLocalizer.GetString("is downloading {0} with Banshee"),
                                                                  FileTransfer.Filename));
                return(base.Start());
            }

            return(false);
        }
        private void OnTubeManagerClosed(object sender, EventArgs args)
        {
            TubeManager manager = sender as TubeManager;

            if (manager.CurrentActivity.InitiatorHandle != Contact.Connection.SelfHandle)
            {
//                if (dialog != null) {
//                    dialog.Destroy ();
//                    dialog = null;
//                }
                if (getting_response)
                {
                    ResetResponseMessage();
                }
            }
            else
            {
                TelepathyNotification.Create().Show(Contact.Name,
                                                    AddinManager.CurrentLocalizer.GetString("is no longer sharing their Banshee library with you"));
            }
        }
        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();
        }