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

/*
 * Copyright 2016 Michael Gratton <mike@vee.net>
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later). See the COPYING file in this distribution.
 */

#include "geary-client-43.0.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "geary-engine.h"
#include <glib-object.h>

enum  {
	COMPONENTS_PLACEHOLDER_PANE_0_PROPERTY,
	COMPONENTS_PLACEHOLDER_PANE_ICON_NAME_PROPERTY,
	COMPONENTS_PLACEHOLDER_PANE_TITLE_PROPERTY,
	COMPONENTS_PLACEHOLDER_PANE_SUBTITLE_PROPERTY,
	COMPONENTS_PLACEHOLDER_PANE_NUM_PROPERTIES
};
static GParamSpec* components_placeholder_pane_properties[COMPONENTS_PLACEHOLDER_PANE_NUM_PROPERTIES];

struct _ComponentsPlaceholderPanePrivate {
	GtkImage* placeholder_image;
	GtkLabel* title_label;
	GtkLabel* subtitle_label;
};

static gint ComponentsPlaceholderPane_private_offset;
static gpointer components_placeholder_pane_parent_class = NULL;

static void components_placeholder_pane_update (ComponentsPlaceholderPane* self);
static void components_placeholder_pane_finalize (GObject * obj);
static GType components_placeholder_pane_get_type_once (void);
static void _vala_components_placeholder_pane_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec);
static void _vala_components_placeholder_pane_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec);

static inline gpointer
components_placeholder_pane_get_instance_private (ComponentsPlaceholderPane* self)
{
	return G_STRUCT_MEMBER_P (self, ComponentsPlaceholderPane_private_offset);
}

