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

/* vim:set et sts=4 sw=4:
 *
 * ibus - The Input Bus
 *
 * Copyright(c) 2011-2014 Peng Huang <shawn.p.huang@gmail.com>
 * Copyright(c) 2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
 * USA
 */

#include <glib-object.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <gobject/gvaluecollector.h>
#include <stdlib.h>
#include <string.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
#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 TYPE_THEMED_RGBA (themed_rgba_get_type ())
#define THEMED_RGBA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEMED_RGBA, ThemedRGBA))
#define THEMED_RGBA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEMED_RGBA, ThemedRGBAClass))
#define IS_THEMED_RGBA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEMED_RGBA))
#define IS_THEMED_RGBA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEMED_RGBA))
#define THEMED_RGBA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEMED_RGBA, ThemedRGBAClass))

typedef struct _ThemedRGBA ThemedRGBA;
typedef struct _ThemedRGBAClass ThemedRGBAClass;
typedef struct _ThemedRGBAPrivate ThemedRGBAPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __vala_GdkRGBA_free0(var) ((var == NULL) ? NULL : (var = (_vala_GdkRGBA_free (var), NULL)))
typedef struct _ParamSpecThemedRGBA ParamSpecThemedRGBA;

#define TYPE_ICON_WIDGET (icon_widget_get_type ())
#define ICON_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ICON_WIDGET, IconWidget))
#define ICON_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ICON_WIDGET, IconWidgetClass))
#define IS_ICON_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ICON_WIDGET))
#define IS_ICON_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ICON_WIDGET))
#define ICON_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ICON_WIDGET, IconWidgetClass))

typedef struct _IconWidget IconWidget;
typedef struct _IconWidgetClass IconWidgetClass;
typedef struct _IconWidgetPrivate IconWidgetPrivate;
enum  {
	ICON_WIDGET_0_PROPERTY,
	ICON_WIDGET_NUM_PROPERTIES
};
static GParamSpec* icon_widget_properties[ICON_WIDGET_NUM_PROPERTIES];

struct _ThemedRGBA {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ThemedRGBAPrivate * priv;
};

struct _ThemedRGBAClass {
	GTypeClass parent_class;
	void (*finalize) (ThemedRGBA *self);
};

struct _ThemedRGBAPrivate {
	GdkRGBA* _normal_fg;
	GdkRGBA* _normal_bg;
	GdkRGBA* _selected_fg;
	GdkRGBA* _selected_bg;
	GtkStyleContext* m_style_context;
	GtkSettings* m_settings;
};

struct _ParamSpecThemedRGBA {
	GParamSpec parent_instance;
};

struct _IconWidget {
	GtkImage parent_instance;
	IconWidgetPrivate * priv;
};

struct _IconWidgetClass {
	GtkImageClass parent_class;
};

static gint ThemedRGBA_private_offset;
static gpointer themed_rgba_parent_class = NULL;
static gpointer icon_widget_parent_class = NULL;

