[longomatch] Start with the Gtk theming



commit ce71c51229dcf6ec8d8f2b0de53ddcda5942d565
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Aug 12 13:54:40 2014 +0200

    Start with the Gtk theming
    
    Setup infrastructure and do the welcome page

 LongoMatch.Core/Config.cs                          |    4 +-
 LongoMatch.Core/LongoMatch.Core.mdp                |    1 +
 LongoMatch.Core/Makefile.am                        |    3 +-
 LongoMatch.Core/StyleConf.cs                       |   53 ++++
 LongoMatch.GUI/Gui/Panel/WelcomePanel.cs           |  154 ++++++++++--
 LongoMatch.GUI/LongoMatch.GUI.mdp                  |    3 +-
 LongoMatch.GUI/Makefile.am                         |    5 +-
 .../gtk-gui/LongoMatch.Gui.Panel.WelcomePanel.cs   |  270 +++-----------------
 LongoMatch.GUI/gtk-gui/gui.stetic                  |  155 ++----------
 LongoMatch.Services/Services/Core.cs               |    4 +-
 LongoMatch/LongoMatchGtk.mdp                       |    1 +
 LongoMatch/Main.cs                                 |   34 +++-
 Makefile.am                                        |    1 +
 configure.ac                                       |    5 +
 data/theme/Makefile.am                             |    1 +
 data/theme/longomatch-dark.json                    |   13 +
 16 files changed, 316 insertions(+), 391 deletions(-)
---
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index f9a2dfb..61a3950 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -39,9 +39,11 @@ namespace LongoMatch
                public static ITeamTemplatesProvider TeamTemplatesProvider;
                public static ICategoriesTemplatesProvider CategoriesTemplatesProvider;
                public static EventsBroker EventsBroker;
-
+               
                public static IDataBaseManager DatabaseManager;
                public static IRenderingJobsManager RenderingJobsManger;
+               
+               public static StyleConf Style;
 
                static ConfigState state;
                
diff --git a/LongoMatch.Core/LongoMatch.Core.mdp b/LongoMatch.Core/LongoMatch.Core.mdp
index 23cbf10..c7320e0 100644
--- a/LongoMatch.Core/LongoMatch.Core.mdp
+++ b/LongoMatch.Core/LongoMatch.Core.mdp
@@ -149,6 +149,7 @@
     <File subtype="Code" buildaction="Compile" name="Store/Playlists/PlaylistPlayElement.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/Playlists/PlaylistDrawing.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/Playlists/PlaylistImage.cs" />
+    <File subtype="Code" buildaction="Compile" name="StyleConf.cs" />
   </Contents>
   <References>
     <ProjectReference type="Package" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
diff --git a/LongoMatch.Core/Makefile.am b/LongoMatch.Core/Makefile.am
index 802469f..30eacc0 100644
--- a/LongoMatch.Core/Makefile.am
+++ b/LongoMatch.Core/Makefile.am
@@ -103,7 +103,8 @@ SOURCES = Common/Area.cs \
        Store/Time.cs \
        Store/TimeNode.cs \
        Store/TimelineNode.cs \
-       Store/Timer.cs
+       Store/Timer.cs \
+       StyleConf.cs
 
 RESOURCES = $(top_srcdir)/images/field_background.svg \
        $(top_srcdir)/images/goal_background.svg \
diff --git a/LongoMatch.Core/StyleConf.cs b/LongoMatch.Core/StyleConf.cs
new file mode 100644
index 0000000..5301d30
--- /dev/null
+++ b/LongoMatch.Core/StyleConf.cs
@@ -0,0 +1,53 @@
+//
+//  Copyright (C) 2014 Andoni Morales Alastruey
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+
+namespace LongoMatch.Common
+{
+       public class StyleConf
+       {
+               public int WelcomeBorder { get; set; }
+
+               public int WelcomeIconSize { get; set; }
+
+               public int WelcomeLogoWidth { get; set; }
+
+               public int WelcomeLogoHeight { get; set; }
+
+               public int WelcomeIconsHSpacing { get; set; }
+
+               public int WelcomeIconsVSpacing { get; set; }
+
+               public int WelcomeIconsTextSpacing { get; set; }
+
+               public int WelcomeIconsTextHeight { get; set; }
+
+               public int WelcomeIconsPerRow { get; set; }
+
+               public int WelcomeTextHeight { get; set; }
+
+               public int WelcomeMinWidthBorder { get; set; }
+
+               public int TeamsComboColorHeight { get; set; }
+
+               public static StyleConf Load (string filename)
+               {
+                       return Serializer.Load <StyleConf> (filename);
+               }
+       }
+}
diff --git a/LongoMatch.GUI/Gui/Panel/WelcomePanel.cs b/LongoMatch.GUI/Gui/Panel/WelcomePanel.cs
index 55db4e4..a8df929 100644
--- a/LongoMatch.GUI/Gui/Panel/WelcomePanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/WelcomePanel.cs
@@ -18,36 +18,156 @@
 using System;
 using LongoMatch.Handlers;
 using LongoMatch.Common;