gchar*
components_placeholder_pane_get_icon_name (ComponentsPlaceholderPane* self)
{
	gchar* result;
	GtkImage* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_val_if_fail (COMPONENTS_IS_PLACEHOLDER_PANE (self), NULL);
	_tmp0_ = self->priv->placeholder_image;
	g_object_get (_tmp0_, "icon-name", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
components_placeholder_pane_set_icon_name (ComponentsPlaceholderPane* self,
                                           const gchar* value)
{
	GtkImage* _tmp0_;
	g_return_if_fail (COMPONENTS_IS_PLACEHOLDER_PANE (self));
	_tmp0_ = self->priv->placeholder_image;
	g_object_set (_tmp0_, "icon-name", value, NULL);
	g_object_notify_by_pspec ((GObject *) self, components_placeholder_pane_properties[COMPONENTS_PLACEHOLDER_PANE_ICON_NAME_PROPERTY]);
}

const gchar*
components_placeholder_pane_get_title (ComponentsPlaceholderPane* self)
{
	const gchar* result;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (COMPONENTS_IS_PLACEHOLDER_PANE (self), NULL);
	_tmp0_ = self->priv->title_label;
	_tmp1_ = gtk_label_get_text (_tmp0_);
	result = _tmp1_;
	return result;
}

void
components_placeholder_pane_set_title (ComponentsPlaceholderPane* self,
                                       const gchar* value)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (COMPONENTS_IS_PLACEHOLDER_PANE (self));
	_tmp0_ = self->priv->title_label;
	gtk_label_set_text (_tmp0_, value);
	components_placeholder_pane_update (self);
	g_object_notify_by_pspec ((GObject *) self, components_placeholder_pane_properties[COMPONENTS_PLACEHOLDER_PANE_TITLE_PROPERTY]);
}

const gchar*
components_placeholder_pane_get_subtitle (ComponentsPlaceholderPane* self)
{
	const gchar* result;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (COMPONENTS_IS_PLACEHOLDER_PANE (self), NULL);
	_tmp0_ = self->priv->subtitle_label;
	_tmp1_ = gtk_label_get_text (_tmp0_);
	result = _tmp1_;
	return result;
}

void
components_placeholder_pane_set_subtitle (ComponentsPlaceholderPane* self,
                                          const gchar* value)
{
	GtkLabel* _tmp0_;
	g_return_if_fail (COMPONENTS_IS_PLACEHOLDER_PANE (self));
	_tmp0_ = self->priv->subtitle_label;
	gtk_label_set_text (_tmp0_, value);
	components_placeholder_pane_update (self);
	g_object_notify_by_pspec ((GObject *) self, components_placeholder_pane_properties[COMPONENTS_PLACEHOLDER_PANE_SUBTITLE_PROPERTY]);
}

static void
components_placeholder_pane_update (ComponentsPlaceholderPane* self)
{
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	GtkLabel* _tmp3_;
	const gchar* _tmp4_;
	gboolean _tmp6_ = FALSE;
	GtkLabel* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	g_return_if_fail (COMPONENTS_IS_PLACEHOLDER_PANE (self));
	_tmp0_ = self->priv->title_label;
	_tmp1_ = gtk_label_get_text (_tmp0_);
	if (geary_string_is_empty_or_whitespace (_tmp1_)) {
		GtkLabel* _tmp2_;
		_tmp2_ = self->priv->title_label;
		gtk_widget_hide (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_widget_get_type (), GtkWidget));
	}
	_tmp3_ = self->priv->subtitle_label;
	_tmp4_ = gtk_label_get_text (_tmp3_);
	if (geary_string_is_empty_or_whitespace (_tmp4_)) {
		GtkLabel* _tmp5_;
		_tmp5_ = self->priv->subtitle_label;
		gtk_widget_hide (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, gtk_widget_get_type (), GtkWidget));
	}
	_tmp7_ = self->priv->title_label;
	_tmp8_ = gtk_widget_get_visible (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gtk_widget_get_type (), GtkWidget));
	_tmp9_ = _tmp8_;
	if (_tmp9_) {
		_tmp6_ = TRUE;
	} else {
		GtkLabel* _tmp10_;
		gboolean _tmp11_;
		gboolean _tmp12_;
		_tmp10_ = self->priv->subtitle_label;
		_tmp11_ = gtk_widget_get_visible (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, gtk_widget_get_type (), GtkWidget));
		_tmp12_ = _tmp11_;
		_tmp6_ = _tmp12_;
	}
	if (_tmp6_) {
		GtkStyleContext* _tmp13_;
		_tmp13_ = gtk_widget_get_style_context (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
		gtk_style_context_add_class (_tmp13_, COMPONENTS_PLACEHOLDER_PANE_CLASS_HAS_TEXT);
	}
}

ComponentsPlaceholderPane*
components_placeholder_pane_construct (GType object_type)
{
	ComponentsPlaceholderPane * self = NULL;
	self = (ComponentsPlaceholderPane*) g_object_new (object_type, NULL);
	return self;
}

ComponentsPlaceholderPane*
components_placeholder_pane_new (void)
{
	return components_placeholder_pane_construct (COMPONENTS_TYPE_PLACEHOLDER_PANE);
}

