LoadIcon() public static method

public static LoadIcon ( int size ) : Gdk.Pixbuf
size int
return Gdk.Pixbuf
Esempio n. 1
0
        public ZoomableNetworkMap()
        {
            noticeIcon = Gui.LoadIcon(24, "dialog-information");
            rng        = new Random();

            networkZOrder = ArrayList.Synchronized(new ArrayList());

            selectedGroup     = null;
            nodeDragging      = false;
            nodeDraggingLastX = 0;
            nodeDraggingLastY = 0;

            Core.NetworkAdded   += (NetworkEventHandler)DispatchService.GuiDispatch(new NetworkEventHandler(AddNetwork));
            Core.NetworkRemoved += (NetworkEventHandler)DispatchService.GuiDispatch(new NetworkEventHandler(DeleteNetwork));

            foreach (Network network in Core.Networks)
            {
                AddNetwork(network);
            }

            base.ButtonPressEvent   += base_ButtonPressEvent;
            base.ButtonReleaseEvent += base_ButtonReleaseEvent;
            base.MotionNotifyEvent  += base_MotionNotifyEvent;

            this.render  = DrawContents;
            this.overlay = DrawOverlay;
            this.QueueDraw();
        }
Esempio n. 2
0
        private TransfersPage()
        {
            ScrolledWindow swindow = new ScrolledWindow();

            transferListStore  = new ListStore(typeof(IFileTransfer));
            transferList       = new TreeView();
            transferList.Model = transferListStore;

            swindow.Add(transferList);
            this.PackStart(swindow, true, true, 0);
            swindow.ShowAll();

            TreeViewColumn column = transferList.AppendColumn("", new CellRendererPixbuf(), new TreeCellDataFunc(TransferIconFunc));

            column.MinWidth = 25;

            column           = transferList.AppendColumn("Name", new CellRendererText(), new TreeCellDataFunc(TransferNameFunc));
            column.Expand    = true;
            column.Resizable = true;

            column           = transferList.AppendColumn("Progress", new CellRendererProgress(), new TreeCellDataFunc(TransferProgressFunc));
            column.Resizable = true;
            column.MinWidth  = 100;

            column           = transferList.AppendColumn("Up Speed", new CellRendererText(), new TreeCellDataFunc(TransferUpSpeedFunc));
            column.Resizable = true;

            column           = transferList.AppendColumn("Down Speed", new CellRendererText(), new TreeCellDataFunc(TransferDownSpeedFunc));
            column.Resizable = true;

            column           = transferList.AppendColumn("Status", new CellRendererText(), new TreeCellDataFunc(TransferStatusFunc));
            column.Resizable = true;
            column.MinWidth  = 150;

            transferList.RowActivated     += OnTransferListRowActivated;
            transferList.ButtonPressEvent += OnTransferListButtonPressEvent;

            downloadImage = Gui.LoadIcon(16, "go-down");
            uploadImage   = Gui.LoadIcon(16, "go-up");

            GLib.Timeout.Add(500, new GLib.TimeoutHandler(RefreshTransferList));

            /*
             * Core.NetworkAdded +=
             *      (NetworkEventHandler)DispatchService.GuiDispatch(
             *              new NetworkEventHandler(Core_NetworkAdded)
             *      );
             */

            Core.FileTransferManager.NewFileTransfer +=
                (EventHandler <FileTransferEventArgs>)DispatchService.GuiDispatch(
                    new EventHandler <FileTransferEventArgs>(manager_NewFileTransfer)
                    );

            Core.FileTransferManager.FileTransferRemoved +=
                (EventHandler <FileTransferEventArgs>)DispatchService.GuiDispatch(
                    new EventHandler <FileTransferEventArgs>(manager_FileTransferRemoved)
                    );
        }
Esempio n. 3
0
        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();
            };
        }
Esempio n. 4
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 Hyena.Widgets.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();
        }
Esempio n. 5
0
        private void RoomComboImageFunc(CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            var pixbufCell = (CellRendererPixbuf)cell;
            var room       = model.GetValue(iter, 1) as ChatRoom;

            if (room != null && room.HasPassword)
            {
                pixbufCell.Pixbuf = Gui.LoadIcon(22, "dialog-password");
            }
            else
            {
                pixbufCell.Pixbuf = null;
            }
        }
