예제 #1
0
        private void OnTorrentStateChanged(object sender, TorrentStateChangedEventArgs args)
        {
            TorrentManager manager = (TorrentManager)sender;

            Gtk.Application.Invoke(delegate {
                if (args.OldState == TorrentState.Downloading)
                {
                    logger.Debug("Removing " + manager.Torrent.Name + " from download label");
                    mainWindow.DownloadingLabel.RemoveTorrent(manager);
                }
                else if (args.OldState == TorrentState.Seeding)
                {
                    logger.Debug("Removing " + manager.Torrent.Name + " from upload label");
                    mainWindow.SeedingLabel.RemoveTorrent(manager);
                }

                if (args.NewState == TorrentState.Downloading)
                {
                    logger.Debug("Adding " + manager.Torrent.Name + " to download label");
                    mainWindow.DownloadingLabel.AddTorrent(manager);
                }
                else if (args.NewState == TorrentState.Seeding)
                {
                    logger.Debug("Adding " + manager.Torrent.Name + " to upload label");
                    mainWindow.SeedingLabel.AddTorrent(manager);
                }

                if (!prefSettings.EnableNotifications)
                {
                    return;
                }
                if (args.NewState != TorrentState.Seeding)
                {
                    return;
                }
                if (args.OldState != TorrentState.Downloading)
                {
                    return;
                }

                Notifications.Notification notify = new Notifications.Notification("Download Complete", manager.Torrent + " has finished downloading.");
                notify.AttachToWidget(mainWindow.TrayIcon);
                notify.Timeout = 5000;
                notify.Show();
            });
        }
예제 #2
0
        private void RealNotifyUser(string title, string message, NotificationType type)
        {
            var icon = Stock.Info;

            switch (type)
            {
            case NotificationType.Information:
                icon = Stock.DialogInfo;
                break;

            case NotificationType.Warning:
                icon = Stock.DialogWarning;
                break;

            case NotificationType.Error:
                icon = Stock.DialogError;
                break;
            }

            var notification = new Notifications.Notification(title, message, Stock.Info);

            notification.Show();
        }
예제 #3
0
        void HandleStateChanged(object sender, StateChangedEventArgs args)
        {
            // Update toolbar
            updateToolBar ();

            Download manager = (Download) sender;

            if (args.NewState == Monsoon.State.Stopped)
                PeerListStore.Clear ();

            this.updateView ();

            if (!Preferences.EnableNotifications)
                return;
            if (args.NewState != Monsoon.State.Seeding)
                return;
            if (args.OldState != Monsoon.State.Downloading)
                return;

            try {
                Notifications.Notification notify = new Notifications.Notification (_("Download Complete"), manager.Torrent.Name, Stock.GoDown);
                if (Preferences.EnableTray)
                    notify.Show ();
                notify.Urgency = Notifications.Urgency.Low;
                notify.Timeout = 5000;
                notify.Show ();
                notify.AddAction("reveal-item", "Show", delegate {
                    System.Diagnostics.Process.Start("\"file://" + manager.SavePath + "\"");
                });
            } catch (Exception ex) {
                logger.Error ("Could not display notification");
                logger.Error (ex.ToString());
            }
        }
예제 #4
0
파일: GtkRunner.cs 프로젝트: admz/duplicati
        private void RealNotifyUser(string title, string message, NotificationType type)
        {
            var icon = Stock.Info;
            switch (type)
            {
                case NotificationType.Information:
                    icon = Stock.DialogInfo;
                    break;
                case NotificationType.Warning:
                    icon = Stock.DialogWarning;
                    break;
                case NotificationType.Error:
                    icon = Stock.DialogError;
                    break;
            }

            var notification = new Notifications.Notification(title, message, Stock.Info);
            notification.Show();
        }
예제 #5
0
		private void OnTorrentStateChanged(object sender, TorrentStateChangedEventArgs args)
		{
			TorrentManager manager = (TorrentManager)sender;
			
			Gtk.Application.Invoke (delegate {
				if (args.OldState == TorrentState.Downloading) {
					logger.Debug("Removing " + manager.Torrent.Name + " from download label");
					mainWindow.DownloadingLabel.RemoveTorrent(manager);
				} else if (args.OldState == TorrentState.Seeding) {
					logger.Debug("Removing " + manager.Torrent.Name + " from upload label");
					mainWindow.SeedingLabel.RemoveTorrent(manager);
				}
				
				if (args.NewState == TorrentState.Downloading) {
					logger.Debug("Adding " + manager.Torrent.Name + " to download label");
					mainWindow.DownloadingLabel.AddTorrent(manager);
				} else if (args.NewState == TorrentState.Seeding) {
					logger.Debug("Adding " + manager.Torrent.Name + " to upload label");
					mainWindow.SeedingLabel.AddTorrent(manager);
				}
			
				if (!prefSettings.EnableNotifications)
					return;
				if (args.NewState != TorrentState.Seeding)
					return;
				if (args.OldState != TorrentState.Downloading)
					return;
			
				Notifications.Notification notify = new Notifications.Notification ("Download Complete", manager.Torrent + " has finished downloading.");
				notify.AttachToWidget (mainWindow.TrayIcon);
				notify.Timeout = 5000;
				notify.Show ();
			});
			
		}