Exemple #1
0
        // ============================================
        // PRIVATE (Methods) Event Handlers
        // ============================================
        private void OnAdded(object sender)
        {
            Gtk.Application.Invoke(delegate {
                FileReceiver fileRecv = sender as FileReceiver;

                FileProgressObject obj = new FileProgressObject();
                obj.Delete            += new BlankEventHandler(OnButtonDelete);

                // Setup Image
                string ext = FileUtils.GetExtension(fileRecv.MyDiskName);
                obj.Image  = StockIcons.GetFileIconPixbuf(TextUtils.UpFirstChar(ext));

                // Set Transfer Info
                SetTransferInfo(obj, fileRecv);

                // Set Info
                UserInfo userInfo = fileRecv.Peer.Info as UserInfo;
                obj.SetName(fileRecv.Name, userInfo.Name);

                // Add Update
                progressObjects.Add(fileRecv, obj);
                vbox.PackStart(obj, false, false, 2);
                obj.ShowAll();
            });
        }
        // ============================================
        // PRIVATE Methods
        // ============================================
        private void InitializeMenuBar()
        {
            MenuItem item;

            // File Menu
            Menu fileMenu = new Gtk.Menu();

            item = new ImageMenuItem("Proxy Settings");
            ((ImageMenuItem)item).Image = StockIcons.GetImage("Proxy", 20);
            item.Activated += new EventHandler(OnProxySettings);
            fileMenu.Append(item);

            item = new SeparatorMenuItem();
            fileMenu.Append(item);

            item            = new ImageMenuItem(Gtk.Stock.Quit, null);
            item.Activated += new EventHandler(OnQuit);
            fileMenu.Append(item);

            item         = new MenuItem("_File");
            item.Submenu = fileMenu;
            this.menuBar.Append(item);

            // Help Menu
            Menu helpMenu = new Gtk.Menu();

            item            = new ImageMenuItem(Gtk.Stock.About, null);
            item.Activated += new EventHandler(OnAbout);
            helpMenu.Append(item);

            item         = new MenuItem("_Help");
            item.Submenu = helpMenu;
            this.menuBar.Append(item);
        }
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New Login Dialog
        public Login()
        {
            SetDefaultSize(240, 355);
            DefaultIcon = StockIcons.GetPixbuf("NyFolderIcon");

            // Initialize Dialog Options
            Title = Info.Name + " Login";
            Logo  = StockIcons.GetPixbuf("NyFolderLogo", 240, 140);

            // Remember Password (CheckButton)
            checkRememberPassword.Image = new Gtk.Image(Stock.Save, IconSize.Button);

            // Secure Authentication (CheckButton)
            checkSecureAuth          = new CheckButton("Use Secure Authentication");
            checkSecureAuth.Active   = true;
            checkSecureAuth.Image    = StockIcons.GetImage("Lock", 22);
            checkSecureAuth.Toggled += new EventHandler(OnCheckSecureAuthToggled);
            VBox.PackStart(checkSecureAuth, false, false, 2);

            // Initialize MenuBar
            this.menuBar = new Gtk.MenuBar();
            VBox.PackStart(this.menuBar, false, false, 0);
            this.VBox.ReorderChild(this.menuBar, 0);
            InitializeMenuBar();

            // Initialize Dialog Buttons
            AddButton(Gtk.Stock.Ok, ResponseType.Ok);
            AddButton(Gtk.Stock.Quit, ResponseType.Close);

            ShowAll();
        }
        public AdvancedSearch()
        {
            stockIcons = new StockIcons();

            documentsStockIcon = stockIcons.DocumentAssociated;
            videosStockIcon    = stockIcons.VideoFiles;
            musicStockIcon     = stockIcons.AudioFiles;
            picturesStockIcon  = stockIcons.ImageFiles;

            InitializeComponent();

            // Set our default
            DocumentsRadioButton.IsChecked = true;

            //
            prop1prop2OperationComboBox.SelectedIndex = 0;

            // Because the search can take some time, using a background thread.
            // This timer will check if that thread is still alive and accordingly update
            // the cursor
            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval  = new TimeSpan(0, 0, 1);
            timer.IsEnabled = true;
            timer.Tick     += new EventHandler(timer_Tick);
        }
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New Proxy Settings Dialog
        public AcceptUser(PeerSocket peer) :
            base("dialog", "AcceptUserDialog.glade")
        {
            // Get UserInfo
            UserInfo userInfo = peer.Info as UserInfo;

            // Initialize GUI
            this.labelTitle.Text = "<span size='x-large'><b>Accept User</b> (";
            if (userInfo.SecureAuthentication == true)
            {
                this.image.Pixbuf     = StockIcons.GetPixbuf("SecureAuth");
                this.labelTitle.Text += "Secure";
                this.Dialog.Title    += " (Secure Authentication)";
            }
            else
            {
                this.image.Pixbuf     = StockIcons.GetPixbuf("InsecureAuth");
                this.labelTitle.Text += "Insecure";
                this.Dialog.Title    += " (Insecure Authentication)";
            }
            this.labelTitle.Text     += ")</span>";
            this.labelTitle.UseMarkup = true;

            entryName.Text = userInfo.Name;
            entryIP.Text   = peer.GetRemoteIP().ToString();
        }
        public void StockIconsContainedInAllCollection()
        {
            // TODO: Redesign test, this is a pretty redundant test with the way the class is designed.

            var icons = new StockIcons();

            PropertyInfo[] infos = typeof(StockIcons).GetType().GetProperties(BindingFlags.Public);

            foreach (var info in infos)
            {
                if (info.PropertyType != typeof(StockIcon))
                {
                    continue;
                }

                StockIcon icon = null;

                try
                {
                    //this will throw an exception if the icon does not exist on the system
                    icon = (StockIcon)info.GetValue(icons, null);
                }

                catch { continue; }

                Assert.Contains(icon, icons.AllStockIcons);
            }
        }
