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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.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 TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON (tuba_widgets_relationship_button_get_type ())
#define TUBA_WIDGETS_RELATIONSHIP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON, TubaWidgetsRelationshipButton))
#define TUBA_WIDGETS_RELATIONSHIP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON, TubaWidgetsRelationshipButtonClass))
#define TUBA_WIDGETS_IS_RELATIONSHIP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON))
#define TUBA_WIDGETS_IS_RELATIONSHIP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON))
#define TUBA_WIDGETS_RELATIONSHIP_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON, TubaWidgetsRelationshipButtonClass))

typedef struct _TubaWidgetsRelationshipButton TubaWidgetsRelationshipButton;
typedef struct _TubaWidgetsRelationshipButtonClass TubaWidgetsRelationshipButtonClass;
typedef struct _TubaWidgetsRelationshipButtonPrivate TubaWidgetsRelationshipButtonPrivate;

#define TUBA_TYPE_ENTITY (tuba_entity_get_type ())
#define TUBA_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_ENTITY, TubaEntity))
#define TUBA_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_ENTITY, TubaEntityClass))
#define TUBA_IS_ENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_ENTITY))
#define TUBA_IS_ENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_ENTITY))
#define TUBA_ENTITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_ENTITY, TubaEntityClass))

typedef struct _TubaEntity TubaEntity;
typedef struct _TubaEntityClass TubaEntityClass;

#define TUBA_API_TYPE_RELATIONSHIP (tuba_api_relationship_get_type ())
#define TUBA_API_RELATIONSHIP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_RELATIONSHIP, TubaAPIRelationship))
#define TUBA_API_RELATIONSHIP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_RELATIONSHIP, TubaAPIRelationshipClass))
#define TUBA_API_IS_RELATIONSHIP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_RELATIONSHIP))
#define TUBA_API_IS_RELATIONSHIP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_RELATIONSHIP))
#define TUBA_API_RELATIONSHIP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_RELATIONSHIP, TubaAPIRelationshipClass))

typedef struct _TubaAPIRelationship TubaAPIRelationship;
typedef struct _TubaAPIRelationshipClass TubaAPIRelationshipClass;
enum  {
	TUBA_WIDGETS_RELATIONSHIP_BUTTON_0_PROPERTY,
	TUBA_WIDGETS_RELATIONSHIP_BUTTON_RS_PROPERTY,
	TUBA_WIDGETS_RELATIONSHIP_BUTTON_HANDLE_PROPERTY,
	TUBA_WIDGETS_RELATIONSHIP_BUTTON_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_relationship_button_properties[TUBA_WIDGETS_RELATIONSHIP_BUTTON_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TUBA_API_RELATIONSHIP_TYPE_MODIFY_PARAM (tuba_api_relationship_modify_param_get_type ())
typedef struct _TubaAPIRelationshipModifyParam TubaAPIRelationshipModifyParam;

struct _TubaWidgetsRelationshipButton {
	GtkButton parent_instance;
	TubaWidgetsRelationshipButtonPrivate * priv;
	GSourceFunc fn;
	gpointer fn_target;
	GDestroyNotify fn_target_destroy_notify;
};

struct _TubaWidgetsRelationshipButtonClass {
	GtkButtonClass parent_class;
	void (*invalidate) (TubaWidgetsRelationshipButton* self);
};

struct _TubaWidgetsRelationshipButtonPrivate {
	TubaAPIRelationship* _rs;
	gchar* _handle;
};

struct _TubaAPIRelationshipModifyParam {
	gchar* param;
	gchar* val;
};

static gint TubaWidgetsRelationshipButton_private_offset;
static gpointer tuba_widgets_relationship_button_parent_class = NULL;

VALA_EXTERN GType tuba_widgets_relationship_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsRelationshipButton, g_object_unref)
VALA_EXTERN GType tuba_entity_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaEntity, g_object_unref)
VALA_EXTERN GType tuba_api_relationship_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIRelationship, g_object_unref)
VALA_EXTERN void tuba_widgets_relationship_button_invalidate (TubaWidgetsRelationshipButton* self);
VALA_EXTERN void tuba_widgets_relationship_button_on_bound (TubaWidgetsRelationshipButton* self);
VALA_EXTERN TubaAPIRelationship* tuba_widgets_relationship_button_get_rs (TubaWidgetsRelationshipButton* self);
static void _tuba_widgets_relationship_button_invalidate_tuba_api_relationship_invalidated (TubaAPIRelationship* _sender,
                                                                                     gpointer self);
