diff options
author | JP Rosevear <jpr@ximian.com> | 2001-10-10 02:37:53 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-10-10 02:37:53 +0800 |
commit | 4186cba8a65447ae5b93b43070eb290ee0762ff2 (patch) | |
tree | 7d4810e20102c8097522fefe18e4ad470bf1c1f8 /calendar/cal-util | |
parent | 78a2327d01e6536506a58ac43191dc50486ef95d (diff) | |
download | gsoc2013-evolution-4186cba8a65447ae5b93b43070eb290ee0762ff2.tar.gz gsoc2013-evolution-4186cba8a65447ae5b93b43070eb290ee0762ff2.tar.zst gsoc2013-evolution-4186cba8a65447ae5b93b43070eb290ee0762ff2.zip |
util function to get address (itip_addresses_get_default): get only the
2001-10-09 JP Rosevear <jpr@ximian.com>
* gui/itip-utils.c (get_address): util function to get address
(itip_addresses_get_default): get only the default address
(itip_address_free): free single address
(itip_addresses_free): use above
(comp_limit_attendees): limit the number of attendees to one, the
user
(comp_sentby): set the sentby parameter if the user is not the
organizer
(comp_minimal): remove extraneous info for send (for refresh and
declinecounter)
(comp_compliant): remove all alarms, do various things to make the
components comply with itip spec based on method
(itip_send_comp): use comp_compliant method
* gui/itip-utils.h: new protos
* gui/e-itip-control.c: rescan the component when necessary
(get_next): don't get stuck in infinite loop if there are no
viewable components
(e_itip_control_set_data): if there are no viewable components,
spit an error message
* gui/dialogs/meeting-page.h: tidy
* gui/dialogs/meeting-page.c (meeting_page_fill_widgets): use
organizer's cn if possible
(other_clicked_cb): no longer doing the sent by stuff directly,
hide more widgets
* pcs/query.c: use bonobo exception stuff
* cal-util/cal-component.c (cal_component_rescan): have the comp
rescan its libical component (for when you change things directly)
(free_icalcomponent): take a param on whether to free the
component or just clean up the mappings
(cal_component_has_attendees): util function
* cal-util/cal-component.h: new protos
svn path=/trunk/; revision=13525
Diffstat (limited to 'calendar/cal-util')
-rw-r--r-- | calendar/cal-util/cal-component.c | 51 | ||||
-rw-r--r-- | calendar/cal-util/cal-component.h | 3 |
2 files changed, 46 insertions, 8 deletions
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c index b4784c6124..0d58d41017 100644 --- a/calendar/cal-util/cal-component.c +++ b/calendar/cal-util/cal-component.c @@ -262,7 +262,7 @@ free_alarm_cb (gpointer key, gpointer value, gpointer data) * does, it means we don't own it and we shouldn't free it. */ static void -free_icalcomponent (CalComponent *comp) +free_icalcomponent (CalComponent *comp, gboolean free) { CalComponentPrivate *priv; @@ -273,11 +273,11 @@ free_icalcomponent (CalComponent *comp) /* Free the icalcomponent */ - if (icalcomponent_get_parent (priv->icalcomp) == NULL) + if (free && icalcomponent_get_parent (priv->icalcomp) == NULL) { icalcomponent_free (priv->icalcomp); - - priv->icalcomp = NULL; - + priv->icalcomp = NULL; + } + /* Free the mappings */ priv->uid = NULL; @@ -350,7 +350,7 @@ cal_component_destroy (GtkObject *object) comp = CAL_COMPONENT (object); priv = comp->priv; - free_icalcomponent (comp); + free_icalcomponent (comp, TRUE); g_hash_table_destroy (priv->alarm_uid_hash); priv->alarm_uid_hash = NULL; @@ -919,7 +919,7 @@ cal_component_set_new_vtype (CalComponent *comp, CalComponentVType type) priv = comp->priv; - free_icalcomponent (comp); + free_icalcomponent (comp, TRUE); if (type == CAL_COMPONENT_NO_TYPE) return; @@ -997,7 +997,7 @@ cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp) if (priv->icalcomp == icalcomp) return TRUE; - free_icalcomponent (comp); + free_icalcomponent (comp, TRUE); if (!icalcomp) { priv->icalcomp = NULL; @@ -1045,6 +1045,25 @@ cal_component_get_icalcomponent (CalComponent *comp) return priv->icalcomp; } +void +cal_component_rescan (CalComponent *comp) +{ + CalComponentPrivate *priv; + + g_return_if_fail (comp != NULL); + g_return_if_fail (IS_CAL_COMPONENT (comp)); + + priv = comp->priv; + + /* Clear everything out */ + free_icalcomponent (comp, FALSE); + g_hash_table_destroy (priv->alarm_uid_hash); + priv->alarm_uid_hash = NULL; + + scan_icalcomponent (comp); + ensure_mandatory_properties (comp); +} + /** * cal_component_get_vtype: * @comp: A calendar component object. @@ -3749,6 +3768,22 @@ cal_component_set_attendee_list (CalComponent *comp, GSList *attendee_list) set_attendee_list (comp, &priv->attendee_list, attendee_list); } +gboolean +cal_component_has_attendees (CalComponent *comp) +{ + CalComponentPrivate *priv; + + g_return_val_if_fail (comp != NULL, FALSE); + g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); + + priv = comp->priv; + + if (g_slist_length (priv->attendee_list) > 0) + return TRUE; + + return FALSE; +} + diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h index 801cdc51f0..b8bd010b63 100644 --- a/calendar/cal-util/cal-component.h +++ b/calendar/cal-util/cal-component.h @@ -206,6 +206,7 @@ void cal_component_set_new_vtype (CalComponent *comp, CalComponentVType type); gboolean cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp); icalcomponent *cal_component_get_icalcomponent (CalComponent *comp); +void cal_component_rescan (CalComponent *comp); CalComponentVType cal_component_get_vtype (CalComponent *comp); @@ -270,6 +271,7 @@ void cal_component_set_last_modified (CalComponent *comp, struct icaltimetype *t void cal_component_get_organizer (CalComponent *comp, CalComponentOrganizer *organizer); void cal_component_set_organizer (CalComponent *comp, CalComponentOrganizer *organizer); +gboolean cal_component_has_organizer (CalComponent *comp); void cal_component_get_percent (CalComponent *comp, int **percent); void cal_component_set_percent (CalComponent *comp, int *percent); @@ -308,6 +310,7 @@ void cal_component_set_url (CalComponent *comp, const char *url); void cal_component_get_attendee_list (CalComponent *comp, GSList **attendee_list); void cal_component_set_attendee_list (CalComponent *comp, GSList *attendee_list); +gboolean cal_component_has_attendees (CalComponent *comp); gboolean cal_component_event_dates_match (CalComponent *comp1, CalComponent *comp2); |