~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to calendar/libecal/e-cal-component.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#define getppid() 0
35
35
#endif
36
36
 
 
37
G_DEFINE_TYPE (ECalComponent, e_cal_component, G_TYPE_OBJECT)
 
38
 
37
39
/* Extension property for alarm components so that we can reference them by UID */
38
40
#define EVOLUTION_ALARM_UID_PROPERTY "X-EVOLUTION-ALARM-UID"
39
41
 
190
192
 
191
193
 
192
194
 
193
 
static void e_cal_component_class_init (ECalComponentClass *klass);
194
 
static void e_cal_component_init (ECalComponent *comp, ECalComponentClass *klass);
195
195
static void e_cal_component_finalize (GObject *object);
196
196
 
197
197
static GObjectClass *parent_class;
198
198
 
199
199
 
200
200
 
201
 
/**
202
 
 * e_cal_component_get_type:
203
 
 *
204
 
 * Registers the #ECalComponent class if necessary, and returns the type ID
205
 
 * associated to it.
206
 
 *
207
 
 * Return value: The type ID of the #ECalComponent class.
208
 
 **/
209
 
GType
210
 
e_cal_component_get_type (void)
211
 
{
212
 
        static GType e_cal_component_type = 0;
213
 
 
214
 
        if (!e_cal_component_type) {
215
 
                static GTypeInfo info = {
216
 
                        sizeof (ECalComponentClass),
217
 
                        (GBaseInitFunc) NULL,
218
 
                        (GBaseFinalizeFunc) NULL,
219
 
                        (GClassInitFunc) e_cal_component_class_init,
220
 
                        NULL, NULL,
221
 
                        sizeof (ECalComponent),
222
 
                        0,
223
 
                        (GInstanceInitFunc) e_cal_component_init
224
 
                };
225
 
                e_cal_component_type = g_type_register_static (G_TYPE_OBJECT, "ECalComponent", &info, 0);
226
 
        }
227
 
 
228
 
        return e_cal_component_type;
229
 
}
230
 
 
231
201
/* Class initialization function for the calendar component object */
232
202
static void
233
203
e_cal_component_class_init (ECalComponentClass *klass)
243
213
 
244
214
/* Object initialization function for the calendar component object */
245
215
static void
246
 
e_cal_component_init (ECalComponent *comp, ECalComponentClass *klass)
 
216
e_cal_component_init (ECalComponent *comp)
247
217
{
248
218
        ECalComponentPrivate *priv;
249
219
 
409
379
 *
410
380
 * Generates a unique identifier suitable for calendar components.
411
381
 *
412
 
 * Return value: A unique identifier string.  Every time this function is called
 
382
 * Returns: A unique identifier string.  Every time this function is called
413
383
 * a different string is returned.
414
384
 **/
415
385
gchar *
454
424
 * existing #icalcomponent structure by using e_cal_component_set_icalcomponent() or with a
455
425
 * new empty component type by using e_cal_component_set_new_vtype().
456
426
 *
457
 
 * Return value: A newly-created calendar component object.
 
427
 * Returns: A newly-created calendar component object.
458
428
 **/
459
429
ECalComponent *
460
430
e_cal_component_new (void)
468
438
 *
469
439
 * Creates a new calendar component object from the given iCalendar string.
470
440
 *
471
 
 * Return value: A calendar component representing the given iCalendar string on
 
441
 * Returns: A calendar component representing the given iCalendar string on
472
442
 * success, NULL if there was an error.
473
443
 **/
474
444
ECalComponent *
501
471
 * Creates a new calendar component object by copying the information from
502
472
 * another one.
503
473
 *
504
 
 * Return value: A newly-created calendar component with the same values as the
 
474
 * Returns: A newly-created calendar component with the same values as the
505
475
 * original one.
506
476
 **/
507
477
ECalComponent *
569
539
static void
570
540
scan_datetime (ECalComponent *comp, struct datetime *datetime, icalproperty *prop)
571
541
{
572
 
        ECalComponentPrivate *priv;
573
 
 
574
 
        priv = comp->priv;
575
 
 
576
542
        datetime->prop = prop;
577
543
        datetime->tzid_param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER);
578
544
}
1081
1047
 *
