[chronojump] quotation marks cannot be inserted on session window
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] quotation marks cannot be inserted on session window
- Date: Sun, 23 Jul 2017 18:03:11 +0000 (UTC)
commit 0f75016e9b8f10beada110c112ade2f333ee41c3
Author: Xavier de Blas <xaviblas gmail com>
Date: Sun Jul 23 20:02:10 2017 +0200
quotation marks cannot be inserted on session window
glade/session_add_edit.glade | 1 +
src/gui/session.cs | 35 +++++++++++++++++++++++++++++------
2 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/glade/session_add_edit.glade b/glade/session_add_edit.glade
index 81504f1..d5c7c7b 100644
--- a/glade/session_add_edit.glade
+++ b/glade/session_add_edit.glade
@@ -90,6 +90,7 @@
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
+ <signal name="changed" handler="on_entry_place_changed" swapped="no"/>
</widget>
<packing>
<property name="left_attach">1</property>
diff --git a/src/gui/session.cs b/src/gui/session.cs
index 6b352de..b414b6a 100644
--- a/src/gui/session.cs
+++ b/src/gui/session.cs
@@ -69,6 +69,7 @@ public class SessionAddEditWindow {
string [] levels;
bool addSession;
+ private bool textviewChanging = false;
private Session currentSession;
private Gtk.Button fakeButtonAccept;
@@ -121,7 +122,9 @@ public class SessionAddEditWindow {
//showSportStuffWithLoadedData();
}
-
+
+ textview.Buffer.Changed += new EventHandler(textviewChanged);
+ textviewChanging = false;
}
static public SessionAddEditWindow Show (Gtk.Window parent, Session currentSession)
@@ -189,10 +192,33 @@ public class SessionAddEditWindow {
}
- void on_entries_required_changed (object o, EventArgs args) {
+ void on_entries_required_changed (object o, EventArgs args)
+ {
+ entry_name.Text = Util.MakeValidSQL(entry_name.Text);
+
showHideButtonAccept();
}
-
+
+ private void on_entry_place_changed (object o, EventArgs args)
+ {
+ entry_place.Text = Util.MakeValidSQL(entry_place.Text);
+ }
+
+ private void textviewChanged(object o,EventArgs args)
+ {
+ if(textviewChanging)
+ return;
+
+ textviewChanging = true;
+
+ TextBuffer tb = o as TextBuffer;
+ if (o == null)
+ return;
+
+ tb.Text = Util.MakeValidSQL(tb.Text);
+ textviewChanging = false;
+ }
+
void showHideButtonAccept() {
if(entry_name.Text.ToString().Length > 0 &&
( ! (!radiobutton_diff_sports.Active &&
@@ -564,7 +590,6 @@ public class SessionAddEditWindow {
//check if name of session exists (is owned by other session),
//but all is ok if the name is the same as the old name (editing)
string name = Util.RemoveTildeAndColon(entry_name.Text);
- name = Util.RemoveChar(name, '"');
bool sessionNameExists = Sqlite.Exists (false, Constants.SessionTable, name);
if(sessionNameExists && name != currentSession.Name ) {
@@ -592,8 +617,6 @@ public class SessionAddEditWindow {
string place = Util.RemoveTildeAndColon(entry_place.Text);
string comments = Util.RemoveTildeAndColon(textview.Buffer.Text);
- place = Util.RemoveChar(place, '"');
- comments = Util.RemoveChar(comments, '"');
if(addSession)
currentSession = new Session (name, place,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]