Beispiel #1
0
/* Fills the widgets with audio alarm data */
static void
alarm_to_aalarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm)
{
    const char *url;
    icalattach *attach;

    e_cal_component_alarm_get_attach (alarm, (&attach));
    url = icalattach_get_url (attach);
    icalattach_unref (attach);

    if ( !(url && *url) )
        return;

    e_dialog_toggle_set (dialog->aalarm_sound, TRUE);
    gtk_file_chooser_set_uri (
        GTK_FILE_CHOOSER (dialog->aalarm_file_chooser), url);
}
Beispiel #2
0
/* Fills the audio alarm data with the values from the widgets */
static void
aalarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
{
    char *url;
    icalattach *attach;

    if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->aalarm_sound)))
        return;

    url = gtk_file_chooser_get_uri (
              GTK_FILE_CHOOSER (dialog->aalarm_file_chooser));
    attach = icalattach_new_from_url (url ? url : "");
    g_free (url);

    e_cal_component_alarm_set_attach (alarm, attach);
    icalattach_unref (attach);
}
void
icalvalue_set_attach (icalvalue *value, icalattach *attach)
{
    struct icalvalue_impl *impl;
 
    icalerror_check_arg_rv ((value != NULL), "value");
    icalerror_check_value_type (value, ICAL_ATTACH_VALUE);
    icalerror_check_arg_rv ((attach != NULL), "attach");
  
    impl = (struct icalvalue_impl *) value;
 
    icalattach_ref (attach);

    if (impl->data.v_attach)
	icalattach_unref (impl->data.v_attach);
  
    impl->data.v_attach = attach;
}
Beispiel #4
0
/* Fills the procedure alarm data with the values from the widgets */
static void
palarm_widgets_to_alarm (Dialog *dialog,
                         ECalComponentAlarm *alarm)
{
	gchar *program;
	icalattach *attach;
	gchar *str;
	ECalComponentText description;
	icalcomponent *icalcomp;
	icalproperty *icalprop;

	program = e_dialog_editable_get (dialog->palarm_program);
	attach = icalattach_new_from_url (program ? program : "");
	g_free (program);

	e_cal_component_alarm_set_attach (alarm, attach);
	icalattach_unref (attach);

	str = e_dialog_editable_get (dialog->palarm_args);

		description.value = str;
		description.altrep = NULL;

		e_cal_component_alarm_set_description (alarm, &description);

	g_free (str);

	/* remove the X-EVOLUTION-NEEDS-DESCRIPTION property, so that
	 * we don't re-set the alarm's description */
	icalcomp = e_cal_component_alarm_get_icalcomponent (alarm);
	icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
	while (icalprop) {
		const gchar *x_name;

		x_name = icalproperty_get_x_name (icalprop);
		if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) {
			icalcomponent_remove_property (icalcomp, icalprop);
			break;
		}

		icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
	}
}
Beispiel #5
0
/* Fills the widgets from procedure alarm data */
static void
alarm_to_palarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm)
{
    ECalComponentText description;
    const char *url;
    icalattach *attach;

    e_cal_component_alarm_get_attach (alarm, (&attach));
    url = icalattach_get_url (attach);
    icalattach_unref (attach);

    if ( !(url && *url) )
        return;

    e_dialog_editable_set (dialog->palarm_program, url);
    e_cal_component_alarm_get_description (alarm, &description);

    e_dialog_editable_set (dialog->palarm_args, description.value);
}
static void
add_attach (icalcomponent *icalcomp,
            const gchar *uri)
{
	gsize buf_size;
	gchar *buf;
	icalproperty *prop;
	icalattach *attach;

	g_return_if_fail (icalcomp != NULL);
	g_return_if_fail (uri != NULL);

	buf_size = 2 * strlen (uri);
	buf = g_malloc0 (buf_size);
	icalvalue_encode_ical_string (uri, buf, buf_size);
	attach = icalattach_new_from_url (uri);
	prop = icalproperty_new_attach (attach);
	icalcomponent_add_property (icalcomp, prop);
	icalattach_unref (attach);
	g_free (buf);
}