1082
1048
 * Supported component types are VEVENT, VTODO, VJOURNAL, VFREEBUSY, and VTIMEZONE.
1083
1049
 *
1084
 
 * Return value: TRUE on success, FALSE if @icalcomp is an unsupported component
 
1050
 * Returns: TRUE on success, FALSE if @icalcomp is an unsupported component
1085
1051
 * type.
1086
1052
 **/
1087
1053
gboolean
1129
1095
 * Queries the #icalcomponent structure that a calendar component object is
1130
1096
 * wrapping.
1131
1097
 *
1132
 
 * Return value: An #icalcomponent structure, or NULL if the @comp has no
 
1098
 * Returns: An #icalcomponent structure, or NULL if the @comp has no
1133
1099
 * #icalcomponent set to it.
1134
1100
 **/
1135
1101
icalcomponent *
1197
1163
 *
1198
1164
 * Queries the type of a calendar component object.
1199
1165
 *
1200
 
 * Return value: The type of the component, as defined by RFC 2445.
 
1166
 * Returns: The type of the component, as defined by RFC 2445.
1201
1167
 **/
1202
1168
ECalComponentVType
1203
1169
e_cal_component_get_vtype (ECalComponent *comp)
1243
1209
 * call e_cal_component_commit_sequence() before this function to ensure that the
1244
1210
 * component's sequence number is consistent with the state of the object.
1245
1211
 *
1246
 
 * Return value: String representation of the calendar component according to
 
1212
 * Returns: String representation of the calendar component according to
1247
1213
 * RFC 2445.
1248
1214
 **/
1249
1215
gchar *
1422
1388
 * Get the ID of the component as a #ECalComponentId.  The return value should
1423
1389
 * be freed with e_cal_component_free_id() when you have finished with it.
1424
1390
 *
1425
 
 * Return value: the id of the component
 
1391
 * Returns: the id of the component
1426
1392
 */
1427
1393
ECalComponentId *
1428
1394
e_cal_component_get_id (ECalComponent *comp)
1631
1597
 *
1632
1598
 * Queries the component to see if it has attachments.
1633
1599
 *
1634
 
 * Return value: TRUE if there are attachments, FALSE otherwise.
 
1600
 * Returns: TRUE if there are attachments, FALSE otherwise.
1635
1601
 */
1636
1602
gboolean
1637
1603
e_cal_component_has_attachments (ECalComponent *comp)
1655
1621
 *
1656
1622
 * Get the number of attachments to this calendar component object.
1657
1623
 *
1658
 
 * Return value: the number of attachments.
 
1624
 * Returns: the number of attachments.
1659
1625
 */
1660
1626
gint
1661
1627
e_cal_component_get_num_attachments (ECalComponent *comp)
2938
2904
 * Queries whether a calendar component object has any exception dates defined
2939
2905
 * for it.
2940
2906
 *
2941
 
 * Return value: TRUE if the component has exception dates, FALSE otherwise.
 
2907
 * Returns: TRUE if the component has exception dates, FALSE otherwise.
2942
2908
 **/
2943
2909
gboolean
2944
2910
e_cal_component_has_exdates (ECalComponent *comp)
3099
3065
 * Queries whether a calendar component object has any exception rules defined
3100
3066
 * for it.
3101
3067
 *
3102
 
 * Return value: TRUE if the component has exception rules, FALSE otherwise.
 
3068
 * Returns: TRUE if the component has exception rules, FALSE otherwise.
3103
3069
 **/
3104
3070
gboolean
3105
3071
e_cal_component_has_exrules (ECalComponent *comp)
3122
3088
 * Queries whether a calendar component object has any exception dates
3123
3089
 * or exception rules.
3124
3090
 *
