/* registry-placeholder.c generated by valac 0.56.3, the Vala compiler
 * generated from registry-placeholder.vala, do not modify */

/*
  This file is part of Dconf Editor

  Dconf Editor 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.

  Dconf Editor 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 Dconf Editor.  If not, see <https://www.gnu.org/licenses/>.
*/

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

#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_REGISTRY_PLACEHOLDER (registry_placeholder_get_type ())
#define REGISTRY_PLACEHOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_REGISTRY_PLACEHOLDER, RegistryPlaceholder))
#define REGISTRY_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_REGISTRY_PLACEHOLDER, RegistryPlaceholderClass))
#define IS_REGISTRY_PLACEHOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_REGISTRY_PLACEHOLDER))
#define IS_REGISTRY_PLACEHOLDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_REGISTRY_PLACEHOLDER))
#define REGISTRY_PLACEHOLDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_REGISTRY_PLACEHOLDER, RegistryPlaceholderClass))

typedef struct _RegistryPlaceholder RegistryPlaceholder;
typedef struct _RegistryPlaceholderClass RegistryPlaceholderClass;
typedef struct _RegistryPlaceholderPrivate RegistryPlaceholderPrivate;
enum  {
	REGISTRY_PLACEHOLDER_0_PROPERTY,
	REGISTRY_PLACEHOLDER_LABEL_PROPERTY,
	REGISTRY_PLACEHOLDER_ICON_NAME_PROPERTY,
	REGISTRY_PLACEHOLDER_BIG_PROPERTY,
	REGISTRY_PLACEHOLDER_NUM_PROPERTIES
};
static GParamSpec* registry_placeholder_properties[REGISTRY_PLACEHOLDER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _RegistryPlaceholder {
	GtkGrid parent_instance;
	RegistryPlaceholderPrivate * priv;
};

struct _RegistryPlaceholderClass {
	GtkGridClass parent_class;
};

struct _RegistryPlaceholderPrivate {
	GtkLabel* placeholder_label;
	GtkImage* placeholder_image;
	gchar* _icon_name;
};

static gint RegistryPlaceholder_private_offset;
static gpointer registry_placeholder_parent_class = NULL;

VALA_EXTERN GType registry_placeholder_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RegistryPlaceholder, g_object_unref)
VALA_EXTERN RegistryPlaceholder* registry_placeholder_new (const gchar* _icon_name,
                                               const gchar* _label,
                                               gboolean _big);
VALA_EXTERN RegistryPlaceholder* registry_placeholder_construct (GType object_type,
                                                     const gchar* _icon_name,
                                                     const gchar* _label,
                                                     gboolean _big);
VALA_EXTERN void registry_placeholder_set_label (RegistryPlaceholder* self,
                                     const gchar* value);
static const gchar* registry_placeholder_get_icon_name (RegistryPlaceholder* self);
static void registry_placeholder_set_icon_name (RegistryPlaceholder* self,
                                         const gchar* value);
VALA_EXTERN void registry_placeholder_set_big (RegistryPlaceholder* self,
                                   gboolean value);
static GObject * registry_placeholder_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
static void registry_placeholder_finalize (GObject * obj);
static GType registry_placeholder_get_type_once (void);
static void _vala_registry_placeholder_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_registry_placeholder_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
registry_placeholder_get_instance_private (RegistryPlaceholder* self)
{
	return G_STRUCT_MEMBER_P (self, RegistryPlaceholder_private_offset);
}

RegistryPlaceholder*
registry_placeholder_construct (GType object_type,
                                const gchar* _icon_name,
                                const gchar* _label,
                                gboolean _big)
{
	RegistryPlaceholder * self = NULL;
	g_return_val_if_fail (_icon_name != NULL, NULL);
	g_return_val_if_fail (_label != NULL, NULL);
	self = (RegistryPlaceholder*) g_object_new (object_type, "icon-name", _icon_name, "label", _label, "big", _big, NULL);
	return self;
}

RegistryPlaceholder*
registry_placeholder_new (const gchar* _icon_name,
                          const gchar* _label,
                          gboolean _big)
{
	return registry_placeholder_construct (TYPE_REGISTRY_PLACEHOLDER, _icon_name, _label, _big);
}

void
registry_placeholder_set_label (RegistryPlaceholder* self,
                                const gchar* value)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->placeholder_label;
	gtk_label_set_label (_tmp0_, value);
}

static const gchar*
registry_placeholder_get_icon_name (RegistryPlaceholder* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_icon_name;
	result = _tmp0_;
	return result;
}

static void
registry_placeholder_set_icon_name (RegistryPlaceholder* self,
                                    const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_icon_name);
	self->priv->_icon_name = _tmp0_;
}

