/*************************************************************************************************************
* This file contains clients online progress bar
* 2012/8 by Dlxko
* Version 3.0
**************************************************************************************************************/
#include "ProgressClients.h"

//Dialog tmp
static char text_tmp[TEMP_SIZE_MEDIUM];
static double temporary_value;

// Function to update progressbar of onlines
void function_update_progress_clients()
{
	// If no clients set to NULL
	if (clients_connected < 1)
		temporary_value = 0;
	// Else count value to set
	else
	{
		temporary_value = clients_connected;
		temporary_value /= MAX_CLIENTS;
	}

	// Set value
	gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress1), temporary_value);

	// Get text and print it to progress bar
	memset(text_tmp, 0, TEMP_SIZE_MEDIUM);
	sprintf_s(text_tmp, TEMP_SIZE_MEDIUM, "%d/%d", clients_connected, MAX_CLIENTS);
	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress1), text_tmp);
}