VALA_EXTERN void tuba_widgets_relationship_button_on_clicked (TubaWidgetsRelationshipButton* self);
static void tuba_widgets_relationship_button_real_invalidate (TubaWidgetsRelationshipButton* self);
VALA_EXTERN gboolean tuba_api_relationship_get_blocking (TubaAPIRelationship* self);
VALA_EXTERN gboolean tuba_api_relationship_get_domain_blocking (TubaAPIRelationship* self);
static gboolean ___lambda20_ (TubaWidgetsRelationshipButton* self);
VALA_EXTERN void tuba_api_relationship_question_modify_block (TubaAPIRelationship* self,
                                                  const gchar* handle,
                                                  gboolean block);
VALA_EXTERN const gchar* tuba_widgets_relationship_button_get_handle (TubaWidgetsRelationshipButton* self);
static gboolean ____lambda20__gsource_func (gpointer self);
VALA_EXTERN gboolean tuba_api_relationship_get_muting (TubaAPIRelationship* self);
static gboolean ____lambda21_ (TubaWidgetsRelationshipButton* self);
VALA_EXTERN GType tuba_api_relationship_modify_param_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TubaAPIRelationshipModifyParam* tuba_api_relationship_modify_param_dup (const TubaAPIRelationshipModifyParam* self);
VALA_EXTERN void tuba_api_relationship_modify_param_free (TubaAPIRelationshipModifyParam* self);
VALA_EXTERN void tuba_api_relationship_modify_param_copy (const TubaAPIRelationshipModifyParam* self,
                                              TubaAPIRelationshipModifyParam* dest);
VALA_EXTERN void tuba_api_relationship_modify_param_destroy (TubaAPIRelationshipModifyParam* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (TubaAPIRelationshipModifyParam, tuba_api_relationship_modify_param_destroy)
VALA_EXTERN void tuba_api_relationship_modify (TubaAPIRelationship* self,
                                   const gchar* operation,
                                   TubaAPIRelationshipModifyParam* modify_params,
                                   gint modify_params_length1);
static gboolean _____lambda21__gsource_func (gpointer self);
VALA_EXTERN gboolean tuba_api_relationship_get_following (TubaAPIRelationship* self);
VALA_EXTERN gboolean tuba_api_relationship_get_requested (TubaAPIRelationship* self);
static gboolean _____lambda22_ (TubaWidgetsRelationshipButton* self);
static gboolean ______lambda22__gsource_func (gpointer self);
VALA_EXTERN gboolean tuba_api_relationship_get_blocked_by (TubaAPIRelationship* self);
static gboolean ______lambda23_ (TubaWidgetsRelationshipButton* self);
static gboolean _______lambda23__gsource_func (gpointer self);
VALA_EXTERN TubaWidgetsRelationshipButton* tuba_widgets_relationship_button_new (void);
VALA_EXTERN TubaWidgetsRelationshipButton* tuba_widgets_relationship_button_construct (GType object_type);
VALA_EXTERN void tuba_widgets_relationship_button_set_rs (TubaWidgetsRelationshipButton* self,
                                              TubaAPIRelationship* value);
VALA_EXTERN void tuba_widgets_relationship_button_set_handle (TubaWidgetsRelationshipButton* self,
                                                  const gchar* value);
static GObject * tuba_widgets_relationship_button_constructor (GType type,
                                                        guint n_construct_properties,
                                                        GObjectConstructParam * construct_properties);
static void _tuba_widgets_relationship_button_on_bound_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self);
static void _tuba_widgets_relationship_button_on_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                      gpointer self);
static void tuba_widgets_relationship_button_finalize (GObject * obj);
static GType tuba_widgets_relationship_button_get_type_once (void);
static void _vala_tuba_widgets_relationship_button_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static void _vala_tuba_widgets_relationship_button_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec);

static inline gpointer
tuba_widgets_relationship_button_get_instance_private (TubaWidgetsRelationshipButton* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsRelationshipButton_private_offset);
}

static void
_tuba_widgets_relationship_button_invalidate_tuba_api_relationship_invalidated (TubaAPIRelationship* _sender,
                                                                                gpointer self)
{
	tuba_widgets_relationship_button_invalidate ((TubaWidgetsRelationshipButton*) self);
}

