[gnome-calendar] manager: remove get_event* methods
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] manager: remove get_event* methods
- Date: Thu, 4 Dec 2014 22:34:44 +0000 (UTC)
commit 65653d16b4e06c51f8ee6ccb342cb502d697f8ff
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Mon Oct 6 12:15:04 2014 -0400
manager: remove get_event* methods
Now those values are accesible from inside GcalEventWidget and
GcalEditDialog using its internals copies of ECalComponent of the event
they represent
src/gcal-manager.c | 368 ----------------------------------------------------
src/gcal-manager.h | 41 ------
2 files changed, 0 insertions(+), 409 deletions(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index e422ecb..9257174 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -942,374 +942,6 @@ gcal_manager_set_new_range (GcalManager *manager,
}
}
-icaltimetype*
-gcal_manager_get_event_start_date (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid)
-{
- GcalManagerPrivate *priv;
- GcalManagerUnit *unit;
- ECalComponent *event;
- ECalComponentDateTime dt;
- icaltimetype *dtstart;
-
- priv = gcal_manager_get_instance_private (manager);
-
- 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);
-
- if (dtstart->is_date != 1)
- *dtstart = icaltime_convert_to_zone (*(dt.value), priv->system_timezone);
-
- e_cal_component_free_datetime (&dt);
- return dtstart;
-}
-
-/**
- * gcal_manager_get_event_end_date:
- * @manager: a #GcalManager object
- * @source_uid: the uid of the #ESource
- * @event_uid: the uid of the #ECalComponent
- *
- * Get the date/time end of a calendar event
- *
- * Returns: (transfer full) An #icaltimetype object, free with g_free().
- **/
-icaltimetype*
-gcal_manager_get_event_end_date (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid)
-{
- GcalManagerPrivate *priv;
- GcalManagerUnit *unit;
- ECalComponent *event;
- ECalComponentDateTime dt;
- icaltimetype *dtend;
-
- priv = gcal_manager_get_instance_private (manager);
-
- unit = g_hash_table_lookup (priv->clients, source_uid);
- event = g_hash_table_lookup (unit->events, event_uid);
- e_cal_component_get_dtend (event, &dt);
- dtend = gcal_dup_icaltime (dt.value);
-
- if (dtend->is_date != 1)
- *dtend = icaltime_convert_to_zone (*(dt.value), priv->system_timezone);
-
- e_cal_component_free_datetime (&dt);
- return dtend;
-}
-
-/**
- * gcal_manager_get_event_summary:
- * @manager: a #GcalManager object
- * @source_uid: the uid of the #ESource
- * @event_uid: the uid of the #ECalComponent
- *
- * Returns the summary of a calendar event.
- *
- * Returns: (transfer full) a c-string to be freed with g_free()
- **/
-gchar*
-gcal_manager_get_event_summary (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid)
-{
- GcalManagerPrivate *priv;
- GcalManagerUnit *unit;
- ECalComponent *event;
- ECalComponentText e_summary;
- gchar *summary;
-
- priv = gcal_manager_get_instance_private (manager);
-
- unit = g_hash_table_lookup (priv->clients, source_uid);
- event = g_hash_table_lookup (unit->events, event_uid);
- e_cal_component_get_summary (event, &e_summary);
- summary = g_strdup (e_summary.value);
-
- return summary;
-}
-
-gchar**
-gcal_manager_get_event_organizer (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid)
-{
- GcalManagerPrivate *priv;
- GcalManagerUnit *unit;
- ECalComponent *event;
- ECalComponentOrganizer e_organizer;
- gchar** values;
-
- priv = gcal_manager_get_instance_private (manager);
-
- unit = g_hash_table_lookup (priv->clients, source_uid);
- event = g_hash_table_lookup (unit->events, event_uid);
- e_cal_component_get_organizer (event, &e_organizer);
-
- if (e_organizer.cn == NULL)
- return NULL;
-
- values = g_new (gchar*, 3);
- values[2] = NULL;
- values[0] = g_strdup (e_organizer.cn);
- values[1] = g_strdup (e_organizer.value);
-
- return values;
-}
-
-const gchar*
-gcal_manager_get_event_location (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid)
-{
- GcalManagerPrivate *priv;
- GcalManagerUnit *unit;
- ECalComponent *event;
- const gchar* location;
-
- priv = gcal_manager_get_instance_private (manager);
-
- unit = g_hash_table_lookup (priv->clients, source_uid);
- event = g_hash_table_lookup (unit->events, event_uid);
- e_cal_component_get_location (event, &location);
- return location;
-}
-
-gchar*
-gcal_manager_get_event_description (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid)
-{
- GcalManagerPrivate *priv;
- GcalManagerUnit *unit;
- ECalComponent *event;
- GSList *text_list;
- GSList *l;
-
- gchar *desc;
-
- priv = gcal_manager_get_instance_private (manager);
- desc = NULL;
-
- unit = g_hash_table_lookup (priv->clients, source_uid);
- event = g_hash_table_lookup (unit->events, event_uid);
- e_cal_component_get_description_list (event, &text_list);
-
- for (l = text_list; l != NULL; l = l->next)
- {
- if (l->data != NULL)
- {
- ECalComponentText *text;
- gchar *carrier;
- text = l->data;
-
- if (desc != NULL)
- {
- carrier = g_strconcat (desc, text->value, NULL);
- g_free (desc);
- desc = carrier;
- }
- else
- {
- desc = g_strdup (text->value);
- }
- }
- }
-
- e_cal_component_free_text_list (text_list);
- return desc;
-}
-
-GdkRGBA*
-gcal_manager_get_event_color (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid)
-{
- GcalManagerPrivate *priv;
- ESource *source;
- ESourceSelectable *extension;
- GdkRGBA *color;
-
- priv = gcal_manager_get_instance_private (manager);
- source = e_source_registry_ref_source (priv->source_registry,
- source_uid);
- color = NULL;
-
- if (source != NULL)
- {
- color = g_new0 (GdkRGBA, 1);
-
- extension =
- E_SOURCE_SELECTABLE (e_source_get_extension (source,
- E_SOURCE_EXTENSION_CALENDAR));
- gdk_rgba_parse (color, e_source_selectable_get_color (extension));
-
- g_object_unref (source);
- }
-
- return color;
-}
-
-GList*
-gcal_manager_get_event_reminders (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid)
-{
- GcalManagerPrivate *priv;
- GcalManagerUnit *unit;
- ECalComponent *event;
- GList *reminders;
-
- priv = gcal_manager_get_instance_private (manager);
- reminders = NULL;
-
- unit = g_hash_table_lookup (priv->clients, source_uid);
- event = g_hash_table_lookup (unit->events, event_uid);
-
- if (e_cal_component_has_alarms (event))
- {
- GList *alarms;
- GList *l;
-
- alarms = e_cal_component_get_alarm_uids (event);
- for (l = alarms; l != NULL; l = l->next)
- {
- gchar *type;
- gint number;
- gchar *time;
- ECalComponentAlarm *alarm;
- ECalComponentAlarmAction action;
- ECalComponentAlarmTrigger trigger;
-
- type = NULL;
- time = NULL;
- number = 0;
- alarm = e_cal_component_get_alarm (event, l->data);
-
- e_cal_component_alarm_get_action (alarm, &action);
- /* here, this are the tricky bits.
- * We assume a bunch of differents AlarmAction(s) as one:
- * "Notification". In case we need to add extra-refinemen. This is the
- * place to change stuff t*/
- if (action == E_CAL_COMPONENT_ALARM_AUDIO
- || action == E_CAL_COMPONENT_ALARM_DISPLAY)
- type = g_strdup (_("Notification"));
- else if (action == E_CAL_COMPONENT_ALARM_EMAIL)
- type = g_strdup (_("Email"));
-
- e_cal_component_alarm_get_trigger (alarm, &trigger);
- /* Second part of tricky bits. We will ignore triggers types other
- * than E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, and other than
- * before. In case of extra tweaking (almost sure it will be needed)
- * this is the place of doing it. */
- if (trigger.type == E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START)
- {
- /* cut/pasted/tweaking chunk of code from
- * evo:calendar/gui/e-alarm-list.c +435 */
- if (trigger.u.rel_duration.is_neg && trigger.u.rel_duration.days >= 1)
- {
- number = trigger.u.rel_duration.days;
- time = g_strdup (_("days"));
- }
-
- if (trigger.u.rel_duration.is_neg && trigger.u.rel_duration.weeks >= 1)
- {
- number = trigger.u.rel_duration.weeks;
- time = g_strdup (_("weeks"));
- }
-
- if (trigger.u.rel_duration.is_neg && trigger.u.rel_duration.hours >= 1)
- {
- number = trigger.u.rel_duration.hours;
- time = g_strdup (_("hours"));
- }
-
- if (trigger.u.rel_duration.is_neg && trigger.u.rel_duration.minutes >= 1)
- {
- number = trigger.u.rel_duration.minutes;
- time = g_strdup (_("minutes"));
- }
- }
-
- if (type != NULL && time != NULL)
- {
- gchar *one_reminder;
-
- one_reminder = g_strdup_printf ("%s %d %s %s",
- type,
- number,
- time,
- _("before"));
- reminders = g_list_prepend (reminders, one_reminder);
-
- g_free (type);
- g_free (time);
- }
-
- e_cal_component_alarm_free (alarm);
- }
- cal_obj_uid_list_free (alarms);
- }
-
- reminders = g_list_reverse (reminders);
- return reminders;
-}
-
-gboolean
-gcal_manager_has_event_reminders (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid)
-{
- GcalManagerPrivate *priv;
- GcalManagerUnit *unit;
- ECalComponent *event;
-
- priv = gcal_manager_get_instance_private (manager);
-
- unit = g_hash_table_lookup (priv->clients, source_uid);
- event = g_hash_table_lookup (unit->events, event_uid);
- return e_cal_component_has_alarms (event);
-}
-
-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;
-
- priv = gcal_manager_get_instance_private (manager);
-
- 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 0aa2b92..5eec487 100644
--- a/src/gcal-manager.h
+++ b/src/gcal-manager.h
@@ -85,47 +85,6 @@ void gcal_manager_set_new_range (GcalManager *manager
const icaltimetype *initial_date,
const icaltimetype *final_date);
-/* Get methods */
-icaltimetype* gcal_manager_get_event_start_date (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid);
-
-icaltimetype* gcal_manager_get_event_end_date (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid);
-
-gchar* gcal_manager_get_event_summary (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid);
-
-gchar** gcal_manager_get_event_organizer (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid);
-
-const gchar* gcal_manager_get_event_location (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid);
-
-gchar* gcal_manager_get_event_description (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid);
-
-GdkRGBA* gcal_manager_get_event_color (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid);
-
-GList* gcal_manager_get_event_reminders (GcalManager *manager,
- const gchar *source_uid,
- const gchar *event_uid);
-
-gboolean gcal_manager_has_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]