Ejemplo n.º 1
0
        public PreferencesDialog(MainWindow mainWindow)
        {
            this.engineSettings    = SettingsManager.EngineSettings;
            this.prefSettings      = SettingsManager.Preferences;
            this.labelController   = mainWindow.LabelController;
            this.trayIcon          = mainWindow.TrayIcon;
            this.interfaceSettings = mainWindow.InterfaceSettings;

            Build();
            buildFoldersPanel();
            buildImportPanel();
            buildLabelPage();
            buildConnectionPage();
            restorePreferences();
            BuildGeneralPage();
            SetNames();
            upnpCheckBox.Toggled   += OnUpnpCheckBoxToggled;
            spinMaxActive.Sensitive = false;
            spinMaxSeed.Sensitive   = false;
//			spinMaxActive.ValueChanged += delegate {
//				DownloadQueueService queue = ServiceManager.Get <DownloadQueueService> ();
//				queue.MaxActive = spinMaxActive.ValueAsInt;
//			};
            spinMaxDownload.ValueChanged += delegate {
                DownloadQueueService queue = ServiceManager.Get <DownloadQueueService> ();
                queue.MaxDownloads = spinMaxActive.ValueAsInt;
            };
//			spinMaxSeed.ValueChanged += delegate {
//				DownloadQueueService queue = ServiceManager.Get <DownloadQueueService> ();
//				queue.MaxSeeds = spinMaxActive.ValueAsInt;
//			};
        }
Ejemplo n.º 2
0
        public LabelTreeView(LabelController labels, bool contextActive)
        {
            Controller         = labels;
            this.contextActive = contextActive;

            Reorderable      = false;
            HeadersVisible   = false;
            HeadersClickable = false;

            buildColumns();
            BuildContextMenu();

            Controller.Added   += LabelAdded;
            Controller.Removed += LabelRemoved;

            Selection.Changed += Event.Wrap(delegate(object sender, EventArgs e) {
                TreeIter iter;
                if (Selection.GetSelected(out iter))
                {
                    Controller.Selection = ((TorrentLabel)Model.GetValue(iter, 0));
                }
            });

            Controller.Labels.ForEach(Add);
            Remove(Controller.Delete);
        }
Ejemplo n.º 3
0
        public PreferencesDialog(MainWindow mainWindow)
        {
            this.engineSettings = SettingsManager.EngineSettings;
            this.prefSettings = SettingsManager.Preferences;
            this.labelController = mainWindow.LabelController;
            this.trayIcon = mainWindow.TrayIcon;
            this.interfaceSettings = mainWindow.InterfaceSettings;

            Build();
            buildFoldersPanel();
            buildImportPanel();
            buildLabelPage();
            buildConnectionPage();
            restorePreferences();
            BuildGeneralPage();
            SetNames ();
            upnpCheckBox.Toggled += OnUpnpCheckBoxToggled;
            spinMaxActive.Sensitive = false;
            spinMaxSeed.Sensitive = false;
            //			spinMaxActive.ValueChanged += delegate {
            //				DownloadQueueService queue = ServiceManager.Get <DownloadQueueService> ();
            //				queue.MaxActive = spinMaxActive.ValueAsInt;
            //			};
            spinMaxDownload.ValueChanged += delegate {
                DownloadQueueService queue = ServiceManager.Get <DownloadQueueService> ();
                queue.MaxDownloads = spinMaxActive.ValueAsInt;
            };
            //			spinMaxSeed.ValueChanged += delegate {
            //				DownloadQueueService queue = ServiceManager.Get <DownloadQueueService> ();
            //				queue.MaxSeeds = spinMaxActive.ValueAsInt;
            //			};
        }
Ejemplo n.º 4
0
        public LabelTreeView(LabelController labels, bool contextActive)
        {
            Controller = labels;
            this.contextActive = contextActive;

            Reorderable = false;
            HeadersVisible = false;
            HeadersClickable = false;

            buildColumns();
            BuildContextMenu();

            Controller.Added += LabelAdded;
            Controller.Removed += LabelRemoved;

            Selection.Changed += Event.Wrap (delegate(object sender, EventArgs e) {
                TreeIter iter;
                if (Selection.GetSelected (out iter))
                    Controller.Selection = ((TorrentLabel) Model.GetValue (iter, 0));
            });

            Controller.Labels.ForEach (Add);
            Remove (Controller.Delete);
        }
Ejemplo n.º 5
0
        public TorrentTreeView() : base()
        {
            Torrents = new ListStore(typeof(Download), typeof(string), typeof(string),
                                     typeof(int), typeof(string), typeof(string),
                                     typeof(string), typeof(string), typeof(string),
                                     typeof(string), typeof(string), typeof(string), typeof(string));

            FilterModel             = new Gtk.TreeModelFilter(Torrents, null);
            FilterModel.VisibleFunc = delegate(TreeModel model, TreeIter iter) {
                return(Filter == null ? true : Filter((Download)model.GetValue(iter, 0)));
            };
            Model = FilterModel;
            this.torrentController = ServiceManager.Get <TorrentController> ();

            buildColumns();

            Reorderable        = true;
            HeadersVisible     = true;
            HeadersClickable   = true;
            Selection.Mode     = SelectionMode.Multiple;
            Selection.Changed += Event.Wrap(delegate(object o, EventArgs e) {
                TreeIter iter;
                TreePath [] selectedTorrents = Selection.GetSelectedRows();

                List <Download> downloads = new List <Download> ();
                foreach (TreePath path in Selection.GetSelectedRows())
                {
                    if (Torrents.GetIter(out iter, path))
                    {
                        downloads.Add((Download)Torrents.GetValue(iter, 0));
                    }
                }

                torrentController.Select(downloads);
            });

            sourceEntries = new TargetEntry [] {
                new TargetEntry(RowAtom.Name, TargetFlags.App, 0)
            };
            targetEntries = new TargetEntry [] {
                new TargetEntry(RowAtom.Name, TargetFlags.Widget, 0),
                new TargetEntry(FileAtom.Name, TargetFlags.OtherApp, 0)
            };
            EnableModelDragSource(Gdk.ModifierType.Button1Mask, sourceEntries, Gdk.DragAction.Copy);
            EnableModelDragDest(targetEntries, Gdk.DragAction.Copy);
            DragDataGet += OnTorrentDragDataGet;

            menu = new TorrentContextMenu();
            torrentController.Added += delegate(object sender, DownloadAddedEventArgs e) {
                AddDownload(e.Download);
            };
            torrentController.Removed += delegate(object sender, DownloadAddedEventArgs e) {
                RemoveDownload(e.Download);
            };

            LabelController lc = ServiceManager.Get <LabelController> ();

            lc.SelectionChanged += delegate {
                TorrentLabel label = lc.Selection;
                Filter = delegate(Download download) {
                    return(label.Torrents.Contains(download));
                };
            };

            // FIXME: This shouldn't be necessary
            torrentController.Torrents.ForEach(AddDownload);
        }