void
tuba_widgets_relationship_button_on_bound (TubaWidgetsRelationshipButton* self)
{
	TubaAPIRelationship* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_rs;
	if (_tmp0_ != NULL) {
		TubaAPIRelationship* _tmp1_;
		guint _tmp2_;
		TubaAPIRelationship* _tmp3_;
		_tmp1_ = self->priv->_rs;
		g_signal_parse_name ("invalidated", TUBA_API_TYPE_RELATIONSHIP, &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _tuba_widgets_relationship_button_invalidate_tuba_api_relationship_invalidated, self);
		_tmp3_ = self->priv->_rs;
		g_signal_connect_object (_tmp3_, "invalidated", (GCallback) _tuba_widgets_relationship_button_invalidate_tuba_api_relationship_invalidated, self, 0);
	}
	tuba_widgets_relationship_button_invalidate (self);
}

void
tuba_widgets_relationship_button_on_clicked (TubaWidgetsRelationshipButton* self)
{
	GSourceFunc _tmp0_;
	gpointer _tmp0__target;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->fn;
	_tmp0__target = self->fn_target;
	if (_tmp0_ != NULL) {
		GSourceFunc _tmp1_;
		gpointer _tmp1__target;
		gtk_widget_set_sensitive ((GtkWidget*) self, FALSE);
		_tmp1_ = self->fn;
		_tmp1__target = self->fn_target;
		_tmp1_ (_tmp1__target);
		(self->fn_target_destroy_notify == NULL) ? NULL : (self->fn_target_destroy_notify (self->fn_target), NULL);
		self->fn = NULL;
		self->fn_target = NULL;
		self->fn_target_destroy_notify = NULL;
		self->fn = NULL;
		self->fn_target = NULL;
		self->fn_target_destroy_notify = NULL;
	}
}

static gboolean
___lambda20_ (TubaWidgetsRelationshipButton* self)
{
	TubaAPIRelationship* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	_tmp0_ = self->priv->_rs;
	_tmp1_ = tuba_api_relationship_get_domain_blocking (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		gtk_widget_activate_action ((GtkWidget*) self, "domain_blocking", NULL, NULL);
	} else {
		TubaAPIRelationship* _tmp3_;
		gboolean _tmp4_;
		gboolean _tmp5_;
		_tmp3_ = self->priv->_rs;
		_tmp4_ = tuba_api_relationship_get_blocking (_tmp3_);
		_tmp5_ = _tmp4_;
		if (_tmp5_) {
			TubaAPIRelationship* _tmp6_;
			const gchar* _tmp7_;
			_tmp6_ = self->priv->_rs;
			_tmp7_ = self->priv->_handle;
			tuba_api_relationship_question_modify_block (_tmp6_, _tmp7_, FALSE);
		}
	}
	result = TRUE;
	return result;
}

static gboolean
____lambda20__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda20_ ((TubaWidgetsRelationshipButton*) self);
	return result;
}

static gboolean
____lambda21_ (TubaWidgetsRelationshipButton* self)
{
	TubaAPIRelationship* _tmp0_;
	gboolean result;
	_tmp0_ = self->priv->_rs;
	tuba_api_relationship_modify (_tmp0_, "unmute", NULL, (gint) 0);
	result = TRUE;
	return result;
}

static gboolean
_____lambda21__gsource_func (gpointer self)
{
	gboolean result;
	result = ____lambda21_ ((TubaWidgetsRelationshipButton*) self);
	return result;
}

static gboolean
_____lambda22_ (TubaWidgetsRelationshipButton* self)
{
	TubaAPIRelationship* _tmp0_;
	gboolean result;
	_tmp0_ = self->priv->_rs;
	tuba_api_relationship_modify (_tmp0_, "unfollow", NULL, (gint) 0);
	result = TRUE;
	return result;
}

static gboolean
______lambda22__gsource_func (gpointer self)
{
	gboolean result;
	result = _____lambda22_ ((TubaWidgetsRelationshipButton*) self);
	return result;
}

static gboolean
______lambda23_ (TubaWidgetsRelationshipButton* self)
{
	TubaAPIRelationship* _tmp0_;
	gboolean result;
	_tmp0_ = self->priv->_rs;
	tuba_api_relationship_modify (_tmp0_, "follow", NULL, (gint) 0);
	result = TRUE;
	return result;
}

