[gnome-games] libgames-support: Add games_clock_is_started()
- From: Christian Persch <chpe src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games] libgames-support: Add games_clock_is_started()
- Date: Sun, 12 Jul 2009 19:21:32 +0000 (UTC)
commit 2828dd840ffcfe523338c3b1927ada547bea8dbe
Author: Christian Persch <chpe gnome org>
Date: Sun Jul 12 21:16:56 2009 +0200
libgames-support: Add games_clock_is_started()
libgames-support/games-clock.c | 15 +++++++++++++++
libgames-support/games-clock.h | 3 +--
2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/libgames-support/games-clock.c b/libgames-support/games-clock.c
index 66e3389..4cc9f74 100644
--- a/libgames-support/games-clock.c
+++ b/libgames-support/games-clock.c
@@ -116,12 +116,27 @@ games_clock_start (GamesClock *clock_widget)
g_return_if_fail (GAMES_IS_CLOCK (clock_widget));
clock_widget->started = TRUE;
+ clock_widget->start_time = time (NULL) - (clock_widget->stop_time - clock_widget->start_time);
if (clock_widget->update)
games_clock_start_timer (clock_widget);
}
/**
+ * games_clock_is_started:
+ * @clock_widget:
+ *
+ * Returns: whether @clock_widget is running
+ */
+gboolean
+games_clock_is_started (GamesClock *clock_widget)
+{
+ g_return_val_if_fail (GAMES_IS_CLOCK (clock_widget), FALSE);
+
+ return clock_widget->started;
+}
+
+/**
* games_clock_stop:
* @clock_widget:
*
diff --git a/libgames-support/games-clock.h b/libgames-support/games-clock.h
index 1191bda..0db21c6 100644
--- a/libgames-support/games-clock.h
+++ b/libgames-support/games-clock.h
@@ -38,11 +38,10 @@ typedef GtkLabelClass GamesClockClass;
GType games_clock_get_type (void);
GtkWidget *games_clock_new (void);
void games_clock_start (GamesClock *clock_widget);
+gboolean games_clock_is_started (GamesClock *clock_widget);
void games_clock_stop (GamesClock *clock_widget);
void games_clock_reset (GamesClock *clock_widget);
time_t games_clock_get_seconds (GamesClock *clock_widget);
-void games_clock_set_seconds (GamesClock *clock_widget,
- time_t seconds);
void games_clock_add_seconds (GamesClock *clock_widget,
time_t seconds);
void games_clock_set_update (GamesClock *clock_widget,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]