Beispiel #1
0
        private void network_ReceivedNonCriticalError(Network network, Node from, MeshworkError error)
        {
            if (error is DirectoryNotFoundError)
            {
                string errorPath = ((DirectoryNotFoundError)error).DirPath;
                errorPath = errorPath.Substring(1);

                // FIXME: errorPath doesn't have network part, navigatingTo does!!
                if (true)
                //if (errorPath == navigatingTo)
                {
                    Gui.ShowErrorDialog("Directory not found");

                    StopNavigating();

                    // FIXME: Maybe something should reset the state on the directory object
                }
            }
        }
Beispiel #2
0
        private void browseButton_clicked(object o, EventArgs args)
        {
            FileSelector selector = new FileSelector("Select Image");

            selector.Show();
            int result = selector.Run();

            if (result == (int)Gtk.ResponseType.Ok)
            {
                try {
                    AddFile(selector.Filename);
                } catch (Exception ex) {
                    selector.Hide();
                    Gui.ShowMessageDialog(ex.Message);
                    return;
                }
            }
            selector.Hide();
        }
Beispiel #3
0
        private void joinButton_Clicked(object sender, EventArgs e)
        {
            Network selectedNetwork = GetSelectedNetwork();

            if (selectedNetwork == null)
            {
                Gui.ShowMessageDialog("No network selected.", Dialog, Gtk.MessageType.Error, Gtk.ButtonsType.Ok);
                return;
            }

            try {
                string roomName = roomNameCombo.Entry.Text.Trim();
                string password = passwordEntry.Text;

                string roomId = (passwordCheck.Active) ? Common.SHA512Str(roomName + password) : Common.SHA512Str(roomName);

                ChatRoom room = selectedNetwork.GetChatRoom(roomId);
                if (room != null && room.InRoom)
                {
                    // Already in here!
                    ChatRoomSubpage window = (ChatRoomSubpage)room.Properties["Window"];
                    window.GrabFocus();
                }
                else
                {
                    if (passwordCheck.Active == true)
                    {
                        selectedNetwork.JoinOrCreateChat(roomName, passwordEntry.Text);
                    }
                    else
                    {
                        selectedNetwork.JoinOrCreateChat(roomName, null);
                    }
                }
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowMessageDialog(ex.Message, Dialog);
                Dialog.Respond(ResponseType.None);
                return;
            }
            Dialog.Respond(ResponseType.Ok);
        }
Beispiel #4
0
        void BrowseToolButtonClicked(object sender, EventArgs e)
        {
            try {
                TreeIter iter;
                if (resultsTree.Selection.GetSelected(out iter))
                {
                    SearchResult selectedResult = resultsTree.Model.GetValue(iter, 0) as SearchResult;
                    if (selectedResult != null)
                    {
                        string path = PathUtil.Join(selectedResult.Node.Directory.FullPath,
                                                    String.Join("/", selectedResult.FullPath.Split('/').Slice(0, -2)));

                        UserBrowserPage.Instance.NavigateTo(path);
                        Gui.MainWindow.SelectedPage = UserBrowserPage.Instance;
                    }
                }
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.Message);
            }
        }
Beispiel #5
0
        private void manager_NewFileTransfer(object sender, FileTransferEventArgs e)
        {
            try {
                // Add transfer to list
                transferListStore.AppendValues(e.Transfer);

                // Watch a few other events
                e.Transfer.PeerAdded += (EventHandler <FileTransferPeerEventArgs>)DispatchService.GuiDispatch(
                    new EventHandler <FileTransferPeerEventArgs>(transfer_PeerAdded)
                    );

                e.Transfer.Error += (EventHandler <ErrorEventArgs>)DispatchService.GuiDispatch(
                    new EventHandler <ErrorEventArgs>(transfer_Error)
                    );

                Gui.MainWindow.RefreshCounts();
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
            }
        }
Beispiel #6
0
 public static bool QuitMeshwork()
 {
     try {
         int result = Gui.ShowMessageDialog("Are you sure you want to quit Meshwork?", Gui.MainWindow.Window, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo);
         if (result == (int)ResponseType.Yes)
         {
             Gui.Settings.SaveSettings();
             Core.Stop();
             Gtk.Application.Quit();
             Environment.Exit(0);
             return(true);
         }
         else
         {
             return(false);
         }
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         throw ex;
     }
 }
