[chronojump] encoder load signal works with enter or double click on treeview
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] encoder load signal works with enter or double click on treeview
- Date: Wed, 14 May 2014 11:44:41 +0000 (UTC)
commit 8194063a39263864417b97cf3a9e68330c86b5d7
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed May 14 13:44:10 2014 +0200
encoder load signal works with enter or double click on treeview
glade/chronojump.glade | 1 +
src/gui/encoder.cs | 10 +++++-----
src/gui/genericWindow.cs | 21 ++++++++++++++++++++-
3 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 7077ebf..ce13d4a 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -24151,6 +24151,7 @@ One serie can contain several tests.</property>
<widget class="GtkTreeView" id="treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="row_activated" handler="on_row_double_clicked" swapped="no"/>
</widget>
</child>
</widget>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index fe7f7c1..c9aa3d0 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -544,7 +544,7 @@ public partial class ChronoJumpWindow
Catalog.GetString("If there is more than one value for an exercise,\nthe used
value is the top one."),
bigArray);
- genericWin.SetTreeview(columnsString, false, dataPrint, new ArrayList(),
Constants.ContextMenu.DELETE);
+ genericWin.SetTreeview(columnsString, false, dataPrint, new ArrayList(),
Constants.ContextMenu.DELETE, false);
//find all persons in current session
ArrayList personsPre =
SqlitePersonSession.SelectCurrentSessionPersons(currentSession.UniqueID);
@@ -798,7 +798,7 @@ public partial class ChronoJumpWindow
Catalog.GetString("If you want to edit or delete a row, right click on it.")
+ "\n",
bigArray);
- genericWin.SetTreeview(columnsString, true, dataPrint, new ArrayList(),
Constants.ContextMenu.EDITDELETE);
+ genericWin.SetTreeview(columnsString, true, dataPrint, new ArrayList(),
Constants.ContextMenu.EDITDELETE, false);
genericWin.AddOptionsToComboCheckBoxesOptions(encoderExercisesNames);
genericWin.CreateComboCheckBoxes();
genericWin.MarkActiveCurves(checkboxes);
@@ -1005,7 +1005,7 @@ public partial class ChronoJumpWindow
string.Format(Catalog.GetString("Select persons to compare to {0}."),
currentPerson.Name), bigArray);
- genericWin.SetTreeview(columnsString, true, data, nonSensitiveRows,
Constants.ContextMenu.NONE);
+ genericWin.SetTreeview(columnsString, true, data, nonSensitiveRows,
Constants.ContextMenu.NONE, false);
genericWin.CreateComboCheckBoxes();
genericWin.MarkActiveCurves(checkboxes);
genericWin.ShowButtonCancel(false);
@@ -1104,7 +1104,7 @@ public partial class ChronoJumpWindow
dataConverted.Add(encPS.ToStringArray());
}
- genericWin.SetTreeview(columnsString, true, dataConverted, nonSensitiveRows,
Constants.ContextMenu.NONE);
+ genericWin.SetTreeview(columnsString, true, dataConverted, nonSensitiveRows,
Constants.ContextMenu.NONE, false);
genericWin.CreateComboCheckBoxes();
genericWin.MarkActiveCurves(checkboxes);
genericWin.ShowButtonCancel(false);
@@ -1176,7 +1176,7 @@ public partial class ChronoJumpWindow
currentPerson.Name) + "\n" +
Catalog.GetString("If you want to edit or delete a row, right click on it."),
bigArray);
- genericWin.SetTreeview(columnsString, false, dataPrint, new ArrayList(),
Constants.ContextMenu.EDITDELETE);
+ genericWin.SetTreeview(columnsString, false, dataPrint, new ArrayList(),
Constants.ContextMenu.EDITDELETE, true);
//find all persons in current session
ArrayList personsPre =
SqlitePersonSession.SelectCurrentSessionPersons(currentSession.UniqueID);
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index daf4106..9dc0c43 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -424,9 +424,12 @@ public class GenericWindow
textview.Buffer = tb;
}
+ bool activateRowAcceptsWindow;
//data is an ArrayList of strings[], each string [] is a row, each of its strings is a column
public void SetTreeview(string [] columnsString, bool addCheckbox,
- ArrayList data, ArrayList myNonSensitiveRows, Constants.ContextMenu contextMenu)
+ ArrayList data, ArrayList myNonSensitiveRows, Constants.ContextMenu contextMenu,
+ bool activateRowAcceptsWindow //this param makes button_accept the window if
'enter' on a row or double click
+ )
{
//adjust window to be bigger
generic_window.Resizable = true;
@@ -447,6 +450,7 @@ Log.WriteLine("aaaaaaaaaaaaaaaa1");
Log.WriteLine("aaaaaaaaaaaaaaaa2");
genericWinContextMenu = contextMenu;
+ this.activateRowAcceptsWindow = activateRowAcceptsWindow;
treeview.CursorChanged += on_treeview_cursor_changed;
if(contextMenu == Constants.ContextMenu.EDITDELETE) {
@@ -603,6 +607,21 @@ Log.WriteLine("aaaaaaaaaaaaaaaa2");
}
}
}
+
+ void on_row_double_clicked (object o, Gtk.RowActivatedArgs args)
+ {
+ if(activateRowAcceptsWindow) {
+ TreeView tv = (TreeView) o;
+ TreeModel model;
+ TreeIter iter;
+
+ if (tv.Selection.GetSelected (out model, out iter)) {
+ //activate on_button_accept_clicked()
+ button_accept.Activate();
+ }
+ }
+ }
+
private void on_treeview_button_release_event (object o, ButtonReleaseEventArgs args) {
//TreeviewSelectedUniqueID = -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]