Exemple #7
0
 // ============================================
 // PUBLIC Constructors
 // ============================================
 public UpdateNotifier()
 {
     // Initialize Stock
     Gdk.Pixbuf pixbuf;
     pixbuf = new Gdk.Pixbuf(null, "UpdateNotifier.png");
     StockIcons.AddToStock("UpdateNotifier", pixbuf);
     StockIcons.AddToStockImages("UpdateNotifier", pixbuf);
 }
Exemple #8
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New P2P Port Dialog
        public SetPort() : base("dialog", "SetPortDialog.glade")
        {
            // Set Current Default P2PManager Port
            Port = P2PManager.Port;

            // Initialize Dialog Image
            this.image.Pixbuf = StockIcons.GetPixbuf("Channel", 48);
        }
 /// <summary>
 /// Set the icon of the library
 /// </summary>
 /// <param name="iconId">the Shell stock icon ID</param>
 public void SetIcon(int iconId)
 {
     using (ShellLibrary shellLibrary = ShellLibrary.Load(LibraryName, true))
     {
         shellLibrary.Icon = Helper.GetIcon(iconId);
         ShellIcon         = StockIcons.GetBitmapSource((StockIconIdentifier)iconId);
     }
 }
Exemple #10
0
        // ============================================
        // PRIVATE Members
        // ============================================

        // ============================================
        // PUBLIC Constructors
        // ============================================
        public Talk()
        {
            // Initialize Talk Stock
            Gdk.Pixbuf pixbuf;
            pixbuf = new Gdk.Pixbuf(null, "TalkBubble.png");
            StockIcons.AddToStock("TalkBubble", pixbuf);
            StockIcons.AddToStockImages("TalkBubble", pixbuf);
        }
        // ============================================
        // PRIVATE Members
        // ============================================

        // ============================================
        // PUBLIC Constructors
        // ============================================
        public Search()
        {
            // Initialize Search Stock
            Gdk.Pixbuf pixbuf;
            pixbuf = new Gdk.Pixbuf(null, "Search.png");
            StockIcons.AddToStock("Search", pixbuf);
            StockIcons.AddToStockImages("Search", pixbuf);
        }
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New Proxy Settings Dialog
        public ProxySettings() : base("dialog", "ProxySettingsDialog.glade")
        {
            // Add Proxy Settings Box
            proxy = new Niry.GUI.Gtk2.ProxySettings();
            this.vbox.PackStart(proxy, true, true, 2);
            proxy.ShowAll();

            // Initialize Dialog Image
            this.image.Pixbuf = StockIcons.GetPixbuf("Proxy", 48);
        }
