[chronojump] Session delete on main gui
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Session delete on main gui
- Date: Thu, 9 Apr 2020 09:38:43 +0000 (UTC)
commit c9b8afc6c967e8d340992d65139324b06d1aea6a
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Apr 9 11:38:16 2020 +0200
Session delete on main gui
glade/app1.glade | 383 +++++++++++++++++++++++++++++++++--
src/Makefile.am | 1 +
src/gui/app1/chronojump.cs | 26 ---
src/gui/app1/icons.cs | 2 -
src/gui/app1/sessionDelete.cs | 87 ++++++++
src/gui/app1/sessionLoadAndImport.cs | 3 +-
6 files changed, 452 insertions(+), 50 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index e6f7dbd2..b428767e 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -77,25 +77,6 @@
</child>
</widget>
</child>
- <child>
- <widget class="GtkImageMenuItem" id="menuitem_delete_session">
- <property name="label" translatable="yes">_Delete</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tooltip" translatable="yes">delete current session</property>
- <property name="use_underline">True</property>
- <property name="use_stock">False</property>
- <property name="always_show_image">True</property>
- <signal name="activate" handler="on_delete_session_activate" swapped="no"/>
- <child internal-child="image">
- <widget class="GtkImage" id="image_session_delete">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-missing-image</property>
- </widget>
- </child>
- </widget>
- </child>
<child>
<widget class="GtkSeparatorMenuItem" id="separador4">
<property name="visible">True</property>
@@ -35451,7 +35432,7 @@ then click this button.</property>
<property name="has_tooltip">True</property>
<property name="tooltip"
translatable="yes">Delete session</property>
<property name="relief">half</property>
- <signal name="clicked"
handler="on_delete_session_activate" swapped="no"/>
+ <signal name="clicked"
handler="on_app1s_delete_session_confirm_start" swapped="no"/>
<child>
<widget class="GtkEventBox"
id="eventbox_button_menu_session_delete">
<property name="visible">True</property>
@@ -35462,7 +35443,7 @@ then click this button.</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
<child>
- <widget class="GtkImage"
id="image_session_delete1">
+ <widget class="GtkImage"
id="image_session_delete">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-open</property>
@@ -37086,6 +37067,366 @@ then click this button.</property>
<property name="type">tab</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="hbox402">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkVBox" id="vbox195">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkVBox" id="vbox197">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">30</property>
+ <child>
+ <widget class="GtkFrame" id="frame16">
+ <property name="width_request">500</property>
+ <property name="height_request">400</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <widget class="GtkViewport" id="viewport10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">4</property>
+ <child>
+ <widget class="GtkVBox" id="vbox198">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">20</property>
+ <child>
+ <widget class="GtkVBox"
id="app1s_vbox_delete_question">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">16</property>
+ <child>
+ <widget class="GtkVBox" id="vbox200">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label487">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Are
you sure you want to delete the current session</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment49">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">30</property>
+ <child>
+ <widget class="GtkLabel"
id="app1s_label_delete_session_confirm_name">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="wrap">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox201">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label493">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">and
all the session tests?</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment50">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">30</property>
+ <child>
+ <widget class="GtkLabel"
id="app1s_label_import_file1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="wrap">True</property>
+ <property name="wrap_mode">char</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox199">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel"
id="app1s_label_delete_cannot">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Sorry,
this session cannot be modified.</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="app1s_label_delete_done">
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Deleted session and all its tests.</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVButtonBox"
id="app1s_vbuttonbox_delete_accept_cancel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">20</property>
+ <child>
+ <widget class="GtkButton"
id="app1s_button_delete_accept">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property
name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked"
handler="on_app1s_button_delete_accept_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="app1s_button_delete_cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property
name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked"
handler="on_app1s_button_delete_cancel_clicked" swapped="no"/>
+ <accelerator key="Escape" signal="clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox_session_more4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label495">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Session</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label496">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">/</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label497">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">More</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label498">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">/</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label499">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Delete</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">spread</property>
+ <child>
+ <widget class="GtkButton"
id="app1s_button_delete_close">
+ <property name="label">gtk-close</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property
name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked"
handler="on_app1s_button_delete_close_clicked" swapped="no"/>
+ <accelerator key="Escape" signal="clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label37">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">delete confirm</property>
+ </widget>
+ <packing>
+ <property name="position">5</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/Makefile.am b/src/Makefile.am
index 6afb9166..1658825a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,7 @@ SOURCES = \
gui/app1/forceSensor.cs\
gui/app1/forceSensorAnalyze.cs\
gui/app1/sessionLoadAndImport.cs\
+ gui/app1/sessionDelete.cs\
gui/app1/jump.cs\
gui/app1/menu.cs\
gui/app1/menu_tiny.cs\
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 1a4ed6ca..88513431 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -209,7 +209,6 @@ public partial class ChronoJumpWindow
//menu session
[Widget] Gtk.MenuItem menuitem_edit_session;
- [Widget] Gtk.MenuItem menuitem_delete_session;
[Widget] Gtk.MenuItem menuitem_export_csv;
[Widget] Gtk.Image image_session_open;
@@ -2562,31 +2561,6 @@ public partial class ChronoJumpWindow
chronojumpWindowTestsNext();
}
-
- private void on_delete_session_activate (object o, EventArgs args)
- {
- LogB.Information("--- delete session ---");
- //sessionAddEditWin.HideAndNull(); //delete session signal does not come now from
sessionAddEditWin
-
- if(currentSession.Name == Constants.SessionSimulatedName)
- new DialogMessage(Constants.MessageTypes.INFO, Constants.SessionProtectedStr());
- else {
- ConfirmWindow confirmWin = ConfirmWindow.Show(
- Catalog.GetString("Are you sure you want to delete the current
session") + "\n<b>" + currentSession.Name + "</b>",
- "", Catalog.GetString("and all the session tests?"));
- confirmWin.Button_accept.Clicked += new EventHandler(on_delete_session_accepted);
- }
- }
-
- private void on_delete_session_accepted (object o, EventArgs args)
- {
- string sessionUniqueID = currentSession.UniqueID.ToString ();
- closeSession ();
-
- SqliteSession.DeleteAllStuff(sessionUniqueID);
- new DialogMessage(Constants.MessageTypes.INFO, Catalog.GetString("Deleted session and all its
tests."));
- }
-
private void closeSession()
{
setApp1Title("", current_menuitem_mode);
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index 3d454fd0..998489ce 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -37,7 +37,6 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_session_new2;
[Widget] Gtk.Image image_session_edit;
[Widget] Gtk.Image image_session_delete;
- [Widget] Gtk.Image image_session_delete1;
[Widget] Gtk.Image image_session_preferences;
[Widget] Gtk.Image image_mode_encoder_capture;
[Widget] Gtk.Image image_current_person_zoom;
@@ -645,7 +644,6 @@ public partial class ChronoJumpWindow
image_run_type_delete_simple.Pixbuf = pixbuf;
image_run_type_delete_intervallic.Pixbuf = pixbuf;
image_session_delete.Pixbuf = pixbuf;
- image_session_delete1.Pixbuf = pixbuf;
image_encoder_exercise_delete.Pixbuf = pixbuf;
image_force_sensor_exercise_delete.Pixbuf = pixbuf;
image_run_encoder_exercise_delete.Pixbuf = pixbuf;
diff --git a/src/gui/app1/sessionDelete.cs b/src/gui/app1/sessionDelete.cs
new file mode 100644
index 00000000..51d9cd13
--- /dev/null
+++ b/src/gui/app1/sessionDelete.cs
@@ -0,0 +1,87 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump 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.
+ *
+ * ChronoJump 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2004-2020 Xavier de Blas <xaviblas gmail com>
+ */
+
+using System;
+using Gtk;
+using Glade;
+
+public partial class ChronoJumpWindow
+{
+ [Widget] Gtk.VBox app1s_vbox_delete_question;
+ [Widget] Gtk.Label app1s_label_delete_session_confirm_name;
+ [Widget] Gtk.VButtonBox app1s_vbuttonbox_delete_accept_cancel;
+ [Widget] Gtk.Label app1s_label_delete_cannot;
+ [Widget] Gtk.Label app1s_label_delete_done;
+ [Widget] Gtk.Button app1s_button_delete_close;
+
+ private void on_app1s_delete_session_confirm_start (object o, EventArgs args)
+ {
+ app1s_notebook.CurrentPage = app1s_PAGE_DELETE_CONFIRM;
+
+ app1s_vbox_delete_question.Visible = false;
+ app1s_label_delete_session_confirm_name.Visible = false;
+ app1s_vbuttonbox_delete_accept_cancel.Visible = false;
+
+ app1s_label_delete_cannot.Visible = false;
+ app1s_label_delete_done.Visible = false;
+
+ app1s_button_delete_close.Visible = false;
+
+ if(currentSession.Name == Constants.SessionSimulatedName)
+ {
+ app1s_label_delete_cannot.Visible = true;
+ app1s_button_delete_close.Visible = true;
+ }
+ else {
+ app1s_vbox_delete_question.Visible = true;
+
+ app1s_label_delete_session_confirm_name.Text = "<b>" + currentSession.Name + "</b>";
+ app1s_label_delete_session_confirm_name.UseMarkup = true;
+ app1s_label_delete_session_confirm_name.Visible = true;
+
+ app1s_vbuttonbox_delete_accept_cancel.Visible = true;
+ }
+ }
+
+ private void on_app1s_button_delete_accept_clicked (object o, EventArgs args)
+ {
+ string sessionUniqueID = currentSession.UniqueID.ToString ();
+ closeSession ();
+
+ SqliteSession.DeleteAllStuff(sessionUniqueID);
+
+ app1s_vbox_delete_question.Visible = false;
+ app1s_label_delete_session_confirm_name.Visible = false;
+ app1s_vbuttonbox_delete_accept_cancel.Visible = false;
+
+ app1s_label_delete_done.Visible = true;
+ app1s_button_delete_close.Visible = true;
+ }
+
+ private void on_app1s_button_delete_cancel_clicked (object o, EventArgs args)
+ {
+ app1s_notebook.CurrentPage = app1s_PAGE_MODES;
+ }
+
+ private void on_app1s_button_delete_close_clicked (object o, EventArgs args)
+ {
+ app1s_notebook.CurrentPage = app1s_PAGE_MODES;
+ }
+}
diff --git a/src/gui/app1/sessionLoadAndImport.cs b/src/gui/app1/sessionLoadAndImport.cs
index 2284c17c..7d39375d 100644
--- a/src/gui/app1/sessionLoadAndImport.cs
+++ b/src/gui/app1/sessionLoadAndImport.cs
@@ -104,6 +104,7 @@ public partial class ChronoJumpWindow
const int app1s_PAGE_SELECT_SESSION = 2; //for load session and for import
public const int app1s_PAGE_IMPORT_CONFIRM = 3;
public const int app1s_PAGE_IMPORT_RESULT = 4;
+ public const int app1s_PAGE_DELETE_CONFIRM = 5;
private void app1s_initializeGui()
{
@@ -573,7 +574,7 @@ public partial class ChronoJumpWindow
app1s_notebook.CurrentPage = app1s_PAGE_MODES;
reloadSession(); //explained at top of the file.
- //but now show persons, show menu:
+ //but after reloading session do not show persons, show menu:
radio_show_menu.Toggle();
radio_show_menu.Active = true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]