static gboolean
_______lambda23__gsource_func (gpointer self)
{
	gboolean result;
	result = ______lambda23_ ((TubaWidgetsRelationshipButton*) self);
	return result;
}

static void
tuba_widgets_relationship_button_real_invalidate (TubaWidgetsRelationshipButton* self)
{
	TubaAPIRelationship* _tmp0_;
	gboolean _tmp1_ = FALSE;
	TubaAPIRelationship* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	_tmp0_ = self->priv->_rs;
	if (_tmp0_ == NULL) {
		gtk_widget_set_sensitive ((GtkWidget*) self, FALSE);
		gtk_button_set_label ((GtkButton*) self, _ ("Follow"));
		(self->fn_target_destroy_notify == NULL) ? NULL : (self->fn_target_destroy_notify (self->fn_target), NULL);
		self->fn = NULL;
		self->fn_target = NULL;
		self->fn_target_destroy_notify = NULL;
		self->fn = NULL;
		self->fn_target = NULL;
		self->fn_target_destroy_notify = NULL;
		return;
	}
	gtk_widget_set_sensitive ((GtkWidget*) self, TRUE);
	gtk_widget_remove_css_class ((GtkWidget*) self, "suggested-action");
	gtk_widget_remove_css_class ((GtkWidget*) self, "destructive-action");
	_tmp2_ = self->priv->_rs;
	_tmp3_ = tuba_api_relationship_get_blocking (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		_tmp1_ = TRUE;
	} else {
		TubaAPIRelationship* _tmp5_;
		gboolean _tmp6_;
		gboolean _tmp7_;
		_tmp5_ = self->priv->_rs;
		_tmp6_ = tuba_api_relationship_get_domain_blocking (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp1_ = _tmp7_;
	}
	if (_tmp1_) {
		gtk_button_set_label ((GtkButton*) self, _ ("Unblock"));
		(self->fn_target_destroy_notify == NULL) ? NULL : (self->fn_target_destroy_notify (self->fn_target), NULL);
		self->fn = NULL;
		self->fn_target = NULL;
		self->fn_target_destroy_notify = NULL;
		self->fn = ____lambda20__gsource_func;
		self->fn_target = g_object_ref (self);
		self->fn_target_destroy_notify = g_object_unref;
		gtk_widget_add_css_class ((GtkWidget*) self, "destructive-action");
		return;
	} else {
		TubaAPIRelationship* _tmp8_;
		gboolean _tmp9_;
		gboolean _tmp10_;
		_tmp8_ = self->priv->_rs;
		_tmp9_ = tuba_api_relationship_get_muting (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_) {
			gtk_button_set_label ((GtkButton*) self, _ ("Unmute"));
			(self->fn_target_destroy_notify == NULL) ? NULL : (self->fn_target_destroy_notify (self->fn_target), NULL);
			self->fn = NULL;
			self->fn_target = NULL;
			self->fn_target_destroy_notify = NULL;
			self->fn = _____lambda21__gsource_func;
			self->fn_target = g_object_ref (self);
			self->fn_target_destroy_notify = g_object_unref;
			gtk_widget_add_css_class ((GtkWidget*) self, "destructive-action");
		} else {
			gboolean _tmp11_ = FALSE;
			TubaAPIRelationship* _tmp12_;
			gboolean _tmp13_;
			gboolean _tmp14_;
			_tmp12_ = self->priv->_rs;
			_tmp13_ = tuba_api_relationship_get_following (_tmp12_);
			_tmp14_ = _tmp13_;
			if (_tmp14_) {
				_tmp11_ = TRUE;
			} else {
				TubaAPIRelationship* _tmp15_;
				gboolean _tmp16_;
				gboolean _tmp17_;
				_tmp15_ = self->priv->_rs;
				_tmp16_ = tuba_api_relationship_get_requested (_tmp15_);
				_tmp17_ = _tmp16_;
				_tmp11_ = _tmp17_;
			}
			if (_tmp11_) {
				gtk_button_set_label ((GtkButton*) self, _ ("Unfollow"));
				(self->fn_target_destroy_notify == NULL) ? NULL : (self->fn_target_destroy_notify (self->fn_target), NULL);
				self->fn = NULL;
				self->fn_target = NULL;
				self->fn_target_destroy_notify = NULL;
				self->fn = ______lambda22__gsource_func;
				self->fn_target = g_object_ref (self);
				self->fn_target_destroy_notify = g_object_unref;
				gtk_widget_add_css_class ((GtkWidget*) self, "destructive-action");
				return;
			} else {
				TubaAPIRelationship* _tmp18_;
				gboolean _tmp19_;
				gboolean _tmp20_;
				_tmp18_ = self->priv->_rs;
				_tmp19_ = tuba_api_relationship_get_following (_tmp18_);
				_tmp20_ = _tmp19_;
				if (!_tmp20_) {
					TubaAPIRelationship* _tmp21_;
					gboolean _tmp22_;
					gboolean _tmp23_;
					gtk_button_set_label ((GtkButton*) self, _ ("Follow"));
					gtk_widget_add_css_class ((GtkWidget*) self, "suggested-action");
					_tmp21_ = self->priv->_rs;
					_tmp22_ = tuba_api_relationship_get_blocked_by (_tmp21_);
					_tmp23_ = _tmp22_;
					if (_tmp23_) {
						gtk_widget_set_sensitive ((GtkWidget*) self, FALSE);
						return;
					}
					(self->fn_target_destroy_notify == NULL) ? NULL : (self->fn_target_destroy_notify (self->fn_target), NULL);
					self->fn = NULL;
					self->fn_target = NULL;
					self->fn_target_destroy_notify = NULL;
					self->fn = _______lambda23__gsource_func;
					self->fn_target = g_object_ref (self);
					self->fn_target_destroy_notify = g_object_unref;
					return;
				}
			}
		}
	}
}

void
tuba_widgets_relationship_button_invalidate (TubaWidgetsRelationshipButton* self)
{
	TubaWidgetsRelationshipButtonClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = TUBA_WIDGETS_RELATIONSHIP_BUTTON_GET_CLASS (self);
	if (_klass_->invalidate) {
		_klass_->invalidate (self);
	}
}

TubaWidgetsRelationshipButton*
tuba_widgets_relationship_button_construct (GType object_type)
{
	TubaWidgetsRelationshipButton * self = NULL;
	self = (TubaWidgetsRelationshipButton*) g_object_new (object_type, NULL);
	return self;
}

TubaWidgetsRelationshipButton*
tuba_widgets_relationship_button_new (void)
{
	return tuba_widgets_relationship_button_construct (TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON);
}

TubaAPIRelationship*
tuba_widgets_relationship_button_get_rs (TubaWidgetsRelationshipButton* self)
{
	TubaAPIRelationship* result;
	TubaAPIRelationship* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_rs;
	result = _tmp0_;
	return result;
}

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

void
tuba_widgets_relationship_button_set_rs (TubaWidgetsRelationshipButton* self,
                                         TubaAPIRelationship* value)
{
	TubaAPIRelationship* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_relationship_button_get_rs (self);
	if (old_value != value) {
		TubaAPIRelationship* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_rs);
		self->priv->_rs = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_relationship_button_properties[TUBA_WIDGETS_RELATIONSHIP_BUTTON_RS_PROPERTY]);
	}
}