Exemple #13
0
        public LoadWebImage()
        {
            XML xml = new XML(null, "LoadWebImageDialog.glade", "dialog", null);

            xml.Autoconnect(this);

            this.image.Pixbuf = StockIcons.GetPixbuf("NyIVImage");

            this.dialog.ShowAll();
        }
Exemple #14
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New Account Registration
        public AccountRegistration()
        {
            // Initialize Plugin Info
            this.pluginInfo = new Info();

            // Initialize Stock
            Gdk.Pixbuf pixbuf;
            pixbuf = new Gdk.Pixbuf(null, "Registration.png");
            StockIcons.AddToStock("Registration", pixbuf);
            StockIcons.AddToStockImages("Registration", pixbuf);
        }
Exemple #15
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create DeviantART Preview
        public DeviantART()
        {
            // Initialize Plugin Info
            this.pluginInfo = new Info();

            // Initialize Talk Stock
            Gdk.Pixbuf pixbuf;
            pixbuf = new Gdk.Pixbuf(null, "DeviantART.png");
            StockIcons.AddToStock("DeviantART", pixbuf);
            StockIcons.AddToStockImages("DeviantART", pixbuf);
        }
Exemple #16
0
        public Window1()
        {
            InitializeComponent();

            // Initialize our default collection of StockIcons.
            // We will reuse this collection and only change certain properties as needed
            stockIcons = new StockIcons();

            // Select large size
            comboBox1.SelectedIndex = 1;
        }
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New Registration Dialog
        public RegistrationDialog() :
            base("dialog", new Glade.XML(null, "RegistrationDialog.glade", "dialog", null))
        {
            // Initialize Dialog Image
            this.image.Pixbuf = StockIcons.GetPixbuf("Registration");

            // Initialize Events
            entryPassword.Changed           += new EventHandler(OnPasswordChanged);
            entryPasswordCheck.Changed      += new EventHandler(OnPasswordCheckChanged);
            buttonCheckAvailability.Clicked += new EventHandler(OnCheckAvailability);
        }
Exemple #18
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create Talk
        public Talk()
        {
            // Initialize Plugin Info
            this.pluginInfo = new Info();

            // Initialize Talk Stock
            Gdk.Pixbuf pixbuf;
            pixbuf = new Gdk.Pixbuf(null, "TalkBubble.png");
            StockIcons.AddToStock("TalkBubble", pixbuf);
            StockIcons.AddToStockImages("TalkBubble", pixbuf);
        }
        /// Create new Dialog
        public SetPort()
        {
            XML xml = new XML(null, "SetPortDialog.glade", "dialog", null);

            xml.Autoconnect(this);

            Port = P2PManager.Port;

            this.image.Pixbuf = StockIcons.GetPixbuf("Channel");
            this.dialog.ShowAll();
        }