+using Mono.Unix;
+using Gtk;
+
+using Action = System.Action;
+using System.Collections.Generic;
 
 namespace LongoMatch.Gui.Panel
 {
        [System.ComponentModel.ToolboxItem(true)]
        public partial class WelcomePanel : Gtk.Bin
        {
+       
+               static WelcomeButton [] buttons = {
+                       new WelcomeButton ("longomatch-new", Catalog.GetString ("New"),
+                                          new Action (() => Config.EventsBroker.EmitNewProject (null))),
+                       new WelcomeButton ("longomatch-open", Catalog.GetString ("Open"),
+                                          new Action (() => Config.EventsBroker.EmitOpenProject ())),
+                       new WelcomeButton ("longomatch-import", Catalog.GetString ("Import"),
+                                          new Action (() => Config.EventsBroker.EmitImportProject ())),
+                       new WelcomeButton ("longomatch-project", Catalog.GetString ("Projects\nmanager"),
+                                          new Action (() => Config.EventsBroker.EmitManageProjects ())),
+                       new WelcomeButton ("longomatch-sportconfig", Catalog.GetString ("Sport\ntemplates"),
+                                          new Action (() => Config.EventsBroker.EmitManageCategories ())),
+                       new WelcomeButton ("longomatch-teamconfig", Catalog.GetString ("Team\ntemplates"),
+                                          new Action (() => Config.EventsBroker.EmitManageTeams ())),
+                                          
+               };
+               List<Widget> buttonWidgets;
+               Gtk.Image logoImage;
+               
                public WelcomePanel ()
                {
                        this.Build ();
-                       backgroundwidget.Background = Gdk.Pixbuf.LoadFromResource (Constants.BACKGROUND);
-                       Bind ();
+                       HeightRequest = MinHeight;
+                       WidthRequest = MinWidth;
+                       buttonWidgets = new List<Widget>();
+                       hbox1.BorderWidth = (uint) Config.Style.WelcomeBorder;
+                       Create ();
+                       Name = "WelcomePanel";
+               }
+
+               int MinWidth {
+                       get {
+                               return Math.Max (Config.Style.WelcomeLogoWidth,
+                                                Config.Style.WelcomeIconSize * 3 +
+                                                Config.Style.WelcomeIconsHSpacing * 2) +
+                                       Config.Style.WelcomeMinWidthBorder;
+                       }
+               }
+               
+               int MinHeight {
+                       get {
+                               return  HeaderHeight + Config.Style.WelcomeLogoHeight +
+                                       (IconHeight + Config.Style.WelcomeIconsVSpacing) * NRows + 20;
+                       }
                }
                
-               void Bind ()
+               int IconHeight {
+                       get {
+                               return Config.Style.WelcomeLogoHeight + Config.Style.WelcomeIconsTextSpacing +
+                                       Config.Style.WelcomeTextHeight;
+                       }
+               }
+               
+               int HeaderHeight {
+                       get {
+                               return Config.Style.WelcomeBorder * 2 + Config.Style.WelcomeIconSize;
+                       }
+               }
+               int NRows {
+                       get {
+                               return (int)Math.Ceiling ((float)buttons.Length / 
Config.Style.WelcomeIconsPerRow);
+                       }
+               }
+               
+               void Create ()
                {
-                       openbutton.Clicked += (sender, e) => {
-                               Config.EventsBroker.EmitOpenProject ();};
-                       newbutton.Clicked += (sender, e) => {
-                               Config.EventsBroker.EmitNewProject (null);};
-                       teamsbutton.Clicked += (sender, e) => {
-                               Config.EventsBroker.EmitManageTeams ();};
-                       sportsbutton.Clicked += (sender, e) => {
-                               Config.EventsBroker.EmitManageCategories ();};
-                   preferencesbutton.Clicked += (sender, e) => {
-                               Config.EventsBroker.EmitEditPreferences ();};
-                   projectsbutton.Clicked += (sender, e) =>  {
-                               Config.EventsBroker.EmitManageProjects ();};
-                       importbutton.Clicked += (sender, e) =>  {
-                               Config.EventsBroker.EmitImportProject ();};
+                       int padding;
+
+                       Gtk.Image prefImage = new Gtk.Image (
+                               IconTheme.Default.LoadIcon ("longomatch-preferences",
+                                                   Config.Style.WelcomeIconSize, 0));
+                       preferencesbutton.Add (prefImage);
+                       preferencesbutton.WidthRequest = Config.Style.WelcomeIconSize;
+                       preferencesbutton.HeightRequest = Config.Style.WelcomeIconSize;
+
+                       logoImage = new Gtk.Image ();
+                       logoImage.Pixbuf = Gdk.Pixbuf.LoadFromResource ("longomatch-dark-bg.svg");
+                       logoImage.WidthRequest = Config.Style.WelcomeLogoWidth;
+                       logoImage.HeightRequest = Config.Style.WelcomeLogoHeight;
+                       fixedwidget.Put (logoImage, 0, 0);
+
+                       padding = Config.Style.WelcomeLogoHeight + Config.Style.WelcomeIconsVSpacing;
+                       for (int i=0; i < buttons.Length; i++) {
+                               Widget b;
+                               int x, y;
+                               
+                               x = (Config.Style.WelcomeIconsHSpacing + Config.Style.WelcomeIconSize) *
+                                       (i % Config.Style.WelcomeIconsPerRow);
+                               y = (Config.Style.WelcomeIconsVSpacing + Config.Style.WelcomeIconSize) *
+                                       (i / Config.Style.WelcomeIconsPerRow);
+
+                               b = CreateButton (buttons[i]);
+                               fixedwidget.Put (b, x, y + padding);
+                               buttonWidgets.Add (b);
+                       }
+                       fixedwidget.HeightRequest = Config.Style.WelcomeLogoHeight +
+                                       (IconHeight + Config.Style.WelcomeIconsVSpacing) * NRows; 
+               }
+               
+               Widget CreateButton (WelcomeButton b) {
+                       Button button;
+                       VBox box;
+                       Gtk.Image image;
+                       Label label;
+                       
+                       image = new Gtk.Image (
+                               IconTheme.Default.LoadIcon (b.name, Config.Style.WelcomeIconSize, 0));
+
+                       button = new Button ();
+                       button.Clicked += (sender, e) => (b.func());
+                       button.HeightRequest = Config.Style.WelcomeIconSize;
+                       button.WidthRequest = Config.Style.WelcomeIconSize;
+                       button.Add (image);
+
+                       label = new Label (b.text);
+                       label.LineWrap = true;
+                       label.LineWrapMode = Pango.WrapMode.Word;
+                       label.Justify = Justification.Center;
+
+                       box = new VBox (false, Config.Style.WelcomeIconsTextSpacing);
+                       box.PackStart (button, false, false, 0);
+                       box.PackStart (label, false, false, 0);
+                       box.HeightRequest = IconHeight;
+                       box.ShowAll ();
+                       return box;
+               }
+       }
+       
+       public struct WelcomeButton {
+               public string name;
+               public string text;
+               public Action func;
+
+               public WelcomeButton (string name, string text, Action func) {
+                       this.name = name;
+                       this.text = text;
+                       this.func = func;
                }
+               
        }
 }
 
