[chronojump] Load signal/select curves needs delete confirmation if askDeletion is true on preferences
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Load signal/select curves needs delete confirmation if askDeletion is true on preferences
- Date: Wed, 14 May 2014 10:40:42 +0000 (UTC)
commit 11977a8af3ca3171f64624050ce0d5b780f65657
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed May 14 12:39:40 2014 +0200
Load signal/select curves needs delete confirmation if askDeletion is true on preferences
src/gui/encoder.cs | 24 ++++++++++++++++++++++--
src/gui/genericWindow.cs | 9 ++++++---
2 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 927d823..62a5f43 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -821,7 +821,7 @@ public partial class ChronoJumpWindow
genericWin.Button_accept.Clicked += new EventHandler(on_encoder_show_curves_done);
genericWin.Button_row_edit.Clicked += new EventHandler(on_encoder_show_curves_row_edit);
genericWin.Button_row_edit_apply.Clicked += new
EventHandler(on_encoder_show_curves_row_edit_apply);
- genericWin.Button_row_delete.Clicked += new EventHandler(on_encoder_show_curves_row_delete);
+ genericWin.Button_row_delete.Clicked += new
EventHandler(on_encoder_show_curves_row_delete_pre);
//used when we don't need to read data,
//and we want to ensure next window will be created at needed size
@@ -908,6 +908,15 @@ public partial class ChronoJumpWindow
updateUserCurvesLabelsAndCombo();
}
+ protected void on_encoder_show_curves_row_delete_pre (object o, EventArgs args) {
+ if(askDeletion) {
+ ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString(
+ "Are you sure you want to delete this curve?"), "", "");
+ confirmWin.Button_accept.Clicked += new
EventHandler(on_encoder_show_curves_row_delete);
+ } else
+ on_encoder_show_curves_row_delete (o, args);
+ }
+
protected void on_encoder_show_curves_row_delete (object o, EventArgs args) {
Log.WriteLine("row delete at show curves");
@@ -921,6 +930,7 @@ public partial class ChronoJumpWindow
Sqlite.Delete(false, Constants.EncoderTable, Convert.ToInt32(uniqueID));
updateUserCurvesLabelsAndCombo();
}
+ genericWin.Delete_row_accepted();
}
@@ -1186,7 +1196,7 @@ public partial class ChronoJumpWindow
genericWin.Button_accept.Clicked += new EventHandler(on_encoder_load_signal_accepted);
genericWin.Button_row_edit.Clicked += new EventHandler(on_encoder_load_signal_row_edit);
genericWin.Button_row_edit_apply.Clicked += new
EventHandler(on_encoder_load_signal_row_edit_apply);
- genericWin.Button_row_delete.Clicked += new EventHandler(on_encoder_load_signal_row_delete);
+ genericWin.Button_row_delete.Clicked += new
EventHandler(on_encoder_load_signal_row_delete_pre);
genericWin.ShowNow();
}
@@ -1271,6 +1281,15 @@ public partial class ChronoJumpWindow
genericWin.ShowEditRow(false);
}
+ protected void on_encoder_load_signal_row_delete_pre (object o, EventArgs args) {
+ if(askDeletion) {
+ ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString(
+ "Are you sure you want to delete this signal?"), "", "");
+ confirmWin.Button_accept.Clicked += new
EventHandler(on_encoder_load_signal_row_delete);
+ } else
+ on_encoder_load_signal_row_delete (o, args);
+ }
+
protected void on_encoder_load_signal_row_delete (object o, EventArgs args) {
Log.WriteLine("row delete at load signal");
@@ -1290,6 +1309,7 @@ public partial class ChronoJumpWindow
//genericWin selected row is deleted, unsensitive the "load" button
genericWin.SetButtonAcceptSensitive(false);
}
+ genericWin.Delete_row_accepted();
}
void on_button_encoder_export_all_curves_clicked (object o, EventArgs args)
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index 52eac00..daf4106 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -670,13 +670,16 @@ Log.WriteLine("aaaaaaaaaaaaaaaa2");
}
private void on_delete_selected_clicked (object o, EventArgs args) {
- //remove selected row from treeview
- store = UtilGtk.RemoveRow(treeview, store);
-
//activate button to manage on gui/encoder.cs in order to delete from SQL
button_row_delete.Click();
}
+ //if confirmed deletion, this will be called
+ public void Delete_row_accepted() {
+ //remove selected row from treeview
+ store = UtilGtk.RemoveRow(treeview, store);
+ }
+
public void SetButtonAcceptLabel(string str) {
button_accept.Label=str;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]