Exemple #20
0
        public ProxySettings()
        {
            XML xml = new XML(null, "ProxySettingsDialog.glade", "dialog", null);

            xml.Autoconnect(this);
            this.image.Pixbuf = StockIcons.GetPixbuf("NyIVProxy");

            proxy = new Niry.GUI.Gtk2.ProxySettings();
            this.vbox.PackStart(proxy, true, true, 2);

            this.dialog.ShowAll();
        }
        // ============================================
        // PUBLIC Constructors
        // ============================================
        public TopBar() : base(false, 2)
        {
            // Initialize Search Logo
            this.imageLogo        = StockIcons.GetImage("Search");
            this.imageLogo.Xalign = 0.1f;
            this.imageLogo.Yalign = 0.1f;
            this.imageLogo.Xpad   = 2;
            this.PackStart(this.imageLogo, false, false, 2);

            // Initialize Top VBox
            this.table = new Gtk.Table(3, 2, false);
            this.table.ColumnSpacing = 6;
            this.table.RowSpacing    = 2;
            this.PackStart(this.table, true, true, 2);

            Gtk.Label label;

            // Initialize Search Label
            label           = new Gtk.Label("<b>Search:</b>");
            label.UseMarkup = true;
            label.Xalign    = 1.0f;
            this.table.Attach(label, 0, 1, 0, 1);

            // Initialize Entry Search
            this.entrySearch = new Gtk.Entry();
            this.table.Attach(this.entrySearch, 1, 2, 0, 1);

            // Initialize Search By
            label           = new Gtk.Label("<b>By:</b>");
            label.UseMarkup = true;
            label.Xalign    = 1.0f;
            this.table.Attach(label, 0, 1, 1, 2);

            // Initialize Combo Search Type
            this.comboSearchType = ComboBox.NewText();
            AddSearchType();
            this.comboSearchType.Active = 0;
            this.table.Attach(this.comboSearchType, 1, 2, 1, 2);

            // Initialize Search By
            label           = new Gtk.Label("<b>User:</b>");
            label.UseMarkup = true;
            label.Xalign    = 1.0f;
            table.Attach(label, 0, 1, 2, 3);

            // Initialize Combo Search Type
            this.comboSearchUser = ComboBox.NewText();
            AddSearchUsers();
            this.comboSearchUser.Active = 0;
            this.table.Attach(this.comboSearchUser, 1, 2, 2, 3);

            this.ShowAll();
        }
Exemple #22
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New "Add Peer" Dialog
        public AddPeer() : base("dialog", "AddPeerDialog.glade")
        {
            checkSecureAuth.Toggled += new EventHandler(OnCheckSecureAuthToggled);

            this.Dialog.Response += new ResponseHandler(OnResponse);

            // Widget.Sensitive
            OnCheckSecureAuthToggled(checkSecureAuth, null);

            // Initialize Dialog Image
            this.image.Pixbuf = StockIcons.GetPixbuf("Network", 96);
        }
        /// Create New Add Peer Dialog
        public AddPeer()
        {
            XML xml = new XML(null, "AddPeerDialog.glade", "dialog", null);

            xml.Autoconnect(this);

            this.image.Pixbuf        = StockIcons.GetPixbuf("Network");
            checkSecureAuth.Toggled += new EventHandler(OnCheckSecureAuthToggled);

            this.dialog.Response += new ResponseHandler(OnResponse);
            this.dialog.ShowAll();

            // Widget.Sensitive
            OnCheckSecureAuthToggled(checkSecureAuth, null);
        }
