/* delete-dialog.c generated by valac 0.28.0, the Vala compiler
 * generated from delete-dialog.vala, do not modify */

/*
 * Seahorse
 *
 * Copyright (C) 2011 Collabora Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
 *
 * Author: Stef Walter <stefw@collabora.co.uk>
 */

#include <glib.h>
#include <glib-object.h>
#include "seahorse-common.h"
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

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

struct _SeahorseDeleteDialogPrivate {
	GtkToggleButton* _check;
	gboolean _check_require;
};


static gpointer seahorse_delete_dialog_parent_class = NULL;

#define SEAHORSE_DELETE_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_TYPE_DELETE_DIALOG, SeahorseDeleteDialogPrivate))
enum  {
	SEAHORSE_DELETE_DIALOG_DUMMY_PROPERTY,
	SEAHORSE_DELETE_DIALOG_CHECK_LABEL,
	SEAHORSE_DELETE_DIALOG_CHECK_VALUE,
	SEAHORSE_DELETE_DIALOG_CHECK_REQUIRE
};
static void seahorse_delete_dialog_update_response_buttons (SeahorseDeleteDialog* self);
static GObject * seahorse_delete_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _seahorse_delete_dialog___lambda14_ (SeahorseDeleteDialog* self, GtkToggleButton* toggle);
static void __seahorse_delete_dialog___lambda14__gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void seahorse_delete_dialog_finalize (GObject* obj);
static void _vala_seahorse_delete_dialog_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_seahorse_delete_dialog_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GtkDialog* seahorse_delete_dialog_constructv (GType object_type, GtkWindow* parent, const gchar* format, va_list _vala_va_list) {
	SeahorseDeleteDialog * self = NULL;
	GtkWindow* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	va_list _tmp2_ = {0};
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	g_return_val_if_fail (format != NULL, NULL);
	_tmp0_ = parent;
	_tmp1_ = format;
	va_copy (_tmp2_, _vala_va_list);
	_tmp3_ = g_strdup_vprintf (_tmp1_, _tmp2_);
	_tmp4_ = _tmp3_;
	self = (SeahorseDeleteDialog*) g_object_new (object_type, "message-type", GTK_MESSAGE_QUESTION, "transient-for", _tmp0_, "text", _tmp4_, NULL);
	_g_free0 (_tmp4_);
	va_end (_tmp2_);
	return (GtkDialog*) self;
}


GtkDialog* seahorse_delete_dialog_new (GtkWindow* parent, const gchar* format, ...) {
	va_list _vala_va_list_obj;
	va_start (_vala_va_list_obj, format);
	return seahorse_delete_dialog_constructv (SEAHORSE_TYPE_DELETE_DIALOG, parent, format, _vala_va_list_obj);
}


GtkDialog* seahorse_delete_dialog_construct (GType object_type, GtkWindow* parent, const gchar* format, ...) {
	va_list _vala_va_list_obj;
	va_start (_vala_va_list_obj, format);
	return seahorse_delete_dialog_constructv (object_type, parent, format, _vala_va_list_obj);
}


static void seahorse_delete_dialog_update_response_buttons (SeahorseDeleteDialog* self) {
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_check_require;
	if (!_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		GtkToggleButton* _tmp2_ = NULL;
		gboolean _tmp3_ = FALSE;
		_tmp2_ = self->priv->_check;
		_tmp3_ = gtk_toggle_button_get_active (_tmp2_);
		_tmp0_ = _tmp3_;
	}
	gtk_dialog_set_response_sensitive ((GtkDialog*) self, (gint) GTK_RESPONSE_OK, _tmp0_);
}


gboolean seahorse_delete_dialog_prompt (GtkWindow* parent, const gchar* text) {
	gboolean result = FALSE;
	GtkDialog* dialog = NULL;
	GtkWindow* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	SeahorseDeleteDialog* _tmp2_ = NULL;
	gint response = 0;
	gint _tmp3_ = 0;
	g_return_val_if_fail (text != NULL, FALSE);
	_tmp0_ = parent;
	_tmp1_ = text;
	_tmp2_ = (SeahorseDeleteDialog*) seahorse_delete_dialog_new (_tmp0_, "%s", _tmp1_, NULL);
	g_object_ref_sink (_tmp2_);
	dialog = (GtkDialog*) _tmp2_;
	_tmp3_ = gtk_dialog_run (dialog);
	response = _tmp3_;
	gtk_widget_destroy ((GtkWidget*) dialog);
	result = response == ((gint) GTK_RESPONSE_OK);
	_g_object_unref0 (dialog);
	return result;
}