3125
 
 * Return value: TRUE if the component has exceptions, FALSE otherwise.
 
3091
 * Returns: TRUE if the component has exceptions, FALSE otherwise.
3126
3092
 **/
3127
3093
gboolean
3128
3094
e_cal_component_has_exceptions (ECalComponent *comp)
3382
3348
 *
3383
3349
 * Check whether a calendar component object has an organizer or not.
3384
3350
 *
3385
 
 * Return value: TRUE if there is an organizer, FALSE otherwise.
 
3351
 * Returns: TRUE if there is an organizer, FALSE otherwise.
3386
3352
 **/
3387
3353
gboolean
3388
3354
e_cal_component_has_organizer (ECalComponent *comp)
3424
3390
                *percent = NULL;
3425
3391
}
3426
3392
 
 
3393
/**
 
3394
 * e_cal_component_set_percent_as_int:
 
3395
 *
 
3396
 * Since: 2.28
 
3397
 **/
3427
3398
void
3428
3399
e_cal_component_set_percent_as_int (ECalComponent *comp, gint percent)
3429
3400
{
3456
3427
 
3457
3428
}
3458
3429
 
 
3430
/**
 
3431
 * e_cal_component_get_percent_as_int:
 
3432
 *
 
3433
 * Since: 2.28
 
3434
 **/