Esempio n. 6
0
        private void RoomSecureDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            var    pixbufCell = (CellRendererPixbuf)cell;
            object item       = model.GetValue(iter, 0);

            if (item is ChatRoom && ((ChatRoom)item).HasPassword)
            {
                pixbufCell.Pixbuf = Gui.LoadIcon(22, "dialog-password");
            }
            else
            {
                pixbufCell.Pixbuf = null;
            }
        }
Esempio n. 7
0
        private void RoomComboImageFunc(CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            var pixbufCell = (CellRendererPixbuf)cell;
            var obj        = model.GetValue(iter, 0);

            if (obj is ChatRoom && ((ChatRoom)obj).HasPassword)
            {
                pixbufCell.Pixbuf = Gui.LoadIcon(22, "dialog-password");
            }
            else
            {
                pixbufCell.Pixbuf = null;
            }
        }
Esempio n. 8
0
        private ConnectionsPage()
        {
            ScrolledWindow swindow = new ScrolledWindow();

            connectionListStore              = new ListStore(typeof(ITransport));
            connectionList                   = new TreeView();
            connectionList.Model             = connectionListStore;
            connectionList.HeadersVisible    = true;
            connectionList.ButtonPressEvent += connectionList_ButtonPressEvent;

            incomingPixbuf = Gui.LoadIcon(16, "go-next");
            outgoingPixbuf = Gui.LoadIcon(16, "go-previous");

            TreeViewColumn column;

            column          = connectionList.AppendColumn("", new CellRendererPixbuf(), new TreeCellDataFunc(ConnectionListIconFunc));
            column.MinWidth = 25;

            column           = connectionList.AppendColumn("Remote Address", new CellRendererText(), new TreeCellDataFunc(ConnectionListAddressFunc));
            column.Resizable = true;

            column           = connectionList.AppendColumn("Type", new CellRendererText(), new TreeCellDataFunc(ConnectionListTypeFunc));
            column.Resizable = true;

            column           = connectionList.AppendColumn("Status", new CellRendererText(), new TreeCellDataFunc(ConnectionListStatusFunc));
            column.Resizable = true;

            column           = connectionList.AppendColumn("Information", new CellRendererText(), new TreeCellDataFunc(ConnectionListInformationFunc));
            column.Resizable = true;

            swindow.Add(connectionList);
            this.PackStart(swindow, true, true, 0);
            swindow.ShowAll();

            Core.TransportManager.NewTransportAdded +=
                (EventHandler <TransportEventArgs>)DispatchService.GuiDispatch(
                    new EventHandler <TransportEventArgs>(OnNewTransportAdded)
                    );

            Core.TransportManager.TransportRemoved +=
                (EventHandler <TransportEventArgs>)DispatchService.GuiDispatch(
                    new EventHandler <TransportEventArgs>(OnTransportRemoved)
                    );

            Core.TransportManager.TransportError +=
                (EventHandler <ErrorEventArgs>)DispatchService.GuiDispatch(
                    new EventHandler <ErrorEventArgs>(CoreTransportManagerTransportError)
                    );
        }
Esempio n. 9
0
        public NavigationBar() : base(new Adjustment(0, 0, 0, 0, 0, 0), new Adjustment(0, 0, 0, 0, 0, 0))
        {
            mainHBox         = new HBox();
            mainHBox.Spacing = 3;
            mainHBox.Show();
            base.Put(mainHBox, 0, 0);
            base.HeightRequest = 30;

            base.Hadjustment.StepIncrement = 10;

            mainHBox.SizeAllocated += mainHBox_SizeAllocated;

            base.ScrollEvent += base_ScrollEvent;

            homeIcon    = Gui.LoadIcon(16, "user-home");
            networkIcon = Gui.LoadIcon(16, "stock_internet");
        }