diff --git a/LongoMatch.GUI/LongoMatch.GUI.mdp b/LongoMatch.GUI/LongoMatch.GUI.mdp
index dab67c2..8f08f86 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.mdp
+++ b/LongoMatch.GUI/LongoMatch.GUI.mdp
@@ -128,7 +128,6 @@
     <File subtype="Code" buildaction="Compile" 
name="gtk-gui/LongoMatch.Gui.Component.Stats.PlayerSubcategoryViewer.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/AnalysisComponent.cs" />
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.AnalysisComponent.cs" 
/>
-    <File subtype="Code" buildaction="EmbedAsResource" name="../images/background.svg" />
     <File subtype="Directory" buildaction="Compile" name="Gui/Panel" />
     <File subtype="Code" buildaction="Compile" name="Gui/Panel/WelcomePanel.cs" />
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Panel.WelcomePanel.cs" />
@@ -181,6 +180,8 @@
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/tools/line-double-arrow.svg" />
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/tools/line-arrow.svg" />
     <File subtype="Code" buildaction="Nothing" name="LongoMatch.GUI.dll.config" 
copyToOutputDirectory="PreserveNewest" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="../data/images/longomatch-light-bg.svg" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="../data/images/longomatch-dark-bg.svg" />
   </Contents>
   <References>
     <ProjectReference type="Package" localcopy="True" refto="atk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
diff --git a/LongoMatch.GUI/Makefile.am b/LongoMatch.GUI/Makefile.am
index 3d42753..527a24f 100644
--- a/LongoMatch.GUI/Makefile.am
+++ b/LongoMatch.GUI/Makefile.am
@@ -137,7 +137,6 @@ RESOURCES = gtk-gui/gui.stetic \
        $(top_srcdir)/images/logo.svg \
        $(top_srcdir)/images/video.png \
        $(top_srcdir)/images/camera-video.png \
-       $(top_srcdir)/images/background.svg \
        $(top_srcdir)/images/background.png \
        $(top_srcdir)/images/tools/draw-arrow.png \
        $(top_srcdir)/images/tools/draw-circle-unfilled.png \
@@ -155,7 +154,9 @@ RESOURCES = gtk-gui/gui.stetic \
        $(top_srcdir)/images/tools/line-double-dot.svg \
        $(top_srcdir)/images/tools/line-dot.svg \
        $(top_srcdir)/images/tools/line-double-arrow.svg \