VALA_EXTERN gpointer themed_rgba_ref (gpointer instance);
VALA_EXTERN void themed_rgba_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_themed_rgba (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_themed_rgba (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_themed_rgba (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_themed_rgba (const GValue* value);
VALA_EXTERN GType themed_rgba_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ThemedRGBA, themed_rgba_unref)
static void themed_rgba_reset_rgba (ThemedRGBA* self);
static void _vala_GdkRGBA_free (GdkRGBA* self);
VALA_EXTERN ThemedRGBA* themed_rgba_new (GtkStyleContext* style_context);
VALA_EXTERN ThemedRGBA* themed_rgba_construct (GType object_type,
                                   GtkStyleContext* style_context);
static void themed_rgba_get_rgba (ThemedRGBA* self);
static void __lambda4_ (ThemedRGBA* self);
static void ___lambda4__g_object_notify (GObject* _sender,
                                  GParamSpec* pspec,
                                  gpointer self);
VALA_EXTERN void themed_rgba_set_normal_fg (ThemedRGBA* self,
                                GdkRGBA* value);
VALA_EXTERN void themed_rgba_set_normal_bg (ThemedRGBA* self,
                                GdkRGBA* value);
VALA_EXTERN void themed_rgba_set_selected_fg (ThemedRGBA* self,
                                  GdkRGBA* value);
VALA_EXTERN void themed_rgba_set_selected_bg (ThemedRGBA* self,
                                  GdkRGBA* value);
VALA_EXTERN GdkRGBA* themed_rgba_get_normal_fg (ThemedRGBA* self);
static GdkRGBA* _vala_GdkRGBA_copy (GdkRGBA* self);
VALA_EXTERN GdkRGBA* themed_rgba_get_normal_bg (ThemedRGBA* self);
VALA_EXTERN GdkRGBA* themed_rgba_get_selected_fg (ThemedRGBA* self);
VALA_EXTERN GdkRGBA* themed_rgba_get_selected_bg (ThemedRGBA* self);
static void themed_rgba_finalize (ThemedRGBA * obj);
static GType themed_rgba_get_type_once (void);
VALA_EXTERN GType icon_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (IconWidget, g_object_unref)
VALA_EXTERN IconWidget* icon_widget_new (const gchar* icon_name_or_path,
                             GtkIconSize size);
VALA_EXTERN IconWidget* icon_widget_construct (GType object_type,
                                   const gchar* icon_name_or_path,
                                   GtkIconSize size);
static GType icon_widget_get_type_once (void);

static inline gpointer
themed_rgba_get_instance_private (ThemedRGBA* self)
{
	return G_STRUCT_MEMBER_P (self, ThemedRGBA_private_offset);
}

static void
_vala_GdkRGBA_free (GdkRGBA* self)
{
	g_boxed_free (gdk_rgba_get_type (), self);
}

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

static void
__lambda4_ (ThemedRGBA* self)
{
	themed_rgba_get_rgba (self);
}

static void
___lambda4__g_object_notify (GObject* _sender,
                             GParamSpec* pspec,
                             gpointer self)
{
	__lambda4_ ((ThemedRGBA*) self);
}

ThemedRGBA*
themed_rgba_construct (GType object_type,
                       GtkStyleContext* style_context)
{
	ThemedRGBA* self = NULL;
	GtkStyleContext* _tmp0_;
	GtkSettings* _tmp1_;
	GtkSettings* _tmp2_;
	GtkSettings* _tmp3_;
	g_return_val_if_fail (style_context != NULL, NULL);
	self = (ThemedRGBA*) g_type_create_instance (object_type);
	themed_rgba_reset_rgba (self);
	_tmp0_ = _g_object_ref0 (style_context);
	_g_object_unref0 (self->priv->m_style_context);
	self->priv->m_style_context = _tmp0_;
	themed_rgba_get_rgba (self);
	_tmp1_ = gtk_settings_get_default ();
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->priv->m_settings);
	self->priv->m_settings = _tmp2_;
	_tmp3_ = self->priv->m_settings;
	g_signal_connect ((GObject*) _tmp3_, "notify::gtk-theme-name", (GCallback) ___lambda4__g_object_notify, self);
	return self;
}

ThemedRGBA*
themed_rgba_new (GtkStyleContext* style_context)
{
	return themed_rgba_construct (TYPE_THEMED_RGBA, style_context);
}

static void
themed_rgba_reset_rgba (ThemedRGBA* self)
{
	g_return_if_fail (self != NULL);
	themed_rgba_set_normal_fg (self, NULL);
	themed_rgba_set_normal_bg (self, NULL);
	themed_rgba_set_selected_fg (self, NULL);
	themed_rgba_set_selected_bg (self, NULL);
}

static void
themed_rgba_get_rgba (ThemedRGBA* self)
{
	GdkRGBA color = {0};
	GdkRGBA _tmp0_ = {0};
	GtkStyleContext* _tmp1_;
	GdkRGBA _tmp2_ = {0};
	gboolean _tmp3_;
	GdkRGBA* _tmp7_;
	GdkRGBA* _tmp8_;
	GtkStyleContext* _tmp9_;
	GdkRGBA _tmp10_ = {0};
	gboolean _tmp11_;
	GdkRGBA* _tmp15_;
	GdkRGBA* _tmp16_;
	GtkStyleContext* _tmp17_;
	GdkRGBA _tmp18_ = {0};
	gboolean _tmp19_;
	GdkRGBA* _tmp23_;
	GdkRGBA* _tmp24_;
	GtkStyleContext* _tmp25_;
	GdkRGBA _tmp26_ = {0};
	gboolean _tmp27_;
	GdkRGBA* _tmp31_;
	GdkRGBA* _tmp32_;
	g_return_if_fail (self != NULL);
	themed_rgba_reset_rgba (self);
	_tmp0_.red = (gdouble) 0;
	color = _tmp0_;
	_tmp1_ = self->priv->m_style_context;
	_tmp3_ = gtk_style_context_lookup_color (_tmp1_, "theme_fg_color", &_tmp2_);
	color = _tmp2_;
	if (_tmp3_) {
	} else {
		GtkStyleContext* _tmp4_;
		GdkRGBA _tmp5_ = {0};
		gboolean _tmp6_;
		_tmp4_ = self->priv->m_style_context;
		_tmp6_ = gtk_style_context_lookup_color (_tmp4_, "fg_normal", &_tmp5_);
		color = _tmp5_;
		if (_tmp6_) {
		} else {
			gdk_rgba_parse (&color, "#2e3436");
		}
	}
	_tmp7_ = gdk_rgba_copy (&color);
	_tmp8_ = _tmp7_;
	themed_rgba_set_normal_fg (self, _tmp8_);
	__vala_GdkRGBA_free0 (_tmp8_);
	_tmp9_ = self->priv->m_style_context;
	_tmp11_ = gtk_style_context_lookup_color (_tmp9_, "theme_selected_fg_color", &_tmp10_);
	color = _tmp10_;
	if (_tmp11_) {
	} else {
		GtkStyleContext* _tmp12_;
		GdkRGBA _tmp13_ = {0};
		gboolean _tmp14_;
		_tmp12_ = self->priv->m_style_context;
		_tmp14_ = gtk_style_context_lookup_color (_tmp12_, "fg_selected", &_tmp13_);
		color = _tmp13_;
		if (_tmp14_) {
		} else {
			gdk_rgba_parse (&color, "#ffffff");
		}
	}
	_tmp15_ = gdk_rgba_copy (&color);
	_tmp16_ = _tmp15_;
	themed_rgba_set_selected_fg (self, _tmp16_);
	__vala_GdkRGBA_free0 (_tmp16_);
	_tmp17_ = self->priv->m_style_context;
	_tmp19_ = gtk_style_context_lookup_color (_tmp17_, "theme_bg_color", &_tmp18_);
	color = _tmp18_;
	if (_tmp19_) {
	} else {
		GtkStyleContext* _tmp20_;
		GdkRGBA _tmp21_ = {0};
		gboolean _tmp22_;
		_tmp20_ = self->priv->m_style_context;
		_tmp22_ = gtk_style_context_lookup_color (_tmp20_, "base_normal", &_tmp21_);
		color = _tmp21_;
		if (_tmp22_) {
		} else {
			gdk_rgba_parse (&color, "#f6f5f4");
		}
	}
	_tmp23_ = gdk_rgba_copy (&color);
	_tmp24_ = _tmp23_;
	themed_rgba_set_normal_bg (self, _tmp24_);
	__vala_GdkRGBA_free0 (_tmp24_);
	_tmp25_ = self->priv->m_style_context;
	_tmp27_ = gtk_style_context_lookup_color (_tmp25_, "theme_selected_bg_color", &_tmp26_);
	color = _tmp26_;
	if (_tmp27_) {
	} else {
		GtkStyleContext* _tmp28_;
		GdkRGBA _tmp29_ = {0};
		gboolean _tmp30_;
		_tmp28_ = self->priv->m_style_context;
		_tmp30_ = gtk_style_context_lookup_color (_tmp28_, "base_selected", &_tmp29_);
		color = _tmp29_;
		if (_tmp30_) {
		} else {
			gdk_rgba_parse (&color, "#3584e4");
		}
	}
	_tmp31_ = gdk_rgba_copy (&color);
	_tmp32_ = _tmp31_;
	themed_rgba_set_selected_bg (self, _tmp32_);
	__vala_GdkRGBA_free0 (_tmp32_);
}

GdkRGBA*
themed_rgba_get_normal_fg (ThemedRGBA* self)
{
	GdkRGBA* result;
	GdkRGBA* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_normal_fg;
	result = _tmp0_;
	return result;
}

static GdkRGBA*
_vala_GdkRGBA_copy (GdkRGBA* self)
{
	return g_boxed_copy (gdk_rgba_get_type (), self);
}

static gpointer
__vala_GdkRGBA_copy0 (gpointer self)
{
	return self ? _vala_GdkRGBA_copy (self) : NULL;
}

void
themed_rgba_set_normal_fg (ThemedRGBA* self,
                           GdkRGBA* value)
{
	GdkRGBA* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = __vala_GdkRGBA_copy0 (value);
	__vala_GdkRGBA_free0 (self->priv->_normal_fg);
	self->priv->_normal_fg = _tmp0_;
}

GdkRGBA*
themed_rgba_get_normal_bg (ThemedRGBA* self)
{
	GdkRGBA* result;
	GdkRGBA* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_normal_bg;
	result = _tmp0_;
	return result;
}

void
themed_rgba_set_normal_bg (ThemedRGBA* self,
                           GdkRGBA* value)
{
	GdkRGBA* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = __vala_GdkRGBA_copy0 (value);
	__vala_GdkRGBA_free0 (self->priv->_normal_bg);
	self->priv->_normal_bg = _tmp0_;
}

GdkRGBA*
themed_rgba_get_selected_fg (ThemedRGBA* self)
{
	GdkRGBA* result;
	GdkRGBA* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_selected_fg;
	result = _tmp0_;
	return result;
}

void
themed_rgba_set_selected_fg (ThemedRGBA* self,
                             GdkRGBA* value)
{
	GdkRGBA* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = __vala_GdkRGBA_copy0 (value);
	__vala_GdkRGBA_free0 (self->priv->_selected_fg);
	self->priv->_selected_fg = _tmp0_;
}

GdkRGBA*
themed_rgba_get_selected_bg (ThemedRGBA* self)
{
	GdkRGBA* result;
	GdkRGBA* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_selected_bg;
	result = _tmp0_;
	return result;
}

void
themed_rgba_set_selected_bg (ThemedRGBA* self,
                             GdkRGBA* value)
{
	GdkRGBA* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = __vala_GdkRGBA_copy0 (value);
	__vala_GdkRGBA_free0 (self->priv->_selected_bg);
	self->priv->_selected_bg = _tmp0_;
}

static void
value_themed_rgba_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
value_themed_rgba_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		themed_rgba_unref (value->data[0].v_pointer);
	}
}