Esempio n. 10
0
        public ConnectDialog() : base(Gui.MainWindow.Window, "ConnectDialog")
        {
            store              = new ListStore(typeof(object), typeof(string));
            ipCombo.Model      = store;
            ipCombo.TextColumn = 1;

            CellRendererPixbuf imageCell = new CellRendererPixbuf();
            CellRendererText   textCell  = new CellRendererText();

            ipCombo.Clear();
            ipCombo.PackStart(imageCell, false);
            ipCombo.PackStart(textCell, true);
            ipCombo.SetCellDataFunc(imageCell, ShowImage);
            ipCombo.SetCellDataFunc(textCell, ShowText);
            ipCombo.WrapWidth = 3;
            ipCombo.Entry.ActivatesDefault = true;
            PopulateAddressCombo();

            networksListStore = new ListStore(typeof(object));
            networksListStore.AppendValues(new object());
            foreach (Network network in Core.Networks)
            {
                networksListStore.AppendValues(network);
            }

            networksComboBox.Clear();

            CellRendererText networkNameCell = new CellRendererText();

            networksComboBox.PackStart(networkNameCell, false);
            networksComboBox.SetCellDataFunc(networkNameCell, new CellLayoutDataFunc(NetworkTextFunc));
            networksComboBox.Model    = networksListStore;
            networksComboBox.Changed += delegate { PopulateAddressCombo(); };
            networksComboBox.Active   = Math.Min(networksListStore.IterNChildren(), 1);

            notImage   = Gui.LoadIcon(16, "dialog-warning");
            localImage = Gui.LoadIcon(16, "stock_channel");
        }
Esempio n. 11
0
 public NetworkOverviewItem()
 {
     icon = Gui.LoadIcon(24, "stock_internet");
 }
Esempio n. 12
0
 public FileSearchItem(FileSearch search)
 {
     icon        = Gui.LoadIcon(16, "system-search");
     this.search = search;
     pageWidget  = new SearchResultsPage(search);
 }
Esempio n. 13
0
        public UserBrowserPage()
        {
            // Create the files tree
            filesList = new TreeView();
            filesList.RowActivated     += on_filesList_row_activated;
            filesList.ButtonPressEvent += filesList_ButtonPressEvent;

            // Create the navigation bar
            Alignment navigationBarAlignment = new Alignment(0, 0, 1, 1);

            navigationBarAlignment.TopPadding    = 3;
            navigationBarAlignment.BottomPadding = 3;
            navigationBar = new NavigationBar();
            navigationBar.PathButtonClicked += on_navigationBar_PathButtonClicked;
            navigationBarAlignment.Add(navigationBar);
            base.PackStart(navigationBarAlignment, false, false, 0);
            navigationBarAlignment.ShowAll();

            // Load some images
            stockDirectoryPixbuf = Gui.LoadIcon(16, "folder");
            stockFilePixbuf      = Gui.LoadIcon(16, "text-x-generic");
            networkIcon          = Gui.LoadIcon(16, "stock_internet");

            // Set up the file list
            filesList.Selection.Changed += filesList_Selection_Changed;
            filesList.Selection.Mode     = SelectionMode.Browse;

            /*
             * filesList.Selection.Mode = SelectionMode.Multiple;
             * filesList.RubberBanding = true;
             */

            filesListStore  = new ListStore(typeof(IDirectoryItem));
            filesList.Model = filesListStore;

            TreeViewColumn column;

            // Add Name column
            column           = new TreeViewColumn();
            column.Title     = "Name";
            column.Resizable = true;

            Gtk.CellRendererPixbuf fileListRowIcon = new Gtk.CellRendererPixbuf();
            column.PackStart(fileListRowIcon, false);
            column.SetCellDataFunc(fileListRowIcon, new TreeCellDataFunc(FileNameIconFunc));

            Gtk.CellRendererText fileListRowText = new Gtk.CellRendererText();
            column.PackStart(fileListRowText, true);
            column.SetCellDataFunc(fileListRowText, new TreeCellDataFunc(FileNameTextFunc));

            filesList.AppendColumn(column);

            // Add Size Column
            column           = filesList.AppendColumn("Size", new CellRendererText(), new TreeCellDataFunc(FileSizeFunc));
            column.Resizable = true;

            // Add Type Column
            column           = filesList.AppendColumn("Type", new CellRendererText(), new TreeCellDataFunc(FileTypeFunc));
            column.Resizable = true;

            // Add InfoHash Column
            column           = filesList.AppendColumn("Info Hash", new CellRendererText(), new TreeCellDataFunc(FileInfoHashFunc));
            column.Resizable = true;

            base.PackStart(Gui.AddScrolledWindow(filesList), true, true, 0);
            filesList.ShowAll();

            waitingBoxAlignment = new Alignment(0.5f, 0.5f, 0, 0);
            VBox waitingBox = new VBox();

            waitProgressBar = new ProgressBar();
            waitLabel       = new Label();
            waitingBox.PackStart(waitProgressBar, false, false, 0);
            waitingBox.PackStart(waitLabel, false, false, 0);
            waitingBoxAlignment.Add(waitingBox);
            this.PackStart(waitingBoxAlignment, true, true, 0);

            Core.NetworkAdded += Core_NetworkAdded;
            foreach (Network network in Core.Networks)
            {
                Core_NetworkAdded(network);
            }

            resultPopupMenu = new Menu();

            ImageMenuItem item = new ImageMenuItem("Download");

            item.Image      = new Image(Gui.LoadIcon(16, "go-down"));
            item.Activated += on_mnuFileDownload_activate;
            resultPopupMenu.Append(item);

            item            = new ImageMenuItem(Gtk.Stock.Properties, null);
            item.Activated += filePropertiesMenuItem_Activated;
            resultPopupMenu.Append(item);

            NavigateTo("/");
        }
