[gnome-games] libgames-support: Make GamesClock work with multiple calls to start()
- From: Christian Persch <chpe src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games] libgames-support: Make GamesClock work with multiple calls to start()
- Date: Sun, 19 Jul 2009 20:05:05 +0000 (UTC)
commit 50bf21f250663e25bf04035ba0a02e8087d99fa1
Author: Christian Persch <chpe gnome org>
Date: Sat Jul 18 21:19:20 2009 +0200
libgames-support: Make GamesClock work with multiple calls to start()
When calling start() on a running clock, don't do anything. Should fix bug #588920.
libgames-support/games-clock.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/libgames-support/games-clock.c b/libgames-support/games-clock.c
index 4cc9f74..b982c79 100644
--- a/libgames-support/games-clock.c
+++ b/libgames-support/games-clock.c
@@ -115,6 +115,9 @@ games_clock_start (GamesClock *clock_widget)
{
g_return_if_fail (GAMES_IS_CLOCK (clock_widget));
+ if (clock_widget->started)
+ return; /* nothing to do */
+
clock_widget->started = TRUE;
clock_widget->start_time = time (NULL) - (clock_widget->stop_time - clock_widget->start_time);
@@ -148,6 +151,9 @@ games_clock_stop (GamesClock *clock_widget)
{
g_return_if_fail (GAMES_IS_CLOCK (clock_widget));
+ if (!clock_widget->started)
+ return;
+
clock_widget->started = FALSE;
clock_widget->stop_time = time (NULL);
@@ -201,8 +207,10 @@ games_clock_add_seconds (GamesClock *clock_widget,
{
g_return_if_fail (GAMES_IS_CLOCK (clock_widget));
- if (!clock_widget->started)
+ if (!clock_widget->started) {
g_warning ("Clock not started, cannot add seconds!\n");
+ return;
+ }
clock_widget->start_time -= seconds;
clock_paint (clock_widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]