Beispiel #7
0
        public static PrivateChatSubpage StartPrivateChat(Network network, Node node, bool focus)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            if (node.IsLocal)
            {
                Gui.ShowErrorDialog("You cannot send messages to yourself!");
                return(null);
            }
            else if (node.FinishedKeyExchange == true)
            {
                PrivateChatSubpage page;
                if (privateMessageWindows.ContainsKey(network.NetworkID + node.NodeID) == false)
                {
                    page = new PrivateChatSubpage(network, node);
                    privateMessageWindows[network.NetworkID + node.NodeID] = page;
                    ChatsPage.Instance.AddPrivateChatSubpage(page);
                }
                else
                {
                    page = (PrivateChatSubpage)privateMessageWindows[network.NetworkID + node.NodeID];
                }

                if (focus)
                {
                    Gui.MainWindow.SelectedPage = ChatsPage.Instance;
                    page.GrabFocus();
                }

                return(page);
            }
            else
            {
                Gui.ShowErrorDialog("You cannot send messages to untrusted nodes.");
                return(null);
            }
        }
Beispiel #8
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");
        }
Beispiel #9
0
 void FilePropertiesButtonClicked(object sender, EventArgs args)
 {
     try {
         TreeIter iter;
         if (resultsTree.Selection.GetSelected(out iter))
         {
             SearchResult selectedResult = resultsTree.Model.GetValue(iter, 0) as SearchResult;
             if (selectedResult != null && selectedResult.Type == SearchResultType.File)
             {
                 var path = PathUtil.Join(selectedResult.Node.Directory.FullPath, selectedResult.FileListing.FullPath);
                 Core.FileSystem.BeginGetFileDetails(path, delegate(IFile file) {
                     Application.Invoke(delegate {
                         var win = new FilePropertiesWindow(file);
                         win.Show();
                     });
                 });
             }
         }
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.Message);
     }
 }
Beispiel #10
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("/");
        }
Beispiel #11
0
 public FileSearchItem(FileSearch search)
 {
     icon        = Gui.LoadIcon(16, "system-search");
     this.search = search;
     pageWidget  = new SearchResultsPage(search);
 }
 private void joinButton_Clicked(object sender, EventArgs args)
 {
     Window.Destroy();
     Gui.JoinChatRoom(room, passwordEntry.Text);
 }
Beispiel #13
0
 public UserBrowserItem()
 {
     icon = Gui.LoadIcon(24, "folder");
 }
Beispiel #14
0
 public StatusItem()
 {
     icon = Gui.LoadIcon(16, "text-x-generic");
 }
Beispiel #15
0
 private void on_userList_RowActivated(object sender, Gtk.RowActivatedArgs e)
 {
     Gui.StartPrivateChat(network, GetSelectedNode());
 }
Beispiel #16
0
 public ConnectionsItem()
 {
     icon = Gui.LoadIcon(16, "network-transmit-receive");
 }
Beispiel #17
0
 public NewSearchItem()
 {
     icon = Gui.LoadIcon(24, "system-search");
 }
Beispiel #18
0
 private void map_NodeDoubleClicked(Node selectedNode)
 {
     Gui.StartPrivateChat(selectedNode.Network, selectedNode);
 }
Beispiel #19
0
 protected void SetNotUrgent()
 {
     Gui.SetWindowUrgencyHint(window, false);
 }
Beispiel #20
0
 protected void SetUrgent()
 {
     Gui.SetWindowUrgencyHint(window, true);
 }
Beispiel #21
0
 private WhatsNewSearchItem() : base(new WhatsNewFileSearch())
 {
     starPixbuf = Gui.LoadIcon(16, "star1");
 }
Beispiel #22
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);
        }
Beispiel #23
0
 void on_m_MessageMenuItem_activate(object o, EventArgs e)
 {
     Gui.StartPrivateChat(network, selectedNode);
 }
Beispiel #24
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;
            }
Beispiel #25
0
 public NetworkOverviewItem()
 {
     icon = Gui.LoadIcon(24, "stock_internet");
 }
 public WhatsPopularSearchItem() : base(new WhatsPopularFileSearch())
 {
     starPixbuf = Gui.LoadIcon(16, "star1");
 }
Beispiel #27
0
 public ChatsItem()
 {
     icon = Gui.LoadIcon(16, "internet-group-chat");
 }
