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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*- */
/*
    This file is part of Déjà Dup.
    © 2009 Michael Terry <mike@mterry.name>

    Déjà Dup is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Déjà Dup 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>


#define DEJA_DUP_TYPE_CONFIG_WIDGET (deja_dup_config_widget_get_type ())
#define DEJA_DUP_CONFIG_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_CONFIG_WIDGET, DejaDupConfigWidget))
#define DEJA_DUP_CONFIG_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_CONFIG_WIDGET, DejaDupConfigWidgetClass))
#define DEJA_DUP_IS_CONFIG_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_CONFIG_WIDGET))
#define DEJA_DUP_IS_CONFIG_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_CONFIG_WIDGET))
#define DEJA_DUP_CONFIG_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_CONFIG_WIDGET, DejaDupConfigWidgetClass))

typedef struct _DejaDupConfigWidget DejaDupConfigWidget;
typedef struct _DejaDupConfigWidgetClass DejaDupConfigWidgetClass;
typedef struct _DejaDupConfigWidgetPrivate DejaDupConfigWidgetPrivate;

#define DEJA_DUP_TYPE_CONFIG_LABEL (deja_dup_config_label_get_type ())
#define DEJA_DUP_CONFIG_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_CONFIG_LABEL, DejaDupConfigLabel))
#define DEJA_DUP_CONFIG_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_CONFIG_LABEL, DejaDupConfigLabelClass))
#define DEJA_DUP_IS_CONFIG_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_CONFIG_LABEL))
#define DEJA_DUP_IS_CONFIG_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_CONFIG_LABEL))
#define DEJA_DUP_CONFIG_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_CONFIG_LABEL, DejaDupConfigLabelClass))

typedef struct _DejaDupConfigLabel DejaDupConfigLabel;
typedef struct _DejaDupConfigLabelClass DejaDupConfigLabelClass;
typedef struct _DejaDupConfigLabelPrivate DejaDupConfigLabelPrivate;

#define DEJA_DUP_TYPE_CONFIG_LABEL_BOOL (deja_dup_config_label_bool_get_type ())
#define DEJA_DUP_CONFIG_LABEL_BOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_CONFIG_LABEL_BOOL, DejaDupConfigLabelBool))
#define DEJA_DUP_CONFIG_LABEL_BOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_CONFIG_LABEL_BOOL, DejaDupConfigLabelBoolClass))
#define DEJA_DUP_IS_CONFIG_LABEL_BOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_CONFIG_LABEL_BOOL))
#define DEJA_DUP_IS_CONFIG_LABEL_BOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_CONFIG_LABEL_BOOL))
#define DEJA_DUP_CONFIG_LABEL_BOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_CONFIG_LABEL_BOOL, DejaDupConfigLabelBoolClass))

typedef struct _DejaDupConfigLabelBool DejaDupConfigLabelBool;
typedef struct _DejaDupConfigLabelBoolClass DejaDupConfigLabelBoolClass;
typedef struct _DejaDupConfigLabelBoolPrivate DejaDupConfigLabelBoolPrivate;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _DejaDupConfigWidget {
	GtkEventBox parent_instance;
	DejaDupConfigWidgetPrivate * priv;
	GConfClient* client;
};

struct _DejaDupConfigWidgetClass {
	GtkEventBoxClass parent_class;
	void (*set_from_config) (DejaDupConfigWidget* self);
};

struct _DejaDupConfigLabel {
	DejaDupConfigWidget parent_instance;
	DejaDupConfigLabelPrivate * priv;
	GtkHBox* hbox;
	GtkLabel* label;
};

struct _DejaDupConfigLabelClass {
	DejaDupConfigWidgetClass parent_class;
};

struct _DejaDupConfigLabelBool {
	DejaDupConfigLabel parent_instance;
	DejaDupConfigLabelBoolPrivate * priv;
};

struct _DejaDupConfigLabelBoolClass {
	DejaDupConfigLabelClass parent_class;
};


static gpointer deja_dup_config_label_bool_parent_class = NULL;

GType deja_dup_config_widget_get_type (void);
GType deja_dup_config_label_get_type (void);
GType deja_dup_config_label_bool_get_type (void);
enum  {
	DEJA_DUP_CONFIG_LABEL_BOOL_DUMMY_PROPERTY
};
DejaDupConfigLabelBool* deja_dup_config_label_bool_new (const char* key);
DejaDupConfigLabelBool* deja_dup_config_label_bool_construct (GType object_type, const char* key);
const char* deja_dup_config_widget_get_key (DejaDupConfigWidget* self);
static void deja_dup_config_label_bool_real_set_from_config (DejaDupConfigWidget* base);



DejaDupConfigLabelBool* deja_dup_config_label_bool_construct (GType object_type, const char* key) {
	DejaDupConfigLabelBool * self;
	g_return_val_if_fail (key != NULL, NULL);
	self = (DejaDupConfigLabelBool*) g_object_new (object_type, "key", key, NULL);
	return self;
}


DejaDupConfigLabelBool* deja_dup_config_label_bool_new (const char* key) {
	return deja_dup_config_label_bool_construct (DEJA_DUP_TYPE_CONFIG_LABEL_BOOL, key);
}


static void deja_dup_config_label_bool_real_set_from_config (DejaDupConfigWidget* base) {
	DejaDupConfigLabelBool * self;
	GError * _inner_error_;
	gboolean val = FALSE;
	self = (DejaDupConfigLabelBool*) base;
	_inner_error_ = NULL;
	{
		gboolean _tmp0_;
		const char* _tmp1_;
		_tmp0_ = gconf_client_get_bool (((DejaDupConfigWidget*) self)->client, deja_dup_config_widget_get_key ((DejaDupConfigWidget*) self), &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch10_g_error;
		}
		val = _tmp0_;
		_tmp1_ = NULL;
		if (val) {
			_tmp1_ = _ ("Yes");
		} else {
			_tmp1_ = _ ("No");
		}
		gtk_label_set_label (((DejaDupConfigLabel*) self)->label, _tmp1_);
	}
	goto __finally10;
	__catch10_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		{
			g_warning ("ConfigLabelBool.vala:38: %s\n", e->message);
			_g_error_free0 (e);
		}
	}
	__finally10:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void deja_dup_config_label_bool_class_init (DejaDupConfigLabelBoolClass * klass) {
	deja_dup_config_label_bool_parent_class = g_type_class_peek_parent (klass);
	DEJA_DUP_CONFIG_WIDGET_CLASS (klass)->set_from_config = deja_dup_config_label_bool_real_set_from_config;
}


static void deja_dup_config_label_bool_instance_init (DejaDupConfigLabelBool * self) {
}


GType deja_dup_config_label_bool_get_type (void) {
	static volatile gsize deja_dup_config_label_bool_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_config_label_bool_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DejaDupConfigLabelBoolClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deja_dup_config_label_bool_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DejaDupConfigLabelBool), 0, (GInstanceInitFunc) deja_dup_config_label_bool_instance_init, NULL };
		GType deja_dup_config_label_bool_type_id;
		deja_dup_config_label_bool_type_id = g_type_register_static (DEJA_DUP_TYPE_CONFIG_LABEL, "DejaDupConfigLabelBool", &g_define_type_info, 0);
		g_once_init_leave (&deja_dup_config_label_bool_type_id__volatile, deja_dup_config_label_bool_type_id);
	}
	return deja_dup_config_label_bool_type_id__volatile;
}