static void
value_themed_rgba_copy_value (const GValue* src_value,
                              GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = themed_rgba_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
value_themed_rgba_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
value_themed_rgba_collect_value (GValue* value,
                                 guint n_collect_values,
                                 GTypeCValue* collect_values,
                                 guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		ThemedRGBA * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = themed_rgba_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_themed_rgba_lcopy_value (const GValue* value,
                               guint n_collect_values,
                               GTypeCValue* collect_values,
                               guint collect_flags)
{
	ThemedRGBA ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = themed_rgba_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_themed_rgba (const gchar* name,
                        const gchar* nick,
                        const gchar* blurb,
                        GType object_type,
                        GParamFlags flags)
{
	ParamSpecThemedRGBA* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_THEMED_RGBA), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
value_get_themed_rgba (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_THEMED_RGBA), NULL);
	return value->data[0].v_pointer;
}

void
value_set_themed_rgba (GValue* value,
                       gpointer v_object)
{
	ThemedRGBA * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_THEMED_RGBA));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_THEMED_RGBA));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		themed_rgba_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		themed_rgba_unref (old);
	}
}

void
value_take_themed_rgba (GValue* value,
                        gpointer v_object)
{
	ThemedRGBA * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_THEMED_RGBA));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_THEMED_RGBA));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		themed_rgba_unref (old);
	}
}

