/* KeywordList.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from KeywordList.vala, do not modify */

/* KeywordList.vala
 *
 * Copyright 2023 Diego Iván <diegoivan.mae@gmail.com>
 *
 * This program 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.
 *
 * 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#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 PAPER_CLIP_TYPE_KEYWORD_LIST (paper_clip_keyword_list_get_type ())
#define PAPER_CLIP_KEYWORD_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAPER_CLIP_TYPE_KEYWORD_LIST, PaperClipKeywordList))
#define PAPER_CLIP_KEYWORD_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAPER_CLIP_TYPE_KEYWORD_LIST, PaperClipKeywordListClass))
#define PAPER_CLIP_IS_KEYWORD_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PAPER_CLIP_TYPE_KEYWORD_LIST))
#define PAPER_CLIP_IS_KEYWORD_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAPER_CLIP_TYPE_KEYWORD_LIST))
#define PAPER_CLIP_KEYWORD_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAPER_CLIP_TYPE_KEYWORD_LIST, PaperClipKeywordListClass))

typedef struct _PaperClipKeywordList PaperClipKeywordList;
typedef struct _PaperClipKeywordListClass PaperClipKeywordListClass;
typedef struct _PaperClipKeywordListPrivate PaperClipKeywordListPrivate;

#define PAPER_CLIP_TYPE_DOCUMENT (paper_clip_document_get_type ())
#define PAPER_CLIP_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAPER_CLIP_TYPE_DOCUMENT, PaperClipDocument))
#define PAPER_CLIP_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAPER_CLIP_TYPE_DOCUMENT, PaperClipDocumentClass))
#define PAPER_CLIP_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PAPER_CLIP_TYPE_DOCUMENT))
#define PAPER_CLIP_IS_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAPER_CLIP_TYPE_DOCUMENT))
#define PAPER_CLIP_DOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAPER_CLIP_TYPE_DOCUMENT, PaperClipDocumentClass))

typedef struct _PaperClipDocument PaperClipDocument;
typedef struct _PaperClipDocumentClass PaperClipDocumentClass;
enum  {
	PAPER_CLIP_KEYWORD_LIST_0_PROPERTY,
	PAPER_CLIP_KEYWORD_LIST_IS_EMPTY_PROPERTY,
	PAPER_CLIP_KEYWORD_LIST_DOCUMENT_PROPERTY,
	PAPER_CLIP_KEYWORD_LIST_NUM_PROPERTIES
};
static GParamSpec* paper_clip_keyword_list_properties[PAPER_CLIP_KEYWORD_LIST_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define PAPER_CLIP_TYPE_KEYWORD_ROW (paper_clip_keyword_row_get_type ())
#define PAPER_CLIP_KEYWORD_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAPER_CLIP_TYPE_KEYWORD_ROW, PaperClipKeywordRow))
#define PAPER_CLIP_KEYWORD_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAPER_CLIP_TYPE_KEYWORD_ROW, PaperClipKeywordRowClass))
#define PAPER_CLIP_IS_KEYWORD_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PAPER_CLIP_TYPE_KEYWORD_ROW))
#define PAPER_CLIP_IS_KEYWORD_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAPER_CLIP_TYPE_KEYWORD_ROW))
#define PAPER_CLIP_KEYWORD_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAPER_CLIP_TYPE_KEYWORD_ROW, PaperClipKeywordRowClass))

typedef struct _PaperClipKeywordRow PaperClipKeywordRow;
typedef struct _PaperClipKeywordRowClass PaperClipKeywordRowClass;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _PaperClipKeywordList {
	AdwPreferencesGroup parent_instance;
	PaperClipKeywordListPrivate * priv;
};

struct _PaperClipKeywordListClass {
	AdwPreferencesGroupClass parent_class;
};

struct _PaperClipKeywordListPrivate {
	GtkListBox* listbox;
	gboolean _is_empty;
	GtkWidget* empty_state_row;
	PaperClipDocument* _document;
};

static gint PaperClipKeywordList_private_offset;
static gpointer paper_clip_keyword_list_parent_class = NULL;

VALA_EXTERN GType paper_clip_keyword_list_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PaperClipKeywordList, g_object_unref)
VALA_EXTERN GType paper_clip_document_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PaperClipDocument, g_object_unref)
static GtkWidget* paper_clip_keyword_list_create_keyword_row (PaperClipKeywordList* self,
                                                       GObject* item);
VALA_EXTERN GType paper_clip_keyword_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PaperClipKeywordRow, g_object_unref)
VALA_EXTERN PaperClipDocument* paper_clip_keyword_list_get_document (PaperClipKeywordList* self);
VALA_EXTERN PaperClipKeywordRow* paper_clip_keyword_row_new (void);
VALA_EXTERN PaperClipKeywordRow* paper_clip_keyword_row_construct (GType object_type);
VALA_EXTERN void paper_clip_keyword_row_set_document (PaperClipKeywordRow* self,
                                          PaperClipDocument* value);
static void paper_clip_keyword_list_on_items_changed (PaperClipKeywordList* self);
VALA_EXTERN GListModel* paper_clip_document_get_keywords (PaperClipDocument* self);
static void paper_clip_keyword_list_create_default_row (PaperClipKeywordList* self);
static void paper_clip_keyword_list_set_is_empty (PaperClipKeywordList* self,
                                           gboolean value);
static void paper_clip_keyword_list_on_row_activated (PaperClipKeywordList* self,
                                               GtkListBoxRow* selected_row);
VALA_EXTERN void paper_clip_document_add_keyword (PaperClipDocument* self,
                                      const gchar* keyword);
static void _paper_clip_keyword_list_on_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                           GtkListBoxRow* row,
                                                                           gpointer self);
VALA_EXTERN PaperClipKeywordList* paper_clip_keyword_list_new (void);
VALA_EXTERN PaperClipKeywordList* paper_clip_keyword_list_construct (GType object_type);
VALA_EXTERN gboolean paper_clip_keyword_list_get_is_empty (PaperClipKeywordList* self);
VALA_EXTERN void paper_clip_keyword_list_set_document (PaperClipKeywordList* self,
                                           PaperClipDocument* value);
static GtkWidget* _paper_clip_keyword_list_create_keyword_row_gtk_list_box_create_widget_func (GObject* item,
                                                                                        gpointer self);
static void _paper_clip_keyword_list_on_items_changed_g_list_model_items_changed (GListModel* _sender,
                                                                           guint position,
                                                                           guint removed,
                                                                           guint added,
                                                                           gpointer self);
static GObject * paper_clip_keyword_list_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties);
static void _paper_clip_keyword_list___lambda7_ (PaperClipKeywordList* self);
static void __paper_clip_keyword_list___lambda7__g_simple_action_activate (GSimpleAction* _sender,
                                                                    GVariant* parameter,
                                                                    gpointer self);
static void paper_clip_keyword_list_finalize (GObject * obj);
static GType paper_clip_keyword_list_get_type_once (void);
static void _vala_paper_clip_keyword_list_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_paper_clip_keyword_list_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec);

static inline gpointer
paper_clip_keyword_list_get_instance_private (PaperClipKeywordList* self)
{
	return G_STRUCT_MEMBER_P (self, PaperClipKeywordList_private_offset);
}

static GtkWidget*
paper_clip_keyword_list_create_keyword_row (PaperClipKeywordList* self,
                                            GObject* item)
{
	PaperClipKeywordRow* row = NULL;
	gchar* _tmp0_;
	PaperClipDocument* _tmp1_;
	PaperClipDocument* _tmp2_;
	PaperClipKeywordRow* _tmp3_ = NULL;
	GtkWidget* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = g_strdup (_ ("Keyword"));
	_tmp1_ = paper_clip_keyword_list_get_document (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = paper_clip_keyword_row_new ();
	adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp3_, _tmp0_);
	_g_free0 (_tmp0_);
	paper_clip_keyword_row_set_document (_tmp3_, _tmp2_);
	g_object_ref_sink (_tmp3_);
	row = _tmp3_;
	g_object_bind_property_with_closures (item, "str", (GObject*) row, "text", 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)));
	result = (GtkWidget*) row;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
paper_clip_keyword_list_on_items_changed (PaperClipKeywordList* self)
{
	PaperClipDocument* _tmp0_;
	PaperClipDocument* _tmp1_;
	GListModel* _tmp2_;
	GListModel* _tmp3_;
	gint i = 0;
	GtkListBoxRow* current_row = NULL;
	PaperClipDocument* _tmp16_;
	PaperClipDocument* _tmp17_;
	GListModel* _tmp18_;
	GListModel* _tmp19_;
	g_return_if_fail (self != NULL);
	_tmp0_ = paper_clip_keyword_list_get_document (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = paper_clip_document_get_keywords (_tmp1_);
	_tmp3_ = _tmp2_;
	if (g_list_model_get_n_items (_tmp3_) == ((guint) 0)) {
		paper_clip_keyword_list_create_default_row (self);
		paper_clip_keyword_list_set_is_empty (self, TRUE);
		return;
	}
	i = 0;
	while (TRUE) {
		GtkListBox* _tmp4_;
		GtkListBoxRow* _tmp5_;
		GtkListBoxRow* _tmp6_;
		GtkListBoxRow* _tmp7_;
		GtkListBoxRow* _tmp8_;
		GtkWidget* _tmp9_;
		GtkListBox* _tmp12_;
		GtkListBoxRow* _tmp13_;
		gint _tmp15_;
		_tmp4_ = self->priv->listbox;
		_tmp5_ = gtk_list_box_get_row_at_index (_tmp4_, i);
		_tmp6_ = _g_object_ref0 (_tmp5_);
		_g_object_unref0 (current_row);
		current_row = _tmp6_;
		_tmp7_ = current_row;
		if (!(_tmp7_ != NULL)) {
			break;
		}
		_tmp8_ = current_row;
		_tmp9_ = self->priv->empty_state_row;
		if (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, gtk_widget_get_type (), GtkWidget) == _tmp9_) {
			GtkListBox* _tmp10_;
			GtkWidget* _tmp11_;
			_tmp10_ = self->priv->listbox;
			_tmp11_ = self->priv->empty_state_row;
			gtk_list_box_remove (_tmp10_, _tmp11_);
			paper_clip_keyword_list_set_is_empty (self, FALSE);
			break;
		}
		_tmp12_ = self->priv->listbox;
		_tmp13_ = gtk_list_box_get_row_at_index (_tmp12_, i + 1);
		if (_tmp13_ == NULL) {
			GtkListBoxRow* _tmp14_;
			_tmp14_ = current_row;
			gtk_widget_grab_focus ((GtkWidget*) _tmp14_);
		}
		_tmp15_ = i;
		i = _tmp15_ + 1;
	}
	_tmp16_ = paper_clip_keyword_list_get_document (self);
	_tmp17_ = _tmp16_;
	_tmp18_ = paper_clip_document_get_keywords (_tmp17_);
	_tmp19_ = _tmp18_;
	if (g_list_model_get_n_items (_tmp19_) == ((guint) 1)) {
		GtkListBox* _tmp20_;
		GtkWidget* _tmp21_;
		_tmp20_ = self->priv->listbox;
		_tmp21_ = gtk_widget_get_first_child ((GtkWidget*) _tmp20_);
		gtk_widget_grab_focus (_tmp21_);
	}
	_g_object_unref0 (current_row);
}

static void
paper_clip_keyword_list_create_default_row (PaperClipKeywordList* self)
{
	GtkCenterBox* center_box = NULL;
	GtkCenterBox* _tmp0_;
	GtkLabel* label = NULL;
	GtkLabel* _tmp1_ = NULL;
	GtkImage* _tmp2_ = NULL;
	GtkImage* _tmp3_;
	GtkWidget* _tmp4_;
	AdwPreferencesRow* _tmp5_ = NULL;
	GtkListBox* _tmp6_;
	GtkWidget* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkCenterBox*) gtk_center_box_new ();
	g_object_ref_sink (_tmp0_);
	center_box = _tmp0_;
	_tmp1_ = (GtkLabel*) gtk_label_new (_ ("Add Keyword"));
	gtk_label_set_justify (_tmp1_, GTK_JUSTIFY_CENTER);
	gtk_label_set_wrap (_tmp1_, TRUE);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp1_, 12);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp1_, 12);
	g_object_ref_sink (_tmp1_);
	label = _tmp1_;
	gtk_center_box_set_center_widget (center_box, (GtkWidget*) label);
	_tmp2_ = (GtkImage*) gtk_image_new_from_icon_name ("list-add-symbolic");
	gtk_widget_set_halign ((GtkWidget*) _tmp2_, GTK_ALIGN_END);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp2_, 12);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	gtk_center_box_set_start_widget (center_box, (GtkWidget*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = _g_object_ref0 ((GtkWidget*) center_box);
	_tmp5_ = (AdwPreferencesRow*) adw_preferences_row_new ();
	gtk_list_box_row_set_child ((GtkListBoxRow*) _tmp5_, _tmp4_);
	_g_object_unref0 (_tmp4_);
	gtk_list_box_row_set_activatable ((GtkListBoxRow*) _tmp5_, TRUE);
	gtk_list_box_row_set_selectable ((GtkListBoxRow*) _tmp5_, FALSE);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->empty_state_row);
	self->priv->empty_state_row = (GtkWidget*) _tmp5_;
	_tmp6_ = self->priv->listbox;
	_tmp7_ = self->priv->empty_state_row;
	gtk_list_box_append (_tmp6_, _tmp7_);
	_g_object_unref0 (label);
	_g_object_unref0 (center_box);
}

static void
paper_clip_keyword_list_on_row_activated (PaperClipKeywordList* self,
                                          GtkListBoxRow* selected_row)
{
	GtkWidget* _tmp0_;
	PaperClipDocument* _tmp1_;
	PaperClipDocument* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (selected_row != NULL);
	_tmp0_ = self->priv->empty_state_row;
	if (G_TYPE_CHECK_INSTANCE_CAST (selected_row, gtk_widget_get_type (), GtkWidget) != _tmp0_) {
		return;
	}
	_tmp1_ = paper_clip_keyword_list_get_document (self);
	_tmp2_ = _tmp1_;
	paper_clip_document_add_keyword (_tmp2_, "");
}

static void
_paper_clip_keyword_list_on_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                      GtkListBoxRow* row,
                                                                      gpointer self)
{
	paper_clip_keyword_list_on_row_activated ((PaperClipKeywordList*) self, row);
}

PaperClipKeywordList*
paper_clip_keyword_list_construct (GType object_type)
{
	PaperClipKeywordList * self = NULL;
	self = (PaperClipKeywordList*) g_object_new (object_type, NULL);
	return self;
}

PaperClipKeywordList*
paper_clip_keyword_list_new (void)
{
	return paper_clip_keyword_list_construct (PAPER_CLIP_TYPE_KEYWORD_LIST);
}

gboolean
paper_clip_keyword_list_get_is_empty (PaperClipKeywordList* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_empty;
	return result;
}

static void
paper_clip_keyword_list_set_is_empty (PaperClipKeywordList* self,
                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = paper_clip_keyword_list_get_is_empty (self);
	if (old_value != value) {
		self->priv->_is_empty = value;
		g_object_notify_by_pspec ((GObject *) self, paper_clip_keyword_list_properties[PAPER_CLIP_KEYWORD_LIST_IS_EMPTY_PROPERTY]);
	}
}

PaperClipDocument*
paper_clip_keyword_list_get_document (PaperClipKeywordList* self)
{
	PaperClipDocument* result;
	PaperClipDocument* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_document;
	result = _tmp0_;
	return result;
}

static GtkWidget*
_paper_clip_keyword_list_create_keyword_row_gtk_list_box_create_widget_func (GObject* item,
                                                                             gpointer self)
{
	GtkWidget* result;
	result = paper_clip_keyword_list_create_keyword_row ((PaperClipKeywordList*) self, item);
	return result;
}

static void
_paper_clip_keyword_list_on_items_changed_g_list_model_items_changed (GListModel* _sender,
                                                                      guint position,
                                                                      guint removed,
                                                                      guint added,
                                                                      gpointer self)
{
	paper_clip_keyword_list_on_items_changed ((PaperClipKeywordList*) self);
}

void
paper_clip_keyword_list_set_document (PaperClipKeywordList* self,
                                      PaperClipDocument* value)
{
	GtkListBox* _tmp0_;
	PaperClipDocument* _tmp1_;
	PaperClipDocument* _tmp2_;
	GListModel* _tmp3_;
	GListModel* _tmp4_;
	PaperClipDocument* _tmp5_;
	PaperClipDocument* _tmp6_;
	GListModel* _tmp7_;
	GListModel* _tmp8_;
	g_return_if_fail (self != NULL);
	self->priv->_document = value;
	_tmp0_ = self->priv->listbox;
	_tmp1_ = paper_clip_keyword_list_get_document (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = paper_clip_document_get_keywords (_tmp2_);
	_tmp4_ = _tmp3_;
	gtk_list_box_bind_model (_tmp0_, _tmp4_, _paper_clip_keyword_list_create_keyword_row_gtk_list_box_create_widget_func, g_object_ref (self), g_object_unref);
	_tmp5_ = paper_clip_keyword_list_get_document (self);
	_tmp6_ = _tmp5_;
	_tmp7_ = paper_clip_document_get_keywords (_tmp6_);
	_tmp8_ = _tmp7_;
	g_signal_connect_object (_tmp8_, "items-changed", (GCallback) _paper_clip_keyword_list_on_items_changed_g_list_model_items_changed, self, 0);
	paper_clip_keyword_list_on_items_changed (self);
	g_object_notify_by_pspec ((GObject *) self, paper_clip_keyword_list_properties[PAPER_CLIP_KEYWORD_LIST_DOCUMENT_PROPERTY]);
}

static void
_paper_clip_keyword_list___lambda7_ (PaperClipKeywordList* self)
{
	PaperClipDocument* _tmp0_;
	PaperClipDocument* _tmp1_;
	_tmp0_ = paper_clip_keyword_list_get_document (self);
	_tmp1_ = _tmp0_;
	paper_clip_document_add_keyword (_tmp1_, "");
}

static void
__paper_clip_keyword_list___lambda7__g_simple_action_activate (GSimpleAction* _sender,
                                                               GVariant* parameter,
                                                               gpointer self)
{
	_paper_clip_keyword_list___lambda7_ ((PaperClipKeywordList*) self);
}

static GObject *
paper_clip_keyword_list_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	PaperClipKeywordList * self;
	GSimpleActionGroup* action_group = NULL;
	GSimpleActionGroup* _tmp0_;
	GSimpleAction* action = NULL;
	GSimpleAction* _tmp1_;
	GSimpleAction* _tmp2_;
	GSimpleActionGroup* _tmp3_;
	GSimpleAction* _tmp4_;
	GSimpleActionGroup* _tmp5_;
	parent_class = G_OBJECT_CLASS (paper_clip_keyword_list_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PAPER_CLIP_TYPE_KEYWORD_LIST, PaperClipKeywordList);
	_tmp0_ = g_simple_action_group_new ();
	action_group = _tmp0_;
	_tmp1_ = g_simple_action_new ("add-keyword", NULL);
	action = _tmp1_;
	_tmp2_ = action;
	g_signal_connect_object (_tmp2_, "activate", (GCallback) __paper_clip_keyword_list___lambda7__g_simple_action_activate, self, 0);
	_tmp3_ = action_group;
	_tmp4_ = action;
	g_action_map_add_action ((GActionMap*) _tmp3_, (GAction*) _tmp4_);
	_tmp5_ = action_group;
	gtk_widget_insert_action_group ((GtkWidget*) self, "keyword-list", (GActionGroup*) _tmp5_);
	_g_object_unref0 (action);
	_g_object_unref0 (action_group);
	return obj;
}

static void
paper_clip_keyword_list_class_init (PaperClipKeywordListClass * klass,
                                    gpointer klass_data)
{
	paper_clip_keyword_list_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PaperClipKeywordList_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_paper_clip_keyword_list_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_paper_clip_keyword_list_set_property;
	G_OBJECT_CLASS (klass)->constructor = paper_clip_keyword_list_constructor;
	G_OBJECT_CLASS (klass)->finalize = paper_clip_keyword_list_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PAPER_CLIP_KEYWORD_LIST_IS_EMPTY_PROPERTY, paper_clip_keyword_list_properties[PAPER_CLIP_KEYWORD_LIST_IS_EMPTY_PROPERTY] = g_param_spec_boolean ("is-empty", "is-empty", "is-empty", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PAPER_CLIP_KEYWORD_LIST_DOCUMENT_PROPERTY, paper_clip_keyword_list_properties[PAPER_CLIP_KEYWORD_LIST_DOCUMENT_PROPERTY] = g_param_spec_object ("document", "document", "document", PAPER_CLIP_TYPE_DOCUMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/io/github/diegoivan/pdf_metadata_editor/gtk/keyword-list.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "listbox", FALSE, PaperClipKeywordList_private_offset + G_STRUCT_OFFSET (PaperClipKeywordListPrivate, listbox));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_row_activated", G_CALLBACK(_paper_clip_keyword_list_on_row_activated_gtk_list_box_row_activated));
}

static void
paper_clip_keyword_list_instance_init (PaperClipKeywordList * self,
                                       gpointer klass)
{
	self->priv = paper_clip_keyword_list_get_instance_private (self);
	self->priv->empty_state_row = NULL;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
paper_clip_keyword_list_finalize (GObject * obj)
{
	PaperClipKeywordList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PAPER_CLIP_TYPE_KEYWORD_LIST, PaperClipKeywordList);
	_g_object_unref0 (self->priv->empty_state_row);
	G_OBJECT_CLASS (paper_clip_keyword_list_parent_class)->finalize (obj);
}

static GType
paper_clip_keyword_list_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PaperClipKeywordListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) paper_clip_keyword_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PaperClipKeywordList), 0, (GInstanceInitFunc) paper_clip_keyword_list_instance_init, NULL };
	GType paper_clip_keyword_list_type_id;
	paper_clip_keyword_list_type_id = g_type_register_static (adw_preferences_group_get_type (), "PaperClipKeywordList", &g_define_type_info, 0);
	PaperClipKeywordList_private_offset = g_type_add_instance_private (paper_clip_keyword_list_type_id, sizeof (PaperClipKeywordListPrivate));
	return paper_clip_keyword_list_type_id;
}

GType
paper_clip_keyword_list_get_type (void)
{
	static volatile gsize paper_clip_keyword_list_type_id__once = 0;
	if (g_once_init_enter (&paper_clip_keyword_list_type_id__once)) {
		GType paper_clip_keyword_list_type_id;
		paper_clip_keyword_list_type_id = paper_clip_keyword_list_get_type_once ();
		g_once_init_leave (&paper_clip_keyword_list_type_id__once, paper_clip_keyword_list_type_id);
	}
	return paper_clip_keyword_list_type_id__once;
}

static void
_vala_paper_clip_keyword_list_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	PaperClipKeywordList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PAPER_CLIP_TYPE_KEYWORD_LIST, PaperClipKeywordList);
	switch (property_id) {
		case PAPER_CLIP_KEYWORD_LIST_IS_EMPTY_PROPERTY:
		g_value_set_boolean (value, paper_clip_keyword_list_get_is_empty (self));
		break;
		case PAPER_CLIP_KEYWORD_LIST_DOCUMENT_PROPERTY:
		g_value_set_object (value, paper_clip_keyword_list_get_document (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_paper_clip_keyword_list_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	PaperClipKeywordList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PAPER_CLIP_TYPE_KEYWORD_LIST, PaperClipKeywordList);
	switch (property_id) {
		case PAPER_CLIP_KEYWORD_LIST_IS_EMPTY_PROPERTY:
		paper_clip_keyword_list_set_is_empty (self, g_value_get_boolean (value));
		break;
		case PAPER_CLIP_KEYWORD_LIST_DOCUMENT_PROPERTY:
		paper_clip_keyword_list_set_document (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

