/* components-headerbar-conversation-list.c generated by valac 0.56.3, the Vala compiler
 * generated from components-headerbar-conversation-list.vala, do not modify */

/*
 * Copyright © 2017 Software Freedom Conservancy Inc.
 * Copyright © 2021 Michael Gratton <mike@vee.net>
 * Copyright © 2022 Cédric Bellegarde <cedric.bellegarde@adishatz.org>
 *
 * 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 <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <glib-object.h>

enum  {
	COMPONENTS_CONVERSATION_LIST_HEADER_BAR_0_PROPERTY,
	COMPONENTS_CONVERSATION_LIST_HEADER_BAR_ACCOUNT_PROPERTY,
	COMPONENTS_CONVERSATION_LIST_HEADER_BAR_FOLDER_PROPERTY,
	COMPONENTS_CONVERSATION_LIST_HEADER_BAR_SEARCH_OPEN_PROPERTY,
	COMPONENTS_CONVERSATION_LIST_HEADER_BAR_NUM_PROPERTIES
};
static GParamSpec* components_conversation_list_header_bar_properties[COMPONENTS_CONVERSATION_LIST_HEADER_BAR_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _ComponentsConversationListHeaderBarPrivate {
	gchar* _account;
	gchar* _folder;
	gboolean _search_open;
	GtkToggleButton* search_button;
};

static gint ComponentsConversationListHeaderBar_private_offset;
static gpointer components_conversation_list_header_bar_parent_class = NULL;

static GObject * components_conversation_list_header_bar_constructor (GType type,
                                                               guint n_construct_properties,
                                                               GObjectConstructParam * construct_properties);
static void components_conversation_list_header_bar_finalize (GObject * obj);
static GType components_conversation_list_header_bar_get_type_once (void);
static void _vala_components_conversation_list_header_bar_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec);
static void _vala_components_conversation_list_header_bar_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec);

static inline gpointer
components_conversation_list_header_bar_get_instance_private (ComponentsConversationListHeaderBar* self)
{
	return G_STRUCT_MEMBER_P (self, ComponentsConversationListHeaderBar_private_offset);
}

const gchar*
components_conversation_list_header_bar_get_account (ComponentsConversationListHeaderBar* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (COMPONENTS_IS_CONVERSATION_LIST_HEADER_BAR (self), NULL);
	_tmp0_ = self->priv->_account;
	result = _tmp0_;
	return result;
}

void
components_conversation_list_header_bar_set_account (ComponentsConversationListHeaderBar* self,
                                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (COMPONENTS_IS_CONVERSATION_LIST_HEADER_BAR (self));
	old_value = components_conversation_list_header_bar_get_account (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_account);
		self->priv->_account = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, components_conversation_list_header_bar_properties[COMPONENTS_CONVERSATION_LIST_HEADER_BAR_ACCOUNT_PROPERTY]);
	}
}

const gchar*
components_conversation_list_header_bar_get_folder (ComponentsConversationListHeaderBar* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (COMPONENTS_IS_CONVERSATION_LIST_HEADER_BAR (self), NULL);
	_tmp0_ = self->priv->_folder;
	result = _tmp0_;
	return result;
}

void
components_conversation_list_header_bar_set_folder (ComponentsConversationListHeaderBar* self,
                                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (COMPONENTS_IS_CONVERSATION_LIST_HEADER_BAR (self));
	old_value = components_conversation_list_header_bar_get_folder (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_folder);
		self->priv->_folder = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, components_conversation_list_header_bar_properties[COMPONENTS_CONVERSATION_LIST_HEADER_BAR_FOLDER_PROPERTY]);
	}
}

gboolean
components_conversation_list_header_bar_get_search_open (ComponentsConversationListHeaderBar* self)
{
	gboolean result;
	g_return_val_if_fail (COMPONENTS_IS_CONVERSATION_LIST_HEADER_BAR (self), FALSE);
	result = self->priv->_search_open;
	return result;
}

void
components_conversation_list_header_bar_set_search_open (ComponentsConversationListHeaderBar* self,
                                                         gboolean value)
{
	gboolean old_value;
	g_return_if_fail (COMPONENTS_IS_CONVERSATION_LIST_HEADER_BAR (self));
	old_value = components_conversation_list_header_bar_get_search_open (self);
	if (old_value != value) {
		self->priv->_search_open = value;
		g_object_notify_by_pspec ((GObject *) self, components_conversation_list_header_bar_properties[COMPONENTS_CONVERSATION_LIST_HEADER_BAR_SEARCH_OPEN_PROPERTY]);
	}
}

ComponentsConversationListHeaderBar*
components_conversation_list_header_bar_construct (GType object_type)
{
	ComponentsConversationListHeaderBar * self = NULL;
	self = (ComponentsConversationListHeaderBar*) g_object_new (object_type, NULL);
	return self;
}

ComponentsConversationListHeaderBar*
components_conversation_list_header_bar_new (void)
{
	return components_conversation_list_header_bar_construct (COMPONENTS_TYPE_CONVERSATION_LIST_HEADER_BAR);
}

static GObject *
components_conversation_list_header_bar_constructor (GType type,
                                                     guint n_construct_properties,
                                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ComponentsConversationListHeaderBar * self;
	GtkToggleButton* _tmp0_;
	parent_class = G_OBJECT_CLASS (components_conversation_list_header_bar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, COMPONENTS_TYPE_CONVERSATION_LIST_HEADER_BAR, ComponentsConversationListHeaderBar);
	g_object_bind_property_with_closures (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject), "account", G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject), "title", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	g_object_bind_property_with_closures (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject), "folder", G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject), "subtitle", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp0_ = self->priv->search_button;
	g_object_bind_property_with_closures (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject), "search-open", G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, G_TYPE_OBJECT, GObject), "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	return obj;
}

static void
components_conversation_list_header_bar_class_init (ComponentsConversationListHeaderBarClass * klass,
                                                    gpointer klass_data)
{
	components_conversation_list_header_bar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ComponentsConversationListHeaderBar_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_components_conversation_list_header_bar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_components_conversation_list_header_bar_set_property;
	G_OBJECT_CLASS (klass)->constructor = components_conversation_list_header_bar_constructor;
	G_OBJECT_CLASS (klass)->finalize = components_conversation_list_header_bar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), COMPONENTS_CONVERSATION_LIST_HEADER_BAR_ACCOUNT_PROPERTY, components_conversation_list_header_bar_properties[COMPONENTS_CONVERSATION_LIST_HEADER_BAR_ACCOUNT_PROPERTY] = g_param_spec_string ("account", "account", "account", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), COMPONENTS_CONVERSATION_LIST_HEADER_BAR_FOLDER_PROPERTY, components_conversation_list_header_bar_properties[COMPONENTS_CONVERSATION_LIST_HEADER_BAR_FOLDER_PROPERTY] = g_param_spec_string ("folder", "folder", "folder", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), COMPONENTS_CONVERSATION_LIST_HEADER_BAR_SEARCH_OPEN_PROPERTY, components_conversation_list_header_bar_properties[COMPONENTS_CONVERSATION_LIST_HEADER_BAR_SEARCH_OPEN_PROPERTY] = g_param_spec_boolean ("search-open", "search-open", "search-open", FALSE, 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-headerbar-conversation-list.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "search_button", FALSE, ComponentsConversationListHeaderBar_private_offset + G_STRUCT_OFFSET (ComponentsConversationListHeaderBarPrivate, search_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "back_button", FALSE, G_STRUCT_OFFSET (ComponentsConversationListHeaderBar, back_button));
}

static void
components_conversation_list_header_bar_instance_init (ComponentsConversationListHeaderBar * self,
                                                       gpointer klass)
{
	self->priv = components_conversation_list_header_bar_get_instance_private (self);
	self->priv->_search_open = FALSE;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
components_conversation_list_header_bar_finalize (GObject * obj)
{
	ComponentsConversationListHeaderBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, COMPONENTS_TYPE_CONVERSATION_LIST_HEADER_BAR, ComponentsConversationListHeaderBar);
	_g_free0 (self->priv->_account);
	_g_free0 (self->priv->_folder);
	G_OBJECT_CLASS (components_conversation_list_header_bar_parent_class)->finalize (obj);
}

/**
 * The conversation list headerbar.
 *
 * @see Application.MainWindow
 */
