[longomatch] Add support to select the sort method to the GUI layer



commit c4ad47df290e08774674dea00fecc28fcfc45f73
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Jan 5 01:04:00 2010 +0100

    Add support to select the sort method to the GUI layer

 LongoMatch/Gui/Component/CategoryProperties.cs     |    6 +++
 LongoMatch/Gui/TreeView/CategoriesTreeView.cs      |   15 +++++++
 .../LongoMatch.Gui.Component.CategoryProperties.cs |   36 +++++++++++++++++
 LongoMatch/gtk-gui/gui.stetic                      |   42 +++++++++++++++++++-
 4 files changed, 98 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch/Gui/Component/CategoryProperties.cs b/LongoMatch/Gui/Component/CategoryProperties.cs
index 93cf4b0..5978da2 100644
--- a/LongoMatch/Gui/Component/CategoryProperties.cs
+++ b/LongoMatch/Gui/Component/CategoryProperties.cs
@@ -60,6 +60,7 @@ namespace LongoMatch.Gui.Component
 				nameentry.Text = stn.Name;
 				timeadjustwidget1.SetTimeNode(stn);
 				colorbutton1.Color = stn.Color;
+				sortmethodcombobox.Active = (int)stn.SortingMethod;
 
 				if (stn.HotKey.Defined) {
 					hotKeyLabel.Text = stn.HotKey.ToString();
@@ -102,5 +103,10 @@ namespace LongoMatch.Gui.Component
 		{
 			stn.Name = nameentry.Text;
 		}
+
+		protected virtual void OnSortmethodcomboboxChanged (object sender, System.EventArgs e)
+		{
+			stn.SortingMethodString = sortmethodcombobox.ActiveText;
+		}
 	}
 }
diff --git a/LongoMatch/Gui/TreeView/CategoriesTreeView.cs b/LongoMatch/Gui/TreeView/CategoriesTreeView.cs
index a5fd850..88f914a 100644
--- a/LongoMatch/Gui/TreeView/CategoriesTreeView.cs
+++ b/LongoMatch/Gui/TreeView/CategoriesTreeView.cs
@@ -66,18 +66,26 @@ namespace LongoMatch.Gui.Component
 			hotKeyColumn.Title = Catalog.GetString("Hotkey");
 			Gtk.CellRendererText hotKeyCell = new Gtk.CellRendererText();
 			hotKeyColumn.PackStart(hotKeyCell, true);
+			
+			Gtk.TreeViewColumn sortMethodColumn = new Gtk.TreeViewColumn();
+			sortMethodColumn.Title = Catalog.GetString("Sort Method");
+			Gtk.CellRendererText sortMethodCell = new Gtk.CellRendererText();
+			sortMethodColumn.PackStart(sortMethodCell, true);
 
 			nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderName));
 			startTimeColumn.SetCellDataFunc(startTimeCell, new Gtk.TreeCellDataFunc(RenderStartTime));
 			stopTimeColumn.SetCellDataFunc(stopTimeCell, new Gtk.TreeCellDataFunc(RenderStopTime));
 			colorColumn.SetCellDataFunc(colorCell, new Gtk.TreeCellDataFunc(RenderColor));
 			hotKeyColumn.SetCellDataFunc(hotKeyCell, new Gtk.TreeCellDataFunc(RenderHotKey));
+			sortMethodColumn.SetCellDataFunc(sortMethodCell, new Gtk.TreeCellDataFunc(RenderSortMethod));
+
 
 			AppendColumn(nameColumn);
 			AppendColumn(startTimeColumn);
 			AppendColumn(stopTimeColumn);
 			AppendColumn(colorColumn);
 			AppendColumn(hotKeyColumn);
+			AppendColumn(sortMethodColumn);
 		}
 
 		private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
@@ -115,6 +123,13 @@ namespace LongoMatch.Gui.Component
 
 			(cell as Gtk.CellRendererText).Text = tNode.HotKey.ToString();
 		}
