コード例 #1
0
ファイル: icalbdbset.c プロジェクト: BenjamenMeyer/libical
int icalbdbset_count_components(icalset *set, icalcomponent_kind kind)
{
    icalbdbset *bset;

    if (set == 0) {
        icalerror_set_errno(ICAL_BADARG_ERROR);
        return -1;
    }

    bset = (icalbdbset *) set;
    return icalcomponent_count_components(bset->cluster, kind);
}
コード例 #2
0
ファイル: dates_callbacks.c プロジェクト: GNOME/dates
void
dates_ical_drop_cb (DatesView *view, const gchar *ical, DatesData *d)
{
    icalcomponent *icalcomp, *icalcomp2;
    gint events;

    if (!d->cal_loaded) {
	/* TODO: Toggle the default calendar here maybe? */
	g_warning ("No calendars selected to add new event to");
	return;
    }
	
    icalcomp = icalcomponent_new_from_string (g_strdup (ical));
    if (!icalcomp)
	g_warning ("Error creating icalcomponent from string");

    switch (icalcomponent_isa (icalcomp)) {
	case ICAL_VEVENT_COMPONENT :
	    icalcomponent_set_uid (icalcomp, "");
	    dates_new (d, icalcomponent_new_clone (icalcomp), TRUE);
	    return;
	case ICAL_VCALENDAR_COMPONENT :
	    /* Iterate through events */
	    /* TODO: A confirmation dialog when calendar has
	     * multiple events?
	     */
	    events = icalcomponent_count_components (icalcomp,
						     ICAL_VEVENT_COMPONENT);
	    if (events == 0) {
		g_warning ("Dragged ical contains no supported "
			   "kinds.");
		break;
	    }
			
	    icalcomp2 = icalcomponent_get_first_component (icalcomp,
							   ICAL_VEVENT_COMPONENT);
	    do {
		icalcomponent_set_uid (icalcomp2, "");
		dates_new (d, icalcomponent_new_clone (
			       icalcomp2), (events == 1) ?
			   TRUE : FALSE);
	    } while ((icalcomp2 = icalcomponent_get_next_component (
			  icalcomp2, ICAL_VEVENT_COMPONENT))); 
	    break;
	default :
	    g_warning ("Dragged ical not a supported kind.");
	    break;
    }

    icalcomponent_free (icalcomp);
}
コード例 #3
0
ファイル: icalcluster.c プロジェクト: xfce-mirror/orage
int icalcluster_count_components(icalcluster *impl, icalcomponent_kind kind) {

	icalerror_check_arg_re((impl!=0),"cluster",ICAL_BADARG_ERROR);

	return icalcomponent_count_components(impl->data, kind);
}