58
58
public partial class IDEStyleOptionsPanelWidget : Gtk.Bin
60
readonly Gtk.IconSize[] sizes = new Gtk.IconSize [] { Gtk.IconSize.Menu, Gtk.IconSize.SmallToolbar, Gtk.IconSize.LargeToolbar };
60
static Lazy<List<string>> themes = new Lazy<List<string>> (() => {
61
var searchDirs = new List<string> ();
63
string prefix = Environment.GetEnvironmentVariable ("MONO_INSTALL_PREFIX");
64
FilePath homeDir = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
66
searchDirs.Add (homeDir.Combine (".themes"));
67
searchDirs.Add (Gtk.Rc.ThemeDir);
68
if (!string.IsNullOrEmpty (prefix))
69
searchDirs.Add (new FilePath (prefix).Combine ("share").Combine ("themes"));
72
var themes = FindThemes (searchDirs).ToList ();
77
public static IList<string> InstalledThemes {
62
84
public IDEStyleOptionsPanelWidget ()
79
99
comboTheme.AppendText (GettextCatalog.GetString ("(Default)"));
81
FilePath homeDir = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
82
string[] searchDirs = { homeDir.Combine (".themes"), Gtk.Rc.ThemeDir };
83
var themes = FindThemes (searchDirs).ToList ();
86
foreach (string t in themes)
101
foreach (string t in InstalledThemes)
87
102
comboTheme.AppendText (t);
89
comboTheme.Active = themes.IndexOf (IdeApp.Preferences.UserInterfaceTheme) + 1;
91
documentSwitcherButton.Active = PropertyService.Get ("MonoDevelop.Core.Gui.EnableDocumentSwitchDialog", true);
92
fontCheckbox.Active = IdeApp.Preferences.CustomPadFont != null;
93
fontButton.FontName = IdeApp.Preferences.CustomPadFont ?? name;
94
fontButton.Sensitive = fontCheckbox.Active;
95
fontOutputCheckbox.Active = IdeApp.Preferences.CustomOutputPadFont != null;
96
fontOutputButton.FontName = IdeApp.Preferences.CustomOutputPadFont ?? name;
97
fontOutputButton.Sensitive = fontOutputCheckbox.Active;
99
fontCheckbox.Toggled += new EventHandler (FontCheckboxToggled);
100
fontOutputCheckbox.Toggled += new EventHandler (FontOutputCheckboxToggled);
102
Gtk.IconSize curSize = IdeApp.Preferences.ToolbarSize;
103
toolbarCombobox.Active = Array.IndexOf (sizes, curSize);
105
comboCompact.Active = (int) IdeApp.Preferences.WorkbenchCompactness;
104
comboTheme.Active = themes.Value.IndexOf (IdeApp.Preferences.UserInterfaceTheme) + 1;
106
labelTheme.Visible = comboTheme.Visible = !Platform.IsMac && !Platform.IsWindows;
108
109
// Code for getting the list of themes based on f-spot
109
ICollection<string> FindThemes (params string[] themeDirs)
110
static ICollection<string> FindThemes (IEnumerable<string> themeDirs)
111
112
var themes = new HashSet<string> ();
112
113
string gtkrc = System.IO.Path.Combine ("gtk-2.0", "gtkrc");
114
115
if (string.IsNullOrEmpty (themeDir) || !System.IO.Directory.Exists (themeDir))
116
117
foreach (FilePath dir in System.IO.Directory.GetDirectories (themeDir)) {
117
if (System.IO.File.Exists (dir.Combine (gtkrc)))
118
themes.Add (dir.FileName);
118
if (System.IO.File.Exists (dir.Combine (gtkrc))) {
119
if (!IdeStartup.FailingGtkThemes.Any (t => t == dir.FileName))
120
themes.Add (dir.FileName);
124
void FontOutputCheckboxToggled (object sender, EventArgs e)
126
fontOutputButton.Sensitive = fontOutputCheckbox.Active;
128
void FontCheckboxToggled (object sender, EventArgs e)
130
fontButton.Sensitive = fontCheckbox.Active;
133
127
public void Store()
135
129
string lc = isoCodes [comboLanguage.Active * 2];
136
130
if (lc != IdeApp.Preferences.UserInterfaceLanguage) {
137
131
IdeApp.Preferences.UserInterfaceLanguage = lc;
138
MessageService.ShowMessage (GettextCatalog.GetString ("The user interface language change will take effect the next time you start MonoDevelop"));
132
MessageService.ShowMessage (
133
GettextCatalog.GetString (
134
"The user interface language change will take effect the next time you start {0}",
135
BrandingService.ApplicationName
141
140
if (comboTheme.Active == 0) {
150
149
if (theme != Gtk.Settings.Default.ThemeName)
151
150
Gtk.Settings.Default.ThemeName = theme;
153
if (fontCheckbox.Active)
154
IdeApp.Preferences.CustomPadFont = fontButton.FontName;
156
IdeApp.Preferences.CustomPadFont = null;
158
if (fontOutputCheckbox.Active)
159
IdeApp.Preferences.CustomOutputPadFont = fontOutputButton.FontName;
161
IdeApp.Preferences.CustomOutputPadFont = null;
163
IdeApp.Preferences.ToolbarSize = sizes [toolbarCombobox.Active];
165
IdeApp.Preferences.WorkbenchCompactness = (WorkbenchCompactness) comboCompact.Active;
167
PropertyService.Set ("MonoDevelop.Core.Gui.EnableDocumentSwitchDialog", documentSwitcherButton.Active);
170
153
static string[] isoCodes = new string[] {