コード例 #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);
        }
コード例 #3
0
        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"));
            }
        }
コード例 #4
0
        public void Dispose()
        {
            if (streaming_server != null)
            {
                streaming_server.Stop();
                streaming_server = null;
            }

            if (proxy_server != null)
            {
                proxy_server.Stop();
                proxy_server = null;
            }

            if (download_manager != null)
            {
                download_manager.Dispose();
                download_manager = null;
            }

            if (upload_manager != null)
            {
                upload_manager.Dispose();
                upload_manager = null;
            }

            if (container != null)
            {
                foreach (ContactSource source in container.Children)
                {
                    Log.DebugFormat("Disposing of ContactSource named {0}", source.Name);
                    source.Contact.ContactServicesChanged -= OnContactServicesChanged;
                    source.Dispose();
                }

                ServiceManager.SourceManager.RemoveSource(container, true);
                container = null;
            }

            if (locator != null)
            {
                locator.ConnectionStatusChanged -= OnConnectionStatusChanged;
                locator.Dispose();
                locator = null;
            }

            foreach (KeyValuePair <string, Connection> kv in conn_map)
            {
                if (kv.Value != null)
                {
                    kv.Value.Roster.RosterStateChanged -= OnRosterStateChanged;
                    kv.Value.Disconnected -= OnDisconnected;
                    kv.Value.Dispose();
                }
            }

            conn_map.Clear();
            source_map.Clear();

            TelepathyNotification notify = TelepathyNotification.Get;

            if (notify != null)
            {
                notify.Dispose();
            }
        }
コード例 #5
0
        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();
        }