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

/*
 *  Copyright (c) 2009-2010 Mike Massonnet <mmassonnet@xfce.org>
 *  Copyright (c) 2009-2010 Vincent Legout <vincent@xfce.org>
 *
 *  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 "xfmpc.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <gtk/gtk.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  {
	XFMPC_STATUSBAR_0_PROPERTY,
	XFMPC_STATUSBAR_TEXT_PROPERTY,
	XFMPC_STATUSBAR_NUM_PROPERTIES
};
static GParamSpec* xfmpc_statusbar_properties[XFMPC_STATUSBAR_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _XfmpcStatusbarPrivate {
	guint context_id;
	gchar* _text;
};

static gint XfmpcStatusbar_private_offset;
static gpointer xfmpc_statusbar_parent_class = NULL;

static GObject * xfmpc_statusbar_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties);
static void xfmpc_statusbar_finalize (GObject * obj);
static GType xfmpc_statusbar_get_type_once (void);
static void _vala_xfmpc_statusbar_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);

static inline gpointer
xfmpc_statusbar_get_instance_private (XfmpcStatusbar* self)
{
	return G_STRUCT_MEMBER_P (self, XfmpcStatusbar_private_offset);
}

XfmpcStatusbar*
xfmpc_statusbar_construct (GType object_type)
{
	XfmpcStatusbar * self = NULL;
	self = (XfmpcStatusbar*) g_object_new (object_type, NULL);
	return self;
}

XfmpcStatusbar*
xfmpc_statusbar_new (void)
{
	return xfmpc_statusbar_construct (XFMPC_TYPE_STATUSBAR);
}

void
xfmpc_statusbar_set_text (XfmpcStatusbar* self,
                          const gchar* value)
{
	gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_text);
	self->priv->_text = _tmp0_;
	gtk_statusbar_pop ((GtkStatusbar*) self, self->priv->context_id);
	_tmp1_ = self->priv->_text;
	gtk_statusbar_push ((GtkStatusbar*) self, self->priv->context_id, _tmp1_);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_statusbar_properties[XFMPC_STATUSBAR_TEXT_PROPERTY]);
}

static GObject *
xfmpc_statusbar_constructor (GType type,
                             guint n_construct_properties,
                             GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	XfmpcStatusbar * self;
	parent_class = G_OBJECT_CLASS (xfmpc_statusbar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XFMPC_TYPE_STATUSBAR, XfmpcStatusbar);
	self->priv->context_id = gtk_statusbar_get_context_id ((GtkStatusbar*) self, "Main text");
	return obj;
}

static void
xfmpc_statusbar_class_init (XfmpcStatusbarClass * klass,
                            gpointer klass_data)
{
	xfmpc_statusbar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XfmpcStatusbar_private_offset);
	G_OBJECT_CLASS (klass)->set_property = _vala_xfmpc_statusbar_set_property;
	G_OBJECT_CLASS (klass)->constructor = xfmpc_statusbar_constructor;
	G_OBJECT_CLASS (klass)->finalize = xfmpc_statusbar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_STATUSBAR_TEXT_PROPERTY, xfmpc_statusbar_properties[XFMPC_STATUSBAR_TEXT_PROPERTY] = g_param_spec_string ("text", "text", "text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
}

static void
xfmpc_statusbar_instance_init (XfmpcStatusbar * self,
                               gpointer klass)
{
	self->priv = xfmpc_statusbar_get_instance_private (self);
}

static void
xfmpc_statusbar_finalize (GObject * obj)
{
	XfmpcStatusbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XFMPC_TYPE_STATUSBAR, XfmpcStatusbar);
	_g_free0 (self->priv->_text);
	G_OBJECT_CLASS (xfmpc_statusbar_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
xfmpc_statusbar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XfmpcStatusbarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xfmpc_statusbar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XfmpcStatusbar), 0, (GInstanceInitFunc) xfmpc_statusbar_instance_init, NULL };
	GType xfmpc_statusbar_type_id;
	xfmpc_statusbar_type_id = g_type_register_static (gtk_statusbar_get_type (), "XfmpcStatusbar", &g_define_type_info, 0);
	XfmpcStatusbar_private_offset = g_type_add_instance_private (xfmpc_statusbar_type_id, sizeof (XfmpcStatusbarPrivate));
	return xfmpc_statusbar_type_id;
}

GType
xfmpc_statusbar_get_type (void)
{
	static volatile gsize xfmpc_statusbar_type_id__once = 0;
	if (g_once_init_enter (&xfmpc_statusbar_type_id__once)) {
		GType xfmpc_statusbar_type_id;
		xfmpc_statusbar_type_id = xfmpc_statusbar_get_type_once ();
		g_once_init_leave (&xfmpc_statusbar_type_id__once, xfmpc_statusbar_type_id);
	}
	return xfmpc_statusbar_type_id__once;
}

static void
_vala_xfmpc_statusbar_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	XfmpcStatusbar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XFMPC_TYPE_STATUSBAR, XfmpcStatusbar);
	switch (property_id) {
		case XFMPC_STATUSBAR_TEXT_PROPERTY:
		xfmpc_statusbar_set_text (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