const gchar* seahorse_delete_dialog_get_check_label (SeahorseDeleteDialog* self) {
	const gchar* result;
	GtkToggleButton* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_check;
	_tmp1_ = gtk_widget_get_visible ((GtkWidget*) _tmp0_);
	if (_tmp1_) {
		GtkToggleButton* _tmp2_ = NULL;
		const gchar* _tmp3_ = NULL;
		_tmp2_ = self->priv->_check;
		_tmp3_ = gtk_button_get_label ((GtkButton*) _tmp2_);
		result = _tmp3_;
		return result;
	}
	result = NULL;
	return result;
}


void seahorse_delete_dialog_set_check_label (SeahorseDeleteDialog* self, const gchar* value) {
	const gchar* _tmp0_ = NULL;
	GtkToggleButton* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	if (_tmp0_ == NULL) {
		GtkToggleButton* _tmp1_ = NULL;
		_tmp1_ = self->priv->_check;
		gtk_widget_hide ((GtkWidget*) _tmp1_);
		value = "";
	} else {
		GtkToggleButton* _tmp2_ = NULL;
		_tmp2_ = self->priv->_check;
		gtk_widget_show ((GtkWidget*) _tmp2_);
	}
	_tmp3_ = self->priv->_check;
	_tmp4_ = value;
	gtk_button_set_label ((GtkButton*) _tmp3_, _tmp4_);
	g_object_notify ((GObject *) self, "check-label");
}


gboolean seahorse_delete_dialog_get_check_value (SeahorseDeleteDialog* self) {
	gboolean result;
	GtkToggleButton* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_check;
	_tmp1_ = gtk_widget_get_visible ((GtkWidget*) _tmp0_);
	if (_tmp1_) {
		GtkToggleButton* _tmp2_ = NULL;
		gboolean _tmp3_ = FALSE;
		_tmp2_ = self->priv->_check;
		_tmp3_ = gtk_toggle_button_get_active (_tmp2_);
		result = _tmp3_;
		return result;
	}
	result = FALSE;
	return result;
}


void seahorse_delete_dialog_set_check_value (SeahorseDeleteDialog* self, gboolean value) {
	GtkToggleButton* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_check;
	_tmp1_ = value;
	gtk_toggle_button_set_active (_tmp0_, _tmp1_);
	g_object_notify ((GObject *) self, "check-value");
}


gboolean seahorse_delete_dialog_get_check_require (SeahorseDeleteDialog* self) {
	gboolean result;
	gboolean _tmp0_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_check_require;
	result = _tmp0_;
	return result;
}


void seahorse_delete_dialog_set_check_require (SeahorseDeleteDialog* self, gboolean value) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_check_require = _tmp0_;
	seahorse_delete_dialog_update_response_buttons (self);
	g_object_notify ((GObject *) self, "check-require");
}


static void _seahorse_delete_dialog___lambda14_ (SeahorseDeleteDialog* self, GtkToggleButton* toggle) {
	g_return_if_fail (toggle != NULL);
	seahorse_delete_dialog_update_response_buttons (self);
}


static void __seahorse_delete_dialog___lambda14__gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	_seahorse_delete_dialog___lambda14_ ((SeahorseDeleteDialog*) self, _sender);
}


static GObject * seahorse_delete_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	SeahorseDeleteDialog * self;
	GtkCheckButton* _tmp0_ = NULL;
	GtkWidget* _tmp1_ = NULL;
	GtkToggleButton* _tmp2_ = NULL;
	GtkToggleButton* _tmp3_ = NULL;
	GtkButton* cancel = NULL;
	GtkButton* _tmp4_ = NULL;
	GtkButton* _tmp5_ = NULL;
	GtkButton* _tmp6_ = NULL;
	GtkButton* delet = NULL;
	GtkButton* _tmp7_ = NULL;
	GtkButton* _tmp8_ = NULL;
	GtkButton* _tmp9_ = NULL;
	parent_class = G_OBJECT_CLASS (seahorse_delete_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEAHORSE_TYPE_DELETE_DIALOG, SeahorseDeleteDialog);
	gtk_window_set_modal ((GtkWindow*) self, TRUE);
	gtk_window_set_destroy_with_parent ((GtkWindow*) self, TRUE);
	_tmp0_ = (GtkCheckButton*) gtk_check_button_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->_check);
	self->priv->_check = (GtkToggleButton*) _tmp0_;
	_tmp1_ = gtk_message_dialog_get_message_area ((GtkMessageDialog*) self);
	_tmp2_ = self->priv->_check;
	gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_container_get_type (), GtkContainer), (GtkWidget*) _tmp2_);
	_tmp3_ = self->priv->_check;
	g_signal_connect_object (_tmp3_, "toggled", (GCallback) __seahorse_delete_dialog___lambda14__gtk_toggle_button_toggled, self, 0);
	_tmp4_ = (GtkButton*) gtk_button_new_from_stock (GTK_STOCK_CANCEL);
	g_object_ref_sink (_tmp4_);
	cancel = _tmp4_;
	_tmp5_ = cancel;
	gtk_dialog_add_action_widget ((GtkDialog*) self, (GtkWidget*) _tmp5_, (gint) GTK_RESPONSE_CANCEL);
	_tmp6_ = cancel;
	gtk_widget_show ((GtkWidget*) _tmp6_);
	_tmp7_ = (GtkButton*) gtk_button_new_from_stock (GTK_STOCK_DELETE);
	g_object_ref_sink (_tmp7_);
	delet = _tmp7_;
	_tmp8_ = delet;
	gtk_dialog_add_action_widget ((GtkDialog*) self, (GtkWidget*) _tmp8_, (gint) GTK_RESPONSE_OK);
	_tmp9_ = delet;
	gtk_widget_show ((GtkWidget*) _tmp9_);
	_g_object_unref0 (delet);
	_g_object_unref0 (cancel);
	return obj;
}