static void
components_placeholder_pane_class_init (ComponentsPlaceholderPaneClass * klass,
                                        gpointer klass_data)
{
	components_placeholder_pane_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ComponentsPlaceholderPane_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_components_placeholder_pane_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_components_placeholder_pane_set_property;
	G_OBJECT_CLASS (klass)->finalize = components_placeholder_pane_finalize;
	/** The icon name of the pane's image. */
	g_object_class_install_property (G_OBJECT_CLASS (klass), COMPONENTS_PLACEHOLDER_PANE_ICON_NAME_PROPERTY, components_placeholder_pane_properties[COMPONENTS_PLACEHOLDER_PANE_ICON_NAME_PROPERTY] = g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/** The text of the pane's title label. */
	g_object_class_install_property (G_OBJECT_CLASS (klass), COMPONENTS_PLACEHOLDER_PANE_TITLE_PROPERTY, components_placeholder_pane_properties[COMPONENTS_PLACEHOLDER_PANE_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/** The text of the pane's sub-title label. */
	g_object_class_install_property (G_OBJECT_CLASS (klass), COMPONENTS_PLACEHOLDER_PANE_SUBTITLE_PROPERTY, components_placeholder_pane_properties[COMPONENTS_PLACEHOLDER_PANE_SUBTITLE_PROPERTY] = g_param_spec_string ("subtitle", "subtitle", "subtitle", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Geary/components-placeholder-pane.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "placeholder_image", FALSE, ComponentsPlaceholderPane_private_offset + G_STRUCT_OFFSET (ComponentsPlaceholderPanePrivate, placeholder_image));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "title_label", FALSE, ComponentsPlaceholderPane_private_offset + G_STRUCT_OFFSET (ComponentsPlaceholderPanePrivate, title_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "subtitle_label", FALSE, ComponentsPlaceholderPane_private_offset + G_STRUCT_OFFSET (ComponentsPlaceholderPanePrivate, subtitle_label));
}

static void
components_placeholder_pane_instance_init (ComponentsPlaceholderPane * self,
                                           gpointer klass)
{
	self->priv = components_placeholder_pane_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
components_placeholder_pane_finalize (GObject * obj)
{
	ComponentsPlaceholderPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, COMPONENTS_TYPE_PLACEHOLDER_PANE, ComponentsPlaceholderPane);
	G_OBJECT_CLASS (components_placeholder_pane_parent_class)->finalize (obj);
}

/**
 * A placeholder image and message for empty views.
 */
static GType
components_placeholder_pane_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ComponentsPlaceholderPaneClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) components_placeholder_pane_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ComponentsPlaceholderPane), 0, (GInstanceInitFunc) components_placeholder_pane_instance_init, NULL };
	GType components_placeholder_pane_type_id;
	components_placeholder_pane_type_id = g_type_register_static (gtk_grid_get_type (), "ComponentsPlaceholderPane", &g_define_type_info, 0);
	ComponentsPlaceholderPane_private_offset = g_type_add_instance_private (components_placeholder_pane_type_id, sizeof (ComponentsPlaceholderPanePrivate));
	return components_placeholder_pane_type_id;
}

GType
components_placeholder_pane_get_type (void)
{
	static volatile gsize components_placeholder_pane_type_id__once = 0;
	if (g_once_init_enter (&components_placeholder_pane_type_id__once)) {
		GType components_placeholder_pane_type_id;
		components_placeholder_pane_type_id = components_placeholder_pane_get_type_once ();
		g_once_init_leave (&components_placeholder_pane_type_id__once, components_placeholder_pane_type_id);
	}
	return components_placeholder_pane_type_id__once;
}

static void
_vala_components_placeholder_pane_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec)
{
	ComponentsPlaceholderPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, COMPONENTS_TYPE_PLACEHOLDER_PANE, ComponentsPlaceholderPane);
	switch (property_id) {
		case COMPONENTS_PLACEHOLDER_PANE_ICON_NAME_PROPERTY:
		g_value_take_string (value, components_placeholder_pane_get_icon_name (self));
		break;
		case COMPONENTS_PLACEHOLDER_PANE_TITLE_PROPERTY:
		g_value_set_string (value, components_placeholder_pane_get_title (self));
		break;
		case COMPONENTS_PLACEHOLDER_PANE_SUBTITLE_PROPERTY:
		g_value_set_string (value, components_placeholder_pane_get_subtitle (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_components_placeholder_pane_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec)
{
	ComponentsPlaceholderPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, COMPONENTS_TYPE_PLACEHOLDER_PANE, ComponentsPlaceholderPane);
	switch (property_id) {
		case COMPONENTS_PLACEHOLDER_PANE_ICON_NAME_PROPERTY:
		components_placeholder_pane_set_icon_name (self, g_value_get_string (value));
		break;
		case COMPONENTS_PLACEHOLDER_PANE_TITLE_PROPERTY:
		components_placeholder_pane_set_title (self, g_value_get_string (value));
		break;
		case COMPONENTS_PLACEHOLDER_PANE_SUBTITLE_PROPERTY:
		components_placeholder_pane_set_subtitle (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

