[Xfce4-commits] <midori:master> Guard Glib.format_size against HAVE_GLIB_2_30
Christian Dywan
noreply at xfce.org
Mon Sep 24 21:42:01 CEST 2012
Updating branch refs/heads/master
to 9111111223fbb9b1f41b34cf8a23c4276b237e29 (commit)
from 0b0deabfae9aebe46dc829a52736709cf5a1afcd (commit)
commit 9111111223fbb9b1f41b34cf8a23c4276b237e29
Author: Christian Dywan <christian at twotoasts.de>
Date: Mon Sep 24 21:40:47 2012 +0200
Guard Glib.format_size against HAVE_GLIB_2_30
midori/midori-download.vala | 7 +++++--
wscript | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/midori/midori-download.vala b/midori/midori-download.vala
index 75a7ea3..cc8c539 100644
--- a/midori/midori-download.vala
+++ b/midori/midori-download.vala
@@ -65,7 +65,6 @@ namespace Midori {
string minutes_ = ngettext ("%d minute", "%d minutes", minutes).printf (minutes);
string seconds_ = ngettext ("%d second", "%d seconds", seconds).printf (seconds);
double last_time = download.get_data<int> ("last-time");
- uint64 last_size = download.get_data<uint64> ("last-size");
string eta = "";
if (estimated > 0) {
@@ -82,7 +81,9 @@ namespace Midori {
eta = _(" - %s remaining").printf (eta);
}
- string speed;
+ string speed = "";
+#if HAVE_GLIB_2_30
+ uint64 last_size = download.get_data<uint64> ("last-size");
if (elapsed != last_time) {
speed = format_size ((uint64)(
(current_size - last_size) / (elapsed - last_time)));
@@ -92,6 +93,8 @@ namespace Midori {
speed = _("?B");
/* i18n: Download tooltip (transfer rate): (130KB/s) */
speed = _(" (%s/s)").printf (speed);
+#endif
+
if (elapsed - last_time > 5.0) {
download.set_data<int> ("last-time", (int)elapsed);
download.set_data<uint64> ("last-size", current_size);
diff --git a/wscript b/wscript
index 0699b74..963d11f 100644
--- a/wscript
+++ b/wscript
@@ -242,6 +242,8 @@ def configure (conf):
check_pkg ('gmodule-2.0', '2.8.0', False)
check_pkg ('gthread-2.0', '2.8.0', False)
check_pkg ('gio-2.0', '2.22.0')
+ if check_version (conf.check_cfg (modversion='gio-2.0'), 2, 30, 0):
+ conf.env.append_value ('VALAFLAGS', '-D HAVE_GLIB_2_30')
args = ''
if Options.platform == 'win32':
args = '--define-variable=target=win32'
More information about the Xfce4-commits
mailing list