/* OverlayIcon.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from OverlayIcon.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 <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.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  {
	WINGPANEL_WIDGETS_OVERLAY_ICON_0_PROPERTY,
	WINGPANEL_WIDGETS_OVERLAY_ICON_NUM_PROPERTIES
};
static GParamSpec* wingpanel_widgets_overlay_icon_properties[WINGPANEL_WIDGETS_OVERLAY_ICON_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _WingpanelWidgetsOverlayIconPrivate {
	GtkImage* main_image;
	GtkImage* overlay_image;
};

static gint WingpanelWidgetsOverlayIcon_private_offset;
static gpointer wingpanel_widgets_overlay_icon_parent_class = NULL;

static GObject * wingpanel_widgets_overlay_icon_constructor (GType type,
                                                      guint n_construct_properties,
                                                      GObjectConstructParam * construct_properties);
static void wingpanel_widgets_overlay_icon_finalize (GObject * obj);
static GType wingpanel_widgets_overlay_icon_get_type_once (void);

static inline gpointer
wingpanel_widgets_overlay_icon_get_instance_private (WingpanelWidgetsOverlayIcon* self)
{
	return G_STRUCT_MEMBER_P (self, WingpanelWidgetsOverlayIcon_private_offset);
}

WingpanelWidgetsOverlayIcon*
wingpanel_widgets_overlay_icon_construct (GType object_type,
                                          const gchar* icon_name)
{
	WingpanelWidgetsOverlayIcon * self = NULL;
	g_return_val_if_fail (icon_name != NULL, NULL);
	self = (WingpanelWidgetsOverlayIcon*) g_object_new (object_type, NULL);
	wingpanel_widgets_overlay_icon_set_main_icon_name (self, icon_name);
	return self;
}

WingpanelWidgetsOverlayIcon*
wingpanel_widgets_overlay_icon_new (const gchar* icon_name)
{
	return wingpanel_widgets_overlay_icon_construct (WINGPANEL_WIDGETS_TYPE_OVERLAY_ICON, icon_name);
}

WingpanelWidgetsOverlayIcon*
wingpanel_widgets_overlay_icon_construct_from_pixbuf (GType object_type,
                                                      GdkPixbuf* pixbuf)
{
	WingpanelWidgetsOverlayIcon * self = NULL;
	g_return_val_if_fail (pixbuf != NULL, NULL);
	self = (WingpanelWidgetsOverlayIcon*) g_object_new (object_type, NULL);
	wingpanel_widgets_overlay_icon_set_main_pixbuf (self, pixbuf);
	return self;
}

WingpanelWidgetsOverlayIcon*
wingpanel_widgets_overlay_icon_new_from_pixbuf (GdkPixbuf* pixbuf)
{
	return wingpanel_widgets_overlay_icon_construct_from_pixbuf (WINGPANEL_WIDGETS_TYPE_OVERLAY_ICON, pixbuf);
}

void
wingpanel_widgets_overlay_icon_set_main_pixbuf (WingpanelWidgetsOverlayIcon* self,
                                                GdkPixbuf* pixbuf)
{
	GtkImage* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->main_image;
	gtk_image_set_from_pixbuf (_tmp0_, pixbuf);
}

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

GdkPixbuf*
wingpanel_widgets_overlay_icon_get_main_pixbuf (WingpanelWidgetsOverlayIcon* self)
{
	GtkImage* _tmp0_;
	GdkPixbuf* _tmp1_;
	GdkPixbuf* _tmp2_;
	GdkPixbuf* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->main_image;
	_tmp1_ = gtk_image_get_pixbuf (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

void
wingpanel_widgets_overlay_icon_set_overlay_pixbuf (WingpanelWidgetsOverlayIcon* self,
                                                   GdkPixbuf* pixbuf)
{
	GtkImage* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->overlay_image;
	gtk_image_set_from_pixbuf (_tmp0_, pixbuf);
}

GdkPixbuf*
wingpanel_widgets_overlay_icon_get_overlay_pixbuf (WingpanelWidgetsOverlayIcon* self)
{
	GtkImage* _tmp0_;
	GdkPixbuf* _tmp1_;
	GdkPixbuf* _tmp2_;
	GdkPixbuf* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->overlay_image;
	_tmp1_ = gtk_image_get_pixbuf (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

void
wingpanel_widgets_overlay_icon_set_main_icon_name (WingpanelWidgetsOverlayIcon* self,
                                                   const gchar* icon_name)
{
	GtkImage* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (icon_name != NULL);
	_tmp0_ = self->priv->main_image;
	g_object_set (_tmp0_, "icon-name", icon_name, NULL);
}

gchar*
wingpanel_widgets_overlay_icon_get_main_icon_name (WingpanelWidgetsOverlayIcon* self)
{
	GtkImage* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->main_image;
	g_object_get (_tmp0_, "icon-name", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
wingpanel_widgets_overlay_icon_set_overlay_icon_name (WingpanelWidgetsOverlayIcon* self,
                                                      const gchar* icon_name)
{
	GtkImage* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (icon_name != NULL);
	_tmp0_ = self->priv->overlay_image;
	g_object_set (_tmp0_, "icon-name", icon_name, NULL);
}

gchar*
wingpanel_widgets_overlay_icon_get_overlay_icon_name (WingpanelWidgetsOverlayIcon* self)
{
	GtkImage* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->overlay_image;
	g_object_get (_tmp0_, "icon-name", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

GtkImage*
wingpanel_widgets_overlay_icon_get_main_image (WingpanelWidgetsOverlayIcon* self)
{
	GtkImage* _tmp0_;
	GtkImage* _tmp1_;
	GtkImage* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->main_image;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

GtkImage*
wingpanel_widgets_overlay_icon_get_overlay_image (WingpanelWidgetsOverlayIcon* self)
{
	GtkImage* _tmp0_;
	GtkImage* _tmp1_;
	GtkImage* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->overlay_image;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static GObject *
wingpanel_widgets_overlay_icon_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WingpanelWidgetsOverlayIcon * self;
	GtkImage* _tmp0_;
	GtkImage* _tmp1_;
	GtkImage* _tmp2_;
	GtkImage* _tmp3_;
	GtkImage* _tmp4_;
	GtkImage* _tmp5_;
	GtkImage* _tmp6_;
	GtkImage* _tmp7_;
	parent_class = G_OBJECT_CLASS (wingpanel_widgets_overlay_icon_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_WIDGETS_TYPE_OVERLAY_ICON, WingpanelWidgetsOverlayIcon);
	_tmp0_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->main_image);
	self->priv->main_image = _tmp0_;
	_tmp1_ = self->priv->main_image;
	g_object_set (_tmp1_, "icon-size", 24, NULL);
	_tmp2_ = self->priv->main_image;
	gtk_image_set_pixel_size (_tmp2_, 24);
	_tmp3_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->overlay_image);
	self->priv->overlay_image = _tmp3_;
	_tmp4_ = self->priv->overlay_image;
	g_object_set (_tmp4_, "icon-size", 24, NULL);
	_tmp5_ = self->priv->overlay_image;
	gtk_image_set_pixel_size (_tmp5_, 24);
	_tmp6_ = self->priv->main_image;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp6_);
	_tmp7_ = self->priv->overlay_image;
	gtk_overlay_add_overlay ((GtkOverlay*) self, (GtkWidget*) _tmp7_);
	return obj;
}

static void
wingpanel_widgets_overlay_icon_class_init (WingpanelWidgetsOverlayIconClass * klass,
                                           gpointer klass_data)
{
	wingpanel_widgets_overlay_icon_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WingpanelWidgetsOverlayIcon_private_offset);
	G_OBJECT_CLASS (klass)->constructor = wingpanel_widgets_overlay_icon_constructor;
	G_OBJECT_CLASS (klass)->finalize = wingpanel_widgets_overlay_icon_finalize;
}

static void
wingpanel_widgets_overlay_icon_instance_init (WingpanelWidgetsOverlayIcon * self,
                                              gpointer klass)
{
	self->priv = wingpanel_widgets_overlay_icon_get_instance_private (self);
}

static void
wingpanel_widgets_overlay_icon_finalize (GObject * obj)
{
	WingpanelWidgetsOverlayIcon * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_WIDGETS_TYPE_OVERLAY_ICON, WingpanelWidgetsOverlayIcon);
	_g_object_unref0 (self->priv->main_image);
	_g_object_unref0 (self->priv->overlay_image);
	G_OBJECT_CLASS (wingpanel_widgets_overlay_icon_parent_class)->finalize (obj);
}

static GType
wingpanel_widgets_overlay_icon_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WingpanelWidgetsOverlayIconClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) wingpanel_widgets_overlay_icon_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WingpanelWidgetsOverlayIcon), 0, (GInstanceInitFunc) wingpanel_widgets_overlay_icon_instance_init, NULL };
	GType wingpanel_widgets_overlay_icon_type_id;
	wingpanel_widgets_overlay_icon_type_id = g_type_register_static (gtk_overlay_get_type (), "WingpanelWidgetsOverlayIcon", &g_define_type_info, 0);
	WingpanelWidgetsOverlayIcon_private_offset = g_type_add_instance_private (wingpanel_widgets_overlay_icon_type_id, sizeof (WingpanelWidgetsOverlayIconPrivate));
	return wingpanel_widgets_overlay_icon_type_id;
}

GType
wingpanel_widgets_overlay_icon_get_type (void)
{
	static volatile gsize wingpanel_widgets_overlay_icon_type_id__once = 0;
	if (g_once_init_enter (&wingpanel_widgets_overlay_icon_type_id__once)) {
		GType wingpanel_widgets_overlay_icon_type_id;
		wingpanel_widgets_overlay_icon_type_id = wingpanel_widgets_overlay_icon_get_type_once ();
		g_once_init_leave (&wingpanel_widgets_overlay_icon_type_id__once, wingpanel_widgets_overlay_icon_type_id);
	}
	return wingpanel_widgets_overlay_icon_type_id__once;
}