Exemple #24
0
        protected void CheckForUpdates(string version, string infos)
        {
            if (version == NyFolder.Info.Version)
            {
                return;
            }

            Gtk.Image  updateImage = StockIcons.GetImage("UpdateNotifier", 22);
            Gtk.Button updateBtn   = new Gtk.Button(updateImage);
            updateBtn.Relief   = ReliefStyle.None;
            updateBtn.Clicked += {
                UpdateInfo updateDialog = new UpdateInfo();
                updateDialog.Version = version;
                updateDialog.Version = infos;
            };
        public void StockIconsNotNull()
        {
            PropertyInfo[] infos = typeof(StockIcons).GetType().GetProperties(BindingFlags.Public);

            // BUG: This (StockIcons) doesn't follow the same pattern as most of the other factory style patterned classes?
            var icons = new StockIcons();

            foreach (PropertyInfo info in infos)
            {
                if (info.PropertyType == typeof(StockIcon))
                {
                    Assert.NotNull((StockIcon)info.GetValue(icons, null));
                }
            }
        }
Exemple #26
0
        // ============================================
        // PRIVATE Members
        // ============================================

        // ============================================
        // PUBLIC Constructors
        // ============================================
        public DownloadManager()
        {
            this.dlWindow = null;

            // Initialize Talk Stock
            Gdk.Pixbuf pixbuf;
            pixbuf = new Gdk.Pixbuf(null, "Download.png");
            StockIcons.AddToStock("Download", pixbuf);
            StockIcons.AddToStockImages("Download", pixbuf);

            pixbuf = new Gdk.Pixbuf(null, "Upload.png");
            StockIcons.AddToStockImages("Upload", pixbuf);

            pixbuf = new Gdk.Pixbuf(null, "DlTrash.png");
            StockIcons.AddToStockImages("DlTrash", pixbuf);
        }
Exemple #27
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create Download Manager
        public DownloadManager()
        {
            // Initialize Plugin Info
            this.pluginInfo = new Info();

            // Initialize Talk Stock
            Gdk.Pixbuf pixbuf;
            pixbuf = new Gdk.Pixbuf(null, "Download.png");
            StockIcons.AddToStock("Download", pixbuf);
            StockIcons.AddToStockImages("Download", pixbuf);

            pixbuf = new Gdk.Pixbuf(null, "Upload.png");
            StockIcons.AddToStockImages("Upload", pixbuf);

            pixbuf = new Gdk.Pixbuf(null, "DlTrash.png");
            StockIcons.AddToStockImages("DlTrash", pixbuf);
        }
Exemple #28
0
 private void InsertIcons()
 {
     foreach (StockIconIdentifier iconId in Enum.GetValues(typeof(StockIconIdentifier)))
     {
         Image image = new Image();
         image.Source = StockIcons.GetBitmapSource((StockIconIdentifier)iconId);
         Button button = new Button();
         button.Content = image;
         button.Name    = iconId.ToString();
         button.Click  += (s, e) =>
         {
             _iconId = (int)Enum.Parse(typeof(StockIconIdentifier), ((Button)e.Source).Name);
             Close();
         };
         _wrapPanel.Children.Add(button);
     }
 }
        public TalkWithDialog() :
            base("dialog", new XML(null, "TalkWithDialog.glade", "dialog", null))
        {
            this.comboPeers = ComboBox.NewText();
            this.vboxMain.PackStart(this.comboPeers, false, false, 2);

            // Add Peers
            if (P2PManager.KnownPeers != null)
            {
                foreach (UserInfo userInfo in P2PManager.KnownPeers.Keys)
                {
                    this.comboPeers.AppendText(userInfo.Name);
                }
            }

            this.image.Pixbuf = StockIcons.GetPixbuf("TalkBubble");
            this.dialog.ShowAll();
        }
Exemple #30
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New "Remove Peer" Dialog
        public RemovePeer() : base("dialog", "RemovePeerDialog.glade")
        {
            this.comboPeers = ComboBox.NewText();
            this.vboxMain.PackStart(this.comboPeers, false, false, 2);

            // Add Peers
            if (P2PManager.KnownPeers != null)
            {
                foreach (UserInfo userInfo in P2PManager.KnownPeers.Keys)
                {
                    this.comboPeers.AppendText(userInfo.Name);
                }
            }
            this.comboPeers.ShowAll();

            // Initialize Dialog Image
            this.image.Pixbuf = StockIcons.GetPixbuf("Network", 96);
        }