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

/*
 * This file is part of budgie-desktop
 *
 * Copyright Budgie Desktop Developers
 *
 * 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.
 */

#include "icontasklistapplet.h"
#include <glib-object.h>
#include <glib.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  {
	BUTTON_WRAPPER_0_PROPERTY,
	BUTTON_WRAPPER_BUTTON_PROPERTY,
	BUTTON_WRAPPER_ORIENT_PROPERTY,
	BUTTON_WRAPPER_NUM_PROPERTIES
};
static GParamSpec* button_wrapper_properties[BUTTON_WRAPPER_NUM_PROPERTIES];

struct _ButtonWrapperPrivate {
	IconButton* _button;
};

static gint ButtonWrapper_private_offset;
static gpointer button_wrapper_parent_class = NULL;
static GType button_wrapper_type_id = 0;

static void __lambda28_ (ButtonWrapper* self);
static void ___lambda28__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static GObject * button_wrapper_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties);
static void button_wrapper_finalize (GObject * obj);
static void _vala_button_wrapper_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static void _vala_button_wrapper_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec);

static inline gpointer
button_wrapper_get_instance_private (ButtonWrapper* self)
{
	return G_STRUCT_MEMBER_P (self, ButtonWrapper_private_offset);
}

ButtonWrapper*
button_wrapper_construct (GType object_type,
                          IconButton* button)
{
	ButtonWrapper * self = NULL;
	self = (ButtonWrapper*) g_object_new (object_type, "button", button, NULL);
	return self;
}

ButtonWrapper*
button_wrapper_new (IconButton* button)
{
	return button_wrapper_construct (TYPE_BUTTON_WRAPPER, button);
}

static void
__lambda28_ (ButtonWrapper* self)
{
	gtk_widget_hide ((GtkWidget*) self);
	gtk_widget_destroy ((GtkWidget*) self);
}

static void
___lambda28__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda28_ ((ButtonWrapper*) self);
}

