public RssManagerDialog(RssManagerController controller)
        {
            this.Build();

            this.controller = controller;

            fetchFeedsWorker = new BackgroundWorker();
            fetchFeedsWorker.DoWork += FetchFeeds;
            fetchFeedsWorker.RunWorkerCompleted += FetchFeedsCompleted;

            BuildFeedPage();
            BuildFilterPage();
            BuildTorrentPage();
            BuildHistoryPage();

            UpdateFeeds();
        }
Beispiel #2
0
        public RssManagerDialog(RssManagerController controller)
        {
            this.Build();

            this.controller = controller;

            fetchFeedsWorker                     = new BackgroundWorker();
            fetchFeedsWorker.DoWork             += FetchFeeds;
            fetchFeedsWorker.RunWorkerCompleted += FetchFeedsCompleted;

            BuildFeedPage();
            BuildFilterPage();
            BuildTorrentPage();
            BuildHistoryPage();

            UpdateFeeds();
        }
Beispiel #3
0
        public MainWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            this.portController = ServiceManager.Get <ListenPortController> ();
            this.torrentController = ServiceManager.Get <TorrentController> ();
            interfaceSettings = new InterfaceSettings ();

            Ticker.Tick ();
            LoadAllSettings ();
            Ticker.Tock ("Loaded all settings: {0}");

            Ticker.Tick ();
            Ticker.Tick ();

            Build ();

            AddInManagerAction.Activated += AddInManagerActionActivated;

            InitNatStatus ();

            Ticker.Tock ("Build");
            Ticker.Tick();
            BuildStatusBar();
            Ticker.Tock ("Status bar");
            Ticker.Tick ();
            BuildTray();
            Ticker.Tock ("Tray");
            Ticker.Tick ();
            BuildPiecesTreeView();
            Ticker.Tock ("PiecesTreeview");
            Ticker.Tick ();
            BuildTorrentTreeView();
            Ticker.Tock ("TorrentTreeview");
            Ticker.Tick ();
            BuildPeerTreeView();
            Ticker.Tock ("PeerTreeview");
            Ticker.Tick ();
            BuildFileTreeView();
            Ticker.Tock ("FileTreeview");
            Ticker.Tick ();
            BuildLabelTreeView();
            Ticker.Tock ("Label treeview");
            Ticker.Tick ();
            BuildOptionsPage();
            Ticker.Tock ("Options page");
            Ticker.Tick ();
            BuildSpeedsPopup();
            Ticker.Tock ("Speeds popup");
            Ticker.Tock ("Built all stuff");

            GLib.Timeout.Add (1000, new GLib.TimeoutHandler (updateView));

            Ticker.Tick ();
            RestoreInterfaceSettings ();
            Ticker.Tock ("Restored Interface");

            if (SettingsManager.Preferences.UpnpEnabled)
                portController.Start();

            Ticker.Tick ();
            try{
                torrentController.LoadStoredTorrents ();
            }catch (Exception ex) {
                Console.WriteLine (ex);
                Environment.Exit(414);
            }
            Ticker.Tock ("Loaded torrents");

            Ticker.Tick ();
            logger.Info ("Restoring labels");
            LabelController.Restore ();
            // Restore previously labeled torrents
            foreach (Download download in torrentController.Torrents){
                foreach (TorrentLabel l in LabelController.Labels) {
                    if (l.TruePaths == null)
                        continue;

                    if (Array.IndexOf <string> (l.TruePaths, download.Manager.Torrent.TorrentPath) < 0)
                        continue;

                    l.AddTorrent (download);
                }
            }
            Ticker.Tock ("Restored labels");

            torrentController.Initialise ();
            folderWatcher = new TorrentFolderWatcher (new DirectoryInfo (SettingsManager.Preferences.ImportLocation));
            folderWatcher.TorrentFound += delegate(object o, TorrentWatcherEventArgs e) {
                GLib.Idle.Add(Event.Wrap ((GLib.IdleHandler) delegate {
                    TorrentFound (o, e);
                    return false;
                }));
            };

            torrentController.SelectionChanged += delegate {
                updateToolBar ();
            };

            torrentController.ShouldRemove += HandleShouldRemove;

            if (SettingsManager.Preferences.ImportEnabled) {
                logger.Info ("Starting import folder watcher");
                folderWatcher.Start ();
            }

            logger.Info ("Starting RSS manager");
            rssManagerController = new RssManagerController(SettingsManager.EngineSettings);
            rssManagerController.TorrentFound += delegate(object sender, TorrentRssWatcherEventArgs e) {
                string savePath = e.Filter == null ? SettingsManager.EngineSettings.SavePath : e.Filter.SavePath;
                try {
                    LoadTorrent(e.Item.Link, true, false, false, null, savePath, true);
                } catch {
                    logger.Error("RSS Manager: Unable to add - " + e.Item.Title);
                }
            };
            logger.Info ("Started RSS manager");
            rssManagerController.StartWatchers();
            AddGConfListeners ();
            updateToolBar ();
            ShowAll();
        }