const gchar*
tuba_widgets_relationship_button_get_handle (TubaWidgetsRelationshipButton* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_handle;
	result = _tmp0_;
	return result;
}

void
tuba_widgets_relationship_button_set_handle (TubaWidgetsRelationshipButton* self,
                                             const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_relationship_button_get_handle (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_handle);
		self->priv->_handle = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_relationship_button_properties[TUBA_WIDGETS_RELATIONSHIP_BUTTON_HANDLE_PROPERTY]);
	}
}

static void
_tuba_widgets_relationship_button_on_bound_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self)
{
	tuba_widgets_relationship_button_on_bound ((TubaWidgetsRelationshipButton*) self);
}

static void
_tuba_widgets_relationship_button_on_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                 gpointer self)
{
	tuba_widgets_relationship_button_on_clicked ((TubaWidgetsRelationshipButton*) self);
}

static GObject *
tuba_widgets_relationship_button_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaWidgetsRelationshipButton * self;
	parent_class = G_OBJECT_CLASS (tuba_widgets_relationship_button_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON, TubaWidgetsRelationshipButton);
	g_signal_connect_object ((GObject*) self, "notify::rs", (GCallback) _tuba_widgets_relationship_button_on_bound_g_object_notify, self, 0);
	g_signal_connect_object ((GtkButton*) self, "clicked", (GCallback) _tuba_widgets_relationship_button_on_clicked_gtk_button_clicked, self, 0);
	return obj;
}