+		
+		private void RenderSortMethod(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
+		{
+			SectionsTimeNode tNode = (SectionsTimeNode) Model.GetValue(iter, 0);
+
+			(cell as Gtk.CellRendererText).Text = tNode.SortingMethodString;
+		}
 
 		protected virtual void OnCursorChanged(object o, System.EventArgs e) {
 			TreeIter iter;
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.CategoryProperties.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.CategoryProperties.cs
index 51df543..8583e2b 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.CategoryProperties.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.CategoryProperties.cs
@@ -35,6 +35,12 @@ namespace LongoMatch.Gui.Component {
         
         private Gtk.Label label6;
         
+        private Gtk.HBox hbox1;
+        
+        private Gtk.Label label5;
+        
+        private Gtk.ComboBox sortmethodcombobox;
+        
         protected virtual void Build() {
             Stetic.Gui.Initialize(this);
             // Widget LongoMatch.Gui.Component.CategoryProperties
@@ -137,6 +143,35 @@ namespace LongoMatch.Gui.Component {
             Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox2]));
             w10.Position = 2;
             w10.Fill = false;
+            // Container child vbox3.Gtk.Box+BoxChild
+            this.hbox1 = new Gtk.HBox();
+            this.hbox1.Name = "hbox1";
+            this.hbox1.Spacing = 6;
+            // Container child hbox1.Gtk.Box+BoxChild
+            this.label5 = new Gtk.Label();
+            this.label5.Name = "label5";
+            this.label5.LabelProp = Mono.Unix.Catalog.GetString("Sort Method");
+            this.hbox1.Add(this.label5);
+            Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.hbox1[this.label5]));
+            w11.Position = 0;
+            w11.Expand = false;
+            w11.Fill = false;
+            // Container child hbox1.Gtk.Box+BoxChild
+            this.sortmethodcombobox = Gtk.ComboBox.NewText();
+            this.sortmethodcombobox.AppendText(Mono.Unix.Catalog.GetString("Sort by name"));
+            this.sortmethodcombobox.AppendText(Mono.Unix.Catalog.GetString("Sort by start time"));
+            this.sortmethodcombobox.AppendText(Mono.Unix.Catalog.GetString("Sort by stop time"));
+            this.sortmethodcombobox.AppendText(Mono.Unix.Catalog.GetString("Sort by duration"));
+            this.sortmethodcombobox.Name = "sortmethodcombobox";
+            this.sortmethodcombobox.Active = 0;
+            this.hbox1.Add(this.sortmethodcombobox);
+            Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.hbox1[this.sortmethodcombobox]));
+            w12.Position = 1;
+            this.vbox3.Add(this.hbox1);
+            Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox1]));
+            w13.Position = 3;
+            w13.Expand = false;
+            w13.Fill = false;
             this.Add(this.vbox3);
             if ((this.Child != null)) {
                 this.Child.ShowAll();
@@ -147,6 +182,7 @@ namespace LongoMatch.Gui.Component {
             this.timeadjustwidget1.LagTimeChanged += new System.EventHandler(this.OnTimeadjustwidget1LagTimeChanged);
             this.colorbutton1.ColorSet += new System.EventHandler(this.OnColorbutton1ColorSet);
             this.changebuton.Clicked += new System.EventHandler(this.OnChangebutonClicked);
+            this.sortmethodcombobox.Changed += new System.EventHandler(this.OnSortmethodcomboboxChanged);
         }
     }
 }
diff --git a/LongoMatch/gtk-gui/gui.stetic b/LongoMatch/gtk-gui/gui.stetic
index 9ea5b41..76f2e51 100644
--- a/LongoMatch/gtk-gui/gui.stetic
+++ b/LongoMatch/gtk-gui/gui.stetic
@@ -1956,7 +1956,7 @@
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.CategoryProperties" design-size="260 135">
+  <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.CategoryProperties" design-size="284 118">
     <property name="MemberName" />
     <child>
       <widget class="Gtk.VBox" id="vbox3">
@@ -2092,6 +2092,46 @@
             <property name="Fill">False</property>
           </packing>
         </child>
+        <child>
+          <widget class="Gtk.HBox" id="hbox1">
+            <property name="MemberName" />
+            <property name="Spacing">6</property>
+            <child>
+              <widget class="Gtk.Label" id="label5">
+                <property name="MemberName" />
+                <property name="LabelProp" translatable="yes">Sort Method</property>
+              </widget>
+              <packing>
+                <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.ComboBox" id="sortmethodcombobox">
+                <property name="MemberName" />
+                <property name="IsTextCombo">True</property>
+                <property name="Items" translatable="yes">Sort by name
+Sort by start time
+Sort by stop time
+Sort by duration</property>
+                <property name="Active">0</property>
+                <signal name="Changed" handler="OnSortmethodcomboboxChanged" />
+              </widget>
+              <packing>
+                <property name="Position">1</property>
+                <property name="AutoSize">False</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">3</property>
+            <property name="AutoSize">True</property>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
       </widget>
     </child>
   </widget>



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