/*************************************************************************************************************
This file contains dialogs
2012/6 by Dlxko
**************************************************************************************************************/
#include "Dialogs.h"

void function_show_error(char msg[100])
{
	GtkWidget *dialog;

	dialog = gtk_message_dialog_new(GTK_WINDOW(dialog_window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, msg);
	gtk_window_set_title(GTK_WINDOW(dialog), "Error");
	gtk_dialog_run(GTK_DIALOG(dialog));
	gtk_widget_destroy(dialog);
	function_exit_client(1);
}

void function_show_warning(char msg[100])
{
	GtkWidget *dialog;

	dialog = gtk_message_dialog_new(GTK_WINDOW(dialog_window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, msg);
	gtk_window_set_title(GTK_WINDOW(dialog), "Warning");
	gtk_dialog_run(GTK_DIALOG(dialog));
	gtk_widget_destroy(dialog);
}

void create_dialog_window()
{
	// New window, parameters, title, closing
	dialog_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_widget_set_size_request (GTK_WIDGET (dialog_window), 300, 80);
	gtk_window_set_title (GTK_WINDOW (dialog_window), "Dialog window");
	gtk_window_set_icon(GTK_WINDOW(dialog_window), default_icon);
}