public IndexingStatusWindow() : base("IndexingStatusWindow")
        {
            indexingSpinner = new Hyena.Widgets.AnimatedImage();
            indexingSpinner.SetSizeRequest(16, 16);
            indexingSpinner.Pixbuf      = Gui.LoadIcon(22, "process-working");
            indexingSpinner.FrameHeight = 22;
            indexingSpinner.FrameWidth  = 22;
            indexingSpinner.Load();
            indexingSpinnerAlignment.Add(indexingSpinner);

            hashingSpinner = new Hyena.Widgets.AnimatedImage();
            hashingSpinner.SetSizeRequest(16, 16);
            hashingSpinner.Pixbuf      = Gui.LoadIcon(22, "process-working");
            hashingSpinner.FrameHeight = 22;
            hashingSpinner.FrameWidth  = 22;
            hashingSpinner.Load();
            hashingSpinnerAlignment.Add(hashingSpinner);

            Core.ShareBuilder.StartedIndexing += delegate {
                Application.Invoke(delegate {
                    indexingFileLabel.Text = "(Starting...)";
                    indexingSpinner.Show();
                });
            };

            Core.ShareBuilder.IndexingFile += delegate(object sender, FilenameEventArgs args) {
                Application.Invoke(delegate {
                    indexingFileLabel.Text = args.Filename;
                    indexingSpinner.Show();
                });
            };

            Core.ShareBuilder.FinishedIndexing += delegate {
                Application.Invoke(delegate {
                    indexingFileLabel.Text = "(Idle)";
                    indexingSpinner.Hide();
                });
            };

            Core.ShareBuilder.StoppedIndexing += delegate {
                Application.Invoke(delegate {
                    indexingFileLabel.Text = "(Idle - last run aborted)";
                    indexingSpinner.Hide();
                });
            };

            Core.ShareHasher.StartedHashingFile += delegate {
                UpdateShareHasherStatus();
            };

            Core.ShareHasher.FinishedHashingFile += delegate {
                UpdateShareHasherStatus();
            };

            Core.ShareHasher.QueueChanged += delegate {
                UpdateShareHasherStatus();
            };
        }
Beispiel #2
0
        private void CreateStatusbar()
        {
            statusBar              = new Toolbar();
            statusBar.ShowArrow    = false;
            statusBar.ToolbarStyle = ToolbarStyle.BothHoriz;
            statusBar.ExposeEvent += StatusBarExposeEvent;

            statusLabel        = new Label();
            statusLabel.Xalign = 0;
            statusLabel.Xpad   = 6;

            ToolItem  statusLabelItem = new ToolItem();
            Alignment statusAlign     = new Alignment(0.5f, 0.5f, 1.0f, 1.0f);

            statusLabelItem.Add(statusLabel);
            statusLabelItem.Expand = true;
            statusBar.Insert(statusLabelItem, -1);
            statusLabelItem.ShowAll();

            taskStatusIcon             = new AnimatedImage();
            taskStatusIcon.Pixbuf      = Gui.LoadIcon(22, "process-working");
            taskStatusIcon.FrameHeight = 22;
            taskStatusIcon.FrameWidth  = 22;
            taskStatusIcon.Load();

            EventBox taskStatusIconBox = new EventBox();

            taskStatusIconBox.MotionNotifyEvent += delegate {
                UpdateTaskStatusIcon();
            };
            taskStatusIconBox.ButtonReleaseEvent += delegate {
                IndexingStatusWindow.Instance.Show();
            };
            taskStatusIconBox.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                statusAlign.LeftPadding = (uint)args.Allocation.Width;
            };
            taskStatusIconBox.SetSizeRequest(22, 22);
            taskStatusIconBox.Add(taskStatusIcon);
            taskStatusIconBox.Show();

            ToolItem taskStatusIconItem = new ToolItem();

            taskStatusIconItem.Add(taskStatusIconBox);
            statusBar.Insert(taskStatusIconItem, -1);
            taskStatusIconItem.Show();

            mainVBox.PackStart(statusBar, false, false, 0);

            UpdateTaskStatusIcon();
            UpdateStatusText();
        }