[longomatch] Remind projects sorting in the config



commit 6304e82f76fadca15c296880bd6b0e3d5fa1a225
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Oct 24 19:22:40 2014 +0200

    Remind projects sorting in the config

 LongoMatch.Core/Common/Enums.cs                   |    8 ++++++++
 LongoMatch.Core/Config.cs                         |   12 ++++++++++++
 LongoMatch.GUI/Gui/Component/ProjectListWidget.cs |    3 +++
 3 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Enums.cs b/LongoMatch.Core/Common/Enums.cs
index faa060f..bdf47e7 100644
--- a/LongoMatch.Core/Common/Enums.cs
+++ b/LongoMatch.Core/Common/Enums.cs
@@ -310,4 +310,12 @@ namespace LongoMatch.Core.Common
                ZoomOut,
                FitTimeline,
        }
+
+       public enum ProjectSortMethod {
+               Name,
+               Date,
+               ModificationDate,
+               Season,
+               Competition
+       }
 }
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index 0a905c6..6ebc0d1 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -415,6 +415,16 @@ namespace LongoMatch
                                Save ();
                        }
                }
+               
+               public static ProjectSortMethod ProjectSortMethod {
+                       get {
+                               return state.projectSortMethod;
+                       }
+                       set {
+                               state.projectSortMethod = value;
+                               Save ();
+                       }
+               }
                #endregion
 
        }
@@ -442,6 +452,7 @@ namespace LongoMatch
                public bool reviewPlaysInSameWindow;
                public string defaultTemplate;
                public Hotkeys hotkeys;
+               public ProjectSortMethod projectSortMethod;
                
                public ConfigState () {
                        /* Set default values */
@@ -465,6 +476,7 @@ namespace LongoMatch
                        reviewPlaysInSameWindow = true;
                        defaultTemplate = null;
                        hotkeys = new Hotkeys ();
+                       projectSortMethod = ProjectSortMethod.Date;
                }
        }
 }
diff --git a/LongoMatch.GUI/Gui/Component/ProjectListWidget.cs 
b/LongoMatch.GUI/Gui/Component/ProjectListWidget.cs
index 0cb4dc3..ccc55ff 100644
--- a/LongoMatch.GUI/Gui/Component/ProjectListWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/ProjectListWidget.cs
@@ -23,6 +23,7 @@ using Gdk;
 using Gtk;
 using LongoMatch.Core.Handlers;
 using LongoMatch.Core.Store;
+using LongoMatch.Core.Common;
 
 namespace LongoMatch.Gui.Component
 {
@@ -52,10 +53,12 @@ namespace LongoMatch.Gui.Component
                        iconview.SelectionChanged += OnSelectionChanged;
                        iconview.ItemActivated += HandleItemActivated;
                        iconview.ItemWidth = 200;
+                       sortcombobox.Active = (int)Config.ProjectSortMethod;
                        sortcombobox.Changed += (sender, e) => {
                                /* Hack to make it actually resort */
                                store.SetSortColumnId (-2 , SortType.Ascending);
                                store.SetSortColumnId (0, SortType.Ascending);
+                               Config.ProjectSortMethod = (ProjectSortMethod) sortcombobox.Active;
                        };
                }
 


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