Esempio n. 14
0
 public UserBrowserItem()
 {
     icon = Gui.LoadIcon(24, "folder");
 }
Esempio n. 15
0
 private WhatsNewSearchItem() : base(new WhatsNewFileSearch())
 {
     starPixbuf = Gui.LoadIcon(16, "star1");
 }
Esempio n. 16
0
 public MemosItem()
 {
     icon = Gui.LoadIcon(16, "mail_generic");
 }
Esempio n. 17
0
 public WhatsPopularSearchItem() : base(new WhatsPopularFileSearch())
 {
     starPixbuf = Gui.LoadIcon(16, "star1");
 }
Esempio n. 18
0
            public FilterWidgetRow(FileSearchFilter filter) : base(0, 0, 1, 1)
            {
                TreeIter         iter;
                CellRendererText textCell;
                ListStore        store;

                this.filter = filter;

                matchTypeStore = new ListStore(typeof(string), typeof(FileSearchFilterComparison));

                textCell = new CellRendererText();

                matchTypeComboBox       = new ComboBox();
                matchTypeComboBox.Model = matchTypeStore;
                matchTypeComboBox.PackStart(textCell, true);
                matchTypeComboBox.AddAttribute(textCell, "text", 0);
                matchTypeComboBox.RowSeparatorFunc = ComboSeparatorFunc;
                matchTypeComboBox.Changed         += MatchTypeChanged;

                textCell = new CellRendererText();
                store    = new ListStore(typeof(string), typeof(FilterEntryMode), typeof(FileSearchFilterField));

                filterTextEntry          = new FilterEntry(filter);
                filterTextEntry.Changed += FilterTextChanged;

                fieldComboBox = new ComboBox();
                fieldComboBox.PackStart(textCell, true);
                fieldComboBox.AddAttribute(textCell, "text", 0);
                fieldComboBox.SetCellDataFunc(textCell, FieldComboDataFunc);
                store.AppendValues("File Name", FilterEntryMode.String, FileSearchFilterField.FileName);
                store.AppendValues("Size", FilterEntryMode.Size, FileSearchFilterField.Size);
                store.AppendValues("-");
                store.AppendValues("(Audio)", null);
                store.AppendValues("Artist", FilterEntryMode.String, FileSearchFilterField.Artist);
                store.AppendValues("Album", FilterEntryMode.String, FileSearchFilterField.Album);
                store.AppendValues("Bitrate", FilterEntryMode.Speed, FileSearchFilterField.Bitrate);
                store.AppendValues("-");
                store.AppendValues("(Video)", null);
                store.AppendValues("Resolution", FilterEntryMode.Dimentions, FileSearchFilterField.Resolution);
                store.AppendValues("-");
                store.AppendValues("(Images)", null);
                store.AppendValues("Dimentions", FilterEntryMode.Dimentions, FileSearchFilterField.Dimentions);
                fieldComboBox.Model            = store;
                fieldComboBox.RowSeparatorFunc = ComboSeparatorFunc;
                fieldComboBox.Changed         += FieldChanged;

                /*
                 * if (fieldComboBox.Model.GetIterFirst(out iter)) {
                 *      fieldComboBox.SetActiveIter(iter);
                 * }
                 */

                addButton          = new Button();
                addButton.Relief   = ReliefStyle.None;
                addButton.Image    = new Image(Gui.LoadIcon(16, "list-add"));
                addButton.Clicked += AddButtonClicked;

                removeButton          = new Button();
                removeButton.Relief   = ReliefStyle.None;
                removeButton.Image    = new Image(Gui.LoadIcon(16, "list-remove"));
                removeButton.Clicked += RemoveButtonClicked;

                box = new HBox();
                box.PackStart(fieldComboBox, false, false, 0);
                box.PackStart(matchTypeComboBox, false, false, 3);
                box.PackStart(filterTextEntry, true, true, 0);
                box.PackStart(removeButton, false, false, 0);
                box.PackStart(addButton, false, false, 0);

                this.TopPadding    = 3;
                this.BottomPadding = 3;
                this.Add(box);

                fieldComboBox.Model.GetIterFirst(out iter);
                do
                {
                    FileSearchFilterField field = (FileSearchFilterField)fieldComboBox.Model.GetValue(iter, 2);
                    if (field == filter.Field)
                    {
                        fieldComboBox.SetActiveIter(iter);
                        break;
                    }
                } while (fieldComboBox.Model.IterNext(ref iter));


                matchTypeComboBox.Model.GetIterFirst(out iter);
                do
                {
                    FileSearchFilterComparison comp = (FileSearchFilterComparison)matchTypeComboBox.Model.GetValue(iter, 1);
                    if (comp == filter.Comparison)
                    {
                        matchTypeComboBox.SetActiveIter(iter);
                        break;
                    }
                } while (matchTypeComboBox.Model.IterNext(ref iter));

                filterTextEntry.Text = filter.Text;
            }
