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

/**/
/*  Copyright (C) 2011 Robert Dyer*/
/**/
/*  This file is part of Plank.*/
/**/
/*  Plank 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.*/
/**/
/*  Plank 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, see <http://www.gnu.org/licenses/>.*/
/**/

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

enum  {
	PLANK_DOCK_ITEM_PREFERENCES_0_PROPERTY,
	PLANK_DOCK_ITEM_PREFERENCES_LAUNCHER_PROPERTY,
	PLANK_DOCK_ITEM_PREFERENCES_NUM_PROPERTIES
};
static GParamSpec* plank_dock_item_preferences_properties[PLANK_DOCK_ITEM_PREFERENCES_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _PlankDockItemPreferencesPrivate {
	gchar* _Launcher;
};

static gint PlankDockItemPreferences_private_offset;
static gpointer plank_dock_item_preferences_parent_class = NULL;

static void plank_dock_item_preferences_real_reset_properties (PlankPreferences* base);
static void plank_dock_item_preferences_real_verify (PlankPreferences* base,
                                              const gchar* prop);
static void plank_dock_item_preferences_finalize (GObject * obj);
static GType plank_dock_item_preferences_get_type_once (void);
static void _vala_plank_dock_item_preferences_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec);
static void _vala_plank_dock_item_preferences_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec);

static inline gpointer
plank_dock_item_preferences_get_instance_private (PlankDockItemPreferences* self)
{
	return G_STRUCT_MEMBER_P (self, PlankDockItemPreferences_private_offset);
}

/**
 * {@inheritDoc}
 */
PlankDockItemPreferences*
plank_dock_item_preferences_construct_with_launcher (GType object_type,
                                                     const gchar* launcher)
{
	PlankDockItemPreferences * self = NULL;
	g_return_val_if_fail (launcher != NULL, NULL);
	self = (PlankDockItemPreferences*) plank_preferences_construct (object_type);
	plank_dock_item_preferences_set_Launcher (self, launcher);
	return self;
}

PlankDockItemPreferences*
plank_dock_item_preferences_new_with_launcher (const gchar* launcher)
{
	return plank_dock_item_preferences_construct_with_launcher (PLANK_TYPE_DOCK_ITEM_PREFERENCES, launcher);
}

/**
 * {@inheritDoc}
 */
PlankDockItemPreferences*
plank_dock_item_preferences_construct_with_file (GType object_type,
                                                 GFile* file)
{
	PlankDockItemPreferences * self = NULL;
	g_return_val_if_fail (file != NULL, NULL);
	self = (PlankDockItemPreferences*) plank_preferences_construct_with_file (object_type, file);
	return self;
}

PlankDockItemPreferences*
plank_dock_item_preferences_new_with_file (GFile* file)
{
	return plank_dock_item_preferences_construct_with_file (PLANK_TYPE_DOCK_ITEM_PREFERENCES, file);
}

/**
 * {@inheritDoc}
 */
PlankDockItemPreferences*
plank_dock_item_preferences_construct_with_filename (GType object_type,
                                                     const gchar* filename)
{
	PlankDockItemPreferences * self = NULL;
	g_return_val_if_fail (filename != NULL, NULL);
	self = (PlankDockItemPreferences*) plank_preferences_construct_with_filename (object_type, filename);
	return self;
}

PlankDockItemPreferences*
plank_dock_item_preferences_new_with_filename (const gchar* filename)
{
	return plank_dock_item_preferences_construct_with_filename (PLANK_TYPE_DOCK_ITEM_PREFERENCES, filename);
}

/**
 * {@inheritDoc}
 */
static void
plank_dock_item_preferences_real_reset_properties (PlankPreferences* base)
{
	PlankDockItemPreferences * self;
	self = (PlankDockItemPreferences*) base;
	plank_dock_item_preferences_set_Launcher (self, "");
}

/**
 * {@inheritDoc}
 */
static void
plank_dock_item_preferences_real_verify (PlankPreferences* base,
                                         const gchar* prop)
{
	PlankDockItemPreferences * self;
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	GError* _inner_error0_ = NULL;
	self = (PlankDockItemPreferences*) base;
	g_return_if_fail (prop != NULL);
	_tmp0_ = prop;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("Launcher")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp3_;
				_tmp3_ = self->priv->_Launcher;
				if (g_str_has_prefix (_tmp3_, "/")) {
					{
						gchar* _tmp4_ = NULL;
						const gchar* _tmp5_;
						gchar* _tmp6_;
						_tmp5_ = self->priv->_Launcher;
						_tmp6_ = g_filename_to_uri (_tmp5_, NULL, &_inner_error0_);
						_tmp4_ = _tmp6_;
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							if (_inner_error0_->domain == G_CONVERT_ERROR) {
								goto __catch0_g_convert_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;
						}
						plank_dock_item_preferences_set_Launcher (self, _tmp4_);
						_g_free0 (_tmp4_);
					}
					goto __finally0;
					__catch0_g_convert_error:
					{
						GError* e = NULL;
						GError* _tmp7_;
						const gchar* _tmp8_;
						e = _inner_error0_;
						_inner_error0_ = NULL;
						_tmp7_ = e;
						_tmp8_ = _tmp7_->message;
						g_warning ("DockItemPreferences.vala:74: %s", _tmp8_);
						_g_error_free0 (e);
					}
					__finally0:
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						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;
					}
				}
				break;
			}
		}
	}
}

