[blam/gtk3] ThemeManager: remove old implementation



commit 531dfd944d653c91057aabb3ddecd7bcee5fc392
Author: Carlos Martín Nieto <cmn dwim me>
Date:   Sun Oct 13 16:31:18 2013 +0200

    ThemeManager: remove old implementation

 src/Theme.cs        |    7 +--
 src/ThemeManager.cs |  134 ---------------------------------------------------
 2 files changed, 3 insertions(+), 138 deletions(-)
---
diff --git a/src/Theme.cs b/src/Theme.cs
index df6510d..6331107 100644
--- a/src/Theme.cs
+++ b/src/Theme.cs
@@ -10,7 +10,7 @@ using System.Collections.Generic;
 
 namespace Blam
 {
-       using Theme = Imendio.Blam.Theme;
+       using Defines = Imendio.Blam.Defines;
 
        public interface ITheme
        {
@@ -39,10 +39,9 @@ namespace Blam
                        return replaces["text"];
                }
        }
-}
 
-namespace Imendio.Blam {
-       public class Theme : global::Blam.ITheme {
+       public class Theme : ITheme
+       {
                private string mName = "";
                private string mPath = "";
 
diff --git a/src/ThemeManager.cs b/src/ThemeManager.cs
index 686c805..d782907 100644
--- a/src/ThemeManager.cs
+++ b/src/ThemeManager.cs
@@ -17,7 +17,6 @@ using System.Reactive.Linq;
 
 namespace Blam
 {
-       using Theme = Imendio.Blam.Theme;
        using Defines = Imendio.Blam.Defines;
 
        public class ThemeManager : INotifyPropertyChanged
@@ -97,136 +96,3 @@ namespace Blam
        }
 }
 
-namespace Imendio.Blam {
-       
-       public class ThemeManager {
-               private IList mThemes;
-        private Theme mCurrentTheme;
-
-               public delegate void ThemeSelectedHandler (Theme theme);
-               public event ThemeSelectedHandler ThemeSelected;
-
-        public Theme CurrentTheme {
-            get {
-                return mCurrentTheme;
-            }
-        }
-
-               public ThemeManager ()
-               {
-                       string themePath;
-
-                       mCurrentTheme = null;
-            mThemes = new ArrayList ();
-
-                       try {
-                               LoadThemes (Defines.PERSONAL_THEME_DIR);
-                               LoadThemes (Defines.THEME_DIR);
-                       } catch (Exception) {
-                               /* Do nothing */
-                       }
-               
-                       themePath = "/";
-                       //themePath = Conf.Get (Preference.THEME, Defines.DEFAULT_THEME);
-                       SetTheme (themePath);
-
-                       //Conf.AddNotify (Conf.GetFullKey(Preference.THEME), ConfNotifyHandler);
-               }
-
-        // Returns a list of Themes
-               public IList GetThemeList ()
-               {
-            return mThemes;
-               }
-
-               public Theme AddTheme (string path)
-               {
-                       Theme theme = new Theme (path);
-                       mThemes.Add (theme);
-
-                       return theme;
-               }
-
-               public string PathByName(string name)
-               {
-                       foreach(Theme t in mThemes){
-                               if(t.Name == name){
-                                       return t.Path;
-                               }
-                       }
-                       return name;
-               }
-
-               // -- 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 (string themePath)
-               {
-                       foreach (Theme t in mThemes) {
-                               if (t.Path == themePath) {
-                                       SetTheme (t);
-                                       return;
-                               }
-                       }
-
-                       /* Theme didn't exist, we create it and then set it */
-                                       try {
-                               Theme theme = AddTheme (themePath);
-                               SetTheme (theme);
-                       } catch (Exception) {
-                               if (mCurrentTheme == null) {
-                                       SetTheme (Defines.DEFAULT_THEME);
-                               } else {
-                                       SetTheme (mCurrentTheme);
-                               }
-                       }
-               }
-
-               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);
-                       }
-               }
-
-#if false
-               private void ConfNotifyHandler (object sender, NotifyEventArgs args)
-               {
-                       if (args.Key == Conf.GetFullKey (Preference.THEME)) {
-                               SetTheme ((string) args.Value);
-                       }
-               }
-#endif
-       }
-}
-


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]