static void
themed_rgba_class_init (ThemedRGBAClass * klass,
                        gpointer klass_data)
{
	themed_rgba_parent_class = g_type_class_peek_parent (klass);
	((ThemedRGBAClass *) klass)->finalize = themed_rgba_finalize;
	g_type_class_adjust_private_offset (klass, &ThemedRGBA_private_offset);
}

static void
themed_rgba_instance_init (ThemedRGBA * self,
                           gpointer klass)
{
	self->priv = themed_rgba_get_instance_private (self);
	self->ref_count = 1;
}

static void
themed_rgba_finalize (ThemedRGBA * obj)
{
	ThemedRGBA * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_THEMED_RGBA, ThemedRGBA);
	g_signal_handlers_destroy (self);
	themed_rgba_reset_rgba (self);
	_g_object_unref0 (self->priv->m_settings);
	self->priv->m_settings = NULL;
	__vala_GdkRGBA_free0 (self->priv->_normal_fg);
	__vala_GdkRGBA_free0 (self->priv->_normal_bg);
	__vala_GdkRGBA_free0 (self->priv->_selected_fg);
	__vala_GdkRGBA_free0 (self->priv->_selected_bg);
	_g_object_unref0 (self->priv->m_style_context);
	_g_object_unref0 (self->priv->m_settings);
}

