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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*-
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: Michael Terry
 */

#include <adwaita.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include "deja.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 TYPE_CONFIG_COMBO_ROW (config_combo_row_get_type ())
#define CONFIG_COMBO_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CONFIG_COMBO_ROW, ConfigComboRow))
#define CONFIG_COMBO_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CONFIG_COMBO_ROW, ConfigComboRowClass))
#define IS_CONFIG_COMBO_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CONFIG_COMBO_ROW))
#define IS_CONFIG_COMBO_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CONFIG_COMBO_ROW))
#define CONFIG_COMBO_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CONFIG_COMBO_ROW, ConfigComboRowClass))

typedef struct _ConfigComboRow ConfigComboRow;
typedef struct _ConfigComboRowClass ConfigComboRowClass;
typedef struct _ConfigComboRowPrivate ConfigComboRowPrivate;

#define TYPE_CONFIG_PERIOD_ROW (config_period_row_get_type ())
#define CONFIG_PERIOD_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CONFIG_PERIOD_ROW, ConfigPeriodRow))
#define CONFIG_PERIOD_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CONFIG_PERIOD_ROW, ConfigPeriodRowClass))
#define IS_CONFIG_PERIOD_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CONFIG_PERIOD_ROW))
#define IS_CONFIG_PERIOD_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CONFIG_PERIOD_ROW))
#define CONFIG_PERIOD_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CONFIG_PERIOD_ROW, ConfigPeriodRowClass))

typedef struct _ConfigPeriodRow ConfigPeriodRow;
typedef struct _ConfigPeriodRowClass ConfigPeriodRowClass;
typedef struct _ConfigPeriodRowPrivate ConfigPeriodRowPrivate;
enum  {
	CONFIG_PERIOD_ROW_0_PROPERTY,
	CONFIG_PERIOD_ROW_NUM_PROPERTIES
};
static GParamSpec* config_period_row_properties[CONFIG_PERIOD_ROW_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ConfigComboRow {
	AdwComboRow parent_instance;
	ConfigComboRowPrivate * priv;
};

struct _ConfigComboRowClass {
	AdwComboRowClass parent_class;
	void (*fill_store) (ConfigComboRow* self);
	gchar* (*setting_name) (ConfigComboRow* self);
	gchar* (*label_for_value) (ConfigComboRow* self, gint val);
	gint (*clamp_value) (ConfigComboRow* self, gint val);
	gint (*compare_value) (ConfigComboRow* self, gint val);
};

struct _ConfigPeriodRow {
	ConfigComboRow parent_instance;
	ConfigPeriodRowPrivate * priv;
};

struct _ConfigPeriodRowClass {
	ConfigComboRowClass parent_class;
};

static gpointer config_period_row_parent_class = NULL;

VALA_EXTERN GType config_combo_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ConfigComboRow, g_object_unref)
VALA_EXTERN GType config_period_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ConfigPeriodRow, g_object_unref)
VALA_EXTERN void config_combo_row_fill_store (ConfigComboRow* self);
VALA_EXTERN gchar* config_combo_row_setting_name (ConfigComboRow* self);
VALA_EXTERN gchar* config_combo_row_label_for_value (ConfigComboRow* self,
                                         gint val);
VALA_EXTERN gint config_combo_row_clamp_value (ConfigComboRow* self,
                                   gint val);
static void config_period_row_real_fill_store (ConfigComboRow* base);
VALA_EXTERN guint config_combo_row_add_item (ConfigComboRow* self,
                                 gint val,
                                 const gchar* label);
static gchar* config_period_row_real_setting_name (ConfigComboRow* base);
static gchar* config_period_row_real_label_for_value (ConfigComboRow* base,
                                               gint val);
static gint config_period_row_real_clamp_value (ConfigComboRow* base,
                                         gint val);
VALA_EXTERN ConfigPeriodRow* config_period_row_new (void);
VALA_EXTERN ConfigPeriodRow* config_period_row_construct (GType object_type);
VALA_EXTERN ConfigComboRow* config_combo_row_construct (GType object_type);
static GObject * config_period_row_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
static GType config_period_row_get_type_once (void);