static void
tuba_widgets_relationship_button_class_init (TubaWidgetsRelationshipButtonClass * klass,
                                             gpointer klass_data)
{
	tuba_widgets_relationship_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsRelationshipButton_private_offset);
	((TubaWidgetsRelationshipButtonClass *) klass)->invalidate = (void (*) (TubaWidgetsRelationshipButton*)) tuba_widgets_relationship_button_real_invalidate;
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_relationship_button_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_relationship_button_set_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_widgets_relationship_button_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_relationship_button_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_RELATIONSHIP_BUTTON_RS_PROPERTY, tuba_widgets_relationship_button_properties[TUBA_WIDGETS_RELATIONSHIP_BUTTON_RS_PROPERTY] = g_param_spec_object ("rs", "rs", "rs", TUBA_API_TYPE_RELATIONSHIP, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_RELATIONSHIP_BUTTON_HANDLE_PROPERTY, tuba_widgets_relationship_button_properties[TUBA_WIDGETS_RELATIONSHIP_BUTTON_HANDLE_PROPERTY] = g_param_spec_string ("handle", "handle", "handle", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
tuba_widgets_relationship_button_instance_init (TubaWidgetsRelationshipButton * self,
                                                gpointer klass)
{
	gchar* _tmp0_;
	self->priv = tuba_widgets_relationship_button_get_instance_private (self);
	self->fn = NULL;
	self->fn_target = NULL;
	self->fn_target_destroy_notify = NULL;
	_tmp0_ = g_strdup ("");
	self->priv->_handle = _tmp0_;
}

static void
tuba_widgets_relationship_button_finalize (GObject * obj)
{
	TubaWidgetsRelationshipButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON, TubaWidgetsRelationshipButton);
	_g_object_unref0 (self->priv->_rs);
	(self->fn_target_destroy_notify == NULL) ? NULL : (self->fn_target_destroy_notify (self->fn_target), NULL);
	self->fn = NULL;
	self->fn_target = NULL;
	self->fn_target_destroy_notify = NULL;
	_g_free0 (self->priv->_handle);
	G_OBJECT_CLASS (tuba_widgets_relationship_button_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_relationship_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsRelationshipButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_relationship_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsRelationshipButton), 0, (GInstanceInitFunc) tuba_widgets_relationship_button_instance_init, NULL };
	GType tuba_widgets_relationship_button_type_id;
	tuba_widgets_relationship_button_type_id = g_type_register_static (gtk_button_get_type (), "TubaWidgetsRelationshipButton", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaWidgetsRelationshipButton_private_offset = g_type_add_instance_private (tuba_widgets_relationship_button_type_id, sizeof (TubaWidgetsRelationshipButtonPrivate));
	return tuba_widgets_relationship_button_type_id;
}

GType
tuba_widgets_relationship_button_get_type (void)
{
	static GType tuba_widgets_relationship_button_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_widgets_relationship_button_type_id__once)) {
		GType tuba_widgets_relationship_button_type_id;
		tuba_widgets_relationship_button_type_id = tuba_widgets_relationship_button_get_type_once ();
		g_once_init_leave_pointer (&tuba_widgets_relationship_button_type_id__once, tuba_widgets_relationship_button_type_id);
	}
	return tuba_widgets_relationship_button_type_id__once;
}

static void
_vala_tuba_widgets_relationship_button_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	TubaWidgetsRelationshipButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON, TubaWidgetsRelationshipButton);
	switch (property_id) {
		case TUBA_WIDGETS_RELATIONSHIP_BUTTON_RS_PROPERTY:
		g_value_set_object (value, tuba_widgets_relationship_button_get_rs (self));
		break;
		case TUBA_WIDGETS_RELATIONSHIP_BUTTON_HANDLE_PROPERTY:
		g_value_set_string (value, tuba_widgets_relationship_button_get_handle (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_relationship_button_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec)
{
	TubaWidgetsRelationshipButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_RELATIONSHIP_BUTTON, TubaWidgetsRelationshipButton);
	switch (property_id) {
		case TUBA_WIDGETS_RELATIONSHIP_BUTTON_RS_PROPERTY:
		tuba_widgets_relationship_button_set_rs (self, g_value_get_object (value));
		break;
		case TUBA_WIDGETS_RELATIONSHIP_BUTTON_HANDLE_PROPERTY:
		tuba_widgets_relationship_button_set_handle (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

