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

/*-
 * Copyright (c) 2012-2018 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 3 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, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Corentin Noël <corentin@elementaryos.io>
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>

#define PANTHEON_CALCULATOR_BUTTON_WIDTH 65
#define PANTHEON_CALCULATOR_BUTTON_HEIGHT 43
#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
#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 PANTHEON_CALCULATOR_TYPE_BUTTON (pantheon_calculator_button_get_type ())
#define PANTHEON_CALCULATOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANTHEON_CALCULATOR_TYPE_BUTTON, PantheonCalculatorButton))
#define PANTHEON_CALCULATOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANTHEON_CALCULATOR_TYPE_BUTTON, PantheonCalculatorButtonClass))
#define PANTHEON_CALCULATOR_IS_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANTHEON_CALCULATOR_TYPE_BUTTON))
#define PANTHEON_CALCULATOR_IS_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANTHEON_CALCULATOR_TYPE_BUTTON))
#define PANTHEON_CALCULATOR_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANTHEON_CALCULATOR_TYPE_BUTTON, PantheonCalculatorButtonClass))

typedef struct _PantheonCalculatorButton PantheonCalculatorButton;
typedef struct _PantheonCalculatorButtonClass PantheonCalculatorButtonClass;
typedef struct _PantheonCalculatorButtonPrivate PantheonCalculatorButtonPrivate;
enum  {
	PANTHEON_CALCULATOR_BUTTON_0_PROPERTY,
	PANTHEON_CALCULATOR_BUTTON_NUM_PROPERTIES
};
static GParamSpec* pantheon_calculator_button_properties[PANTHEON_CALCULATOR_BUTTON_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _PantheonCalculatorButton {
	GtkButton parent_instance;
	PantheonCalculatorButtonPrivate * priv;
};

struct _PantheonCalculatorButtonClass {
	GtkButtonClass parent_class;
};

static gpointer pantheon_calculator_button_parent_class = NULL;

VALA_EXTERN GType pantheon_calculator_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PantheonCalculatorButton, g_object_unref)
VALA_EXTERN PantheonCalculatorButton* pantheon_calculator_button_new (const gchar* label);
VALA_EXTERN PantheonCalculatorButton* pantheon_calculator_button_construct (GType object_type,
                                                                const gchar* label);
VALA_EXTERN PantheonCalculatorButton* pantheon_calculator_button_new_from_icon_name (const gchar* icon_name);
VALA_EXTERN PantheonCalculatorButton* pantheon_calculator_button_construct_from_icon_name (GType object_type,
                                                                               const gchar* icon_name);
static GObject * pantheon_calculator_button_constructor (GType type,
                                                  guint n_construct_properties,
                                                  GObjectConstructParam * construct_properties);
static GType pantheon_calculator_button_get_type_once (void);

PantheonCalculatorButton*
pantheon_calculator_button_construct (GType object_type,
                                      const gchar* label)
{
	PantheonCalculatorButton * self = NULL;
	GtkLabel* lbl = NULL;
	GtkLabel* _tmp0_ = NULL;
	g_return_val_if_fail (label != NULL, NULL);
	self = (PantheonCalculatorButton*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (label);
	gtk_label_set_use_markup (_tmp0_, TRUE);
	g_object_ref_sink (_tmp0_);
	lbl = _tmp0_;
	gtk_button_set_child ((GtkButton*) self, (GtkWidget*) lbl);
	_g_object_unref0 (lbl);
	return self;
}

PantheonCalculatorButton*
pantheon_calculator_button_new (const gchar* label)
{
	return pantheon_calculator_button_construct (PANTHEON_CALCULATOR_TYPE_BUTTON, label);
}

PantheonCalculatorButton*
pantheon_calculator_button_construct_from_icon_name (GType object_type,
                                                     const gchar* icon_name)
{
	PantheonCalculatorButton * self = NULL;
	GtkImage* image = NULL;
	GtkImage* _tmp0_ = NULL;
	g_return_val_if_fail (icon_name != NULL, NULL);
	self = (PantheonCalculatorButton*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkImage*) gtk_image_new_from_icon_name (icon_name);
	gtk_widget_set_valign ((GtkWidget*) _tmp0_, GTK_ALIGN_CENTER);
	gtk_widget_set_halign ((GtkWidget*) _tmp0_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp0_);
	image = _tmp0_;
	gtk_button_set_child ((GtkButton*) self, (GtkWidget*) image);
	_g_object_unref0 (image);
	return self;
}

PantheonCalculatorButton*
pantheon_calculator_button_new_from_icon_name (const gchar* icon_name)
{
	return pantheon_calculator_button_construct_from_icon_name (PANTHEON_CALCULATOR_TYPE_BUTTON, icon_name);
}

static GObject *
pantheon_calculator_button_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	PantheonCalculatorButton * self;
	parent_class = G_OBJECT_CLASS (pantheon_calculator_button_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PANTHEON_CALCULATOR_TYPE_BUTTON, PantheonCalculatorButton);
	g_object_set ((GtkWidget*) self, "width-request", PANTHEON_CALCULATOR_BUTTON_WIDTH, NULL);
	g_object_set ((GtkWidget*) self, "height-request", PANTHEON_CALCULATOR_BUTTON_HEIGHT, NULL);
	return obj;
}

static void
pantheon_calculator_button_class_init (PantheonCalculatorButtonClass * klass,
                                       gpointer klass_data)
{
	pantheon_calculator_button_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructor = pantheon_calculator_button_constructor;
}

static void
pantheon_calculator_button_instance_init (PantheonCalculatorButton * self,
                                          gpointer klass)
{
}

static GType
pantheon_calculator_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PantheonCalculatorButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pantheon_calculator_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PantheonCalculatorButton), 0, (GInstanceInitFunc) pantheon_calculator_button_instance_init, NULL };
	GType pantheon_calculator_button_type_id;
	pantheon_calculator_button_type_id = g_type_register_static (gtk_button_get_type (), "PantheonCalculatorButton", &g_define_type_info, 0);
	return pantheon_calculator_button_type_id;
}

GType
pantheon_calculator_button_get_type (void)
{
	static volatile gsize pantheon_calculator_button_type_id__once = 0;
	if (g_once_init_enter (&pantheon_calculator_button_type_id__once)) {
		GType pantheon_calculator_button_type_id;
		pantheon_calculator_button_type_id = pantheon_calculator_button_get_type_once ();
		g_once_init_leave (&pantheon_calculator_button_type_id__once, pantheon_calculator_button_type_id);
	}
	return pantheon_calculator_button_type_id__once;
}

