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

/*
 * Copyright (c) 2014-2025 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <gio/gio.h>
#include <glib.h>
#include "ft_core.h"
#include <string.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

#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

VALA_EXTERN GSettings* ft_settings;
GSettings* ft_settings = NULL;

static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

void
ft_set_settings (GSettings* settings)
{
	GSettings* _tmp0_;
	g_return_if_fail (settings != NULL);
	_tmp0_ = _g_object_ref0 (settings);
	_g_object_unref0 (ft_settings);
	ft_settings = _tmp0_;
}

GSettings*
ft_get_settings (void)
{
	GSettings* _tmp0_;
	GSettings* _tmp2_;
	GSettings* result;
	_tmp0_ = ft_settings;
	if (_tmp0_ == NULL) {
		GSettings* _tmp1_;
		_tmp1_ = g_settings_new ("io.github.focustimerhq.FocusTimer");
		_g_object_unref0 (ft_settings);
		ft_settings = _tmp1_;
	}
	_tmp2_ = ft_settings;
	result = _tmp2_;
	return result;
}

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

