[gnome-calendar/wip/gbsneto/gdatetime: 11/13] utils: add datetime_is_date function
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/gbsneto/gdatetime: 11/13] utils: add datetime_is_date function
- Date: Mon, 4 Jan 2016 04:20:14 +0000 (UTC)
commit 372027cfc8b3ff5a4060299dbb102b6709f661e9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Jan 4 02:09:21 2016 -0200
utils: add datetime_is_date function
A helper function to substitute icaltimetype.is_date
field.
src/gcal-utils.c | 11 +++++++++++
src/gcal-utils.h | 2 ++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-utils.c b/src/gcal-utils.c
index 914ebca..94eb6e5 100644
--- a/src/gcal-utils.c
+++ b/src/gcal-utils.c
@@ -63,6 +63,17 @@ month_item[12] =
G_DEFINE_BOXED_TYPE (icaltimetype, icaltime, gcal_dup_icaltime, g_free)
+gboolean
+datetime_is_date (GDateTime *date)
+{
+ if (!date)
+ return FALSE;
+
+ return g_date_time_get_hour (date) == 0 &&
+ g_date_time_get_minute (date) == 0 &&
+ g_date_time_get_second (date) == 0;
+}
+
GDateTime*
icaltimetype_to_datetime (const icaltimetype *date)
{
diff --git a/src/gcal-utils.h b/src/gcal-utils.h
index 5c436e5..dc2dbcb 100644
--- a/src/gcal-utils.h
+++ b/src/gcal-utils.h
@@ -52,6 +52,8 @@ const gchar* (*GcalTranslateFunc) (GtkWidget
GType icaltime_get_type (void) G_GNUC_CONST;
+gboolean datetime_is_date (GDateTime *date);
+
GDateTime* icaltimetype_to_datetime (const icaltimetype *date);
icaltimetype* datetime_to_icaltimetype (GDateTime *date);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]