Beispiel #28
0
 public MemosItem()
 {
     icon = Gui.LoadIcon(16, "mail_generic");
 }
Beispiel #29
0
 public override void Close()
 {
     Gui.RemovePrivateMessageWindow(network, node);
     base.Close();
 }
Beispiel #30
0
        public static void Main(string[] args)
        {
            /* Initialize our catalog */
            //   Catalog.Init (Defines.Name, Defines.LocaleDir);

            /* Process our args */
            options = new GtkMeshworkOptions();
            options.ProcessArgs(args);

            Common.SetProcessName("meshwork-gtk");

            /* Initialize the GTK application */
            Gtk.Application.Init();

            if (!System.Diagnostics.Debugger.IsAttached)
            {
                /* If we crash, attempt to log the error */
                GLib.ExceptionManager.UnhandledException   += UnhandledGLibExceptionHandler;
                AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            }

            //XXX: Implement Gunique code here!

            splashWindow = new SplashWindow();
            splashWindow.Show();

            /* Load settings */
            if (options.ConfigPath != null)
            {
                Core.LoggingService.LogDebug("Using config dir: " + options.ConfigPath);
                Settings.OverrideConfigPath(options.ConfigPath);
            }
            tmpSettings = Settings.ReadSettings();

            // First run, create initial settings.
            if (tmpSettings == null || !tmpSettings.HasKey)
            {
                tmpSettings          = new Settings();
                tmpSettings.NickName = Core.OS.UserName;
                tmpSettings.RealName = Core.OS.RealName;
                tmpSettings.IncompleteDownloadDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                tmpSettings.CompletedDownloadDir  = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                tmpSettings.SetFirstRun(true);
            }

            /* Load Icons */
            Gtk.Window.DefaultIconList = new Gdk.Pixbuf[] {
                new Gdk.Pixbuf(null, "FileFind.Meshwork.GtkClient.tray_icon.png")
            };

            // Windows specific. Override stock icons to use embeded files.
            var sizes     = new [] { 16, 22, 24, 34 };
            var iconNames = new[] {
                "application-exit", "application-x-executable", "audio-x-generic",
                "computer", "dialog-error", "dialog-information", "dialog-password",
                "gtk-preferences", "dialog-question", "dialog-warning", "folder",
                "go-down", "go-home", "go-next", "go-previous", "go-up", "image-x-generic",
                "internet-group-chat", "list-add", "list-remove", "mail-attachment",
                "mail_generic", "mail-message-new", "mail-signed-verified",
                "network-transmit-receive", "stock_channel", "stock_internet",
                "system-search", "text-x-generic", "user-home", "video-x-generic",
                "view-refresh", "x-office-document"
            };

            foreach (var size in sizes)
            {
                foreach (var iconName in iconNames)
                {
                    if (Environment.OSVersion.Platform != PlatformID.Unix ||
                        !IconTheme.Default.HasIcon(iconName) ||
                        !IconTheme.Default.GetIconSizes(iconName).Contains(size))
                    {
                        var pixbuf = Gui.LoadIconFromResource(iconName, size);
                        if (pixbuf != null)
                        {
                            Gtk.IconTheme.AddBuiltinIcon(iconName, size, pixbuf);
                        }
                        else
                        {
                            Core.LoggingService.LogWarning("Missing embeded icon: {0} ({1}x{1})", iconName, size);
                        }
                    }
                }
            }

            /* Set up UI actions */
            builtin_actions = new BuiltinActionGroup();
            ui_manager      = new UIManager();
            ui_manager.InsertActionGroup(builtin_actions, 0);
            ui_manager.AddUiFromResource("FileFind.Meshwork.GtkClient.MainWindow.xml");
            ui_manager.AddUiFromResource("FileFind.Meshwork.GtkClient.TrayPopupMenu.xml");
            ui_manager.AddUiFromResource("FileFind.Meshwork.GtkClient.SearchPopupMenu.xml");
            ui_manager.AddUiFromResource("FileFind.Meshwork.GtkClient.MapPopupMenu.xml");

            /* Create the Tray Icon */
            trayIcon = new TrayIcon();

            /* Start the event loop */
            GLib.Idle.Add(new GLib.IdleHandler(FinishLoading));
            Gtk.Application.Run();
        }