PlankDockItemPreferences*
plank_dock_item_preferences_construct (GType object_type)
{
	PlankDockItemPreferences * self = NULL;
	self = (PlankDockItemPreferences*) plank_preferences_construct (object_type);
	return self;
}

PlankDockItemPreferences*
plank_dock_item_preferences_new (void)
{
	return plank_dock_item_preferences_construct (PLANK_TYPE_DOCK_ITEM_PREFERENCES);
}

const gchar*
plank_dock_item_preferences_get_Launcher (PlankDockItemPreferences* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_Launcher;
	result = _tmp0_;
	return result;
}

void
plank_dock_item_preferences_set_Launcher (PlankDockItemPreferences* self,
                                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = plank_dock_item_preferences_get_Launcher (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_Launcher);
		self->priv->_Launcher = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, plank_dock_item_preferences_properties[PLANK_DOCK_ITEM_PREFERENCES_LAUNCHER_PROPERTY]);
	}
}

static void
plank_dock_item_preferences_class_init (PlankDockItemPreferencesClass * klass,
                                        gpointer klass_data)
{
	plank_dock_item_preferences_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PlankDockItemPreferences_private_offset);
	((PlankPreferencesClass *) klass)->reset_properties = (void (*) (PlankPreferences*)) plank_dock_item_preferences_real_reset_properties;
	((PlankPreferencesClass *) klass)->verify = (void (*) (PlankPreferences*, const gchar*)) plank_dock_item_preferences_real_verify;
	G_OBJECT_CLASS (klass)->get_property = _vala_plank_dock_item_preferences_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_plank_dock_item_preferences_set_property;
	G_OBJECT_CLASS (klass)->finalize = plank_dock_item_preferences_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PLANK_DOCK_ITEM_PREFERENCES_LAUNCHER_PROPERTY, plank_dock_item_preferences_properties[PLANK_DOCK_ITEM_PREFERENCES_LAUNCHER_PROPERTY] = g_param_spec_string ("Launcher", "launcher", "The uri for this item.", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
plank_dock_item_preferences_instance_init (PlankDockItemPreferences * self,
                                           gpointer klass)
{
	self->priv = plank_dock_item_preferences_get_instance_private (self);
}

static void
plank_dock_item_preferences_finalize (GObject * obj)
{
	PlankDockItemPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PLANK_TYPE_DOCK_ITEM_PREFERENCES, PlankDockItemPreferences);
	_g_free0 (self->priv->_Launcher);
	G_OBJECT_CLASS (plank_dock_item_preferences_parent_class)->finalize (obj);
}

/**
 * Contains preference keys for a dock item.
 */
static GType
plank_dock_item_preferences_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PlankDockItemPreferencesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) plank_dock_item_preferences_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PlankDockItemPreferences), 0, (GInstanceInitFunc) plank_dock_item_preferences_instance_init, NULL };
	GType plank_dock_item_preferences_type_id;
	plank_dock_item_preferences_type_id = g_type_register_static (PLANK_TYPE_PREFERENCES, "PlankDockItemPreferences", &g_define_type_info, 0);
	PlankDockItemPreferences_private_offset = g_type_add_instance_private (plank_dock_item_preferences_type_id, sizeof (PlankDockItemPreferencesPrivate));
	return plank_dock_item_preferences_type_id;
}

GType
plank_dock_item_preferences_get_type (void)
{
	static volatile gsize plank_dock_item_preferences_type_id__once = 0;
	if (g_once_init_enter (&plank_dock_item_preferences_type_id__once)) {
		GType plank_dock_item_preferences_type_id;
		plank_dock_item_preferences_type_id = plank_dock_item_preferences_get_type_once ();
		g_once_init_leave (&plank_dock_item_preferences_type_id__once, plank_dock_item_preferences_type_id);
	}
	return plank_dock_item_preferences_type_id__once;
}

static void
_vala_plank_dock_item_preferences_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec)
{
	PlankDockItemPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PLANK_TYPE_DOCK_ITEM_PREFERENCES, PlankDockItemPreferences);
	switch (property_id) {
		case PLANK_DOCK_ITEM_PREFERENCES_LAUNCHER_PROPERTY:
		g_value_set_string (value, plank_dock_item_preferences_get_Launcher (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_plank_dock_item_preferences_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec)
{
	PlankDockItemPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PLANK_TYPE_DOCK_ITEM_PREFERENCES, PlankDockItemPreferences);
	switch (property_id) {
		case PLANK_DOCK_ITEM_PREFERENCES_LAUNCHER_PROPERTY:
		plank_dock_item_preferences_set_Launcher (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

