diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-07-22 21:38:13 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-07-22 21:38:58 +0400 |
commit | 34a1526d9db7261d7de6b81044bdce3f987e252e (patch) | |
tree | 5e019b81e613d05c69e051ff4099c7968a2bae9e /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels | |
parent | 8ba55e9459ba7fc6128483300bdd3faf5f03ae5c (diff) |
[Ide] Fix theme enumeration
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs index f6e66723bc..e7682f4d8e 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs @@ -36,6 +36,7 @@ using MonoDevelop.Ide.Gui.Dialogs; using MonoDevelop.Components.Commands; using Mono.Addins; using Gtk; +using System.Linq; namespace MonoDevelop.Ide.Gui.OptionPanels { @@ -76,19 +77,12 @@ namespace MonoDevelop.Ide.Gui.OptionPanels comboLanguage.Active = i / 2; comboTheme.AppendText (GettextCatalog.GetString ("(Default)")); - List<string> themes = new List<string> (); - // Code for getting the list of themes taken from f-spot - string homeDir = Environment.GetFolderPath (Environment.SpecialFolder.Personal); - string gtkrc = System.IO.Path.Combine ("gtk-2.0", "gtkrc"); - string [] search = {System.IO.Path.Combine (homeDir, ".themes"), "/usr/share/themes"}; - foreach (string path in search) - if (System.IO.Directory.Exists (path)) - foreach (string dir in System.IO.Directory.GetDirectories (path)) - if (System.IO.File.Exists (System.IO.Path.Combine (dir, gtkrc))) - themes.Add (System.IO.Path.GetFileName (dir)); - + FilePath homeDir = Environment.GetFolderPath (Environment.SpecialFolder.Personal); + string[] searchDirs = { homeDir.Combine (".themes"), Gtk.Rc.ThemeDir }; + var themes = FindThemes (searchDirs).ToList (); themes.Sort (); + foreach (string t in themes) comboTheme.AppendText (t); @@ -112,6 +106,22 @@ namespace MonoDevelop.Ide.Gui.OptionPanels comboCompact.Active = (int) IdeApp.Preferences.WorkbenchCompactness; } + // Code for getting the list of themes based on f-spot + ICollection<string> FindThemes (params string[] themeDirs) + { + var themes = new HashSet<string> (); + string gtkrc = System.IO.Path.Combine ("gtk-2.0", "gtkrc"); + foreach (string themeDir in themeDirs) { + if (string.IsNullOrEmpty (themeDir) && !System.IO.Directory.Exists (themeDir)) + continue; + foreach (FilePath dir in System.IO.Directory.GetDirectories (themeDir)) { + if (System.IO.File.Exists (dir.Combine (gtkrc))) + themes.Add (dir.FileName); + } + } + return themes; + } + void FontOutputCheckboxToggled (object sender, EventArgs e) { fontOutputButton.Sensitive = fontOutputCheckbox.Active; |