Redid the tree again.
[Gitrdone.git] / UI / PreferencesEditor.cs
blob4475a3ac9be02b6a48ebdad6f6d59ad472e34b03
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Text;
7 using System.Windows.Forms;
9 namespace Gitrdone
11 public partial class PreferencesEditor : Form
13 internal Prefs m_prefs;
15 internal PreferencesEditor(Prefs p)
17 m_prefs = p;
18 InitializeComponent();
19 m_gitPath.Text = m_prefs.GitDir;
22 protected string ChooseDir()
24 DialogResult r = m_folderChooser.ShowDialog();
25 if (r == DialogResult.OK)
27 return m_folderChooser.SelectedPath;
29 return "";
32 private void OnChooseMinGWPath(object sender, EventArgs e)
34 string dir = ChooseDir();
35 if (!String.IsNullOrEmpty(dir))
37 m_gitPath.Text = dir;
41 private void OnSave(object sender, EventArgs e)
43 string dir = m_gitPath.Text;
44 if (!System.IO.File.Exists(dir + System.IO.Path.DirectorySeparatorChar + "git-init-db") &&
45 !System.IO.File.Exists(dir + System.IO.Path.DirectorySeparatorChar + "git-init-db.exe"))
47 MessageBox.Show("The location does not appear to have git executables in it.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
48 return;
50 m_prefs.GitDir = dir;
51 m_prefs.Save();
52 Close();