/* basicdialog.c generated by valac 0.24.0, the Vala compiler
 * generated from basicdialog.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>

#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))



gint basic_dialog_ask_overwrite (GtkWindow* window, const gchar* filename);
gint basic_dialog_ask_proceed (GtkWindow* window, const gchar* text, const gchar* buttonOK, const gchar* buttonCancel);
gint basic_dialog_ask_generic (GtkWindow* window, GtkMessageType messageType, const gchar* text, gchar** options, int options_length1);
void basic_dialog_information (GtkWindow* window, const gchar* text);
void basic_dialog_warning (GtkWindow* window, const gchar* text);
void basic_dialog_error (GtkWindow* window, const gchar* text);


gint basic_dialog_ask_overwrite (GtkWindow* window, const gchar* filename) {
	gint result = 0;
	GtkMessageDialog* messageDialog = NULL;
	GtkWindow* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	GtkMessageDialog* _tmp2_ = NULL;
	gint _result_ = 0;
	gint _tmp3_ = 0;
	g_return_val_if_fail (filename != NULL, 0);
	_tmp0_ = window;
	_tmp1_ = filename;
	_tmp2_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp0_, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO, "The file \"%s\" already exists.\nDo you want to overwrite it?", _tmp1_);
	g_object_ref_sink (_tmp2_);
	messageDialog = _tmp2_;
	_tmp3_ = gtk_dialog_run ((GtkDialog*) messageDialog);
	_result_ = _tmp3_;
	gtk_widget_destroy ((GtkWidget*) messageDialog);
	result = _result_;
	_g_object_unref0 (messageDialog);
	return result;
}


gint basic_dialog_ask_proceed (GtkWindow* window, const gchar* text, const gchar* buttonOK, const gchar* buttonCancel) {
	gint result = 0;
	GtkMessageDialog* messageDialog = NULL;
	GtkWindow* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	GtkMessageDialog* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	gint _result_ = 0;
	gint _tmp5_ = 0;
	g_return_val_if_fail (text != NULL, 0);
	g_return_val_if_fail (buttonOK != NULL, 0);
	g_return_val_if_fail (buttonCancel != NULL, 0);
	_tmp0_ = window;
	_tmp1_ = text;
	_tmp2_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp0_, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, "%s", _tmp1_);
	g_object_ref_sink (_tmp2_);
	messageDialog = _tmp2_;
	_tmp3_ = buttonOK;
	gtk_dialog_add_button ((GtkDialog*) messageDialog, _tmp3_, (gint) GTK_RESPONSE_OK);
	_tmp4_ = buttonCancel;
	gtk_dialog_add_button ((GtkDialog*) messageDialog, _tmp4_, (gint) GTK_RESPONSE_CANCEL);
	_tmp5_ = gtk_dialog_run ((GtkDialog*) messageDialog);
	_result_ = _tmp5_;
	gtk_widget_destroy ((GtkWidget*) messageDialog);
	result = _result_;
	_g_object_unref0 (messageDialog);
	return result;
}


gint basic_dialog_ask_generic (GtkWindow* window, GtkMessageType messageType, const gchar* text, gchar** options, int options_length1) {
	gint result = 0;
	GtkMessageDialog* messageDialog = NULL;
	GtkWindow* _tmp0_ = NULL;
	GtkMessageType _tmp1_ = 0;
	const gchar* _tmp2_ = NULL;
	GtkMessageDialog* _tmp3_ = NULL;
	gint _result_ = 0;
	GtkMessageDialog* _tmp15_ = NULL;
	gint _tmp16_ = 0;
	GtkMessageDialog* _tmp17_ = NULL;
	g_return_val_if_fail (text != NULL, 0);
	_tmp0_ = window;
	_tmp1_ = messageType;
	_tmp2_ = text;
	_tmp3_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp0_, GTK_DIALOG_MODAL, _tmp1_, GTK_BUTTONS_NONE, "%s", _tmp2_);
	g_object_ref_sink (_tmp3_);
	messageDialog = _tmp3_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				gint _tmp6_ = 0;
				gchar** _tmp7_ = NULL;
				gint _tmp7__length1 = 0;
				gchar* option = NULL;
				gchar** _tmp8_ = NULL;
				gint _tmp8__length1 = 0;
				gint _tmp9_ = 0;
				const gchar* _tmp10_ = NULL;
				gchar* _tmp11_ = NULL;
				GtkMessageDialog* _tmp12_ = NULL;
				const gchar* _tmp13_ = NULL;
				gint _tmp14_ = 0;
				if (!_tmp4_) {
					gint _tmp5_ = 0;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				_tmp6_ = i;
				_tmp7_ = options;
				_tmp7__length1 = options_length1;
				if (!(_tmp6_ < _tmp7__length1)) {
					break;
				}
				_tmp8_ = options;
				_tmp8__length1 = options_length1;
				_tmp9_ = i;
				_tmp10_ = _tmp8_[_tmp9_];
				_tmp11_ = g_strdup (_tmp10_);
				option = _tmp11_;
				_tmp12_ = messageDialog;
				_tmp13_ = option;
				_tmp14_ = i;
				gtk_dialog_add_button ((GtkDialog*) _tmp12_, _tmp13_, _tmp14_);
				_g_free0 (option);
			}
		}
	}
	_tmp15_ = messageDialog;
	_tmp16_ = gtk_dialog_run ((GtkDialog*) _tmp15_);
	_result_ = _tmp16_;
	_tmp17_ = messageDialog;
	gtk_widget_destroy ((GtkWidget*) _tmp17_);
	result = _result_;
	_g_object_unref0 (messageDialog);
	return result;
}


void basic_dialog_information (GtkWindow* window, const gchar* text) {
	GtkMessageDialog* messageDialog = NULL;
	GtkWindow* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	GtkMessageDialog* _tmp2_ = NULL;
	g_return_if_fail (text != NULL);
	_tmp0_ = window;
	_tmp1_ = text;
	_tmp2_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp0_, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s", _tmp1_);
	g_object_ref_sink (_tmp2_);
	messageDialog = _tmp2_;
	gtk_dialog_run ((GtkDialog*) messageDialog);
	gtk_widget_destroy ((GtkWidget*) messageDialog);
	_g_object_unref0 (messageDialog);
}


void basic_dialog_warning (GtkWindow* window, const gchar* text) {
	GtkMessageDialog* messageDialog = NULL;
	GtkWindow* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	GtkMessageDialog* _tmp2_ = NULL;
	g_return_if_fail (text != NULL);
	_tmp0_ = window;
	_tmp1_ = text;
	_tmp2_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp0_, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, "%s", _tmp1_);
	g_object_ref_sink (_tmp2_);
	messageDialog = _tmp2_;
	gtk_dialog_run ((GtkDialog*) messageDialog);
	gtk_widget_destroy ((GtkWidget*) messageDialog);
	_g_object_unref0 (messageDialog);
}


void basic_dialog_error (GtkWindow* window, const gchar* text) {
	GtkMessageDialog* messageDialog = NULL;
	GtkWindow* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	GtkMessageDialog* _tmp2_ = NULL;
	g_return_if_fail (text != NULL);
	_tmp0_ = window;
	_tmp1_ = text;
	_tmp2_ = (GtkMessageDialog*) gtk_message_dialog_new (_tmp0_, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", _tmp1_);
	g_object_ref_sink (_tmp2_);
	messageDialog = _tmp2_;
	gtk_dialog_run ((GtkDialog*) messageDialog);
	gtk_widget_destroy ((GtkWidget*) messageDialog);
	_g_object_unref0 (messageDialog);
}