static void seahorse_delete_dialog_class_init (SeahorseDeleteDialogClass * klass) {
	seahorse_delete_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (SeahorseDeleteDialogPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_seahorse_delete_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_seahorse_delete_dialog_set_property;
	G_OBJECT_CLASS (klass)->constructor = seahorse_delete_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = seahorse_delete_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_DELETE_DIALOG_CHECK_LABEL, g_param_spec_string ("check-label", "check-label", "check-label", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_DELETE_DIALOG_CHECK_VALUE, g_param_spec_boolean ("check-value", "check-value", "check-value", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_DELETE_DIALOG_CHECK_REQUIRE, g_param_spec_boolean ("check-require", "check-require", "check-require", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void seahorse_delete_dialog_instance_init (SeahorseDeleteDialog * self) {
	self->priv = SEAHORSE_DELETE_DIALOG_GET_PRIVATE (self);
}


static void seahorse_delete_dialog_finalize (GObject* obj) {
	SeahorseDeleteDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEAHORSE_TYPE_DELETE_DIALOG, SeahorseDeleteDialog);
	_g_object_unref0 (self->priv->_check);
	G_OBJECT_CLASS (seahorse_delete_dialog_parent_class)->finalize (obj);
}


GType seahorse_delete_dialog_get_type (void) {
	static volatile gsize seahorse_delete_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&seahorse_delete_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SeahorseDeleteDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_delete_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorseDeleteDialog), 0, (GInstanceInitFunc) seahorse_delete_dialog_instance_init, NULL };
		GType seahorse_delete_dialog_type_id;
		seahorse_delete_dialog_type_id = g_type_register_static (gtk_message_dialog_get_type (), "SeahorseDeleteDialog", &g_define_type_info, 0);
		g_once_init_leave (&seahorse_delete_dialog_type_id__volatile, seahorse_delete_dialog_type_id);
	}
	return seahorse_delete_dialog_type_id__volatile;
}


static void _vala_seahorse_delete_dialog_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	SeahorseDeleteDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SEAHORSE_TYPE_DELETE_DIALOG, SeahorseDeleteDialog);
	switch (property_id) {
		case SEAHORSE_DELETE_DIALOG_CHECK_LABEL:
		g_value_set_string (value, seahorse_delete_dialog_get_check_label (self));
		break;
		case SEAHORSE_DELETE_DIALOG_CHECK_VALUE:
		g_value_set_boolean (value, seahorse_delete_dialog_get_check_value (self));
		break;
		case SEAHORSE_DELETE_DIALOG_CHECK_REQUIRE:
		g_value_set_boolean (value, seahorse_delete_dialog_get_check_require (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_seahorse_delete_dialog_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	SeahorseDeleteDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SEAHORSE_TYPE_DELETE_DIALOG, SeahorseDeleteDialog);
	switch (property_id) {
		case SEAHORSE_DELETE_DIALOG_CHECK_LABEL:
		seahorse_delete_dialog_set_check_label (self, g_value_get_string (value));
		break;
		case SEAHORSE_DELETE_DIALOG_CHECK_VALUE:
		seahorse_delete_dialog_set_check_value (self, g_value_get_boolean (value));
		break;
		case SEAHORSE_DELETE_DIALOG_CHECK_REQUIRE:
		seahorse_delete_dialog_set_check_require (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



