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

/*
 * This file is part of budgie-desktop
 *
 * Copyright Budgie Desktop Developers
 *
 * 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 2 of the License, or
 * (at your option) any later version.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include "raven.h"
#include <glib/gi18n-lib.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 BUDGIE_TYPE_SETTINGS_GRID (budgie_settings_grid_get_type ())
#define BUDGIE_SETTINGS_GRID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUDGIE_TYPE_SETTINGS_GRID, BudgieSettingsGrid))
#define BUDGIE_SETTINGS_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUDGIE_TYPE_SETTINGS_GRID, BudgieSettingsGridClass))
#define BUDGIE_IS_SETTINGS_GRID(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUDGIE_TYPE_SETTINGS_GRID))
#define BUDGIE_IS_SETTINGS_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUDGIE_TYPE_SETTINGS_GRID))
#define BUDGIE_SETTINGS_GRID_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUDGIE_TYPE_SETTINGS_GRID, BudgieSettingsGridClass))

typedef struct _BudgieSettingsGrid BudgieSettingsGrid;
typedef struct _BudgieSettingsGridClass BudgieSettingsGridClass;
typedef struct _BudgieSettingsGridPrivate BudgieSettingsGridPrivate;

#define BUDGIE_TYPE_RAVEN_SETTINGS_PAGE (budgie_raven_settings_page_get_type ())
#define BUDGIE_RAVEN_SETTINGS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUDGIE_TYPE_RAVEN_SETTINGS_PAGE, BudgieRavenSettingsPage))
#define BUDGIE_RAVEN_SETTINGS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUDGIE_TYPE_RAVEN_SETTINGS_PAGE, BudgieRavenSettingsPageClass))
#define BUDGIE_IS_RAVEN_SETTINGS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUDGIE_TYPE_RAVEN_SETTINGS_PAGE))
#define BUDGIE_IS_RAVEN_SETTINGS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUDGIE_TYPE_RAVEN_SETTINGS_PAGE))
#define BUDGIE_RAVEN_SETTINGS_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUDGIE_TYPE_RAVEN_SETTINGS_PAGE, BudgieRavenSettingsPageClass))

typedef struct _BudgieRavenSettingsPage BudgieRavenSettingsPage;
typedef struct _BudgieRavenSettingsPageClass BudgieRavenSettingsPageClass;
typedef struct _BudgieRavenSettingsPagePrivate BudgieRavenSettingsPagePrivate;
enum  {
	BUDGIE_RAVEN_SETTINGS_PAGE_0_PROPERTY,
	BUDGIE_RAVEN_SETTINGS_PAGE_NUM_PROPERTIES
};
static GParamSpec* budgie_raven_settings_page_properties[BUDGIE_RAVEN_SETTINGS_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define BUDGIE_TYPE_SETTINGS_ROW (budgie_settings_row_get_type ())
#define BUDGIE_SETTINGS_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUDGIE_TYPE_SETTINGS_ROW, BudgieSettingsRow))
#define BUDGIE_SETTINGS_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUDGIE_TYPE_SETTINGS_ROW, BudgieSettingsRowClass))
#define BUDGIE_IS_SETTINGS_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUDGIE_TYPE_SETTINGS_ROW))
#define BUDGIE_IS_SETTINGS_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUDGIE_TYPE_SETTINGS_ROW))
#define BUDGIE_SETTINGS_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUDGIE_TYPE_SETTINGS_ROW, BudgieSettingsRowClass))

typedef struct _BudgieSettingsRow BudgieSettingsRow;
typedef struct _BudgieSettingsRowClass BudgieSettingsRowClass;

struct _BudgieSettingsGrid {
	GtkGrid parent_instance;
	BudgieSettingsGridPrivate * priv;
	gint current_row;
	gboolean small_mode;
};

struct _BudgieSettingsGridClass {
	GtkGridClass parent_class;
};

struct _BudgieRavenSettingsPage {
	BudgieSettingsGrid parent_instance;
	BudgieRavenSettingsPagePrivate * priv;
};

struct _BudgieRavenSettingsPageClass {
	BudgieSettingsGridClass parent_class;
};

struct _BudgieRavenSettingsPagePrivate {
	GtkComboBox* raven_position;
	GtkComboBox* notification_sort;
	GSettings* raven_settings;
};

static gint BudgieRavenSettingsPage_private_offset;
static gpointer budgie_raven_settings_page_parent_class = NULL;

VALA_EXTERN GType budgie_settings_grid_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BudgieSettingsGrid, g_object_unref)
VALA_EXTERN GType budgie_raven_settings_page_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BudgieRavenSettingsPage, g_object_unref)
VALA_EXTERN BudgieRavenSettingsPage* budgie_raven_settings_page_new (void);
VALA_EXTERN BudgieRavenSettingsPage* budgie_raven_settings_page_construct (GType object_type);
VALA_EXTERN BudgieSettingsGrid* budgie_settings_grid_new (void);
VALA_EXTERN BudgieSettingsGrid* budgie_settings_grid_construct (GType object_type);
VALA_EXTERN GType budgie_settings_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BudgieSettingsRow, g_object_unref)
VALA_EXTERN void budgie_settings_grid_add_row (BudgieSettingsGrid* self,
                                   BudgieSettingsRow* row);
VALA_EXTERN BudgieSettingsRow* budgie_settings_row_new (GtkWidget* widget,
                                            const gchar* label,
                                            const gchar* description);
VALA_EXTERN BudgieSettingsRow* budgie_settings_row_construct (GType object_type,
                                                  GtkWidget* widget,
                                                  const gchar* label,
                                                  const gchar* description);
static void budgie_raven_settings_page_finalize (GObject * obj);
static GType budgie_raven_settings_page_get_type_once (void);

static inline gpointer
budgie_raven_settings_page_get_instance_private (BudgieRavenSettingsPage* self)
{
	return G_STRUCT_MEMBER_P (self, BudgieRavenSettingsPage_private_offset);
}

BudgieRavenSettingsPage*
budgie_raven_settings_page_construct (GType object_type)
{
	BudgieRavenSettingsPage * self = NULL;
	GtkComboBox* _tmp0_;
	GtkComboBox* _tmp1_;
	GtkCellRendererText* render = NULL;
	GtkCellRendererText* _tmp2_;
	GtkListStore* model = NULL;
	GtkListStore* _tmp3_;
	GtkTreeIter iter = {0};
	static const BudgieRavenPosition positions[3] = {BUDGIE_RAVEN_POSITION_AUTOMATIC, BUDGIE_RAVEN_POSITION_LEFT, BUDGIE_RAVEN_POSITION_RIGHT};
	GtkComboBox* _tmp11_;
	GtkListStore* _tmp12_;
	GtkComboBox* _tmp13_;
	GtkCellRendererText* _tmp14_;
	GtkComboBox* _tmp15_;
	GtkCellRendererText* _tmp16_;
	GtkComboBox* _tmp17_;
	GtkComboBox* _tmp18_;
	BudgieSettingsRow* _tmp19_;
	BudgieSettingsRow* _tmp20_;
	GtkCellRendererText* noti_renderer = NULL;
	GtkCellRendererText* _tmp21_;
	GtkListStore* noti_model = NULL;
	GtkListStore* _tmp22_;
	GtkTreeIter noti_iter = {0};
	static const BudgieNotificationSort sortings[2] = {BUDGIE_NOTIFICATION_SORT_NEW_OLD, BUDGIE_NOTIFICATION_SORT_OLD_NEW};
	GtkComboBox* _tmp30_;
	GtkListStore* _tmp31_;
	GtkComboBox* _tmp32_;
	GtkCellRendererText* _tmp33_;
	GtkComboBox* _tmp34_;
	GtkCellRendererText* _tmp35_;
	GtkComboBox* _tmp36_;
	GtkComboBox* _tmp37_;
	BudgieSettingsRow* _tmp38_;
	BudgieSettingsRow* _tmp39_;
	GSettings* _tmp40_;
	GSettings* _tmp41_;
	GtkComboBox* _tmp42_;
	GSettings* _tmp43_;
	GtkComboBox* _tmp44_;
	self = (BudgieRavenSettingsPage*) budgie_settings_grid_construct (object_type);
	gtk_widget_set_margin_top ((GtkWidget*) self, 8);
	gtk_widget_set_margin_start ((GtkWidget*) self, 20);
	gtk_widget_set_margin_end ((GtkWidget*) self, 20);
	_tmp0_ = (GtkComboBox*) gtk_combo_box_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->raven_position);
	self->priv->raven_position = _tmp0_;
	_tmp1_ = (GtkComboBox*) gtk_combo_box_new ();
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->notification_sort);
	self->priv->notification_sort = _tmp1_;
	_tmp2_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp2_);
	render = _tmp2_;
	_tmp3_ = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, BUDGIE_TYPE_RAVEN_POSITION, -1);
	model = _tmp3_;
	{
		BudgieRavenPosition* pos_collection = NULL;
		gint pos_collection_length1 = 0;
		gint _pos_collection_size_ = 0;
		gint pos_it = 0;
		pos_collection = positions;
		pos_collection_length1 = G_N_ELEMENTS (positions);
		for (pos_it = 0; pos_it < pos_collection_length1; pos_it = pos_it + 1) {
			BudgieRavenPosition pos = 0;
			pos = pos_collection[pos_it];
			{
				GtkListStore* _tmp4_;
				GtkTreeIter _tmp5_ = {0};
				GtkListStore* _tmp6_;
				GtkTreeIter _tmp7_;
				GEnumValue* _tmp8_;
				gchar* _tmp9_;
				gchar* _tmp10_;
				_tmp4_ = model;
				gtk_list_store_append (_tmp4_, &_tmp5_);
				iter = _tmp5_;
				_tmp6_ = model;
				_tmp7_ = iter;
				_tmp8_ = g_enum_get_value (g_type_class_ref (BUDGIE_TYPE_RAVEN_POSITION), pos);
				_tmp9_ = budgie_raven_position_get_display_name (pos);
				_tmp10_ = _tmp9_;
				gtk_list_store_set (_tmp6_, &_tmp7_, 0, (_tmp8_ != NULL) ? _tmp8_->value_name : NULL, 1, _tmp10_, 2, pos, -1, -1);
				_g_free0 (_tmp10_);
			}
		}
	}
	_tmp11_ = self->priv->raven_position;
	_tmp12_ = model;
	gtk_combo_box_set_model (_tmp11_, (GtkTreeModel*) _tmp12_);
	_tmp13_ = self->priv->raven_position;
	_tmp14_ = render;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp13_, (GtkCellRenderer*) _tmp14_, TRUE);
	_tmp15_ = self->priv->raven_position;
	_tmp16_ = render;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp15_, (GtkCellRenderer*) _tmp16_, "text", 1);
	_tmp17_ = self->priv->raven_position;
	gtk_combo_box_set_id_column (_tmp17_, 0);
	_tmp18_ = self->priv->raven_position;
	_tmp19_ = budgie_settings_row_new ((GtkWidget*) _tmp18_, _ ("Set Raven position"), _ ("Set which side of the screen Raven will open on. If set to Automatic, " \
"Raven will open where its parent panel is."));
	_tmp20_ = _tmp19_;
	budgie_settings_grid_add_row ((BudgieSettingsGrid*) self, _tmp20_);
	_g_object_unref0 (_tmp20_);
	_tmp21_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp21_);
	noti_renderer = _tmp21_;
	_tmp22_ = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, BUDGIE_TYPE_NOTIFICATION_SORT, -1);
	noti_model = _tmp22_;
	{
		BudgieNotificationSort* sort_collection = NULL;
		gint sort_collection_length1 = 0;
		gint _sort_collection_size_ = 0;
		gint sort_it = 0;
		sort_collection = sortings;
		sort_collection_length1 = G_N_ELEMENTS (sortings);
		for (sort_it = 0; sort_it < sort_collection_length1; sort_it = sort_it + 1) {
			BudgieNotificationSort sort = 0;
			sort = sort_collection[sort_it];
			{
				GtkListStore* _tmp23_;
				GtkTreeIter _tmp24_ = {0};
				GtkListStore* _tmp25_;
				GtkTreeIter _tmp26_;
				GEnumValue* _tmp27_;
				gchar* _tmp28_;
				gchar* _tmp29_;
				_tmp23_ = noti_model;
				gtk_list_store_append (_tmp23_, &_tmp24_);
				noti_iter = _tmp24_;
				_tmp25_ = noti_model;
				_tmp26_ = noti_iter;
				_tmp27_ = g_enum_get_value (g_type_class_ref (BUDGIE_TYPE_NOTIFICATION_SORT), sort);
				_tmp28_ = budgie_notification_sort_get_display_name (sort);
				_tmp29_ = _tmp28_;
				gtk_list_store_set (_tmp25_, &_tmp26_, 0, (_tmp27_ != NULL) ? _tmp27_->value_name : NULL, 1, _tmp29_, 2, sort, -1, -1);
				_g_free0 (_tmp29_);
			}
		}
	}
	_tmp30_ = self->priv->notification_sort;
	_tmp31_ = noti_model;
	gtk_combo_box_set_model (_tmp30_, (GtkTreeModel*) _tmp31_);
	_tmp32_ = self->priv->notification_sort;
	_tmp33_ = noti_renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp32_, (GtkCellRenderer*) _tmp33_, TRUE);
	_tmp34_ = self->priv->notification_sort;
	_tmp35_ = noti_renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp34_, (GtkCellRenderer*) _tmp35_, "text", 1);
	_tmp36_ = self->priv->notification_sort;
	gtk_combo_box_set_id_column (_tmp36_, 0);
	_tmp37_ = self->priv->notification_sort;
	_tmp38_ = budgie_settings_row_new ((GtkWidget*) _tmp37_, _ ("Set notification sort order"), _ ("Set whether notifications are sorted from oldest to newest, or newest " \
"to oldest."));
	_tmp39_ = _tmp38_;
	budgie_settings_grid_add_row ((BudgieSettingsGrid*) self, _tmp39_);
	_g_object_unref0 (_tmp39_);
	_tmp40_ = g_settings_new ("com.solus-project.budgie-raven");
	_g_object_unref0 (self->priv->raven_settings);
	self->priv->raven_settings = _tmp40_;
	_tmp41_ = self->priv->raven_settings;
	_tmp42_ = self->priv->raven_position;
	g_settings_bind (_tmp41_, "raven-position", (GObject*) _tmp42_, "active-id", G_SETTINGS_BIND_DEFAULT);
	_tmp43_ = self->priv->raven_settings;
	_tmp44_ = self->priv->notification_sort;
	g_settings_bind (_tmp43_, "notification-sort", (GObject*) _tmp44_, "active-id", G_SETTINGS_BIND_DEFAULT);
	_g_object_unref0 (noti_model);
	_g_object_unref0 (noti_renderer);
	_g_object_unref0 (model);
	_g_object_unref0 (render);
	return self;
}

BudgieRavenSettingsPage*
budgie_raven_settings_page_new (void)
{
	return budgie_raven_settings_page_construct (BUDGIE_TYPE_RAVEN_SETTINGS_PAGE);
}

static void
budgie_raven_settings_page_class_init (BudgieRavenSettingsPageClass * klass,
                                       gpointer klass_data)
{
	budgie_raven_settings_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BudgieRavenSettingsPage_private_offset);
	G_OBJECT_CLASS (klass)->finalize = budgie_raven_settings_page_finalize;
}

static void
budgie_raven_settings_page_instance_init (BudgieRavenSettingsPage * self,
                                          gpointer klass)
{
	self->priv = budgie_raven_settings_page_get_instance_private (self);
}

static void
budgie_raven_settings_page_finalize (GObject * obj)
{
	BudgieRavenSettingsPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BUDGIE_TYPE_RAVEN_SETTINGS_PAGE, BudgieRavenSettingsPage);
	_g_object_unref0 (self->priv->raven_position);
	_g_object_unref0 (self->priv->notification_sort);
	_g_object_unref0 (self->priv->raven_settings);
	G_OBJECT_CLASS (budgie_raven_settings_page_parent_class)->finalize (obj);
}

static GType
budgie_raven_settings_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BudgieRavenSettingsPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) budgie_raven_settings_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BudgieRavenSettingsPage), 0, (GInstanceInitFunc) budgie_raven_settings_page_instance_init, NULL };
	GType budgie_raven_settings_page_type_id;
	budgie_raven_settings_page_type_id = g_type_register_static (BUDGIE_TYPE_SETTINGS_GRID, "BudgieRavenSettingsPage", &g_define_type_info, 0);
	BudgieRavenSettingsPage_private_offset = g_type_add_instance_private (budgie_raven_settings_page_type_id, sizeof (BudgieRavenSettingsPagePrivate));
	return budgie_raven_settings_page_type_id;
}

GType
budgie_raven_settings_page_get_type (void)
{
	static volatile gsize budgie_raven_settings_page_type_id__once = 0;
	if (g_once_init_enter (&budgie_raven_settings_page_type_id__once)) {
		GType budgie_raven_settings_page_type_id;
		budgie_raven_settings_page_type_id = budgie_raven_settings_page_get_type_once ();
		g_once_init_leave (&budgie_raven_settings_page_type_id__once, budgie_raven_settings_page_type_id);
	}
	return budgie_raven_settings_page_type_id__once;
}