static void
config_period_row_real_fill_store (ConfigComboRow* base)
{
	ConfigPeriodRow * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	self = (ConfigPeriodRow*) base;
	config_combo_row_add_item ((ConfigComboRow*) self, 1, _ ("Daily"));
	_tmp0_ = config_combo_row_label_for_value ((ConfigComboRow*) self, 2);
	_tmp1_ = _tmp0_;
	config_combo_row_add_item ((ConfigComboRow*) self, 2, _tmp1_);
	_g_free0 (_tmp1_);
	_tmp2_ = config_combo_row_label_for_value ((ConfigComboRow*) self, 3);
	_tmp3_ = _tmp2_;
	config_combo_row_add_item ((ConfigComboRow*) self, 3, _tmp3_);
	_g_free0 (_tmp3_);
	config_combo_row_add_item ((ConfigComboRow*) self, 7, _ ("Weekly"));
}

static gchar*
config_period_row_real_setting_name (ConfigComboRow* base)
{
	ConfigPeriodRow * self;
	gchar* _tmp0_;
	gchar* result;
	self = (ConfigPeriodRow*) base;
	_tmp0_ = g_strdup (DEJA_DUP_PERIODIC_PERIOD_KEY);
	result = _tmp0_;
	return result;
}

static gchar*
config_period_row_real_label_for_value (ConfigComboRow* base,
                                        gint val)
{
	ConfigPeriodRow * self;
	gchar* _tmp0_;
	gchar* result;
	self = (ConfigPeriodRow*) base;
	_tmp0_ = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE, "Every %d day", "Every %d days", (gulong) val), val);
	result = _tmp0_;
	return result;
}

static gint
config_period_row_real_clamp_value (ConfigComboRow* base,
                                    gint val)
{
	ConfigPeriodRow * self;
	gint result;
	self = (ConfigPeriodRow*) base;
	result = MAX (1, val);
	return result;
}

ConfigPeriodRow*
config_period_row_construct (GType object_type)
{
	ConfigPeriodRow * self = NULL;
	self = (ConfigPeriodRow*) config_combo_row_construct (object_type);
	return self;
}

ConfigPeriodRow*
config_period_row_new (void)
{
	return config_period_row_construct (TYPE_CONFIG_PERIOD_ROW);
}

static GObject *
config_period_row_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ConfigPeriodRow * self;
	DejaDupFilteredSettings* settings = NULL;
	DejaDupFilteredSettings* _tmp0_;
	DejaDupFilteredSettings* _tmp1_;
	parent_class = G_OBJECT_CLASS (config_period_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CONFIG_PERIOD_ROW, ConfigPeriodRow);
	_tmp0_ = deja_dup_get_settings (NULL);
	settings = _tmp0_;
	_tmp1_ = settings;
	g_settings_bind ((GSettings*) _tmp1_, DEJA_DUP_PERIODIC_KEY, (GObject*) self, "sensitive", G_SETTINGS_BIND_GET);
	_g_object_unref0 (settings);
	return obj;
}

static void
config_period_row_class_init (ConfigPeriodRowClass * klass,
                              gpointer klass_data)
{
	config_period_row_parent_class = g_type_class_peek_parent (klass);
	((ConfigComboRowClass *) klass)->fill_store = (void (*) (ConfigComboRow*)) config_period_row_real_fill_store;
	((ConfigComboRowClass *) klass)->setting_name = (gchar* (*) (ConfigComboRow*)) config_period_row_real_setting_name;
	((ConfigComboRowClass *) klass)->label_for_value = (gchar* (*) (ConfigComboRow*, gint)) config_period_row_real_label_for_value;
	((ConfigComboRowClass *) klass)->clamp_value = (gint (*) (ConfigComboRow*, gint)) config_period_row_real_clamp_value;
	G_OBJECT_CLASS (klass)->constructor = config_period_row_constructor;
}

static void
config_period_row_instance_init (ConfigPeriodRow * self,
                                 gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
config_period_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ConfigPeriodRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) config_period_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ConfigPeriodRow), 0, (GInstanceInitFunc) config_period_row_instance_init, NULL };
	GType config_period_row_type_id;
	config_period_row_type_id = g_type_register_static (TYPE_CONFIG_COMBO_ROW, "ConfigPeriodRow", &g_define_type_info, 0);
	return config_period_row_type_id;
}

GType
config_period_row_get_type (void)
{
	static gsize config_period_row_type_id__once = 0;
	if (g_once_init_enter (&config_period_row_type_id__once)) {
		GType config_period_row_type_id;
		config_period_row_type_id = config_period_row_get_type_once ();
		g_once_init_leave (&config_period_row_type_id__once, config_period_row_type_id);
	}
	return config_period_row_type_id__once;
}

