/* Inbox.c generated by valac 0.56.19, the Vala compiler
 * generated from Inbox.vala, do not modify */

/*
 * Copyright © 2025 Alain M. (https://github.com/alainm23/planify)
 *
 * 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, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include "planify.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.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

enum  {
	OBJECTS_FILTERS_INBOX_0_PROPERTY,
	OBJECTS_FILTERS_INBOX_NUM_PROPERTIES
};
static GParamSpec* objects_filters_inbox_properties[OBJECTS_FILTERS_INBOX_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))

static gpointer objects_filters_inbox_parent_class = NULL;
static ObjectsFiltersInbox* objects_filters_inbox__instance;
static ObjectsFiltersInbox* objects_filters_inbox__instance = NULL;

static gchar* objects_filters_inbox_real_theme_color (ObjectsBaseObject* base);
static GObject * objects_filters_inbox_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void objects_filters_inbox_finalize (GObject * obj);
static GType objects_filters_inbox_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

ObjectsFiltersInbox*
objects_filters_inbox_get_default (void)
{
	ObjectsFiltersInbox* _tmp0_;
	ObjectsFiltersInbox* _tmp2_;
	ObjectsFiltersInbox* _tmp3_;
	ObjectsFiltersInbox* result;
	_tmp0_ = objects_filters_inbox__instance;
	if (_tmp0_ == NULL) {
		ObjectsFiltersInbox* _tmp1_;
		_tmp1_ = objects_filters_inbox_new ();
		_g_object_unref0 (objects_filters_inbox__instance);
		objects_filters_inbox__instance = _tmp1_;
	}
	_tmp2_ = objects_filters_inbox__instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

static gchar*
objects_filters_inbox_real_theme_color (ObjectsBaseObject* base)
{
	ObjectsFiltersInbox * self;
	const gchar* _tmp0_ = NULL;
	ServicesSettings* _tmp1_;
	ServicesSettings* _tmp2_;
	gboolean _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	self = (ObjectsFiltersInbox*) base;
	_tmp1_ = services_settings_get_default ();
	_tmp2_ = _tmp1_;
	_tmp3_ = services_settings_get_boolean (_tmp2_, "dark-mode");
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		_tmp0_ = "#99c1f1";
	} else {
		_tmp0_ = "#3584e4";
	}
	_tmp4_ = g_strdup (_tmp0_);
	result = _tmp4_;
	return result;
}

ObjectsFiltersInbox*
objects_filters_inbox_construct (GType object_type)
{
	ObjectsFiltersInbox * self = NULL;
	self = (ObjectsFiltersInbox*) objects_base_object_construct (object_type);
	return self;
}

ObjectsFiltersInbox*
objects_filters_inbox_new (void)
{
	return objects_filters_inbox_construct (OBJECTS_FILTERS_TYPE_INBOX);
}

static GObject *
objects_filters_inbox_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ObjectsFiltersInbox * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_ = NULL;
	ServicesSettings* _tmp5_;
	ServicesSettings* _tmp6_;
	gboolean _tmp7_;
	parent_class = G_OBJECT_CLASS (objects_filters_inbox_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_FILTERS_TYPE_INBOX, ObjectsFiltersInbox);
	objects_base_object_set_name ((ObjectsBaseObject*) self, _ ("Inbox"));
	_tmp0_ = g_strconcat (_ ("inbox"), ";", NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat (_tmp1_, _ ("filters"), NULL);
	_tmp3_ = _tmp2_;
	objects_base_object_set_keywords ((ObjectsBaseObject*) self, _tmp3_);
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	objects_base_object_set_icon_name ((ObjectsBaseObject*) self, "mailbox-symbolic");
	objects_base_object_set_view_id ((ObjectsBaseObject*) self, "inbox");
	_tmp5_ = services_settings_get_default ();
	_tmp6_ = _tmp5_;
	_tmp7_ = services_settings_get_boolean (_tmp6_, "dark-mode");
	_g_object_unref0 (_tmp6_);
	if (_tmp7_) {
		_tmp4_ = "#99c1f1";
	} else {
		_tmp4_ = "#3584e4";
	}
	objects_base_object_set_color ((ObjectsBaseObject*) self, _tmp4_);
	return obj;
}

static void
objects_filters_inbox_class_init (ObjectsFiltersInboxClass * klass,
                                  gpointer klass_data)
{
	objects_filters_inbox_parent_class = g_type_class_peek_parent (klass);
	((ObjectsBaseObjectClass *) klass)->theme_color = (gchar* (*) (ObjectsBaseObject*)) objects_filters_inbox_real_theme_color;
	G_OBJECT_CLASS (klass)->constructor = objects_filters_inbox_constructor;
	G_OBJECT_CLASS (klass)->finalize = objects_filters_inbox_finalize;
}

static void
objects_filters_inbox_instance_init (ObjectsFiltersInbox * self,
                                     gpointer klass)
{
}

static void
objects_filters_inbox_finalize (GObject * obj)
{
	ObjectsFiltersInbox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_FILTERS_TYPE_INBOX, ObjectsFiltersInbox);
	G_OBJECT_CLASS (objects_filters_inbox_parent_class)->finalize (obj);
}

static GType
objects_filters_inbox_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ObjectsFiltersInboxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) objects_filters_inbox_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ObjectsFiltersInbox), 0, (GInstanceInitFunc) objects_filters_inbox_instance_init, NULL };
	GType objects_filters_inbox_type_id;
	objects_filters_inbox_type_id = g_type_register_static (OBJECTS_TYPE_BASE_OBJECT, "ObjectsFiltersInbox", &g_define_type_info, 0);
	return objects_filters_inbox_type_id;
}

GType
objects_filters_inbox_get_type (void)
{
	static volatile gsize objects_filters_inbox_type_id__once = 0;
	if (g_once_init_enter (&objects_filters_inbox_type_id__once)) {
		GType objects_filters_inbox_type_id;
		objects_filters_inbox_type_id = objects_filters_inbox_get_type_once ();
		g_once_init_leave (&objects_filters_inbox_type_id__once, objects_filters_inbox_type_id);
	}
	return objects_filters_inbox_type_id__once;
}

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;
}

