예제 #1
0
파일: typer.c 프로젝트: LibreCrops/CopyBao
static void send_button_clicked(GtkWidget *button, gpointer data)
{
    send_enable_buttons(FALSE);

    gtk_widget_set_sensitive(input_send_button, FALSE);
    gtk_widget_show(input_stop_button);
    gtk_widget_set_sensitive(input_text_view, FALSE);

    tsp.text = get_input_text();
    tsp.len = strlen(tsp.text);
    tsp.i = -1;

    tsp.timeout = g_timeout_add(current_period(), do_sending, NULL);

    puts("Start sending...");
}
예제 #2
0
파일: charging.cpp 프로젝트: kosfango/fips
// ===========================================================
// returns charged money since last call and updates charging intervall
	float get_charging_sum(int *charging)
// ===========================================================
{
int		t;
float	charged=0;
float	sum=0;
char	periods[1024];

	t = chargingtimediff(); // get seconds since last call
	if (!t)	return 0;
	*charging-=t;		// reduce charging intervall on elapsed secs
	get_current_zone(periods);
	t=current_period(periods,&sum);
	if (!t)	return 0;	// timeintervall is missing
	while (*charging<0) // while charging intervall <0, we have spent money
	{
		*charging+=t;
		charged+=sum;
	}
	return charged;
}