[longomatch] Move some constants to the config



commit f51e39d13a72e9dfb24a86c5e2391ea57c311484
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Nov 13 19:45:20 2014 +0100

    Move some constants to the config

 LongoMatch.Core/Common/Constants.cs          |    2 +-
 LongoMatch.Core/Config.cs                    |   25 +++++++++++++++++++++++++
 LongoMatch.GUI/Gui/Dialog/About.cs           |    9 +++------
 LongoMatch.GUI/Gui/Panel/WelcomePanel.cs     |    2 +-
 LongoMatch.GUI/LongoMatch.GUI.csproj         |    6 ------
 LongoMatch.Services/Services/CoreServices.cs |    2 +-
 LongoMatch/Main.cs                           |    2 +-
 7 files changed, 32 insertions(+), 16 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Constants.cs b/LongoMatch.Core/Common/Constants.cs
index fbfd36b..f254c33 100644
--- a/LongoMatch.Core/Common/Constants.cs
+++ b/LongoMatch.Core/Common/Constants.cs
@@ -101,7 +101,7 @@ Xavier Queralt Mateu (ca)";
                public const string PROJECT_EXT = ".lgm";
                
                public const string LOGO_ICON = "longomatch";
-               public const string BACKGROUND = "background.png";
+               public const string BACKGROUND = "longomatch-dark-bg.svg";
                public const string FIELD_BACKGROUND = "fields/field-full.svg";
                public const string HALF_FIELD_BACKGROUND = "fields/field-half.svg";
                public const string HHALF_FIELD_BACKGROUND = "fields/field-full-teameditor.svg";
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index 1c60511..e2a0293 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -67,6 +67,10 @@ namespace LongoMatch
                                state = new ConfigState();
                                Save ();
                        }
+                       Background = new Image (Path.Combine (Config.ImagesDir, Constants.BACKGROUND));
+                       Copyright = Constants.COPYRIGHT;
+                       License = Constants.LICENSE;
+                       SoftwareName = Constants.SOFTWARE_NAME;
                }
                
                public static void Save () {
@@ -191,6 +195,27 @@ namespace LongoMatch
                }
                
                #region Properties
+               
+               static public Image Background {
+                       get;
+                       set;
+               }
+
+               static public string Copyright {
+                       get;
+                       set;
+               }
+               
+               static public string License {
+                       get;
+                       set;
+               }
+               
+               static public string SoftwareName {
+                       get;
+                       set;
+               }
+
                static public Image FieldBackground {
                        get {
                                return new Image (Path.Combine (Config.ImagesDir, 
Constants.FIELD_BACKGROUND));
diff --git a/LongoMatch.GUI/Gui/Dialog/About.cs b/LongoMatch.GUI/Gui/Dialog/About.cs
index 176afc8..68d5575 100644
--- a/LongoMatch.GUI/Gui/Dialog/About.cs
+++ b/LongoMatch.GUI/Gui/Dialog/About.cs
@@ -16,8 +16,6 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 // 
 using System;
-using System.Reflection;
-using Gtk;
 
 using LongoMatch.Core.Common;
 
@@ -27,13 +25,12 @@ namespace LongoMatch.Gui.Dialog
        {
                public AboutDialog (Version version)
                {
-                       ProgramName = Constants.SOFTWARE_NAME;
+                       ProgramName = Config.SoftwareName;
                        Version = String.Format("{0}.{1}.{2}",version.Major,version.Minor,version.Build);
-                       Copyright = Constants.COPYRIGHT;
+                       Copyright = Config.Copyright;
                        Website = Constants.WEBSITE;
-                       License = Constants.LICENSE;
+                       License = Config.License;
                        Authors = new string[] {"Andoni Morales Alastruey", "Fluendo" };
-                       Artists = new string[] {"Bencomo González Marrero"};
                        TranslatorCredits = Constants.TRANSLATORS;
                        SetUrlHook(delegate(Gtk.AboutDialog dialog, string url) {
                                try {
diff --git a/LongoMatch.GUI/Gui/Panel/WelcomePanel.cs b/LongoMatch.GUI/Gui/Panel/WelcomePanel.cs
index 06bd569..31bf6d9 100644
--- a/LongoMatch.GUI/Gui/Panel/WelcomePanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/WelcomePanel.cs
@@ -85,7 +85,7 @@ namespace LongoMatch.Gui.Panel
 
                        // Our logo
                        logoImage = new Gtk.Image ();
-                       logoImage.Pixbuf = Gdk.Pixbuf.LoadFromResource ("longomatch-dark-bg.svg");
+                       logoImage.Pixbuf = Config.Background.Value;
                        logoImage.WidthRequest = StyleConf.WelcomeLogoWidth;
                        logoImage.HeightRequest = StyleConf.WelcomeLogoHeight;
                        tablewidget.Attach (logoImage, 0, StyleConf.WelcomeIconsPerRow, 0, 1,
diff --git a/LongoMatch.GUI/LongoMatch.GUI.csproj b/LongoMatch.GUI/LongoMatch.GUI.csproj
index 767931f..e8d8b4a 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.csproj
+++ b/LongoMatch.GUI/LongoMatch.GUI.csproj
@@ -207,12 +207,6 @@
     <EmbeddedResource Include="..\images\tools\line-arrow.svg">
       <LogicalName>line-arrow.svg</LogicalName>
     </EmbeddedResource>
-    <EmbeddedResource Include="..\data\images\longomatch-light-bg.svg">
-      <LogicalName>longomatch-light-bg.svg</LogicalName>
-    </EmbeddedResource>
-    <EmbeddedResource Include="..\data\images\longomatch-dark-bg.svg">
-      <LogicalName>longomatch-dark-bg.svg</LogicalName>
-    </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
     <None Include="LongoMatch.GUI.dll.config">
diff --git a/LongoMatch.Services/Services/CoreServices.cs b/LongoMatch.Services/Services/CoreServices.cs
index d8efd1a..d3dd277 100644
--- a/LongoMatch.Services/Services/CoreServices.cs
+++ b/LongoMatch.Services/Services/CoreServices.cs
@@ -136,7 +136,7 @@ namespace LongoMatch.Services
                        string home;
 
                        if (Environment.GetEnvironmentVariable ("LGM_UNINSTALLED") != null) {
-                               Config.baseDirectory = ".";
+                               Config.baseDirectory = Path.GetFullPath (".");
                                Config.dataDir = "../data";
                        } else {
                                Config.baseDirectory = System.IO.Path.Combine 
(System.AppDomain.CurrentDomain.BaseDirectory, "../");
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 44d6ae8..d27e18a 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -53,11 +53,11 @@ namespace LongoMatch
 
                        try {
                                AddinsManager.Initialize (Config.PluginsConfigDir, Config.PluginsDir);
+                               AddinsManager.LoadConfigModifierAddins ();
                                Config.DrawingToolkit = new CairoBackend ();
                                Config.EventsBroker = new EventsBroker ();
                                Config.MultimediaToolkit = new MultimediaToolkit ();
                                Config.GUIToolkit = new GUIToolkit (version);
-                               AddinsManager.LoadConfigModifierAddins ();
                                bool haveCodecs = AddinsManager.RegisterGStreamerPlugins ();
                                AddinsManager.LoadExportProjectAddins (Config.GUIToolkit.MainController);
                                AddinsManager.LoadMultimediaBackendsAddins (Config.MultimediaToolkit);


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