static GType
themed_rgba_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_themed_rgba_init, value_themed_rgba_free_value, value_themed_rgba_copy_value, value_themed_rgba_peek_pointer, "p", value_themed_rgba_collect_value, "p", value_themed_rgba_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (ThemedRGBAClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) themed_rgba_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ThemedRGBA), 0, (GInstanceInitFunc) themed_rgba_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType themed_rgba_type_id;
	themed_rgba_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ThemedRGBA", &g_define_type_info, &g_define_type_fundamental_info, 0);
	ThemedRGBA_private_offset = g_type_add_instance_private (themed_rgba_type_id, sizeof (ThemedRGBAPrivate));
	return themed_rgba_type_id;
}

GType
themed_rgba_get_type (void)
{
	static volatile gsize themed_rgba_type_id__once = 0;
	if (g_once_init_enter (&themed_rgba_type_id__once)) {
		GType themed_rgba_type_id;
		themed_rgba_type_id = themed_rgba_get_type_once ();
		g_once_init_leave (&themed_rgba_type_id__once, themed_rgba_type_id);
	}
	return themed_rgba_type_id__once;
}

gpointer
themed_rgba_ref (gpointer instance)
{
	ThemedRGBA * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
themed_rgba_unref (gpointer instance)
{
	ThemedRGBA * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		THEMED_RGBA_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

/**
     * IconWidget:
     * @icon_name_or_path: Can be a name or path but not stock id
     *     because gtk_icon_theme_load_icon() cannot fallback the
     *     stock id to a real file name against
     *     gtk_image_new_from_stock().
     * @size: #Gtk.IconSize
     */
static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

IconWidget*
icon_widget_construct (GType object_type,
                       const gchar* icon_name_or_path,
                       GtkIconSize size)
{
	IconWidget * self = NULL;
	GdkPixbuf* pixbuf = NULL;
	gint fixed_width = 0;
	gint fixed_height = 0;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	GdkPixbuf* _tmp17_;
	gfloat width = 0.0F;
	GdkPixbuf* _tmp18_;
	gfloat height = 0.0F;
	GdkPixbuf* _tmp19_;
	gfloat _tmp20_ = 0.0F;
	gfloat scale = 0.0F;
	GdkPixbuf* _tmp21_;
	GdkPixbuf* _tmp22_;
	GdkPixbuf* _tmp23_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (icon_name_or_path != NULL, NULL);
	self = (IconWidget*) g_object_new (object_type, NULL);
	pixbuf = NULL;
	gtk_icon_size_lookup (size, &_tmp0_, &_tmp1_);
	fixed_width = _tmp0_;
	fixed_height = _tmp1_;
	{
		if (string_get (icon_name_or_path, (glong) 0) == '/') {
			GdkPixbuf* _tmp2_ = NULL;
			GdkPixbuf* _tmp3_;
			GdkPixbuf* _tmp4_;
			_tmp3_ = gdk_pixbuf_new_from_file (icon_name_or_path, &_inner_error0_);
			_tmp2_ = _tmp3_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_tmp4_ = _tmp2_;
			_tmp2_ = NULL;
			_g_object_unref0 (pixbuf);
			pixbuf = _tmp4_;
			_g_object_unref0 (_tmp2_);
		} else {
			GtkIconTheme* theme = NULL;
			GtkIconTheme* _tmp5_;
			GtkIconTheme* _tmp6_;
			GdkPixbuf* _tmp7_ = NULL;
			GtkIconTheme* _tmp8_;
			GdkPixbuf* _tmp9_;
			GdkPixbuf* _tmp10_;
			_tmp5_ = gtk_icon_theme_get_default ();
			_tmp6_ = _g_object_ref0 (_tmp5_);
			theme = _tmp6_;
			_tmp8_ = theme;
			_tmp9_ = gtk_icon_theme_load_icon (_tmp8_, icon_name_or_path, fixed_width, 0, &_inner_error0_);
			_tmp7_ = _tmp9_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (theme);
				goto __catch0_g_error;
			}
			_tmp10_ = _tmp7_;
			_tmp7_ = NULL;
			_g_object_unref0 (pixbuf);
			pixbuf = _tmp10_;
			_g_object_unref0 (_tmp7_);
			_g_object_unref0 (theme);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		{
			GtkIconTheme* theme = NULL;
			GtkIconTheme* _tmp11_;
			GtkIconTheme* _tmp12_;
			GdkPixbuf* _tmp13_ = NULL;
			GtkIconTheme* _tmp14_;
			GdkPixbuf* _tmp15_;
			GdkPixbuf* _tmp16_;
			_tmp11_ = gtk_icon_theme_get_default ();
			_tmp12_ = _g_object_ref0 (_tmp11_);
			theme = _tmp12_;
			_tmp14_ = theme;
			_tmp15_ = gtk_icon_theme_load_icon (_tmp14_, "ibus-engine", fixed_width, 0, &_inner_error0_);
			_tmp13_ = _tmp15_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (theme);
				goto __catch1_g_error;
			}
			_tmp16_ = _tmp13_;
			_tmp13_ = NULL;
			_g_object_unref0 (pixbuf);
			pixbuf = _tmp16_;
			_g_object_unref0 (_tmp13_);
			_g_object_unref0 (theme);
		}
		goto __finally1;
		__catch1_g_error:
		{
			g_clear_error (&_inner_error0_);
			gtk_image_set_from_icon_name ((GtkImage*) self, "image-missing", (GtkIconSize) size);
			_g_object_unref0 (pixbuf);
			return self;
		}
		__finally1:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (pixbuf);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (pixbuf);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	_tmp17_ = pixbuf;
	if (_tmp17_ == NULL) {
		_g_object_unref0 (pixbuf);
		return self;
	}
	_tmp18_ = pixbuf;
	width = (gfloat) gdk_pixbuf_get_width (_tmp18_);
	_tmp19_ = pixbuf;
	height = (gfloat) gdk_pixbuf_get_height (_tmp19_);
	if (width > height) {
		_tmp20_ = width;
	} else {
		_tmp20_ = height;
	}
	scale = fixed_width / _tmp20_;
	width *= scale;
	height *= scale;
	_tmp21_ = pixbuf;
	_tmp22_ = gdk_pixbuf_scale_simple (_tmp21_, (gint) width, (gint) height, GDK_INTERP_BILINEAR);
	_g_object_unref0 (pixbuf);
	pixbuf = _tmp22_;
	_tmp23_ = pixbuf;
	gtk_image_set_from_pixbuf ((GtkImage*) self, _tmp23_);
	gtk_widget_show ((GtkWidget*) self);
	_g_object_unref0 (pixbuf);
	return self;
}

IconWidget*
icon_widget_new (const gchar* icon_name_or_path,
                 GtkIconSize size)
{
	return icon_widget_construct (TYPE_ICON_WIDGET, icon_name_or_path, size);
}

static void
icon_widget_class_init (IconWidgetClass * klass,
                        gpointer klass_data)
{
	icon_widget_parent_class = g_type_class_peek_parent (klass);
}

static void
icon_widget_instance_init (IconWidget * self,
                           gpointer klass)
{
}

static GType
icon_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (IconWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) icon_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IconWidget), 0, (GInstanceInitFunc) icon_widget_instance_init, NULL };
	GType icon_widget_type_id;
	icon_widget_type_id = g_type_register_static (gtk_image_get_type (), "IconWidget", &g_define_type_info, 0);
	return icon_widget_type_id;
}

GType
icon_widget_get_type (void)
{
	static volatile gsize icon_widget_type_id__once = 0;
	if (g_once_init_enter (&icon_widget_type_id__once)) {
		GType icon_widget_type_id;
		icon_widget_type_id = icon_widget_get_type_once ();
		g_once_init_leave (&icon_widget_type_id__once, icon_widget_type_id);
	}
	return icon_widget_type_id__once;
}

