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

/*
 * Copyright (c) 2011-2017 elementary LLC (https://elementary.io)
 *
 * 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 "wingpanel.h"
#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>

enum  {
	WINGPANEL_WIDGETS_CONTAINER_0_PROPERTY,
	WINGPANEL_WIDGETS_CONTAINER_CONTENT_WIDGET_PROPERTY,
	WINGPANEL_WIDGETS_CONTAINER_NUM_PROPERTIES
};
static GParamSpec* wingpanel_widgets_container_properties[WINGPANEL_WIDGETS_CONTAINER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _WingpanelWidgetsContainerPrivate {
	GtkGrid* _content_widget;
};

static gint WingpanelWidgetsContainer_private_offset;
static gpointer wingpanel_widgets_container_parent_class = NULL;

static GObject * wingpanel_widgets_container_constructor (GType type,
                                                   guint n_construct_properties,
                                                   GObjectConstructParam * construct_properties);
static void wingpanel_widgets_container_finalize (GObject * obj);
static GType wingpanel_widgets_container_get_type_once (void);
static void _vala_wingpanel_widgets_container_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec);
static void _vala_wingpanel_widgets_container_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec);

static inline gpointer
wingpanel_widgets_container_get_instance_private (WingpanelWidgetsContainer* self)
{
	return G_STRUCT_MEMBER_P (self, WingpanelWidgetsContainer_private_offset);
}

WingpanelWidgetsContainer*
wingpanel_widgets_container_construct (GType object_type)
{
	WingpanelWidgetsContainer * self = NULL;
	self = (WingpanelWidgetsContainer*) g_object_new (object_type, NULL);
	return self;
}

WingpanelWidgetsContainer*
wingpanel_widgets_container_new (void)
{
	return wingpanel_widgets_container_construct (WINGPANEL_WIDGETS_TYPE_CONTAINER);
}

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

GtkGrid*
wingpanel_widgets_container_get_content_widget (WingpanelWidgetsContainer* self)
{
	GtkGrid* result;
	GtkGrid* _tmp0_;
	GtkGrid* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content_widget;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
wingpanel_widgets_container_set_content_widget (WingpanelWidgetsContainer* self,
                                                GtkGrid* value)
{
	GtkGrid* old_value;
	g_return_if_fail (self != NULL);
	old_value = wingpanel_widgets_container_get_content_widget (self);
	if (old_value != value) {
		GtkGrid* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_content_widget);
		self->priv->_content_widget = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, wingpanel_widgets_container_properties[WINGPANEL_WIDGETS_CONTAINER_CONTENT_WIDGET_PROPERTY]);
	}
	_g_object_unref0 (old_value);
}

static GObject *
wingpanel_widgets_container_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WingpanelWidgetsContainer * self;
	GtkGrid* _tmp0_;
	GtkGrid* _tmp1_;
	GtkGrid* _tmp2_;
	GtkGrid* _tmp3_;
	GtkGrid* _tmp4_;
	GtkGrid* _tmp5_;
	GtkGrid* _tmp6_;
	GtkGrid* _tmp7_;
	GtkStyleContext* style_context = NULL;
	GtkStyleContext* _tmp8_;
	GtkStyleContext* _tmp9_;
	GtkStyleContext* _tmp10_;
	GtkStyleContext* _tmp11_;
	GtkStyleContext* _tmp12_;
	parent_class = G_OBJECT_CLASS (wingpanel_widgets_container_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_WIDGETS_TYPE_CONTAINER, WingpanelWidgetsContainer);
	_tmp0_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	wingpanel_widgets_container_set_content_widget (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = wingpanel_widgets_container_get_content_widget (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp4_, TRUE);
	_g_object_unref0 (_tmp4_);
	_tmp5_ = wingpanel_widgets_container_get_content_widget (self);
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp7_);
	_g_object_unref0 (_tmp7_);
	_tmp8_ = gtk_widget_get_style_context ((GtkWidget*) self);
	_tmp9_ = _g_object_ref0 (_tmp8_);
	style_context = _tmp9_;
	_tmp10_ = style_context;
	gtk_style_context_add_class (_tmp10_, GTK_STYLE_CLASS_MENUITEM);
	_tmp11_ = style_context;
	gtk_style_context_remove_class (_tmp11_, GTK_STYLE_CLASS_BUTTON);
	_tmp12_ = style_context;
	gtk_style_context_remove_class (_tmp12_, "text-button");
	_g_object_unref0 (style_context);
	return obj;
}

static void
wingpanel_widgets_container_class_init (WingpanelWidgetsContainerClass * klass,
                                        gpointer klass_data)
{
	wingpanel_widgets_container_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WingpanelWidgetsContainer_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_wingpanel_widgets_container_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_wingpanel_widgets_container_set_property;
	G_OBJECT_CLASS (klass)->constructor = wingpanel_widgets_container_constructor;
	G_OBJECT_CLASS (klass)->finalize = wingpanel_widgets_container_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WINGPANEL_WIDGETS_CONTAINER_CONTENT_WIDGET_PROPERTY, wingpanel_widgets_container_properties[WINGPANEL_WIDGETS_CONTAINER_CONTENT_WIDGET_PROPERTY] = g_param_spec_object ("content-widget", "content-widget", "content-widget", gtk_grid_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
wingpanel_widgets_container_instance_init (WingpanelWidgetsContainer * self,
                                           gpointer klass)
{
	self->priv = wingpanel_widgets_container_get_instance_private (self);
}

static void
wingpanel_widgets_container_finalize (GObject * obj)
{
	WingpanelWidgetsContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_WIDGETS_TYPE_CONTAINER, WingpanelWidgetsContainer);
	_g_object_unref0 (self->priv->_content_widget);
	G_OBJECT_CLASS (wingpanel_widgets_container_parent_class)->finalize (obj);
}

static GType
wingpanel_widgets_container_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WingpanelWidgetsContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) wingpanel_widgets_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WingpanelWidgetsContainer), 0, (GInstanceInitFunc) wingpanel_widgets_container_instance_init, NULL };
	GType wingpanel_widgets_container_type_id;
	wingpanel_widgets_container_type_id = g_type_register_static (gtk_button_get_type (), "WingpanelWidgetsContainer", &g_define_type_info, 0);
	WingpanelWidgetsContainer_private_offset = g_type_add_instance_private (wingpanel_widgets_container_type_id, sizeof (WingpanelWidgetsContainerPrivate));
	return wingpanel_widgets_container_type_id;
}

GType
wingpanel_widgets_container_get_type (void)
{
	static volatile gsize wingpanel_widgets_container_type_id__once = 0;
	if (g_once_init_enter (&wingpanel_widgets_container_type_id__once)) {
		GType wingpanel_widgets_container_type_id;
		wingpanel_widgets_container_type_id = wingpanel_widgets_container_get_type_once ();
		g_once_init_leave (&wingpanel_widgets_container_type_id__once, wingpanel_widgets_container_type_id);
	}
	return wingpanel_widgets_container_type_id__once;
}

static void
_vala_wingpanel_widgets_container_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec)
{
	WingpanelWidgetsContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WINGPANEL_WIDGETS_TYPE_CONTAINER, WingpanelWidgetsContainer);
	switch (property_id) {
		case WINGPANEL_WIDGETS_CONTAINER_CONTENT_WIDGET_PROPERTY:
		g_value_take_object (value, wingpanel_widgets_container_get_content_widget (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_wingpanel_widgets_container_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec)
{
	WingpanelWidgetsContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WINGPANEL_WIDGETS_TYPE_CONTAINER, WingpanelWidgetsContainer);
	switch (property_id) {
		case WINGPANEL_WIDGETS_CONTAINER_CONTENT_WIDGET_PROPERTY:
		wingpanel_widgets_container_set_content_widget (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