-       $(top_srcdir)/images/tools/line-arrow.svg
+       $(top_srcdir)/images/tools/line-arrow.svg \
+       $(top_srcdir)/data/images/longomatch-light-bg.svg \
+       $(top_srcdir)/data/images/longomatch-dark-bg.svg
 
 DLLCONFIG = LongoMatch.GUI.dll.config
 
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.WelcomePanel.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.WelcomePanel.cs
index 9588f2d..890b3fa 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.WelcomePanel.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.WelcomePanel.cs
@@ -5,18 +5,11 @@ namespace LongoMatch.Gui.Panel
        public partial class WelcomePanel
        {
                private global::Gtk.VBox vbox1;
-               private global::LongoMatch.Gui.Component.BackgroundWidget backgroundwidget;
-               private global::Gtk.Label label1;
-               private global::Gtk.HButtonBox hbuttonbox1;
-               private global::Gtk.Button newbutton;
-               private global::Gtk.Button openbutton;
-               private global::Gtk.Button importbutton;
-               private global::Gtk.Label label2;
-               private global::Gtk.HButtonBox hbuttonbox2;
+               private global::Gtk.HBox hbox1;
+               private global::Gtk.Label label3;
                private global::Gtk.Button preferencesbutton;
-               private global::Gtk.Button projectsbutton;
-               private global::Gtk.Button sportsbutton;
-               private global::Gtk.Button teamsbutton;
+               private global::Gtk.Alignment alignment1;
+               private global::Gtk.Fixed fixedwidget;
 
                protected virtual void Build ()
                {
@@ -29,232 +22,45 @@ namespace LongoMatch.Gui.Panel
                        this.vbox1.Name = "vbox1";
                        this.vbox1.Spacing = 6;
                        // Container child vbox1.Gtk.Box+BoxChild
-                       this.backgroundwidget = new global::LongoMatch.Gui.Component.BackgroundWidget ();
-                       this.backgroundwidget.Events = ((global::Gdk.EventMask)(256));
-                       this.backgroundwidget.Name = "backgroundwidget";
-                       this.vbox1.Add (this.backgroundwidget);
-                       global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox1 
[this.backgroundwidget]));
+                       this.hbox1 = new global::Gtk.HBox ();
+                       this.hbox1.Name = "hbox1";
+                       this.hbox1.Spacing = 6;
+                       // Container child hbox1.Gtk.Box+BoxChild
+                       this.label3 = new global::Gtk.Label ();
+                       this.label3.Name = "label3";
+                       this.label3.Xalign = 1F;
+                       this.label3.LabelProp = global::Mono.Unix.Catalog.GetString ("Preferences");
+                       this.hbox1.Add (this.label3);
+                       global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.label3]));
                        w1.Position = 0;
-                       // Container child vbox1.Gtk.Box+BoxChild
-                       this.label1 = new global::Gtk.Label ();
-                       this.label1.Name = "label1";
-                       this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>Projects</b>");
-                       this.label1.UseMarkup = true;
-                       this.label1.Justify = ((global::Gtk.Justification)(2));
-                       this.vbox1.Add (this.label1);
-                       global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.label1]));
+                       // Container child hbox1.Gtk.Box+BoxChild
+                       this.preferencesbutton = new global::Gtk.Button ();
+                       this.preferencesbutton.CanFocus = true;
+                       this.preferencesbutton.Name = "preferencesbutton";
+                       this.preferencesbutton.Label = null;
+                       this.hbox1.Add (this.preferencesbutton);
+                       global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.preferencesbutton]));
                        w2.Position = 1;
                        w2.Expand = false;
                        w2.Fill = false;
+                       this.vbox1.Add (this.hbox1);
+                       global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox1]));
+                       w3.Position = 0;
+                       w3.Expand = false;
+                       w3.Fill = false;
                        // Container child vbox1.Gtk.Box+BoxChild
