예제 #1
0
        public SelectRepositoryDialog(SelectRepositoryMode mode)
        {
            Build();

            GtkWorkarounds.DisableMinimizeMaximizeButtons(this);
            Modal = true;
            foreach (VersionControlSystem vcs in VersionControlService.GetVersionControlSystems())
            {
                if (vcs.IsInstalled)
                {
                    repCombo.AppendText(vcs.Name);
                    systems.Add(vcs);
                }
            }
            repCombo.Active = 0;
            this.mode       = mode;

            store          = new Gtk.TreeStore(typeof(object), typeof(string), typeof(string), typeof(bool), typeof(string));
            repoTree.Model = store;
            TreeViewColumn col = new TreeViewColumn();

            col.Title = GettextCatalog.GetString("Repository");
            CellRendererText  crt = new CellRendererText();
            CellRendererImage crp = new CellRendererImage();

            col.PackStart(crp, false);
            col.PackStart(crt, true);
            col.AddAttribute(crp, "stock-id", IconCol);
            col.AddAttribute(crt, "text", RepoNameCol);
            repoTree.AppendColumn(col);
            repoTree.AppendColumn(GettextCatalog.GetString("Type"), new CellRendererText(), "text", VcsName);
            repoTree.TestExpandRow += new Gtk.TestExpandRowHandler(OnTestExpandRow);
            LoadRepositories();

            if (mode == SelectRepositoryMode.Checkout)
            {
                labelName.Visible    = false;
                entryName.Visible    = false;
                boxMessage.Visible   = false;
                labelMessage.Visible = false;
                defaultPath          = VersionControlDefaultPath;
                entryFolder.Text     = defaultPath;
                buttonOk.Label       = GettextCatalog.GetString("_Checkout");
                UpdateCheckoutButton();
            }
            else
            {
                labelTargetDir.Visible = false;
                boxFolder.Visible      = false;
            }

            repoContainer.SetFlag(WidgetFlags.NoWindow);
            SetupAccessibility();
        }