예제 #1
0
static void
repeat_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm)
{
    ECalComponentAlarmRepeat repeat;

    if (!e_dialog_toggle_get (dialog->repeat_toggle)) {
        repeat.repetitions = 0;

        e_cal_component_alarm_set_repeat (alarm, repeat);
        return;
    }

    repeat.repetitions = e_dialog_spin_get_int (dialog->repeat_quantity);

    memset (&repeat.duration, 0, sizeof (repeat.duration));
    switch (e_dialog_option_menu_get (dialog->repeat_unit, duration_units_map)) {
    case DUR_MINUTES:
        repeat.duration.minutes = e_dialog_spin_get_int (dialog->repeat_value);
        break;

    case DUR_HOURS:
        repeat.duration.hours = e_dialog_spin_get_int (dialog->repeat_value);
        break;

    case DUR_DAYS:
        repeat.duration.days = e_dialog_spin_get_int (dialog->repeat_value);
        break;

    default:
        g_return_if_reached ();
    }

    e_cal_component_alarm_set_repeat (alarm, repeat);

}
예제 #2
0
static void
repeat_widgets_to_alarm (Dialog *dialog,
                         ECalComponentAlarm *alarm)
{
	ECalComponentAlarmRepeat repeat;

	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->repeat_toggle))) {
		repeat.repetitions = 0;

		e_cal_component_alarm_set_repeat (alarm, repeat);
		return;
	}

	repeat.repetitions = gtk_spin_button_get_value_as_int (
		GTK_SPIN_BUTTON (dialog->repeat_quantity));

	memset (&repeat.duration, 0, sizeof (repeat.duration));
	switch (e_dialog_combo_box_get (dialog->repeat_unit_combo, duration_units_map)) {
	case DUR_MINUTES:
		repeat.duration.minutes = gtk_spin_button_get_value_as_int (
			GTK_SPIN_BUTTON (dialog->repeat_value));
		break;

	case DUR_HOURS:
		repeat.duration.hours = gtk_spin_button_get_value_as_int (
			GTK_SPIN_BUTTON (dialog->repeat_value));
		break;

	case DUR_DAYS:
		repeat.duration.days = gtk_spin_button_get_value_as_int (
			GTK_SPIN_BUTTON (dialog->repeat_value));
		break;

	default:
		g_return_if_reached ();
	}

	e_cal_component_alarm_set_repeat (alarm, repeat);

}