-                       this.hbuttonbox1 = new global::Gtk.HButtonBox ();
-                       this.hbuttonbox1.Name = "hbuttonbox1";
-                       this.hbuttonbox1.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(1));
-                       // Container child hbuttonbox1.Gtk.ButtonBox+ButtonBoxChild
-                       this.newbutton = new global::Gtk.Button ();
-                       this.newbutton.CanFocus = true;
-                       this.newbutton.Name = "newbutton";
-                       this.newbutton.UseUnderline = true;
-                       // Container child newbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w3 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
-                       // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w4 = new global::Gtk.HBox ();
-                       w4.Spacing = 2;
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w5 = new global::Gtk.Image ();
-                       w5.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-new", 
global::Gtk.IconSize.Dialog);
-                       w4.Add (w5);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w7 = new global::Gtk.Label ();
-                       w7.LabelProp = global::Mono.Unix.Catalog.GetString ("New Project");
-                       w7.UseUnderline = true;
-                       w4.Add (w7);
-                       w3.Add (w4);
-                       this.newbutton.Add (w3);
-                       this.hbuttonbox1.Add (this.newbutton);
-                       global::Gtk.ButtonBox.ButtonBoxChild w11 = 
((global::Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox1 [this.newbutton]));
-                       w11.Expand = false;
-                       w11.Fill = false;
-                       // Container child hbuttonbox1.Gtk.ButtonBox+ButtonBoxChild
-                       this.openbutton = new global::Gtk.Button ();
-                       this.openbutton.CanFocus = true;
-                       this.openbutton.Name = "openbutton";
-                       this.openbutton.UseUnderline = true;
-                       // Container child openbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w12 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
-                       // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w13 = new global::Gtk.HBox ();
-                       w13.Spacing = 2;
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w14 = new global::Gtk.Image ();
-                       w14.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-open", 
global::Gtk.IconSize.Dialog);
-                       w13.Add (w14);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w16 = new global::Gtk.Label ();
-                       w16.LabelProp = global::Mono.Unix.Catalog.GetString ("Open Project");
-                       w16.UseUnderline = true;
-                       w13.Add (w16);
-                       w12.Add (w13);
-                       this.openbutton.Add (w12);
-                       this.hbuttonbox1.Add (this.openbutton);
-                       global::Gtk.ButtonBox.ButtonBoxChild w20 = 
((global::Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox1 [this.openbutton]));
-                       w20.Position = 1;
-                       w20.Expand = false;
-                       w20.Fill = false;
-                       // Container child hbuttonbox1.Gtk.ButtonBox+ButtonBoxChild
-                       this.importbutton = new global::Gtk.Button ();
-                       this.importbutton.CanFocus = true;
-                       this.importbutton.Name = "importbutton";
-                       this.importbutton.UseUnderline = true;
-                       // Container child importbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w21 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
-                       // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w22 = new global::Gtk.HBox ();
-                       w22.Spacing = 2;
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w23 = new global::Gtk.Image ();
-                       w23.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-jump-to", 
global::Gtk.IconSize.Dialog);
-                       w22.Add (w23);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w25 = new global::Gtk.Label ();
-                       w25.LabelProp = global::Mono.Unix.Catalog.GetString ("Import Project");
-                       w25.UseUnderline = true;
-                       w22.Add (w25);
-                       w21.Add (w22);
-                       this.importbutton.Add (w21);
-                       this.hbuttonbox1.Add (this.importbutton);
-                       global::Gtk.ButtonBox.ButtonBoxChild w29 = 
((global::Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox1 [this.importbutton]));
-                       w29.Position = 2;
-                       w29.Expand = false;
-                       w29.Fill = false;
-                       this.vbox1.Add (this.hbuttonbox1);
-                       global::Gtk.Box.BoxChild w30 = ((global::Gtk.Box.BoxChild)(this.vbox1 
[this.hbuttonbox1]));
-                       w30.Position = 2;
-                       w30.Expand = false;
-                       w30.Fill = false;
-                       // Container child vbox1.Gtk.Box+BoxChild
-                       this.label2 = new global::Gtk.Label ();
-                       this.label2.Name = "label2";
-                       this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>Tools</b>");
-                       this.label2.UseMarkup = true;
-                       this.label2.Justify = ((global::Gtk.Justification)(2));
-                       this.vbox1.Add (this.label2);
-                       global::Gtk.Box.BoxChild w31 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.label2]));
-                       w31.Position = 3;
-                       w31.Expand = false;
-                       w31.Fill = false;
-                       // Container child vbox1.Gtk.Box+BoxChild
-                       this.hbuttonbox2 = new global::Gtk.HButtonBox ();
-                       this.hbuttonbox2.Name = "hbuttonbox2";
-                       this.hbuttonbox2.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(1));
-                       // Container child hbuttonbox2.Gtk.ButtonBox+ButtonBoxChild
-                       this.preferencesbutton = new global::Gtk.Button ();
-                       this.preferencesbutton.CanFocus = true;
-                       this.preferencesbutton.Name = "preferencesbutton";
-                       this.preferencesbutton.UseUnderline = true;
-                       // Container child preferencesbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w32 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
-                       // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w33 = new global::Gtk.HBox ();
-                       w33.Spacing = 2;
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w34 = new global::Gtk.Image ();
-                       w34.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-preferences", 
global::Gtk.IconSize.Dialog);
-                       w33.Add (w34);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w36 = new global::Gtk.Label ();
-                       w36.LabelProp = global::Mono.Unix.Catalog.GetString ("Preferences");
-                       w36.UseUnderline = true;
-                       w33.Add (w36);
-                       w32.Add (w33);
-                       this.preferencesbutton.Add (w32);
-                       this.hbuttonbox2.Add (this.preferencesbutton);
-                       global::Gtk.ButtonBox.ButtonBoxChild w40 = 
((global::Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox2 [this.preferencesbutton]));
-                       w40.Expand = false;
-                       w40.Fill = false;
-                       // Container child hbuttonbox2.Gtk.ButtonBox+ButtonBoxChild
-                       this.projectsbutton = new global::Gtk.Button ();
-                       this.projectsbutton.CanFocus = true;
-                       this.projectsbutton.Name = "projectsbutton";
-                       this.projectsbutton.UseUnderline = true;
-                       // Container child projectsbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w41 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
-                       // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w42 = new global::Gtk.HBox ();
-                       w42.Spacing = 2;
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w43 = new global::Gtk.Image ();
-                       w43.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-properties", 
global::Gtk.IconSize.Dialog);
-                       w42.Add (w43);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w45 = new global::Gtk.Label ();
-                       w45.LabelProp = global::Mono.Unix.Catalog.GetString ("Projects Manager");
-                       w45.UseUnderline = true;
-                       w42.Add (w45);
-                       w41.Add (w42);
-                       this.projectsbutton.Add (w41);
-                       this.hbuttonbox2.Add (this.projectsbutton);
-                       global::Gtk.ButtonBox.ButtonBoxChild w49 = 
((global::Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox2 [this.projectsbutton]));
-                       w49.Position = 1;
-                       w49.Expand = false;
-                       w49.Fill = false;
-                       // Container child hbuttonbox2.Gtk.ButtonBox+ButtonBoxChild
-                       this.sportsbutton = new global::Gtk.Button ();
-                       this.sportsbutton.CanFocus = true;
-                       this.sportsbutton.Name = "sportsbutton";
-                       this.sportsbutton.UseUnderline = true;
-                       // Container child sportsbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w50 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
-                       // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w51 = new global::Gtk.HBox ();
-                       w51.Spacing = 2;
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w52 = new global::Gtk.Image ();
-                       w52.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-edit", 
global::Gtk.IconSize.Dialog);
-                       w51.Add (w52);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w54 = new global::Gtk.Label ();
-                       w54.LabelProp = global::Mono.Unix.Catalog.GetString ("Sports templates");
-                       w54.UseUnderline = true;
-                       w51.Add (w54);
-                       w50.Add (w51);
-                       this.sportsbutton.Add (w50);
-                       this.hbuttonbox2.Add (this.sportsbutton);
-                       global::Gtk.ButtonBox.ButtonBoxChild w58 = 
((global::Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox2 [this.sportsbutton]));
-                       w58.Position = 2;
-                       w58.Expand = false;
-                       w58.Fill = false;
-                       // Container child hbuttonbox2.Gtk.ButtonBox+ButtonBoxChild
-                       this.teamsbutton = new global::Gtk.Button ();
-                       this.teamsbutton.CanFocus = true;
-                       this.teamsbutton.Name = "teamsbutton";
-                       this.teamsbutton.UseUnderline = true;
-                       // Container child teamsbutton.Gtk.Container+ContainerChild
-                       global::Gtk.Alignment w59 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
-                       // Container child GtkAlignment.Gtk.Container+ContainerChild
-                       global::Gtk.HBox w60 = new global::Gtk.HBox ();
-                       w60.Spacing = 2;
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Image w61 = new global::Gtk.Image ();
-                       w61.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-edit", 
global::Gtk.IconSize.Dialog);
-                       w60.Add (w61);
-                       // Container child GtkHBox.Gtk.Container+ContainerChild
-                       global::Gtk.Label w63 = new global::Gtk.Label ();
-                       w63.LabelProp = global::Mono.Unix.Catalog.GetString ("Teams templates");
-                       w63.UseUnderline = true;
-                       w60.Add (w63);
-                       w59.Add (w60);
-                       this.teamsbutton.Add (w59);
-                       this.hbuttonbox2.Add (this.teamsbutton);
-                       global::Gtk.ButtonBox.ButtonBoxChild w67 = 
((global::Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox2 [this.teamsbutton]));
-                       w67.Position = 3;
-                       w67.Expand = false;
-                       w67.Fill = false;
-                       this.vbox1.Add (this.hbuttonbox2);
-                       global::Gtk.Box.BoxChild w68 = ((global::Gtk.Box.BoxChild)(this.vbox1 
[this.hbuttonbox2]));
-                       w68.Position = 4;
-                       w68.Expand = false;
-                       w68.Fill = false;
+                       this.alignment1 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       this.alignment1.Name = "alignment1";
+                       // Container child alignment1.Gtk.Container+ContainerChild
+                       this.fixedwidget = new global::Gtk.Fixed ();
+                       this.fixedwidget.WidthRequest = 450;
+                       this.fixedwidget.HeightRequest = 300;
+                       this.fixedwidget.Name = "fixedwidget";
+                       this.fixedwidget.HasWindow = false;
+                       this.alignment1.Add (this.fixedwidget);
+                       this.vbox1.Add (this.alignment1);
+                       global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox1 
[this.alignment1]));
+                       w5.Position = 1;
                        this.Add (this.vbox1);
                        if ((this.Child != null)) {
                                this.Child.ShowAll ();
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index 74c2727..1a75c08 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -6157,170 +6157,61 @@ You can continue with the current capture, cancel it or save your project.
         <property name="MemberName" />
         <property name="Spacing">6</property>
         <child>
-          <widget class="LongoMatch.Gui.Component.BackgroundWidget" id="backgroundwidget">
-            <property name="MemberName" />
-            <property name="Events">ButtonPressMask</property>
-          </widget>
-          <packing>
-            <property name="Position">0</property>
-            <property name="AutoSize">True</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="Gtk.Label" id="label1">
-            <property name="MemberName" />
-            <property name="LabelProp" translatable="yes">&lt;b&gt;Projects&lt;/b&gt;</property>
-            <property name="UseMarkup">True</property>
-            <property name="Justify">Center</property>
-          </widget>
-          <packing>
-            <property name="Position">1</property>
-            <property name="AutoSize">True</property>
-            <property name="Expand">False</property>
-            <property name="Fill">False</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="Gtk.HButtonBox" id="hbuttonbox1">
+          <widget class="Gtk.HBox" id="hbox1">
             <property name="MemberName" />
-            <property name="Size">3</property>
-            <property name="LayoutStyle">Spread</property>
+            <property name="Spacing">6</property>
             <child>
-              <widget class="Gtk.Button" id="newbutton">
+              <widget class="Gtk.Label" id="label3">
                 <property name="MemberName" />
-                <property name="CanFocus">True</property>
-                <property name="Type">TextAndIcon</property>
-                <property name="Icon">stock:gtk-new Dialog</property>
-                <property name="Label" translatable="yes">New Project</property>
-                <property name="UseUnderline">True</property>
+                <property name="Xalign">1</property>
+                <property name="LabelProp" translatable="yes">Preferences</property>
               </widget>
               <packing>
-                <property name="Expand">False</property>
-                <property name="Fill">False</property>
+                <property name="Position">0</property>
+                <property name="AutoSize">False</property>
               </packing>
             </child>
             <child>
-              <widget class="Gtk.Button" id="openbutton">
+              <widget class="Gtk.Button" id="preferencesbutton">
                 <property name="MemberName" />
                 <property name="CanFocus">True</property>
-                <property name="Type">TextAndIcon</property>
-                <property name="Icon">stock:gtk-open Dialog</property>
-                <property name="Label" translatable="yes">Open Project</property>
-                <property name="UseUnderline">True</property>
+                <property name="Type">Custom</property>
+                <child>
+                  <placeholder />
+                </child>
               </widget>
               <packing>
                 <property name="Position">1</property>
-                <property name="Expand">False</property>
-                <property name="Fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="Gtk.Button" id="importbutton">
-                <property name="MemberName" />
-                <property name="CanFocus">True</property>
-                <property name="Type">TextAndIcon</property>
-                <property name="Icon">stock:gtk-jump-to Dialog</property>
-                <property name="Label" translatable="yes">Import Project</property>
-                <property name="UseUnderline">True</property>
-              </widget>
-              <packing>
-                <property name="Position">2</property>
+                <property name="AutoSize">False</property>
                 <property name="Expand">False</property>
                 <property name="Fill">False</property>
               </packing>
             </child>
           </widget>
           <packing>
-            <property name="Position">2</property>
-            <property name="AutoSize">True</property>
-            <property name="Expand">False</property>
-            <property name="Fill">False</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="Gtk.Label" id="label2">
-            <property name="MemberName" />
-            <property name="LabelProp" translatable="yes">&lt;b&gt;Tools&lt;/b&gt;</property>
-            <property name="UseMarkup">True</property>
-            <property name="Justify">Center</property>
-          </widget>
-          <packing>
-            <property name="Position">3</property>
+            <property name="Position">0</property>
             <property name="AutoSize">True</property>
             <property name="Expand">False</property>
             <property name="Fill">False</property>
           </packing>
         </child>
         <child>
-          <widget class="Gtk.HButtonBox" id="hbuttonbox2">
+          <widget class="Gtk.Alignment" id="alignment1">
             <property name="MemberName" />
-            <property name="Size">4</property>
-            <property name="LayoutStyle">Spread</property>
-            <child>
-              <widget class="Gtk.Button" id="preferencesbutton">
-                <property name="MemberName" />
-                <property name="CanFocus">True</property>
-                <property name="Type">TextAndIcon</property>
-                <property name="Icon">stock:gtk-preferences Dialog</property>
-                <property name="Label" translatable="yes">Preferences</property>
-                <property name="UseUnderline">True</property>
-              </widget>
-              <packing>
-                <property name="Expand">False</property>
-                <property name="Fill">False</property>
-              </packing>
-            </child>
+            <property name="Xscale">0</property>
+            <property name="Yscale">0</property>
             <child>
-              <widget class="Gtk.Button" id="projectsbutton">
+              <widget class="Gtk.Fixed" id="fixedwidget">
                 <property name="MemberName" />
-                <property name="CanFocus">True</property>
-                <property name="Type">TextAndIcon</property>
-                <property name="Icon">stock:gtk-properties Dialog</property>
-                <property name="Label" translatable="yes">Projects Manager</property>
-                <property name="UseUnderline">True</property>
+                <property name="WidthRequest">450</property>
+                <property name="HeightRequest">300</property>
+                <property name="HasWindow">False</property>
               </widget>
-              <packing>
-                <property name="Position">1</property>
-                <property name="Expand">False</property>
-                <property name="Fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="Gtk.Button" id="sportsbutton">
-                <property name="MemberName" />
-                <property name="CanFocus">True</property>
-                <property name="Type">TextAndIcon</property>
-                <property name="Icon">stock:gtk-edit Dialog</property>
-                <property name="Label" translatable="yes">Sports templates</property>
-                <property name="UseUnderline">True</property>
-              </widget>
-              <packing>
-                <property name="Position">2</property>
-                <property name="Expand">False</property>
-                <property name="Fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="Gtk.Button" id="teamsbutton">
-                <property name="MemberName" />
-                <property name="CanFocus">True</property>
-                <property name="Type">TextAndIcon</property>
-                <property name="Icon">stock:gtk-edit Dialog</property>
-                <property name="Label" translatable="yes">Teams templates</property>
-                <property name="UseUnderline">True</property>
-              </widget>
-              <packing>
-                <property name="Position">3</property>
-                <property name="Expand">False</property>
-                <property name="Fill">False</property>
-              </packing>
             </child>
           </widget>
           <packing>
-            <property name="Position">4</property>
-            <property name="AutoSize">True</property>
-            <property name="Expand">False</property>
-            <property name="Fill">False</property>
+            <property name="Position">1</property>
+            <property name="AutoSize">False</property>
           </packing>
         </child>
       </widget>
diff --git a/LongoMatch.Services/Services/Core.cs b/LongoMatch.Services/Services/Core.cs
index 8a8d4e4..592d673 100644
--- a/LongoMatch.Services/Services/Core.cs
+++ b/LongoMatch.Services/Services/Core.cs
@@ -141,7 +141,7 @@ namespace LongoMatch.Services
                                System.IO.Directory.CreateDirectory (Config.TempVideosDir);
                }
 
