Exemplo n.º 1
0
        protected virtual void OnButtonEditRemoteClicked(object sender, EventArgs e)
        {
            TreeIter it;

            if (!treeRemotes.Selection.GetSelected(out it))
            {
                return;
            }

            var remote = (Remote)storeRemotes.GetValue(it, 0);

            if (remote == null)
            {
                return;
            }

            var dlg = new EditRemoteDialog(repo, remote);

            try {
                if (MessageService.RunCustomDialog(dlg) == (int)ResponseType.Ok)
                {
                    if (remote.Url != dlg.RemoteUrl)
                    {
                        repo.ChangeRemoteUrl(remote.Name, dlg.RemoteUrl);
                    }
                    if (remote.PushUrl != dlg.RemotePushUrl)
                    {
                        repo.ChangeRemotePushUrl(remote.Name, dlg.RemotePushUrl);
                    }

                    // Only do rename after we've done previous changes.
                    if (remote.Name != dlg.RemoteName)
                    {
                        repo.RenameRemote(remote.Name, dlg.RemoteName);
                    }
                    FillRemotes();
                }
            } finally {
                dlg.Destroy();
                dlg.Dispose();
            }
        }