public Theme AddTheme(string path) { Theme theme = new Theme (path); mThemes.Add (theme); return theme; }
public ThemeManager() { string themePath; mCurrentTheme = null; mThemes = new ArrayList (); try { LoadThemes (Defines.PERSONAL_THEME_DIR); LoadThemes (Defines.THEME_DIR); } catch (Exception) { /* Do nothing */ } themePath = Conf.Get (Preference.THEME, Defines.DEFAULT_THEME); SetTheme (themePath); Conf.AddNotify (Conf.GetFullKey(Preference.THEME), ConfNotifyHandler); }
// -- Private functions -- private void LoadThemes(string path) { try { string[] dirs = Directory.GetDirectories (path); foreach (string dir in dirs) { try { Theme theme = new Theme (dir); mThemes.Add (theme); } catch (Exception) { /* Do nothing, just continue to the next one */ } } } catch (DirectoryNotFoundException) { /* This dir doesn't exist, no sweat. */ return; } }
private void SetTheme(Theme theme) { if(Conf.Get(Preference.THEME, "") != theme.Path){ Conf.Set (Preference.THEME, theme.Path); } if (theme == mCurrentTheme) { return; } mCurrentTheme = theme; EmitThemeSelected (theme); }
private void EmitThemeSelected(Theme theme) { if (ThemeSelected != null) { ThemeSelected (theme); } }