-               private static void SetupBaseDir ()
+               static void SetupBaseDir ()
                {
                        string home;
                        
@@ -167,7 +167,7 @@ namespace LongoMatch.Services
                                        Constants.SOFTWARE_NAME.ToLower ());
                }
 
-               private static bool? debugging = null;
+               static bool? debugging = null;
 
                public static bool Debugging {
                        get {
diff --git a/LongoMatch/LongoMatchGtk.mdp b/LongoMatch/LongoMatchGtk.mdp
index e9b4985..ccb96ca 100644
--- a/LongoMatch/LongoMatchGtk.mdp
+++ b/LongoMatch/LongoMatchGtk.mdp
@@ -6,6 +6,7 @@
       <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" />
       <EnvironmentVariables>
         <Variable name="LGM_DEBUG" value="3" />
+        <Variable name="LGM_UNINSTALLED" value="1" />
       </EnvironmentVariables>
       <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" 
generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" 
ctype="CSharpCompilerParameters" />
     </Configuration>
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 54b2531..f7b533c 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -38,11 +38,10 @@ namespace LongoMatch
                
                public static void Main (string[] args)
                {
-                       /* Init Gtk */
-                       Application.Init ();
-                       
                        Core.Init ();
 
+                       InitGtk ();
+
                        /* Init GStreamer */
                        GStreamer.Init ();
                        if (!GStreamer.CheckInstallation ())
@@ -77,6 +76,35 @@ namespace LongoMatch
                        }
                }
 
+               static void InitGtk ()
+               {
+                       string dataDir, gtkRC, iconsDir, styleConf;
+                       IconTheme theme;
+                       
+                       if (Environment.GetEnvironmentVariable ("LGM_UNINSTALLED") != null) {
+                               dataDir = "../data";
+                       } else {
+                               dataDir = Path.Combine (Config.baseDirectory, "share",
+                                                       Constants.SOFTWARE_NAME.ToLower ());
+                       }
+                       
+                       gtkRC = Path.Combine (dataDir, "theme", "gtk-2.0", "gtkrc");
+                       if (File.Exists (gtkRC)) {
+                               Rc.AddDefaultFile (gtkRC);
+                       }
+                       
+                       styleConf = Path.Combine (dataDir, "theme", "longomatch-dark.json");
+                       Config.Style = StyleConf.Load (styleConf);
+
+                       Application.Init ();
+
+                       iconsDir = Path.Combine (dataDir, "icons");
+                       if (Directory.Exists (iconsDir)) {
+                               IconTheme.Default.PrependSearchPath (iconsDir);
+                       }
+                       
+               }
+
                private static void OnException (GLib.UnhandledExceptionArgs args)
                {
                        ProcessExecutionError ((Exception)args.ExceptionObject);
diff --git a/Makefile.am b/Makefile.am
index 0fad2ba..34ddbe1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,6 +6,7 @@ ACLOCAL_AMFLAGS = -I build/m4 -I build/m4/shamrock
 
 SUBDIRS = \
        build \
+       data \
        images \
        pkgconfig \
        libcesarplayer \
diff --git a/configure.ac b/configure.ac
index 387f994..9107746 100644
--- a/configure.ac
+++ b/configure.ac
@@ -148,6 +148,11 @@ LongoMatch/longomatch.desktop.in
 LongoMatch/AssemblyInfo.cs
 tools/deb-pkg.sh
 
+data/Makefile
+data/icons/Makefile
+data/images/Makefile
+data/theme/Makefile
+
 po/Makefile.in
 ])
 
