Example #1
0
        public ContactSourceContents (ContactContainerSource source)
        {
            this.source = source;

            HscrollbarPolicy = PolicyType.Never;
            VscrollbarPolicy = PolicyType.Automatic;

            viewport = new Viewport ();
            viewport.ShadowType = ShadowType.None;

            main_box = new VBox ();
            main_box.Spacing = 6;
            main_box.BorderWidth = 5;
            main_box.ReallocateRedraws = true;

            // Clamp the width, preventing horizontal scrolling
            SizeAllocated += delegate (object o, SizeAllocatedArgs args) {
                // TODO '- 10' worked for Nereid, but not for Cubano; properly calculate the right width we should request
                main_box.WidthRequest = args.Allocation.Width - 30;
            };

            viewport.Add (main_box);

            StyleSet += delegate {
                viewport.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
                viewport.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
            };

            AddWithFrame (viewport);
            ShowAll ();
        }
        public TelepathyActions(ContactContainerSource container)
            : base(ServiceManager.Get<InterfaceActionService> (), "telepathy-container")
        {
            this.container = container;

            Add (new ActionEntry [] {
                new ActionEntry ("DownloadTrackAction", null,
                    Catalog.GetString ("Download Track(s)"), null,
                    Catalog.GetString ("Download selected tracks to your computer"),
                    OnDownloadTrack)
            });

            Add (new ActionEntry [] {
                new ActionEntry ("CancelDownloadTrackAction", null,
                    Catalog.GetString ("Cancel Download(s)"), null,
                    Catalog.GetString ("Cancel download of selected tracks to your computer"),
                    OnCancelDownloadTrack)
            });

            Add (new ActionEntry [] {
                new ActionEntry ("CancelBrowseRequest", null,
                    Catalog.GetString ("Cancel Browse Request"), "c",
                    Catalog.GetString ("Cancel pending request to browse a contact's library"),
                    OnCancelBrowseRequest)
            });

            Add (new ToggleActionEntry [] {
                new ToggleActionEntry ("AllowDownloadsAction", null,
                    Catalog.GetString ("Allow Downloads"), null,
                    Catalog.GetString ("Allow file downloads when sharing libraries"),
                    OnAllowDownloads, ContactContainerSource.AllowDownloadsSchema.Get ())
            });

            Add (new ToggleActionEntry [] {
                new ToggleActionEntry ("AllowStreamingAction", null,
                    Catalog.GetString ("Allow Streaming"), null,
                    Catalog.GetString ("Allow streaming when sharing libraries"),
                    OnAllowStreaming, ContactContainerSource.AllowStreamingSchema.Get ())
            });

            Add (new ToggleActionEntry [] {
                new ToggleActionEntry ("ShareCurrentlyPlayingAction", null,
                    Catalog.GetString ("Share Currently Playing"), null,
                    Catalog.GetString ("Set Empathy presence message to what you're currently playing"),
                    OnShareCurrentlyPlaying, ContactContainerSource.ShareCurrentlyPlayingSchema.Get ())
            });

            actions_id = Actions.UIManager.AddUiFromResource ("GlobalUI.xml");
            Actions.AddActionGroup (this);

            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
                PlayerEvent.StartOfStream | PlayerEvent.StateChange);

            //OnUpdated (null, null);

            //Register ();

            Actions.TrackActions.PostActivate += OnTrackActionsActiviated;
        }
        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 ();
            }
        }
        public void DelayedInitialize ()
        {
            // require for bundled version of NDesk.DBus
            NDesk.DBus.BusG.Init ();

            conn_map = new Dictionary <string, Connection> ();
            source_map = new Dictionary <string, IDictionary <Contact, ContactSource>> ();
            
            container = new ContactContainerSource (this);
            ServiceManager.SourceManager.AddSource (container);

            download_manager = new DownloadManagerUi ();
            upload_manager = new UploadManagerUi ();

            try {
                locator = new ConnectionLocator ();
            }
            catch (DBusProxyObjectNotFound e) {
                Log.Error (e.ToString ());
                return;
            }

            foreach (Account account in locator.GetConnections ()) {
                CreateConnection (account);
            }

            locator.ConnectionStatusChanged += OnConnectionStatusChanged;

            try {
                proxy_server = new StreamingHTTPProxyServer ();
                proxy_server.Start ();
            }
            catch (Exception e) {
                Log.Error ("Failed to start Banshee.Telepathy.StreamingHTTPProxyServer");
                Log.Exception (e);
            }

            try {
                streaming_server = new StreamingServer ();
                streaming_server.Start ();
            }
            catch (Exception e) {
                Log.Error ("Failed to start Banshee.Telepathy.StreamingHTTPProxyServer");
                Log.Exception (e);
            }
        }
Example #5
0
 public void ResetSource ()
 {
     source = null;
     tile_map.Clear ();
 }
        public bool SetSource(ISource src)
        {
            source = src as ContactContainerSource;
            if (source == null) {
                return false;
            }

            Refresh ();
            return true;
        }