Example #1
0
        /// <summary>
        /// Setup Dialog - Customize
        /// </summary>
        private void SetupDialog()
        {
            this.Title        = Util.GS("iFolder passphrase");
            this.Icon         = new Gdk.Pixbuf(Util.ImagesPath("ifolder16.png"));
            this.HasSeparator = false;
//			this.BorderWidth = 10;
            this.SetDefaultSize(450, 100);
            //		this.Resizable = false;
            this.Modal             = true;
            this.DestroyWithParent = true;
            this.DefaultResponse   = ResponseType.Ok;

            //-----------------------------
            // Add iFolderGraphic
            //-----------------------------
            HBox imagebox = new HBox();

            imagebox.Spacing = 0;
            iFolderBanner    = new Image(
                new Gdk.Pixbuf(Util.ImagesPath("ifolder-banner.png")));
            imagebox.PackStart(iFolderBanner, false, false, 0);

            ScaledPixbuf =
                new Gdk.Pixbuf(Util.ImagesPath("ifolder-banner-scaler.png"));
            iFolderScaledBanner              = new Image(ScaledPixbuf);
            iFolderScaledBanner.ExposeEvent +=
                new ExposeEventHandler(OnBannerExposed);
            imagebox.PackStart(iFolderScaledBanner, true, true, 0);
            this.VBox.PackStart(imagebox, false, true, 0);

            Table table = new Table(8, 3, false);

            this.VBox.PackStart(table, false, false, 0);
            table.ColumnSpacing = 6;
            table.RowSpacing    = 6;
            table.BorderWidth   = 12;

            // Row 1
            Label l = new Label(Util.GS("Enter the passphrase") + ":");

            table.Attach(l, 0, 3, 0, 1,
                         AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0);
            l.LineWrap = true;
            l.Xalign   = 0.0F;

            // Row 2
            table.Attach(new Label(""), 0, 1, 1, 2,
                         AttachOptions.Fill, 0, 12, 0);      // spacer
            l = new Label(Util.GS("Domain Name") + ":");
            table.Attach(l, 1, 2, 1, 2,
                         AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0);
            l.LineWrap = true;
            l.Xalign   = 0.0F;
            DomainInformation info = simws.GetDomainInformation(DomainID);

            l = new Label(info.Name + " (" + info.Host + ")");
            table.Attach(l, 2, 3, 1, 2,
                         AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0);
            l.LineWrap = true;
            l.Xalign   = 0.0F;

            // Row 3
            table.Attach(new Label(""), 0, 1, 2, 3,
                         AttachOptions.Fill, 0, 12, 0);      // spacer
            l = new Label(Util.GS("_Passphrase:"));
            table.Attach(l, 1, 2, 2, 3,
                         AttachOptions.Shrink | AttachOptions.Fill, 0, 0, 0);
            l.Xalign                   = 0.0F;
            PassPhraseEntry            = new Entry();
            PassPhraseEntry.Visibility = false;
            PassPhraseEntry.Changed   += new EventHandler(OnFieldsChanged);
            table.Attach(PassPhraseEntry, 2, 3, 2, 3,
                         AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0);
            l.MnemonicWidget = PassPhraseEntry;

            // Row 4
            l = new Label(Util.GS("_Re-type passphrase:"));
            table.Attach(l, 1, 2, 3, 4,
                         AttachOptions.Shrink | AttachOptions.Fill, 0, 0, 0);
            l.Xalign = 0.0F;
            PassPhraseVerifyEntry            = new Entry();
            PassPhraseVerifyEntry.Visibility = false;
            PassPhraseVerifyEntry.Changed   += new EventHandler(OnFieldsChanged);
            table.Attach(PassPhraseVerifyEntry, 2, 3, 3, 4,
                         AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0);
            l.MnemonicWidget = PassPhraseVerifyEntry;

            // Row 5
            savePassPhraseButton = new CheckButton(Util.GS("Remember passphrase"));
            table.Attach(savePassPhraseButton, 2, 3, 4, 5,
                         AttachOptions.Shrink | AttachOptions.Fill, 0, 0, 0);

            // Row 6
            l = new Label(Util.GS("Select Passphrase Recovery Agent") + ":");
            table.Attach(l, 0, 3, 5, 6,
                         AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0);
            l.LineWrap = true;
            l.Xalign   = 0.0F;
            // Row 7
            RATreeView = new iFolderTreeView();
            ScrolledWindow sw = new ScrolledWindow();

            sw.ShadowType       = Gtk.ShadowType.EtchedIn;
            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.Add(RATreeView);

            DomainController domainController = DomainController.GetDomainController();

            RATreeStore      = new ListStore(typeof(string));
            RATreeView.Model = RATreeStore;
            RAList           = domainController.GetRAList(DomainID);
            iFolderWebService ifws     = DomainController.GetiFolderService();
            TreeIter          listiter = TreeIter.Zero;
            bool selected = false;

            try{
                ifws.ChangePassword(DomainID, null, null);
                listiter = RATreeStore.AppendValues(Util.GS("Server_Default"));
                selected = true;
            }
            catch { }

            if (RAList == null)
            {
                Debug.PrintLine(" no recovery agent present:");
            }
            else
            {
                Debug.PrintLine("Recovery agent present");
            }
            foreach (string raagent in RAList)
            {
                Debug.PrintLine(String.Format("raagent:{0}", raagent));
                RATreeStore.AppendValues(raagent);
            }
            // RA Name Column
            TreeViewColumn raNameColumn = new TreeViewColumn();

            raNameColumn.Title = Util.GS("Recovery Agents");
            CellRendererText cr = new CellRendererText();

            cr.Xpad = 5;
            raNameColumn.PackStart(cr, false);
            raNameColumn.SetCellDataFunc(cr,
                                         new TreeCellDataFunc(RANameCellTextDataFunc));
            raNameColumn.Resizable = true;
            raNameColumn.MinWidth  = 250;

            RATreeView.AppendColumn(raNameColumn);

            RATreeView.Selection.Mode = SelectionMode.Single;

            table.Attach(sw, 0, 3, 6, 8,
                         AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);


            this.VBox.ShowAll();

            if (selected)
            {
                RATreeView.Selection.SelectIter(listiter);
            }

            this.AddButton(Stock.Cancel, ResponseType.Cancel);
            this.AddButton(Stock.Ok, ResponseType.Ok);
            this.SetResponseSensitive(ResponseType.Ok, false);
            this.DefaultResponse = ResponseType.Ok;
        }