[chronojump] get last version on menu and on errorWin after a crash
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] get last version on menu and on errorWin after a crash
- Date: Tue, 28 Jul 2015 17:11:14 +0000 (UTC)
commit 50bdc91b103d32551838373be403c0cf9c4fbc70
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jul 28 19:10:19 2015 +0200
get last version on menu and on errorWin after a crash
glade/chronojump.glade | 84 +++++++++++++++++++++++++++++++++++++++++++++--
howto_compile.txt | 3 ++
howto_new_version.txt | 19 +++++++----
src/chronojump.cs | 1 +
src/gui/chronojump.cs | 11 ++----
src/gui/error.cs | 30 ++++++++++++++++-
src/json.cs | 25 +++++++++++++-
7 files changed, 151 insertions(+), 22 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index a2fcb7f..96378d1 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -404,6 +404,7 @@
</child>
<child>
<widget class="GtkMenuItem" id="menuitem_check_last_version">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Check last version</property>
<property name="use_underline">True</property>
@@ -7632,6 +7633,9 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
<child>
@@ -9019,6 +9023,9 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">2</property>
@@ -10047,6 +10054,9 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -21528,6 +21538,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -22455,6 +22468,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -23874,6 +23890,9 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -24350,6 +24369,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -28177,7 +28199,7 @@ to the center of the loads.</property>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">10</property>
+ <property name="spacing">12</property>
<child>
<widget class="GtkButton" id="button_send_log">
<property name="label">Send error log</property>
@@ -28193,6 +28215,21 @@ to the center of the loads.</property>
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <widget class="GtkButton" id="button_check_last_version">
+ <property name="label">Check last version</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <signal name="clicked" handler="on_button_check_last_version_clicked"
swapped="no"/>
+ </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>
@@ -35691,6 +35728,24 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -37362,6 +37417,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -38735,9 +38802,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<placeholder/>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel" id="label218">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -39664,6 +39728,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -43378,6 +43445,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -43969,6 +44039,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -44575,6 +44648,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/howto_compile.txt b/howto_compile.txt
index 848f296..03f561f 100644
--- a/howto_compile.txt
+++ b/howto_compile.txt
@@ -51,6 +51,9 @@ packaging (outside the shell): (will fetch chronojump sources from git)
cerbero-cj buildone chronojump
cerbero-cj package chronojump
+#if there are problems on hdiuti do:
+hdiutil create -size 200m ...
+
#if hard disk it's busy, reset MacOSX, and free space:
#if on packaging says: "diskimages-helper: DI_kextDriveDisconnect returned 268435459 ((ipc/send) invalid
destination port).", free space:
diff --git a/howto_new_version.txt b/howto_new_version.txt
index f6e774c..d89f377 100644
--- a/howto_new_version.txt
+++ b/howto_new_version.txt
@@ -104,16 +104,13 @@ chmod +rx Chrono...exe
signal-ftp-sync
wait 5'
-server stuff
-------------
-ssh to chronojump server, sqlite-3 chronojump_server.db
-update preferences set value="0.9.3.0" where name="versionAvailable";
-
-API:
+API (GetLastVersion)
+--------------------
ssh to chronojump server
+su
vi /etc/chronojump.conf
-Update: chronojump_stable_version
+Update: chronojump_stable_version (4 numbers, eg. 1.4.9.0)
/etc/init.d/gunicorn restart
verify:
@@ -130,3 +127,11 @@ twitters again with photos, changes, ...
other stuff
-----------
Update manual/s to chronojump site if changed
+
+_____________ OLD _____________
+
+server stuff
+------------
+ssh to chronojump server, sqlite-3 chronojump_server.db
+update preferences set value="0.9.3.0" where name="versionAvailable";
+
diff --git a/src/chronojump.cs b/src/chronojump.cs
index 9543780..dff68f3 100644
--- a/src/chronojump.cs
+++ b/src/chronojump.cs
@@ -535,6 +535,7 @@ public class ChronoJump
} else {
errorWin = ErrorWindow.Show(messageToShowOnBoot);
errorWin.Show_send_log();
+ errorWin.ProgVersion = progVersion;
errorWin.Button_accept_label(Catalog.GetString("Open Chronojump"));
errorWin.Button_accept.Clicked += new
EventHandler(on_message_boot_accepted_continue);
}
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 7b5e20a..1d4cadc 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -6163,14 +6163,15 @@ LogB.Debug("X");
private void on_menuitem_check_last_version_activate (object o, EventArgs args) {
Json js = new Json();
- bool success = js.GetLastVersion();
+ bool success = js.GetLastVersion(progVersion);
if(success) {
LogB.Information(js.ResultMessage);
new DialogMessage(
"Chronojump",
Constants.MessageTypes.INFO,
- js.ResultMessage);
+ js.ResultMessage
+ );
}
else {
LogB.Error(js.ResultMessage);
@@ -6179,12 +6180,6 @@ LogB.Debug("X");
Constants.MessageTypes.WARNING,
js.ResultMessage);
}
- /*
- new DialogMessage(
- "Chronojump",
- Constants.MessageTypes.INFO,
- "Temporarily Disabled");
- */
}
private void on_menuitem_ping_activate (object o, EventArgs args) {
diff --git a/src/gui/error.cs b/src/gui/error.cs
index b44864d..09ba2ca 100644
--- a/src/gui/error.cs
+++ b/src/gui/error.cs
@@ -43,9 +43,11 @@ public class ErrorWindow
[Widget] Gtk.TextView textview_comments;
[Widget] Gtk.Button button_send_log;
[Widget] Gtk.Label label_send_log_message;
+
string table;
static ErrorWindow ErrorWindowBox;
+ string progVersion = "";
public ErrorWindow (string text1)
{
@@ -134,6 +136,28 @@ public class ErrorWindow
label_send_log_message.Text = js.ResultMessage;
}
+
+ private void on_button_check_last_version_clicked (object o, EventArgs args)
+ {
+ Json js = new Json();
+ bool success = js.GetLastVersion(progVersion);
+
+ if(success) {
+ LogB.Information(js.ResultMessage);
+ new DialogMessage(
+ "Chronojump",
+ Constants.MessageTypes.INFO,
+ js.ResultMessage
+ );
+ }
+ else {
+ LogB.Error(js.ResultMessage);
+ new DialogMessage(
+ "Chronojump",
+ Constants.MessageTypes.WARNING,
+ js.ResultMessage);
+ }
+ }
public void Show_button_open_database_folder () {
button_open_database_folder.Show();
@@ -193,7 +217,11 @@ public class ErrorWindow
public Button Button_abort {
get { return button_abort; }
- }
+ }
+
+ public string ProgVersion {
+ set { progVersion = value; }
+ }
public void HideAndNull() {
ErrorWindowBox.error_window.Hide();
diff --git a/src/json.cs b/src/json.cs
index 4bb0ad7..6ab3fa9 100644
--- a/src/json.cs
+++ b/src/json.cs
@@ -132,7 +132,8 @@ public class Json
}
- public bool GetLastVersion()
+ //public bool ChronojumpUpdated = true;
+ public bool GetLastVersion(string currentVersion)
{
// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create (serverUrl + "/version");
@@ -159,7 +160,27 @@ public class Json
{
responseFromServer = sr.ReadToEnd();
}
- this.ResultMessage = "Last version published: " + responseFromServer;
+
+ //this prints:
+ // {"stable": "1.4.9"}
+ //this.ResultMessage = "Last version published: " + responseFromServer;
+
+ string [] strFull = responseFromServer.Split(new char[] {':'});
+ int startPos = strFull[1].IndexOf('"') +1;
+ int endPos = strFull[1].LastIndexOf('"') -2;
+
+ string lastVersionPublished = strFull[1].Substring(startPos,endPos); //1.4.9
+
+ string updateStr = "";
+ if(currentVersion != lastVersionPublished)
+ updateStr = "\n\n" + Catalog.GetString("Update software at ") + "www.chronojump.org";
+
+ this.ResultMessage =
+ Catalog.GetString("Installed version is: ") + currentVersion + "\n" +
+ Catalog.GetString("Last version published: ") + lastVersionPublished +
+ updateStr;
+
+ //ChronojumpUpdated = (currentVersion == ResultMessage);
return true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]