3459
3435
gint
3460
3436
e_cal_component_get_percent_as_int (ECalComponent *comp)
3461
3437
{
3606
3582
 *
3607
3583
 * Gets the recurrence ID property as a string.
3608
3584
 *
3609
 
 * Return value: the recurrence ID as a string.
 
3585
 * Returns: the recurrence ID as a string.
3610
3586
 */
3611
3587
gchar *
3612
3588
e_cal_component_get_recurid_as_string (ECalComponent *comp)
3709
3685
 * Queries whether a calendar component object has any recurrence dates defined
3710
3686
 * for it.
3711
3687
 *
3712
 
 * Return value: TRUE if the component has recurrence dates, FALSE otherwise.
 
3688
 * Returns: TRUE if the component has recurrence dates, FALSE otherwise.
3713
3689
 **/
3714
3690
gboolean
3715
3691
e_cal_component_has_rdates (ECalComponent *comp)
3802
3778
 * Queries whether a calendar component object has any recurrence rules defined
3803
3779
 * for it.
3804
3780
 *
3805
 
 * Return value: TRUE if the component has recurrence rules, FALSE otherwise.
 
3781
 * Returns: TRUE if the component has recurrence rules, FALSE otherwise.
3806
3782
 **/
3807
3783
gboolean
3808
3784
e_cal_component_has_rrules (ECalComponent *comp)
3825
3801
 * Queries whether a calendar component object has any recurrence dates or
3826
3802
 * recurrence rules.
3827
3803
 *
3828
 
 * Return value: TRUE if the component has recurrences, FALSE otherwise.
 
3804
 * Returns: TRUE if the component has recurrences, FALSE otherwise.
3829
3805
 **/
3830
3806
gboolean
3831
3807
e_cal_component_has_recurrences (ECalComponent *comp)
3853
3829
 * Checks whether the given calendar component object has simple recurrence
3854
3830
 * rules or more complicated ones.
3855
3831
 *
3856
 
 * Return value: TRUE if it has a simple recurrence rule, FALSE otherwise.
 
3832
 * Returns: TRUE if it has a simple recurrence rule, FALSE otherwise.
3857
3833
 */
3858
3834
gboolean
3859
3835
e_cal_component_has_simple_recurrence (ECalComponent *comp)
3886
3862
                goto cleanup;
3887
3863
 
3888
3864
        /* Any funky BY_* */
3889
 
#define N_HAS_BY(field) (count_by_xxx (field, sizeof (field) / sizeof (field[0])))
 
3865
#define N_HAS_BY(field) (count_by_xxx (field, G_N_ELEMENTS (field)))
3890
3866
 
3891
3867
        n_by_second = N_HAS_BY (r->by_second);
3892
3868
        n_by_minute = N_HAS_BY (r->by_minute);
3952
3928
                        if (nth < 1 && nth != -1)
3953
3929
                                goto cleanup;
3954
3930
 
3955
 
                        simple = TRUE;
3956
 
 
3957
3931
                } else if (n_by_day == 1) {
3958
3932
                        enum icalrecurrencetype_weekday weekday;
3959
3933
                        gint pos;
4022
3996
 * Checks whether a calendar component object is an instance of a recurring
4023
3997
 * event.
4024
3998
 *
4025
 
 * Return value: TRUE if it is an instance, FALSE if not.
 
3999
 * Returns: TRUE if it is an instance, FALSE if not.
4026
4000
 */
4027
4001
gboolean
4028
4002
e_cal_component_is_instance (ECalComponent *comp)
4666
4640
 *
4667
4641
 * Queries a calendar component object for the existence of attendees.
4668
4642
 *
4669
 
 * Return value: TRUE if there are attendees, FALSE if not.
 
4643
 * Returns: TRUE if there are attendees, FALSE if not.
4670
4644
 */
4671
4645
gboolean
4672
4646
e_cal_component_has_attendees (ECalComponent *comp)
5027
5001
 *
5028
5002
 * Checks whether the component has any alarms.
5029
5003
 *
5030
 
 * Return value: TRUE if the component has any alarms.
 
5004
 * Returns: TRUE if the component has any alarms.
5031
5005
 **/
5032
5006
gboolean
5033
5007
e_cal_component_has_alarms (ECalComponent *comp)
5233
5207
 * Builds a list of the unique identifiers of the alarm subcomponents inside a
5234
5208
 * calendar component.
5235
5209
 *
5236
 
 * Return value: List of unique identifiers for alarms.  This should be freed
 
5210
 * Returns: List of unique identifiers for alarms.  This should be freed
5237
5211
 * using cal_obj_uid_list_free().
5238
5212
 **/
5239
5213
GList *
5284
5258
 *
5285
5259
 * Queries a particular alarm subcomponent of a calendar component.
5286
5260
 *
5287
 
 * Return value: The alarm subcomponent that corresponds to the specified @auid,
 
5261
 * Returns: The alarm subcomponent that corresponds to the specified @auid,
5288
5262
 * or #NULL if no alarm exists with that UID.  This should be freed using
5289
5263
 * e_cal_component_alarm_free().
5290
5264
 **/
5344
5318
 *
5345
5319
 * Create a new alarm object.
5346
5320
 *
5347
 
 * Return value: a new alarm component
 
5321
 * Returns: a new alarm component
5348
5322
 **/
5349
5323
ECalComponentAlarm *
5350
5324
e_cal_component_alarm_new (void)
5380
5354
 *
5381
5355
 * Creates a new alarm subcomponent by copying the information from another one.
5382
5356
 *
5383
 
 * Return value: A newly-created alarm subcomponent with the same values as the
 
5357
 * Returns: A newly-created alarm subcomponent with the same values as the
5384
5358
 * original one.  Should be freed with e_cal_component_alarm_free().
5385
5359
 **/
5386
5360
ECalComponentAlarm *
5436
5410
 *
5437
5411
 * Queries the unique identifier of an alarm subcomponent.
5438
5412
 *
5439
 
 * Return value: UID of the alarm.
 
5413
 * Returns: UID of the alarm.
5440
5414
 **/
5441
5415
const gchar *
5442
5416
e_cal_component_alarm_get_uid (ECalComponentAlarm *alarm)
5927
5901
 *
5928
5902
 * Queries an alarm to see if it has attendees associated with it.
5929
5903
 *
5930
 
 * Return value: TRUE if there are attendees in the alarm, FALSE if not.
 
5904
 * Returns: TRUE if there are attendees in the alarm, FALSE if not.
5931
5905
 */
5932
5906
gboolean
5933
5907
e_cal_component_alarm_has_attendees (ECalComponentAlarm *alarm)