[chronojump] More SQL testing: GCCollect and NeverClose. TODO: fix this before release
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] More SQL testing: GCCollect and NeverClose. TODO: fix this before release
- Date: Wed, 11 Jan 2017 19:33:17 +0000 (UTC)
commit 345354ce586353ca8c8c86ed6259a270c8766c23
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jan 11 20:32:40 2017 +0100
More SQL testing: GCCollect and NeverClose. TODO: fix this before release
glade/preferences_win.glade | 40 ++++++++++++++++++++++++++++++++++++++++
src/gui/preferences.cs | 24 ++++++++++++++++++++++++
src/sqlite/main.cs | 9 ++++++++-
3 files changed, 72 insertions(+), 1 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index 67cb059..29874ed 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -3140,6 +3140,46 @@ Other</property>
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="hbox22">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkToggleButton" id="toggle_gc_collect_on_close">
+ <property name="label">GCCollect</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="toggled"
handler="on_toggle_gc_collect_on_close_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkToggleButton" id="toggle_never_close">
+ <property name="label"> Disco After</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip">Never close</property>
+ <signal name="toggled" handler="on_toggle_never_close_toggled"
swapped="no"/>
+ </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">3</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 41bfac8..5ac5091 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -134,6 +134,8 @@ public class PreferencesWindow {
[Widget] Gtk.RadioButton radio_export_latin;
[Widget] Gtk.RadioButton radio_export_non_latin;
[Widget] Gtk.Label label_advanced_feedback;
+ [Widget] Gtk.ToggleButton toggle_gc_collect_on_close;
+ [Widget] Gtk.ToggleButton toggle_never_close;
[Widget] Gtk.Button button_accept;
@@ -855,6 +857,28 @@ public class PreferencesWindow {
label_advanced_feedback.Text = "Debug mode on while Chronojump is running.";
}
+ private void on_toggle_gc_collect_on_close_toggled(object o, EventArgs args)
+ {
+ if(toggle_gc_collect_on_close.Active) {
+ Sqlite.GCCollect = true;
+ new DialogMessage(Constants.MessageTypes.INFO, "GCCollect: ACTIVE!");
+ } else {
+ Sqlite.GCCollect = false;
+ new DialogMessage(Constants.MessageTypes.INFO, "GCCollect: UNACTIVE! (default)");
+ }
+ }
+
+ private void on_toggle_never_close_toggled(object o, EventArgs args)
+ {
+ if(toggle_never_close.Active) {
+ Sqlite.NeverCloseDB = true;
+ new DialogMessage(Constants.MessageTypes.INFO, "Never close: ACTIVE!");
+ } else {
+ Sqlite.NeverCloseDB = false;
+ new DialogMessage(Constants.MessageTypes.INFO, "Never close: UNACTIVE! (default)");
+ }
+ }
+
private bool PulseGTK ()
{
if ( ! thread.IsAlive ) {
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 52cb816..38eba7e 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -115,6 +115,8 @@ class Sqlite
public static bool IsOpened = false;
public static bool SafeClose = true;
+ public static bool GCCollect = false; //Experimental
+ public static bool NeverCloseDB = false; //Experimental
// Here it saves the initial class state before it's used. So we can restore it any time
// if needed
@@ -176,6 +178,9 @@ class Sqlite
}
public static void Close()
{
+ if(NeverCloseDB)
+ return;
+
LogB.SQLoff();
if(SafeClose) {
@@ -185,7 +190,9 @@ class Sqlite
dbcon.Close();
if(SafeClose) {
- //GC.Collect(); don't need and very slow
+ if(GCCollect)
+ GC.Collect(); //don't need and very slow
+
dbcmd = dbcon.CreateCommand();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]