void
button_wrapper_gracefully_die (ButtonWrapper* self)
{
	GtkSettings* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GtkOrientation _tmp3_;
	GtkOrientation _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_widget_get_settings ((GtkWidget*) self);
	g_object_get (_tmp0_, "gtk-enable-animations", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		gtk_widget_hide ((GtkWidget*) self);
		gtk_widget_destroy ((GtkWidget*) self);
		return;
	}
	_tmp3_ = button_wrapper_get_orient (self);
	_tmp4_ = _tmp3_;
	if (_tmp4_ == GTK_ORIENTATION_HORIZONTAL) {
		gtk_revealer_set_transition_type ((GtkRevealer*) self, GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
	} else {
		gtk_revealer_set_transition_type ((GtkRevealer*) self, GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP);
	}
	g_signal_connect_object ((GObject*) self, "notify::child-revealed", (GCallback) ___lambda28__g_object_notify, self, G_CONNECT_AFTER);
	gtk_revealer_set_reveal_child ((GtkRevealer*) self, FALSE);
}

IconButton*
button_wrapper_get_button (ButtonWrapper* self)
{
	IconButton* result;
	IconButton* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_button;
	result = _tmp0_;
	return result;
}

static void
button_wrapper_set_button (ButtonWrapper* self,
                           IconButton* value)
{
	IconButton* old_value;
	g_return_if_fail (self != NULL);
	old_value = button_wrapper_get_button (self);
	if (old_value != value) {
		self->priv->_button = value;
		g_object_notify_by_pspec ((GObject *) self, button_wrapper_properties[BUTTON_WRAPPER_BUTTON_PROPERTY]);
	}
}

GtkOrientation
button_wrapper_get_orient (ButtonWrapper* self)
{
	GtkOrientation result;
	g_return_val_if_fail (self != NULL, 0);
	if (gtk_revealer_get_transition_type ((GtkRevealer*) self) == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN) {
		result = GTK_ORIENTATION_VERTICAL;
		return result;
	}
	result = GTK_ORIENTATION_HORIZONTAL;
	return result;
}

void
button_wrapper_set_orient (ButtonWrapper* self,
                           GtkOrientation value)
{
	g_return_if_fail (self != NULL);
	if (value == GTK_ORIENTATION_VERTICAL) {
		gtk_revealer_set_transition_type ((GtkRevealer*) self, GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
	} else {
		gtk_revealer_set_transition_type ((GtkRevealer*) self, GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
	}
	g_object_notify_by_pspec ((GObject *) self, button_wrapper_properties[BUTTON_WRAPPER_ORIENT_PROPERTY]);
}

static GObject *
button_wrapper_constructor (GType type,
                            guint n_construct_properties,
                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ButtonWrapper * self;
	IconButton* _tmp0_;
	parent_class = G_OBJECT_CLASS (button_wrapper_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BUTTON_WRAPPER, ButtonWrapper);
	_tmp0_ = self->priv->_button;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp0_);
	gtk_revealer_set_reveal_child ((GtkRevealer*) self, FALSE);
	gtk_widget_show_all ((GtkWidget*) self);
	return obj;
}

static void
button_wrapper_class_init (ButtonWrapperClass * klass,
                           gpointer klass_data)
{
	button_wrapper_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ButtonWrapper_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_button_wrapper_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_button_wrapper_set_property;
	G_OBJECT_CLASS (klass)->constructor = button_wrapper_constructor;
	G_OBJECT_CLASS (klass)->finalize = button_wrapper_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUTTON_WRAPPER_BUTTON_PROPERTY, button_wrapper_properties[BUTTON_WRAPPER_BUTTON_PROPERTY] = g_param_spec_object ("button", "button", "button", TYPE_ICON_BUTTON, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BUTTON_WRAPPER_ORIENT_PROPERTY, button_wrapper_properties[BUTTON_WRAPPER_ORIENT_PROPERTY] = g_param_spec_enum ("orient", "orient", "orient", gtk_orientation_get_type (), 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
button_wrapper_instance_init (ButtonWrapper * self,
                              gpointer klass)
{
	self->priv = button_wrapper_get_instance_private (self);
}

static void
button_wrapper_finalize (GObject * obj)
{
	ButtonWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BUTTON_WRAPPER, ButtonWrapper);
	G_OBJECT_CLASS (button_wrapper_parent_class)->finalize (obj);
}

/**
 * The wrapper provides nice visual effects to house an IconButton, allowing
 * us to slide the buttons into view when ready, and dispose of them as and
 * when our slide-out animation has finished. Without the wrapper, we'd have
 * a very ugly effect of icons just "popping" off.
 */
GType
button_wrapper_get_type (void)
{
	return button_wrapper_type_id;
}

GType
button_wrapper_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (ButtonWrapperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) button_wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ButtonWrapper), 0, (GInstanceInitFunc) button_wrapper_instance_init, NULL };
	button_wrapper_type_id = g_type_module_register_type (module, gtk_revealer_get_type (), "ButtonWrapper", &g_define_type_info, 0);
	ButtonWrapper_private_offset = sizeof (ButtonWrapperPrivate);
	return button_wrapper_type_id;
}

static void
_vala_button_wrapper_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	ButtonWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BUTTON_WRAPPER, ButtonWrapper);
	switch (property_id) {
		case BUTTON_WRAPPER_BUTTON_PROPERTY:
		g_value_set_object (value, button_wrapper_get_button (self));
		break;
		case BUTTON_WRAPPER_ORIENT_PROPERTY:
		g_value_set_enum (value, button_wrapper_get_orient (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_button_wrapper_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec)
{
	ButtonWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BUTTON_WRAPPER, ButtonWrapper);
	switch (property_id) {
		case BUTTON_WRAPPER_BUTTON_PROPERTY:
		button_wrapper_set_button (self, g_value_get_object (value));
		break;
		case BUTTON_WRAPPER_ORIENT_PROPERTY:
		button_wrapper_set_orient (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