static GType
components_conversation_list_header_bar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ComponentsConversationListHeaderBarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) components_conversation_list_header_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ComponentsConversationListHeaderBar), 0, (GInstanceInitFunc) components_conversation_list_header_bar_instance_init, NULL };
	GType components_conversation_list_header_bar_type_id;
	components_conversation_list_header_bar_type_id = g_type_register_static (hdy_header_bar_get_type (), "ComponentsConversationListHeaderBar", &g_define_type_info, 0);
	ComponentsConversationListHeaderBar_private_offset = g_type_add_instance_private (components_conversation_list_header_bar_type_id, sizeof (ComponentsConversationListHeaderBarPrivate));
	return components_conversation_list_header_bar_type_id;
}

GType
components_conversation_list_header_bar_get_type (void)
{
	static volatile gsize components_conversation_list_header_bar_type_id__once = 0;
	if (g_once_init_enter (&components_conversation_list_header_bar_type_id__once)) {
		GType components_conversation_list_header_bar_type_id;
		components_conversation_list_header_bar_type_id = components_conversation_list_header_bar_get_type_once ();
		g_once_init_leave (&components_conversation_list_header_bar_type_id__once, components_conversation_list_header_bar_type_id);
	}
	return components_conversation_list_header_bar_type_id__once;
}

static void
_vala_components_conversation_list_header_bar_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec)
{
	ComponentsConversationListHeaderBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, COMPONENTS_TYPE_CONVERSATION_LIST_HEADER_BAR, ComponentsConversationListHeaderBar);
	switch (property_id) {
		case COMPONENTS_CONVERSATION_LIST_HEADER_BAR_ACCOUNT_PROPERTY:
		g_value_set_string (value, components_conversation_list_header_bar_get_account (self));
		break;
		case COMPONENTS_CONVERSATION_LIST_HEADER_BAR_FOLDER_PROPERTY:
		g_value_set_string (value, components_conversation_list_header_bar_get_folder (self));
		break;
		case COMPONENTS_CONVERSATION_LIST_HEADER_BAR_SEARCH_OPEN_PROPERTY:
		g_value_set_boolean (value, components_conversation_list_header_bar_get_search_open (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_components_conversation_list_header_bar_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec)
{
	ComponentsConversationListHeaderBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, COMPONENTS_TYPE_CONVERSATION_LIST_HEADER_BAR, ComponentsConversationListHeaderBar);
	switch (property_id) {
		case COMPONENTS_CONVERSATION_LIST_HEADER_BAR_ACCOUNT_PROPERTY:
		components_conversation_list_header_bar_set_account (self, g_value_get_string (value));
		break;
		case COMPONENTS_CONVERSATION_LIST_HEADER_BAR_FOLDER_PROPERTY:
		components_conversation_list_header_bar_set_folder (self, g_value_get_string (value));
		break;
		case COMPONENTS_CONVERSATION_LIST_HEADER_BAR_SEARCH_OPEN_PROPERTY:
		components_conversation_list_header_bar_set_search_open (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

