/* world-location-dialog-row.c generated by valac 0.56.0, the Vala compiler
 * generated from world-location-dialog-row.vala, do not modify */

/*
 * Copyright (C) 2020  Matyáš Hronek <saytamkenorh@seznam.cz>
 *
 * 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.
 *
 * 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.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <libgweather/gweather.h>
#include <float.h>
#include <math.h>

#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 CLOCKS_WORLD_TYPE_LOCATION_DIALOG_ROW (clocks_world_location_dialog_row_get_type ())
#define CLOCKS_WORLD_LOCATION_DIALOG_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_WORLD_TYPE_LOCATION_DIALOG_ROW, ClocksWorldLocationDialogRow))
#define CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_WORLD_TYPE_LOCATION_DIALOG_ROW, ClocksWorldLocationDialogRowClass))
#define CLOCKS_WORLD_IS_LOCATION_DIALOG_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_WORLD_TYPE_LOCATION_DIALOG_ROW))
#define CLOCKS_WORLD_IS_LOCATION_DIALOG_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_WORLD_TYPE_LOCATION_DIALOG_ROW))
#define CLOCKS_WORLD_LOCATION_DIALOG_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_WORLD_TYPE_LOCATION_DIALOG_ROW, ClocksWorldLocationDialogRowClass))

typedef struct _ClocksWorldLocationDialogRow ClocksWorldLocationDialogRow;
typedef struct _ClocksWorldLocationDialogRowClass ClocksWorldLocationDialogRowClass;
typedef struct _ClocksWorldLocationDialogRowPrivate ClocksWorldLocationDialogRowPrivate;

#define CLOCKS_WORLD_TYPE_CLOCK_LOCATION (clocks_world_clock_location_get_type ())
#define CLOCKS_WORLD_CLOCK_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_WORLD_TYPE_CLOCK_LOCATION, ClocksWorldClockLocation))
#define CLOCKS_WORLD_CLOCK_LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_WORLD_TYPE_CLOCK_LOCATION, ClocksWorldClockLocationClass))
#define CLOCKS_WORLD_IS_CLOCK_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_WORLD_TYPE_CLOCK_LOCATION))
#define CLOCKS_WORLD_IS_CLOCK_LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_WORLD_TYPE_CLOCK_LOCATION))
#define CLOCKS_WORLD_CLOCK_LOCATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_WORLD_TYPE_CLOCK_LOCATION, ClocksWorldClockLocationClass))

typedef struct _ClocksWorldClockLocation ClocksWorldClockLocation;
typedef struct _ClocksWorldClockLocationClass ClocksWorldClockLocationClass;
enum  {
	CLOCKS_WORLD_LOCATION_DIALOG_ROW_0_PROPERTY,
	CLOCKS_WORLD_LOCATION_DIALOG_ROW_DATA_PROPERTY,
	CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_NAME_PROPERTY,
	CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_LOCATION_PROPERTY,
	CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_DESCRIPTION_PROPERTY,
	CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_SELECTED_PROPERTY,
	CLOCKS_WORLD_LOCATION_DIALOG_ROW_NUM_PROPERTIES
};
static GParamSpec* clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_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 CLOCKS_UTILS_TYPE_WALL_CLOCK (clocks_utils_wall_clock_get_type ())
#define CLOCKS_UTILS_WALL_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_UTILS_TYPE_WALL_CLOCK, ClocksUtilsWallClock))
#define CLOCKS_UTILS_WALL_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_UTILS_TYPE_WALL_CLOCK, ClocksUtilsWallClockClass))
#define CLOCKS_UTILS_IS_WALL_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_UTILS_TYPE_WALL_CLOCK))
#define CLOCKS_UTILS_IS_WALL_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_UTILS_TYPE_WALL_CLOCK))
#define CLOCKS_UTILS_WALL_CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_UTILS_TYPE_WALL_CLOCK, ClocksUtilsWallClockClass))

typedef struct _ClocksUtilsWallClock ClocksUtilsWallClock;
typedef struct _ClocksUtilsWallClockClass ClocksUtilsWallClockClass;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_time_zone_unref0(var) ((var == NULL) ? NULL : (var = (g_time_zone_unref (var), NULL)))

struct _ClocksWorldLocationDialogRow {
	GtkListBoxRow parent_instance;
	ClocksWorldLocationDialogRowPrivate * priv;
};

struct _ClocksWorldLocationDialogRowClass {
	GtkListBoxRowClass parent_class;
};

struct _ClocksWorldLocationDialogRowPrivate {
	ClocksWorldClockLocation* _data;
	gchar* _clock_name;
	gchar* _clock_location;
	gchar* _clock_description;
	gboolean _clock_selected;
};

static gint ClocksWorldLocationDialogRow_private_offset;
static gpointer clocks_world_location_dialog_row_parent_class = NULL;

VALA_EXTERN GType clocks_world_location_dialog_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksWorldLocationDialogRow, g_object_unref)
VALA_EXTERN GType clocks_world_clock_location_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksWorldClockLocation, g_object_unref)
VALA_EXTERN ClocksWorldLocationDialogRow* clocks_world_location_dialog_row_new (ClocksWorldClockLocation* data);
VALA_EXTERN ClocksWorldLocationDialogRow* clocks_world_location_dialog_row_construct (GType object_type,
                                                                          ClocksWorldClockLocation* data);
VALA_EXTERN GWeatherLocation* clocks_world_clock_location_get_location (ClocksWorldClockLocation* self);
VALA_EXTERN void clocks_world_location_dialog_row_set_clock_name (ClocksWorldLocationDialogRow* self,
                                                      const gchar* value);
VALA_EXTERN void clocks_world_location_dialog_row_set_clock_location (ClocksWorldLocationDialogRow* self,
                                                          const gchar* value);
VALA_EXTERN GType clocks_utils_wall_clock_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClocksUtilsWallClock, g_object_unref)
VALA_EXTERN ClocksUtilsWallClock* clocks_utils_wall_clock_get_default (void);
VALA_EXTERN GDateTime* clocks_utils_wall_clock_get_date_time (ClocksUtilsWallClock* self);
VALA_EXTERN gchar* clocks_utils_get_time_difference_message (gdouble offset);
VALA_EXTERN void clocks_world_location_dialog_row_set_clock_description (ClocksWorldLocationDialogRow* self,
                                                             const gchar* value);
VALA_EXTERN gboolean clocks_world_clock_location_get_selected (ClocksWorldClockLocation* self);
VALA_EXTERN ClocksWorldClockLocation* clocks_world_location_dialog_row_get_data (ClocksWorldLocationDialogRow* self);
VALA_EXTERN void clocks_world_location_dialog_row_set_data (ClocksWorldLocationDialogRow* self,
                                                ClocksWorldClockLocation* value);
VALA_EXTERN const gchar* clocks_world_location_dialog_row_get_clock_name (ClocksWorldLocationDialogRow* self);
VALA_EXTERN const gchar* clocks_world_location_dialog_row_get_clock_location (ClocksWorldLocationDialogRow* self);
VALA_EXTERN const gchar* clocks_world_location_dialog_row_get_clock_description (ClocksWorldLocationDialogRow* self);
VALA_EXTERN gboolean clocks_world_location_dialog_row_get_clock_selected (ClocksWorldLocationDialogRow* self);
VALA_EXTERN void clocks_world_location_dialog_row_set_clock_selected (ClocksWorldLocationDialogRow* self,
                                                          gboolean value);
static void clocks_world_location_dialog_row_finalize (GObject * obj);
static GType clocks_world_location_dialog_row_get_type_once (void);
static void _vala_clocks_world_location_dialog_row_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static void _vala_clocks_world_location_dialog_row_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
clocks_world_location_dialog_row_get_instance_private (ClocksWorldLocationDialogRow* self)
{
	return G_STRUCT_MEMBER_P (self, ClocksWorldLocationDialogRow_private_offset);
}

static gpointer
_g_date_time_ref0 (gpointer self)
{
	return self ? g_date_time_ref (self) : NULL;
}

static gpointer
_g_time_zone_ref0 (gpointer self)
{
	return self ? g_time_zone_ref (self) : NULL;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

ClocksWorldLocationDialogRow*
clocks_world_location_dialog_row_construct (GType object_type,
                                            ClocksWorldClockLocation* data)
{
	ClocksWorldLocationDialogRow * self = NULL;
	GWeatherLocation* _tmp0_;
	GWeatherLocation* _tmp1_;
	const gchar* _tmp2_;
	GWeatherLocation* _tmp3_;
	GWeatherLocation* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	ClocksUtilsWallClock* wallclock = NULL;
	ClocksUtilsWallClock* _tmp7_;
	GDateTime* local_time = NULL;
	ClocksUtilsWallClock* _tmp8_;
	GDateTime* _tmp9_;
	GDateTime* _tmp10_;
	GDateTime* _tmp11_;
	GTimeZone* time_zone = NULL;
	GWeatherLocation* _tmp12_;
	GWeatherLocation* _tmp13_;
	GTimeZone* _tmp14_;
	GTimeZone* _tmp15_;
	GTimeZone* _tmp16_;
	gboolean _tmp34_;
	gboolean _tmp35_;
	g_return_val_if_fail (data != NULL, NULL);
	self = (ClocksWorldLocationDialogRow*) g_object_new (object_type, "data", data, NULL);
	_tmp0_ = clocks_world_clock_location_get_location (data);
	_tmp1_ = _tmp0_;
	_tmp2_ = gweather_location_get_name (_tmp1_);
	clocks_world_location_dialog_row_set_clock_name (self, _tmp2_);
	_tmp3_ = clocks_world_clock_location_get_location (data);
	_tmp4_ = _tmp3_;
	_tmp5_ = gweather_location_get_country_name (_tmp4_);
	_tmp6_ = _tmp5_;
	clocks_world_location_dialog_row_set_clock_location (self, _tmp6_);
	_g_free0 (_tmp6_);
	_tmp7_ = clocks_utils_wall_clock_get_default ();
	wallclock = _tmp7_;
	_tmp8_ = wallclock;
	_tmp9_ = clocks_utils_wall_clock_get_date_time (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = _g_date_time_ref0 (_tmp10_);
	local_time = _tmp11_;
	_tmp12_ = clocks_world_clock_location_get_location (data);
	_tmp13_ = _tmp12_;
	_tmp14_ = gweather_location_get_timezone (_tmp13_);
	_tmp15_ = _g_time_zone_ref0 (_tmp14_);
	time_zone = _tmp15_;
	_tmp16_ = time_zone;
	if (_tmp16_ != NULL) {
		GDateTime* date_time = NULL;
		GDateTime* _tmp17_;
		GTimeZone* _tmp18_;
		GDateTime* _tmp19_;
		GTimeSpan local_offset = 0LL;
		GDateTime* _tmp20_;
		GDateTime* _tmp21_;
		gchar* time_diff_message = NULL;
		gchar* _tmp22_;
		gchar* time_zone_name = NULL;
		GTimeZone* _tmp23_;
		const gchar* _tmp24_;
		gchar* _tmp25_;
		const gchar* _tmp26_;
		_tmp17_ = local_time;
		_tmp18_ = time_zone;
		_tmp19_ = g_date_time_to_timezone (_tmp17_, _tmp18_);
		date_time = _tmp19_;
		_tmp20_ = local_time;
		_tmp21_ = date_time;
		local_offset = g_date_time_get_utc_offset (_tmp20_) - g_date_time_get_utc_offset (_tmp21_);
		_tmp22_ = clocks_utils_get_time_difference_message ((gdouble) local_offset);
		time_diff_message = _tmp22_;
		_tmp23_ = time_zone;
		_tmp24_ = g_time_zone_get_identifier (_tmp23_);
		_tmp25_ = string_replace (_tmp24_, "_", " ");
		time_zone_name = _tmp25_;
		_tmp26_ = time_zone_name;
		if (((const gchar*) _tmp26_) != NULL) {
			const gchar* _tmp27_;
			const gchar* _tmp28_;
			gchar* _tmp29_;
			gchar* _tmp30_;
			_tmp27_ = time_zone_name;
			_tmp28_ = time_diff_message;
			_tmp29_ = g_strdup_printf ("%s • %s", _tmp27_, _tmp28_);
			_tmp30_ = _tmp29_;
			clocks_world_location_dialog_row_set_clock_description (self, _tmp30_);
			_g_free0 (_tmp30_);
		} else {
			const gchar* _tmp31_;
			gchar* _tmp32_;
			gchar* _tmp33_;
			_tmp31_ = time_diff_message;
			_tmp32_ = g_strdup_printf ("%s", _tmp31_);
			_tmp33_ = _tmp32_;
			clocks_world_location_dialog_row_set_clock_description (self, _tmp33_);
			_g_free0 (_tmp33_);
		}
		_g_free0 (time_zone_name);
		_g_free0 (time_diff_message);
		_g_date_time_unref0 (date_time);
	} else {
		clocks_world_location_dialog_row_set_clock_description (self, NULL);
	}
	_tmp34_ = clocks_world_clock_location_get_selected (data);
	_tmp35_ = _tmp34_;
	gtk_widget_set_sensitive ((GtkWidget*) self, !_tmp35_);
	g_object_bind_property_with_closures ((GObject*) data, "selected", (GObject*) self, "clock-selected", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_g_time_zone_unref0 (time_zone);
	_g_date_time_unref0 (local_time);
	_g_object_unref0 (wallclock);
	return self;
}

ClocksWorldLocationDialogRow*
clocks_world_location_dialog_row_new (ClocksWorldClockLocation* data)
{
	return clocks_world_location_dialog_row_construct (CLOCKS_WORLD_TYPE_LOCATION_DIALOG_ROW, data);
}

ClocksWorldClockLocation*
clocks_world_location_dialog_row_get_data (ClocksWorldLocationDialogRow* self)
{
	ClocksWorldClockLocation* result;
	ClocksWorldClockLocation* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_data;
	result = _tmp0_;
	return result;
}

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

void
clocks_world_location_dialog_row_set_data (ClocksWorldLocationDialogRow* self,
                                           ClocksWorldClockLocation* value)
{
	ClocksWorldClockLocation* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_world_location_dialog_row_get_data (self);
	if (old_value != value) {
		ClocksWorldClockLocation* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_data);
		self->priv->_data = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_DATA_PROPERTY]);
	}
}

const gchar*
clocks_world_location_dialog_row_get_clock_name (ClocksWorldLocationDialogRow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_clock_name;
	result = _tmp0_;
	return result;
}

void
clocks_world_location_dialog_row_set_clock_name (ClocksWorldLocationDialogRow* self,
                                                 const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_world_location_dialog_row_get_clock_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_clock_name);
		self->priv->_clock_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_NAME_PROPERTY]);
	}
}

const gchar*
clocks_world_location_dialog_row_get_clock_location (ClocksWorldLocationDialogRow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_clock_location;
	result = _tmp0_;
	return result;
}

void
clocks_world_location_dialog_row_set_clock_location (ClocksWorldLocationDialogRow* self,
                                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_world_location_dialog_row_get_clock_location (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_clock_location);
		self->priv->_clock_location = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_LOCATION_PROPERTY]);
	}
}

const gchar*
clocks_world_location_dialog_row_get_clock_description (ClocksWorldLocationDialogRow* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_clock_description;
	result = _tmp0_;
	return result;
}

void
clocks_world_location_dialog_row_set_clock_description (ClocksWorldLocationDialogRow* self,
                                                        const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_world_location_dialog_row_get_clock_description (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_clock_description);
		self->priv->_clock_description = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_DESCRIPTION_PROPERTY]);
	}
}

gboolean
clocks_world_location_dialog_row_get_clock_selected (ClocksWorldLocationDialogRow* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_clock_selected;
	return result;
}

void
clocks_world_location_dialog_row_set_clock_selected (ClocksWorldLocationDialogRow* self,
                                                     gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = clocks_world_location_dialog_row_get_clock_selected (self);
	if (old_value != value) {
		self->priv->_clock_selected = value;
		g_object_notify_by_pspec ((GObject *) self, clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_SELECTED_PROPERTY]);
	}
}

static void
clocks_world_location_dialog_row_class_init (ClocksWorldLocationDialogRowClass * klass,
                                             gpointer klass_data)
{
	clocks_world_location_dialog_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ClocksWorldLocationDialogRow_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_clocks_world_location_dialog_row_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_clocks_world_location_dialog_row_set_property;
	G_OBJECT_CLASS (klass)->finalize = clocks_world_location_dialog_row_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_WORLD_LOCATION_DIALOG_ROW_DATA_PROPERTY, clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_DATA_PROPERTY] = g_param_spec_object ("data", "data", "data", CLOCKS_WORLD_TYPE_CLOCK_LOCATION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_NAME_PROPERTY, clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_NAME_PROPERTY] = g_param_spec_string ("clock-name", "clock-name", "clock-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_LOCATION_PROPERTY, clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_LOCATION_PROPERTY] = g_param_spec_string ("clock-location", "clock-location", "clock-location", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_DESCRIPTION_PROPERTY, clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_DESCRIPTION_PROPERTY] = g_param_spec_string ("clock-description", "clock-description", "clock-description", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_SELECTED_PROPERTY, clocks_world_location_dialog_row_properties[CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_SELECTED_PROPERTY] = g_param_spec_boolean ("clock-selected", "clock-selected", "clock-selected", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/clocks/ui/world-location-dialog-row.ui");
}

static void
clocks_world_location_dialog_row_instance_init (ClocksWorldLocationDialogRow * self,
                                                gpointer klass)
{
	self->priv = clocks_world_location_dialog_row_get_instance_private (self);
	self->priv->_clock_name = NULL;
	self->priv->_clock_location = NULL;
	self->priv->_clock_description = NULL;
	self->priv->_clock_selected = FALSE;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
clocks_world_location_dialog_row_finalize (GObject * obj)
{
	ClocksWorldLocationDialogRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_WORLD_TYPE_LOCATION_DIALOG_ROW, ClocksWorldLocationDialogRow);
	_g_object_unref0 (self->priv->_data);
	_g_free0 (self->priv->_clock_name);
	_g_free0 (self->priv->_clock_location);
	_g_free0 (self->priv->_clock_description);
	G_OBJECT_CLASS (clocks_world_location_dialog_row_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
clocks_world_location_dialog_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ClocksWorldLocationDialogRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_world_location_dialog_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksWorldLocationDialogRow), 0, (GInstanceInitFunc) clocks_world_location_dialog_row_instance_init, NULL };
	GType clocks_world_location_dialog_row_type_id;
	clocks_world_location_dialog_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "ClocksWorldLocationDialogRow", &g_define_type_info, 0);
	ClocksWorldLocationDialogRow_private_offset = g_type_add_instance_private (clocks_world_location_dialog_row_type_id, sizeof (ClocksWorldLocationDialogRowPrivate));
	return clocks_world_location_dialog_row_type_id;
}

GType
clocks_world_location_dialog_row_get_type (void)
{
	static volatile gsize clocks_world_location_dialog_row_type_id__once = 0;
	if (g_once_init_enter (&clocks_world_location_dialog_row_type_id__once)) {
		GType clocks_world_location_dialog_row_type_id;
		clocks_world_location_dialog_row_type_id = clocks_world_location_dialog_row_get_type_once ();
		g_once_init_leave (&clocks_world_location_dialog_row_type_id__once, clocks_world_location_dialog_row_type_id);
	}
	return clocks_world_location_dialog_row_type_id__once;
}

static void
_vala_clocks_world_location_dialog_row_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	ClocksWorldLocationDialogRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_WORLD_TYPE_LOCATION_DIALOG_ROW, ClocksWorldLocationDialogRow);
	switch (property_id) {
		case CLOCKS_WORLD_LOCATION_DIALOG_ROW_DATA_PROPERTY:
		g_value_set_object (value, clocks_world_location_dialog_row_get_data (self));
		break;
		case CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_NAME_PROPERTY:
		g_value_set_string (value, clocks_world_location_dialog_row_get_clock_name (self));
		break;
		case CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_LOCATION_PROPERTY:
		g_value_set_string (value, clocks_world_location_dialog_row_get_clock_location (self));
		break;
		case CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_DESCRIPTION_PROPERTY:
		g_value_set_string (value, clocks_world_location_dialog_row_get_clock_description (self));
		break;
		case CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_SELECTED_PROPERTY:
		g_value_set_boolean (value, clocks_world_location_dialog_row_get_clock_selected (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_clocks_world_location_dialog_row_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec)
{
	ClocksWorldLocationDialogRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CLOCKS_WORLD_TYPE_LOCATION_DIALOG_ROW, ClocksWorldLocationDialogRow);
	switch (property_id) {
		case CLOCKS_WORLD_LOCATION_DIALOG_ROW_DATA_PROPERTY:
		clocks_world_location_dialog_row_set_data (self, g_value_get_object (value));
		break;
		case CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_NAME_PROPERTY:
		clocks_world_location_dialog_row_set_clock_name (self, g_value_get_string (value));
		break;
		case CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_LOCATION_PROPERTY:
		clocks_world_location_dialog_row_set_clock_location (self, g_value_get_string (value));
		break;
		case CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_DESCRIPTION_PROPERTY:
		clocks_world_location_dialog_row_set_clock_description (self, g_value_get_string (value));
		break;
		case CLOCKS_WORLD_LOCATION_DIALOG_ROW_CLOCK_SELECTED_PROPERTY:
		clocks_world_location_dialog_row_set_clock_selected (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