Esempio n. 19
0
 public StatusItem()
 {
     icon = Gui.LoadIcon(16, "text-x-generic");
 }
Esempio n. 20
0
 public ConnectionsItem()
 {
     icon = Gui.LoadIcon(16, "network-transmit-receive");
 }
Esempio n. 21
0
        public SearchResultsPage(FileSearch search)
        {
            VPaned         paned;
            TreeViewColumn column;
            ToolItem       spacerItem;
            ToolItem       filterItem;
            Alignment      filterAlignment;
            ToolButton     searchAgainToolButton;

            this.search = search;

            downloadToolButton             = new ToolButton(new Image("gtk-save", IconSize.LargeToolbar), "Download");
            downloadToolButton.IsImportant = true;
            downloadToolButton.Sensitive   = false;
            downloadToolButton.Clicked    += DownloadToolButtonClicked;

            searchAgainToolButton             = new ToolButton(new Image("gtk-refresh", IconSize.LargeToolbar), "Search Again");
            searchAgainToolButton.IsImportant = true;
            searchAgainToolButton.Clicked    += SearchAgainToolButtonClicked;

            spacerItem        = new ToolItem();
            spacerItem.Expand = true;

            filterButton          = new ToggleButton("Filter Results");
            filterButton.Image    = new Image(Gui.LoadIcon(16, "application-x-executable"));
            filterButton.Toggled += delegate(object o, EventArgs args) {
                this.ShowFilter = filterButton.Active;
            };

            filterAlignment = new Alignment(0.5f, 0.5f, 0, 0);
            filterAlignment.Add(filterButton);

            filterItem = new ToolItem();
            filterItem.Add(filterAlignment);

            browseToolButton             = new ToolButton(new Image("gtk-open", IconSize.LargeToolbar), "Browse");
            browseToolButton.IsImportant = true;
            browseToolButton.Sensitive   = false;
            browseToolButton.Clicked    += BrowseToolButtonClicked;

            toolbar = new Toolbar();
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.Insert(downloadToolButton, -1);
            toolbar.Insert(browseToolButton, -1);
            toolbar.Insert(spacerItem, -1);
            toolbar.Insert(filterItem, -1);
            toolbar.Insert(new SeparatorToolItem(), -1);
            toolbar.Insert(searchAgainToolButton, -1);
            toolbar.ShowAll();

            this.PackStart(toolbar, false, false, 0);

            resultCountByTypeCache = new Dictionary <FilterType, int>();

            Gdk.Pixbuf audioPixbuf = Gui.LoadIcon(16, "audio-x-generic");
            Gdk.Pixbuf videoPixbuf = Gui.LoadIcon(16, "video-x-generic");
            Gdk.Pixbuf imagePixbuf = Gui.LoadIcon(16, "image-x-generic");
            Gdk.Pixbuf docPixbuf   = Gui.LoadIcon(16, "x-office-document");
            unknownPixbuf = Gui.LoadIcon(16, "text-x-generic");
            folderPixbuf  = Gui.LoadIcon(16, "folder");

            typeStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(FilterType));
            typeStore.AppendValues(null, "All Results", FilterType.All);
            typeStore.AppendValues(null, "-");
            typeStore.AppendValues(audioPixbuf, "Audio", FilterType.Audio);
            typeStore.AppendValues(videoPixbuf, "Video", FilterType.Video);
            typeStore.AppendValues(imagePixbuf, "Images", FilterType.Image);
            typeStore.AppendValues(docPixbuf, "Documents", FilterType.Document);
            typeStore.AppendValues(folderPixbuf, "Folders", FilterType.Folder);
            typeStore.AppendValues(unknownPixbuf, "Other", FilterType.Other);

            typeTree = new TreeView();
            typeTree.HeadersVisible   = false;
            typeTree.RowSeparatorFunc = delegate(TreeModel m, TreeIter i) {
                string text = (string)m.GetValue(i, 1);
                return(text == "-");
            };
            typeTree.Selection.Changed += TypeSelectionChanged;

            typeTree.Model = typeStore;

            CellRendererPixbuf pixbufCell    = new CellRendererPixbuf();
            CellRendererText   textCell      = new CellRendererText();
            CellRendererText   countTextCell = new CellRendererText();

            countTextCell.Sensitive = false;
            countTextCell.Alignment = Pango.Alignment.Right;
            countTextCell.Xalign    = 1;

            column = new TreeViewColumn();
            column.PackStart(pixbufCell, false);
            column.PackStart(textCell, true);
            column.PackStart(countTextCell, false);
            column.AddAttribute(pixbufCell, "pixbuf", 0);
            column.AddAttribute(textCell, "text", 1);
            column.SetCellDataFunc(countTextCell, new TreeCellDataFunc(TypeCountCellFunc));

            typeTree.AppendColumn(column);

            TreeView artistTree = new TreeView();

            artistTree.HeadersVisible = false;

            TreeView albumTree = new TreeView();

            albumTree.HeadersVisible = false;

            HBox topBox = new HBox();

            topBox.PackStart(Gui.AddScrolledWindow(typeTree), true, true, 0);
            topBox.PackStart(Gui.AddScrolledWindow(artistTree), true, true, 1);
            topBox.PackStart(Gui.AddScrolledWindow(albumTree), true, true, 0);
            topBox.Homogeneous = true;

            resultsStore              = new ListStore(typeof(SearchResult));
            resultsStore.RowInserted += delegate {
                Refilter();
            };
            resultsStore.RowDeleted += delegate {
                Refilter();
            };
            resultsTree = new TreeView();
            resultsTree.RowActivated      += resultsTree_RowActivated;
            resultsTree.ButtonPressEvent  += resultsTree_ButtonPressEvent;
            resultsTree.Selection.Changed += ResultsTreeSelectionChanged;

            imageColumns      = new List <TreeViewColumn>();
            audioColumns      = new List <TreeViewColumn>();
            videoColumns      = new List <TreeViewColumn>();
            fileOnlyColumns   = new List <TreeViewColumn>();
            folderOnlyColumns = new List <TreeViewColumn>();

            column              = new TreeViewColumn();
            column.Title        = "File Name";
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Autosize;
            column.Resizable    = true;
            column.SortColumnId = 0;
            //resultsTree.ExpanderColumn = column;

            CellRenderer cell = new CellRendererPixbuf();

            column.PackStart(cell, false);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(IconFunc));

            cell = new CellRendererText();
            column.PackStart(cell, true);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(FileNameFunc));

            resultsTree.AppendColumn(column);

            column              = resultsTree.AppendColumn("Codec", new CellRendererText(), new TreeCellDataFunc(CodecFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 120;
            column.Resizable    = true;
            column.SortColumnId = 1;
            videoColumns.Add(column);

            column              = resultsTree.AppendColumn("Format", new CellRendererText(), new TreeCellDataFunc(FormatFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 90;
            column.Resizable    = true;
            column.SortColumnId = 2;
            imageColumns.Add(column);

            column              = resultsTree.AppendColumn("Resolution", new CellRendererText(), new TreeCellDataFunc(ResolutionFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 90;
            column.Resizable    = true;
            column.SortColumnId = 3;
            videoColumns.Add(column);
            imageColumns.Add(column);

            column              = resultsTree.AppendColumn("Artist", new CellRendererText(), new TreeCellDataFunc(ArtistFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 110;
            column.Resizable    = true;
            column.SortColumnId = 4;
            audioColumns.Add(column);

            column              = resultsTree.AppendColumn("Album", new CellRendererText(), new TreeCellDataFunc(AlbumFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 110;
            column.Resizable    = true;
            column.SortColumnId = 5;
            audioColumns.Add(column);

            column              = resultsTree.AppendColumn("Bitrate", new CellRendererText(), new TreeCellDataFunc(BitrateFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 70;
            column.Resizable    = true;
            column.SortColumnId = 6;
            audioColumns.Add(column);

            column              = resultsTree.AppendColumn("Size", new CellRendererText(), new TreeCellDataFunc(SizeFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 70;
            column.SortColumnId = 7;
            column.Resizable    = true;
            fileOnlyColumns.Add(column);

            column              = resultsTree.AppendColumn("Sources", new CellRendererText(), new TreeCellDataFunc(SourcesFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 85;
            column.SortColumnId = 8;
            column.Resizable    = true;
            fileOnlyColumns.Add(column);

            column              = resultsTree.AppendColumn("User", new CellRendererText(), new TreeCellDataFunc(UserFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 85;
            column.SortColumnId = 8;
            column.Resizable    = true;
            folderOnlyColumns.Add(column);

            column              = resultsTree.AppendColumn("Full Path", new CellRendererText(), new TreeCellDataFunc(FullPathFunc));
            column.Clickable    = true;
            column.Resizable    = true;
            column.SortColumnId = 9;

            column              = resultsTree.AppendColumn("Info Hash", new CellRendererText(), new TreeCellDataFunc(InfoHashFunc));
            column.Clickable    = true;
            column.Resizable    = true;
            column.SortColumnId = 10;
            fileOnlyColumns.Add(column);

            resultsFilter             = new TreeModelFilter(resultsStore, null);
            resultsFilter.VisibleFunc = resultsFilterFunc;

            resultsSort = new TreeModelSort(resultsFilter);
            for (int x = 0; x < resultsTree.Columns.Length; x++)
            {
                resultsSort.SetSortFunc(x, resultsSortFunc);
            }
            resultsTree.Model = resultsSort;

            ScrolledWindow resultsTreeSW = new ScrolledWindow();

            resultsTreeSW.Add(resultsTree);

            paned = new VPaned();
            paned.Add1(topBox);
            paned.Add2(resultsTreeSW);
            paned.Position = 160;
            paned.ShowAll();

            filterWidget = new FilterWidget(search);
            filterWidget.FiltersChanged += filterWidget_FiltersChanged;
            filterWidget.Hidden         += filterWidget_Hidden;

            this.PackStart(filterWidget, false, false, 0);
            this.PackStart(paned, true, true, 0);

            TypeSelectionChanged(typeTree, EventArgs.Empty);

            search.NewResults     += (EventHandler <SearchResultsEventArgs>)DispatchService.GuiDispatch(new EventHandler <SearchResultsEventArgs>(search_NewResults));
            search.ClearedResults += (EventHandler)DispatchService.GuiDispatch(new EventHandler(search_ClearedResults));

            resultPopupMenu = new Menu();

            browseResultMenuItem            = new ImageMenuItem("Browse");
            browseResultMenuItem.Image      = new Image(Gui.LoadIcon(16, "document-open"));
            browseResultMenuItem.Activated += BrowseToolButtonClicked;
            resultPopupMenu.Append(browseResultMenuItem);

            downloadResultMenuItem            = new ImageMenuItem("Download");
            downloadResultMenuItem.Image      = new Image(Gui.LoadIcon(16, "go-down"));
            downloadResultMenuItem.Activated += DownloadToolButtonClicked;
            resultPopupMenu.Append(downloadResultMenuItem);

            resultPropertiesMenuItem            = new ImageMenuItem(Gtk.Stock.Properties, null);
            resultPropertiesMenuItem.Activated += FilePropertiesButtonClicked;
            resultPopupMenu.Append(resultPropertiesMenuItem);
        }
Esempio n. 22
0
 public NewSearchItem()
 {
     icon = Gui.LoadIcon(24, "system-search");
 }
Esempio n. 23
0
 public ChatsItem()
 {
     icon = Gui.LoadIcon(16, "internet-group-chat");
 }
Esempio n. 24
0
 public TransfersItem()
 {
     icon = Gui.LoadIcon(16, "go-down");
 }