[gnome-calendar] Added method for faking ::events-added signal.



commit ade7c97aeddf23e85d916551a92b1f7df648a5eb
Author: Erick PÃrez Castellanos <erick red gmail com>
Date:   Sat Jul 7 23:00:31 2012 -0400

    Added method for faking ::events-added signal.
    
    Added a method for sending a fake signal to newly created that don't cause an
    update of the timespan covered by the actual query of GcalManager.
    Added get_event_all_day method for find out if and event is all-day.

 src/gcal-manager.c |   36 ++++++++++++++++++++++++++++++++++++
 src/gcal-manager.h |    4 ++++
 2 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index 29bdea3..85128df 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -1316,6 +1316,42 @@ gcal_manager_get_event_reminders (GcalManager *manager,
   return reminders;
 }
 
+gboolean
+gcal_manager_get_event_all_day (GcalManager *manager,
+                                const gchar *source_uid,
+                                const gchar *event_uid)
+{
+  GcalManagerPrivate *priv;
+  GcalManagerUnit *unit;
+  ECalComponent *event;
+
+  ECalComponentDateTime dt;
+  icaltimetype *dtstart;
+  icaltimetype *dtend;
+
+  gboolean all_day;
+
+  g_return_val_if_fail (GCAL_IS_MANAGER (manager), FALSE);
+  priv = manager->priv;
+
+  unit = g_hash_table_lookup (priv->clients, source_uid);
+  event = g_hash_table_lookup (unit->events, event_uid);
+
+  e_cal_component_get_dtstart (event, &dt);
+  dtstart = gcal_dup_icaltime (dt.value);
+  e_cal_component_free_datetime (&dt);
+
+  e_cal_component_get_dtend (event, &dt);
+  dtend = gcal_dup_icaltime (dt.value);
+  e_cal_component_free_datetime (&dt);
+
+  all_day = (dtstart->is_date == 1) && (dtend->is_date == 1);
+
+  g_free (dtstart);
+  g_free (dtend);
+  return all_day;
+}
+
 void
 gcal_manager_remove_event (GcalManager *manager,
                            const gchar *source_uid,
diff --git a/src/gcal-manager.h b/src/gcal-manager.h
index 7b73683..721af4b 100644
--- a/src/gcal-manager.h
+++ b/src/gcal-manager.h
@@ -112,6 +112,10 @@ GList*         gcal_manager_get_event_reminders     (GcalManager        *manager
                                                      const gchar        *source_uid,
                                                      const gchar        *event_uid);
 
+gboolean       gcal_manager_get_event_all_day       (GcalManager        *manager,
+                                                     const gchar        *source_uid,
+                                                     const gchar        *event_uid);
+
 void           gcal_manager_remove_event            (GcalManager        *manager,
                                                      const gchar        *source_uid,
                                                      const gchar        *event_uid);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]