void
registry_placeholder_set_big (RegistryPlaceholder* self,
                              gboolean value)
{
	g_return_if_fail (self != NULL);
	if (value) {
		GtkImage* _tmp0_;
		GtkStyleContext* _tmp1_;
		_tmp0_ = self->priv->placeholder_image;
		gtk_image_set_pixel_size (_tmp0_, 72);
		_tmp1_ = gtk_widget_get_style_context ((GtkWidget*) self);
		gtk_style_context_add_class (_tmp1_, "big-popover");
	} else {
		GtkImage* _tmp2_;
		GtkStyleContext* _tmp3_;
		_tmp2_ = self->priv->placeholder_image;
		gtk_image_set_pixel_size (_tmp2_, 36);
		_tmp3_ = gtk_widget_get_style_context ((GtkWidget*) self);
		gtk_style_context_remove_class (_tmp3_, "big-popover");
	}
}

static GObject *
registry_placeholder_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	RegistryPlaceholder * self;
	GtkImage* _tmp0_;
	const gchar* _tmp1_;
	parent_class = G_OBJECT_CLASS (registry_placeholder_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_REGISTRY_PLACEHOLDER, RegistryPlaceholder);
	_tmp0_ = self->priv->placeholder_image;
	_tmp1_ = self->priv->_icon_name;
	g_object_set (_tmp0_, "icon-name", _tmp1_, NULL);
	return obj;
}

static void
registry_placeholder_class_init (RegistryPlaceholderClass * klass,
                                 gpointer klass_data)
{
	registry_placeholder_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RegistryPlaceholder_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_registry_placeholder_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_registry_placeholder_set_property;
	G_OBJECT_CLASS (klass)->constructor = registry_placeholder_constructor;
	G_OBJECT_CLASS (klass)->finalize = registry_placeholder_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), REGISTRY_PLACEHOLDER_LABEL_PROPERTY, registry_placeholder_properties[REGISTRY_PLACEHOLDER_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), REGISTRY_PLACEHOLDER_ICON_NAME_PROPERTY, registry_placeholder_properties[REGISTRY_PLACEHOLDER_ICON_NAME_PROPERTY] = g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), REGISTRY_PLACEHOLDER_BIG_PROPERTY, registry_placeholder_properties[REGISTRY_PLACEHOLDER_BIG_PROPERTY] = g_param_spec_boolean ("big", "big", "big", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT | G_PARAM_EXPLICIT_NOTIFY));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/ca/desrt/dconf-editor/ui/registry-placeholder.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "placeholder_label", FALSE, RegistryPlaceholder_private_offset + G_STRUCT_OFFSET (RegistryPlaceholderPrivate, placeholder_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "placeholder_image", FALSE, RegistryPlaceholder_private_offset + G_STRUCT_OFFSET (RegistryPlaceholderPrivate, placeholder_image));
}

static void
registry_placeholder_instance_init (RegistryPlaceholder * self,
                                    gpointer klass)
{
	self->priv = registry_placeholder_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
registry_placeholder_finalize (GObject * obj)
{
	RegistryPlaceholder * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_REGISTRY_PLACEHOLDER, RegistryPlaceholder);
	_g_free0 (self->priv->_icon_name);
	G_OBJECT_CLASS (registry_placeholder_parent_class)->finalize (obj);
}

static GType
registry_placeholder_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RegistryPlaceholderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) registry_placeholder_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RegistryPlaceholder), 0, (GInstanceInitFunc) registry_placeholder_instance_init, NULL };
	GType registry_placeholder_type_id;
	registry_placeholder_type_id = g_type_register_static (gtk_grid_get_type (), "RegistryPlaceholder", &g_define_type_info, 0);
	RegistryPlaceholder_private_offset = g_type_add_instance_private (registry_placeholder_type_id, sizeof (RegistryPlaceholderPrivate));
	return registry_placeholder_type_id;
}

GType
registry_placeholder_get_type (void)
{
	static volatile gsize registry_placeholder_type_id__once = 0;
	if (g_once_init_enter (&registry_placeholder_type_id__once)) {
		GType registry_placeholder_type_id;
		registry_placeholder_type_id = registry_placeholder_get_type_once ();
		g_once_init_leave (&registry_placeholder_type_id__once, registry_placeholder_type_id);
	}
	return registry_placeholder_type_id__once;
}

static void
_vala_registry_placeholder_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	RegistryPlaceholder * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_REGISTRY_PLACEHOLDER, RegistryPlaceholder);
	switch (property_id) {
		case REGISTRY_PLACEHOLDER_ICON_NAME_PROPERTY:
		g_value_set_string (value, registry_placeholder_get_icon_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_registry_placeholder_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	RegistryPlaceholder * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_REGISTRY_PLACEHOLDER, RegistryPlaceholder);
	switch (property_id) {
		case REGISTRY_PLACEHOLDER_LABEL_PROPERTY:
		registry_placeholder_set_label (self, g_value_get_string (value));
		break;
		case REGISTRY_PLACEHOLDER_ICON_NAME_PROPERTY:
		registry_placeholder_set_icon_name (self, g_value_get_string (value));
		break;
		case REGISTRY_PLACEHOLDER_BIG_PROPERTY:
		registry_placeholder_set_big (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