diff --git a/data/theme/Makefile.am b/data/theme/Makefile.am
index eef12af..23ef57b 100644
--- a/data/theme/Makefile.am
+++ b/data/theme/Makefile.am
@@ -1,6 +1,7 @@
 NULL=
 themedir = @datadir@/@PACKAGE@/theme
 nobase_dist_theme_DATA = \
+       longomatch-dark.json \
        gtk-2.0/gtkrc \
        gtk-2.0/welcome.rc \
        $(NULL)
diff --git a/data/theme/longomatch-dark.json b/data/theme/longomatch-dark.json
new file mode 100644
index 0000000..005eae2
--- /dev/null
+++ b/data/theme/longomatch-dark.json
@@ -0,0 +1,13 @@
+{
+       'WelcomeBorder': 30,
+       'WelcomeIconSize': 80,
+       'WelcomeLogoWidth': 450,
+       'WelcomeLogoHeight': 99,
+       'WelcomeIconsHSpacing': 105,
+       'WelcomeIconsVSpacing': 55,
+       'WelcomeIconsTextSpacing': 5,
+       'WelcomeIconsTextHeight': 20,
+       'WelcomeIconsPerRow': 3,
+       'WelcomeTextHeight': 20,
+       'TeamsComboColorHeight': 2,
+}



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