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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <adwaita.h>
#include <gdk/gdk.h>
#include <gio/gio.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_AVATAR (tuba_widgets_avatar_get_type ())
#define TUBA_WIDGETS_AVATAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_AVATAR, TubaWidgetsAvatar))
#define TUBA_WIDGETS_AVATAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_AVATAR, TubaWidgetsAvatarClass))
#define TUBA_WIDGETS_IS_AVATAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_AVATAR))
#define TUBA_WIDGETS_IS_AVATAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_AVATAR))
#define TUBA_WIDGETS_AVATAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_AVATAR, TubaWidgetsAvatarClass))

typedef struct _TubaWidgetsAvatar TubaWidgetsAvatar;
typedef struct _TubaWidgetsAvatarClass TubaWidgetsAvatarClass;
typedef struct _TubaWidgetsAvatarPrivate TubaWidgetsAvatarPrivate;

#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_ACCOUNT (tuba_api_account_get_type ())
#define TUBA_API_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccount))
#define TUBA_API_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))
#define TUBA_API_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_API_TYPE_ACCOUNT))
#define TUBA_API_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_API_TYPE_ACCOUNT, TubaAPIAccountClass))

typedef struct _TubaAPIAccount TubaAPIAccount;
typedef struct _TubaAPIAccountClass TubaAPIAccountClass;
enum  {
	TUBA_WIDGETS_AVATAR_0_PROPERTY,
	TUBA_WIDGETS_AVATAR_ALTERNATIVE_TEXT_PROPERTY,
	TUBA_WIDGETS_AVATAR_ACCOUNT_PROPERTY,
	TUBA_WIDGETS_AVATAR_ALLOW_MINI_PROFILE_PROPERTY,
	TUBA_WIDGETS_AVATAR_SIZE_PROPERTY,
	TUBA_WIDGETS_AVATAR_CUSTOM_IMAGE_PROPERTY,
	TUBA_WIDGETS_AVATAR_AVATAR_PROPERTY,
	TUBA_WIDGETS_AVATAR_AVATAR_URL_PROPERTY,
	TUBA_WIDGETS_AVATAR_RETRY_ON_NETWORK_CHANGES_PROPERTY,
	TUBA_WIDGETS_AVATAR_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_NUM_PROPERTIES];

#define TUBA_TYPE_APPLICATION (tuba_application_get_type ())
#define TUBA_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_TYPE_APPLICATION, TubaApplication))
#define TUBA_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_TYPE_APPLICATION, TubaApplicationClass))
#define TUBA_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_TYPE_APPLICATION))
#define TUBA_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_TYPE_APPLICATION))
#define TUBA_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_TYPE_APPLICATION, TubaApplicationClass))

typedef struct _TubaApplication TubaApplication;
typedef struct _TubaApplicationClass TubaApplicationClass;
#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_VIEWS_PROFILE_TYPE_PROFILE_ACCOUNT (tuba_views_profile_profile_account_get_type ())
#define TUBA_VIEWS_PROFILE_PROFILE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_VIEWS_PROFILE_TYPE_PROFILE_ACCOUNT, TubaViewsProfileProfileAccount))
#define TUBA_VIEWS_PROFILE_PROFILE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_VIEWS_PROFILE_TYPE_PROFILE_ACCOUNT, TubaViewsProfileProfileAccountClass))
#define TUBA_VIEWS_PROFILE_IS_PROFILE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_VIEWS_PROFILE_TYPE_PROFILE_ACCOUNT))
#define TUBA_VIEWS_PROFILE_IS_PROFILE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_VIEWS_PROFILE_TYPE_PROFILE_ACCOUNT))
#define TUBA_VIEWS_PROFILE_PROFILE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_VIEWS_PROFILE_TYPE_PROFILE_ACCOUNT, TubaViewsProfileProfileAccountClass))

typedef struct _TubaViewsProfileProfileAccount TubaViewsProfileProfileAccount;
typedef struct _TubaViewsProfileProfileAccountClass TubaViewsProfileProfileAccountClass;

#define TUBA_WIDGETS_TYPE_COVER (tuba_widgets_cover_get_type ())
#define TUBA_WIDGETS_COVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_TYPE_COVER, TubaWidgetsCover))
#define TUBA_WIDGETS_COVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_TYPE_COVER, TubaWidgetsCoverClass))
#define TUBA_WIDGETS_IS_COVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_TYPE_COVER))
#define TUBA_WIDGETS_IS_COVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_TYPE_COVER))
#define TUBA_WIDGETS_COVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_TYPE_COVER, TubaWidgetsCoverClass))

typedef struct _TubaWidgetsCover TubaWidgetsCover;
typedef struct _TubaWidgetsCoverClass TubaWidgetsCoverClass;
typedef void (*TubaHelperImageOnItemChangedFn) (GdkPaintable* data, gpointer user_data);
enum  {
	TUBA_WIDGETS_AVATAR_MINI_CLICKED_SIGNAL,
	TUBA_WIDGETS_AVATAR_NUM_SIGNALS
};
static guint tuba_widgets_avatar_signals[TUBA_WIDGETS_AVATAR_NUM_SIGNALS] = {0};

struct _TubaWidgetsAvatar {
	GtkButton parent_instance;
	TubaWidgetsAvatarPrivate * priv;
};

struct _TubaWidgetsAvatarClass {
	GtkButtonClass parent_class;
};

struct _TubaWidgetsAvatarPrivate {
	TubaAPIAccount* _account;
	gboolean _allow_mini_profile;
	gchar* _avatar_url;
	gboolean _retry_on_network_changes;
	GtkPopover* mini_profile;
};

static gint TubaWidgetsAvatar_private_offset;
static gpointer tuba_widgets_avatar_parent_class = NULL;
VALA_EXTERN TubaApplication* tuba_app;

VALA_EXTERN GType tuba_widgets_avatar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsAvatar, 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_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaAPIAccount, g_object_unref)
VALA_EXTERN gboolean tuba_widgets_avatar_get_retry_on_network_changes (TubaWidgetsAvatar* self);
VALA_EXTERN GType tuba_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaApplication, g_object_unref)
static void tuba_widgets_avatar_on_network_change (TubaWidgetsAvatar* self);
static void _tuba_widgets_avatar_on_network_change_g_object_notify (GObject* _sender,
                                                             GParamSpec* pspec,
                                                             gpointer self);
static void tuba_widgets_avatar_clear_mini (TubaWidgetsAvatar* self);
static void tuba_widgets_avatar_on_invalidated (TubaWidgetsAvatar* self,
                                         TubaAPIAccount* account);
VALA_EXTERN AdwAvatar* tuba_widgets_avatar_get_avatar (TubaWidgetsAvatar* self);
VALA_EXTERN const gchar* tuba_api_account_get_display_name (TubaAPIAccount* self);
VALA_EXTERN const gchar* tuba_api_account_get_avatar (TubaAPIAccount* self);
VALA_EXTERN void tuba_widgets_avatar_set_avatar_url (TubaWidgetsAvatar* self,
                                         const gchar* value);
static void tuba_widgets_avatar_on_cache_response (TubaWidgetsAvatar* self,
                                            GdkPaintable* data);
VALA_EXTERN gboolean tuba_application_get_is_online (TubaApplication* self);
VALA_EXTERN GdkPaintable* tuba_widgets_avatar_get_custom_image (TubaWidgetsAvatar* self);
static void tuba_widgets_avatar_show_mini_profile (TubaWidgetsAvatar* self);
VALA_EXTERN TubaViewsProfileProfileAccount* tuba_views_profile_profile_account_new (TubaAPIAccount* t_acc);
VALA_EXTERN TubaViewsProfileProfileAccount* tuba_views_profile_profile_account_construct (GType object_type,
                                                                              TubaAPIAccount* t_acc);
VALA_EXTERN GType tuba_views_profile_profile_account_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaViewsProfileProfileAccount, g_object_unref)
VALA_EXTERN GtkWidget* tuba_views_profile_profile_account_to_mini_widget (TubaViewsProfileProfileAccount* self);
VALA_EXTERN GType tuba_widgets_cover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsCover, g_object_unref)
static void tuba_widgets_avatar_on_mini_avatar_clicked (TubaWidgetsAvatar* self);
static void _tuba_widgets_avatar_on_mini_avatar_clicked_tuba_widgets_cover_avatar_clicked (TubaWidgetsCover* _sender,
                                                                                    gpointer self);
static void _tuba_widgets_avatar_clear_mini_gtk_popover_closed (GtkPopover* _sender,
                                                         gpointer self);
VALA_EXTERN TubaWidgetsAvatar* tuba_widgets_avatar_new (void);
VALA_EXTERN TubaWidgetsAvatar* tuba_widgets_avatar_construct (GType object_type);
VALA_EXTERN void tuba_widgets_avatar_set_alternative_text (TubaWidgetsAvatar* self,
                                               const gchar* value);
VALA_EXTERN void tuba_widgets_avatar_set_account (TubaWidgetsAvatar* self,
                                      TubaAPIAccount* value);
VALA_EXTERN gboolean tuba_widgets_avatar_get_allow_mini_profile (TubaWidgetsAvatar* self);
VALA_EXTERN void tuba_widgets_avatar_set_allow_mini_profile (TubaWidgetsAvatar* self,
                                                 gboolean value);
static void _tuba_widgets_avatar_show_mini_profile_gtk_button_clicked (GtkButton* _sender,
                                                                gpointer self);
VALA_EXTERN gint tuba_widgets_avatar_get_size (TubaWidgetsAvatar* self);
VALA_EXTERN void tuba_widgets_avatar_set_size (TubaWidgetsAvatar* self,
                                   gint value);
VALA_EXTERN const gchar* tuba_widgets_avatar_get_avatar_url (TubaWidgetsAvatar* self);
VALA_EXTERN void tuba_helper_image_request_paintable (const gchar* url,
                                          const gchar* blurhash,
                                          gboolean disable_cache,
                                          TubaHelperImageOnItemChangedFn cb,
                                          gpointer cb_target,
                                          GDestroyNotify cb_target_destroy_notify,
                                          GCancellable* cancellable);
static void _tuba_widgets_avatar_on_cache_response_tuba_helper_image_on_item_changed_fn (GdkPaintable* data,
                                                                                  gpointer self);
VALA_EXTERN void tuba_widgets_avatar_set_retry_on_network_changes (TubaWidgetsAvatar* self,
                                                       gboolean value);
static GObject * tuba_widgets_avatar_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
static void tuba_widgets_avatar_finalize (GObject * obj);
static GType tuba_widgets_avatar_get_type_once (void);
static void _vala_tuba_widgets_avatar_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_tuba_widgets_avatar_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
tuba_widgets_avatar_get_instance_private (TubaWidgetsAvatar* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsAvatar_private_offset);
}

static void
_tuba_widgets_avatar_on_network_change_g_object_notify (GObject* _sender,
                                                        GParamSpec* pspec,
                                                        gpointer self)
{
	tuba_widgets_avatar_on_network_change ((TubaWidgetsAvatar*) self);
}

static void
tuba_widgets_avatar_on_invalidated (TubaWidgetsAvatar* self,
                                    TubaAPIAccount* account)
{
	g_return_if_fail (self != NULL);
	if (account == NULL) {
		AdwAvatar* _tmp0_;
		AdwAvatar* _tmp1_;
		AdwAvatar* _tmp2_;
		AdwAvatar* _tmp3_;
		_tmp0_ = tuba_widgets_avatar_get_avatar (self);
		_tmp1_ = _tmp0_;
		adw_avatar_set_text (_tmp1_, "d");
		_tmp2_ = tuba_widgets_avatar_get_avatar (self);
		_tmp3_ = _tmp2_;
		adw_avatar_set_show_initials (_tmp3_, FALSE);
	} else {
		AdwAvatar* _tmp4_;
		AdwAvatar* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		AdwAvatar* _tmp8_;
		AdwAvatar* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp4_ = tuba_widgets_avatar_get_avatar (self);
		_tmp5_ = _tmp4_;
		_tmp6_ = tuba_api_account_get_display_name (account);
		_tmp7_ = _tmp6_;
		adw_avatar_set_text (_tmp5_, _tmp7_);
		_tmp8_ = tuba_widgets_avatar_get_avatar (self);
		_tmp9_ = _tmp8_;
		adw_avatar_set_show_initials (_tmp9_, TRUE);
		_tmp10_ = tuba_api_account_get_avatar (account);
		_tmp11_ = _tmp10_;
		tuba_widgets_avatar_set_avatar_url (self, _tmp11_);
	}
}

static void
tuba_widgets_avatar_on_cache_response (TubaWidgetsAvatar* self,
                                       GdkPaintable* data)
{
	AdwAvatar* _tmp0_;
	AdwAvatar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tuba_widgets_avatar_get_avatar (self);
	_tmp1_ = _tmp0_;
	adw_avatar_set_custom_image (_tmp1_, data);
	g_object_notify ((GObject*) self, "custom-image");
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static gint
string_index_of_char (const gchar* self,
                      gunichar c,
                      gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = g_utf8_strchr (((gchar*) self) + start_index, (gssize) -1, c);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static void
tuba_widgets_avatar_on_network_change (TubaWidgetsAvatar* self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	TubaApplication* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp2_ = tuba_app;
	_tmp3_ = tuba_application_get_is_online (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_) {
		const gchar* _tmp5_;
		_tmp5_ = self->priv->_avatar_url;
		_tmp1_ = _tmp5_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GdkPaintable* _tmp6_;
		GdkPaintable* _tmp7_;
		_tmp6_ = tuba_widgets_avatar_get_custom_image (self);
		_tmp7_ = _tmp6_;
		_tmp0_ = _tmp7_ == NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar* new_uuid = NULL;
		gchar* _tmp8_;
		gchar* new_avi = NULL;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		_tmp8_ = g_uuid_string_random ();
		new_uuid = _tmp8_;
		_tmp9_ = self->priv->_avatar_url;
		_tmp10_ = g_strdup (_tmp9_);
		new_avi = _tmp10_;
		_tmp11_ = self->priv->_avatar_url;
		if (string_contains (_tmp11_, "#")) {
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			gchar* _tmp14_;
			_tmp12_ = self->priv->_avatar_url;
			_tmp13_ = self->priv->_avatar_url;
			_tmp14_ = string_slice (_tmp12_, (glong) 0, (glong) string_index_of_char (_tmp13_, (gunichar) '#', 0));
			_g_free0 (new_avi);
			new_avi = _tmp14_;
		}
		_tmp15_ = new_avi;
		_tmp16_ = string_to_string (_tmp15_);
		_tmp17_ = new_uuid;
		_tmp18_ = string_to_string (_tmp17_);
		_tmp19_ = g_strconcat (_tmp16_, "#", _tmp18_, NULL);
		_tmp20_ = _tmp19_;
		tuba_widgets_avatar_set_avatar_url (self, _tmp20_);
		_g_free0 (_tmp20_);
		_g_free0 (new_avi);
		_g_free0 (new_uuid);
	}
}

static void
_tuba_widgets_avatar_on_mini_avatar_clicked_tuba_widgets_cover_avatar_clicked (TubaWidgetsCover* _sender,
                                                                               gpointer self)
{
	tuba_widgets_avatar_on_mini_avatar_clicked ((TubaWidgetsAvatar*) self);
}

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

static void
_tuba_widgets_avatar_clear_mini_gtk_popover_closed (GtkPopover* _sender,
                                                    gpointer self)
{
	tuba_widgets_avatar_clear_mini ((TubaWidgetsAvatar*) self);
}

static void
tuba_widgets_avatar_show_mini_profile (TubaWidgetsAvatar* self)
{
	TubaAPIAccount* _tmp0_;
	GtkPopover* _tmp1_;
	GtkPopover* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_account;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->mini_profile;
	if (_tmp1_ == NULL) {
		GtkWidget* mini_cover = NULL;
		TubaAPIAccount* _tmp2_;
		TubaViewsProfileProfileAccount* _tmp3_;
		TubaViewsProfileProfileAccount* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		GtkWidget* _tmp8_;
		GtkWidget* _tmp9_;
		GtkScrolledWindow* _tmp10_ = NULL;
		GtkPopover* _tmp11_ = NULL;
		GtkPopover* _tmp12_;
		GtkPopover* _tmp13_;
		GtkPopover* _tmp14_;
		GtkPopover* _tmp15_;
		_tmp2_ = self->priv->_account;
		_tmp3_ = tuba_views_profile_profile_account_new (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = tuba_views_profile_profile_account_to_mini_widget (_tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		mini_cover = _tmp6_;
		_tmp7_ = mini_cover;
		g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, TUBA_WIDGETS_TYPE_COVER, TubaWidgetsCover), "avatar-clicked", (GCallback) _tuba_widgets_avatar_on_mini_avatar_clicked_tuba_widgets_cover_avatar_clicked, self, 0);
		_tmp8_ = mini_cover;
		_tmp9_ = _g_object_ref0 (_tmp8_);
		_tmp10_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
		gtk_scrolled_window_set_child (_tmp10_, _tmp9_);
		_g_object_unref0 (_tmp9_);
		gtk_widget_set_hexpand ((GtkWidget*) _tmp10_, TRUE);
		gtk_widget_set_vexpand ((GtkWidget*) _tmp10_, TRUE);
		g_object_set (_tmp10_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
		gtk_scrolled_window_set_max_content_height (_tmp10_, 500);
		g_object_set ((GtkWidget*) _tmp10_, "width-request", 360, NULL);
		gtk_scrolled_window_set_propagate_natural_height (_tmp10_, TRUE);
		g_object_ref_sink (_tmp10_);
		_tmp11_ = (GtkPopover*) gtk_popover_new ();
		gtk_popover_set_child (_tmp11_, (GtkWidget*) _tmp10_);
		_g_object_unref0 (_tmp10_);
		g_object_ref_sink (_tmp11_);
		_g_object_unref0 (self->priv->mini_profile);
		self->priv->mini_profile = _tmp11_;
		_tmp12_ = self->priv->mini_profile;
		gtk_widget_add_css_class ((GtkWidget*) _tmp12_, "mini-profile");
		_tmp13_ = self->priv->mini_profile;
		gtk_widget_add_css_class ((GtkWidget*) _tmp13_, "no-padding");
		_tmp14_ = self->priv->mini_profile;
		gtk_widget_set_parent ((GtkWidget*) _tmp14_, (GtkWidget*) self);
		_tmp15_ = self->priv->mini_profile;
		g_signal_connect_object (_tmp15_, "closed", (GCallback) _tuba_widgets_avatar_clear_mini_gtk_popover_closed, self, 0);
		_g_object_unref0 (mini_cover);
	}
	_tmp16_ = self->priv->mini_profile;
	gtk_popover_popup (_tmp16_);
}

static void
tuba_widgets_avatar_clear_mini (TubaWidgetsAvatar* self)
{
	GtkPopover* _tmp0_;
	GtkPopover* _tmp1_;
	GtkPopover* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->mini_profile;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->mini_profile;
	gtk_widget_unparent ((GtkWidget*) _tmp1_);
	_tmp2_ = self->priv->mini_profile;
	g_object_run_dispose ((GObject*) _tmp2_);
	_g_object_unref0 (self->priv->mini_profile);
	self->priv->mini_profile = NULL;
}

static void
tuba_widgets_avatar_on_mini_avatar_clicked (TubaWidgetsAvatar* self)
{
	GtkPopover* _tmp0_;
	TubaAPIAccount* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->mini_profile;
	if (_tmp0_ != NULL) {
		GtkPopover* _tmp1_;
		_tmp1_ = self->priv->mini_profile;
		gtk_popover_popdown (_tmp1_);
	}
	gtk_widget_grab_focus ((GtkWidget*) self);
	_tmp2_ = self->priv->_account;
	g_signal_emit (self, tuba_widgets_avatar_signals[TUBA_WIDGETS_AVATAR_MINI_CLICKED_SIGNAL], 0, _tmp2_);
}

TubaWidgetsAvatar*
tuba_widgets_avatar_construct (GType object_type)
{
	TubaWidgetsAvatar * self = NULL;
	self = (TubaWidgetsAvatar*) g_object_new (object_type, NULL);
	return self;
}

TubaWidgetsAvatar*
tuba_widgets_avatar_new (void)
{
	return tuba_widgets_avatar_construct (TUBA_WIDGETS_TYPE_AVATAR);
}

void
tuba_widgets_avatar_set_alternative_text (TubaWidgetsAvatar* self,
                                          const gchar* value)
{
	const gchar* _tmp0_ = NULL;
	gchar* alt_text = NULL;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	if (value == NULL) {
		_tmp0_ = "";
	} else {
		_tmp0_ = value;
	}
	_tmp1_ = g_strdup (_tmp0_);
	alt_text = _tmp1_;
	gtk_accessible_update_property ((GtkAccessible*) self, GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, alt_text, -1, -1);
	_g_free0 (alt_text);
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_ALTERNATIVE_TEXT_PROPERTY]);
}

void
tuba_widgets_avatar_set_account (TubaWidgetsAvatar* self,
                                 TubaAPIAccount* value)
{
	TubaAPIAccount* _tmp0_;
	g_return_if_fail (self != NULL);
	tuba_widgets_avatar_on_invalidated (self, value);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_account);
	self->priv->_account = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_ACCOUNT_PROPERTY]);
}

gboolean
tuba_widgets_avatar_get_allow_mini_profile (TubaWidgetsAvatar* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_allow_mini_profile;
	return result;
}

static void
_tuba_widgets_avatar_show_mini_profile_gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self)
{
	tuba_widgets_avatar_show_mini_profile ((TubaWidgetsAvatar*) self);
}

void
tuba_widgets_avatar_set_allow_mini_profile (TubaWidgetsAvatar* self,
                                            gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_allow_mini_profile == value) {
		return;
	}
	self->priv->_allow_mini_profile = value;
	if (value) {
		g_signal_connect_object ((GtkButton*) self, "clicked", (GCallback) _tuba_widgets_avatar_show_mini_profile_gtk_button_clicked, self, 0);
	} else {
		guint _tmp0_;
		g_signal_parse_name ("clicked", gtk_button_get_type (), &_tmp0_, NULL, FALSE);
		g_signal_handlers_disconnect_matched ((GtkButton*) self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _tuba_widgets_avatar_show_mini_profile_gtk_button_clicked, self);
	}
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_ALLOW_MINI_PROFILE_PROPERTY]);
}

gint
tuba_widgets_avatar_get_size (TubaWidgetsAvatar* self)
{
	gint result;
	AdwAvatar* _tmp0_;
	AdwAvatar* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = tuba_widgets_avatar_get_avatar (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = adw_avatar_get_size (_tmp1_);
	_tmp3_ = _tmp2_;
	result = _tmp3_;
	return result;
}

void
tuba_widgets_avatar_set_size (TubaWidgetsAvatar* self,
                              gint value)
{
	AdwAvatar* _tmp0_;
	AdwAvatar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tuba_widgets_avatar_get_avatar (self);
	_tmp1_ = _tmp0_;
	adw_avatar_set_size (_tmp1_, value);
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_SIZE_PROPERTY]);
}

GdkPaintable*
tuba_widgets_avatar_get_custom_image (TubaWidgetsAvatar* self)
{
	GdkPaintable* result;
	AdwAvatar* _tmp0_;
	AdwAvatar* _tmp1_;
	GdkPaintable* _tmp2_;
	GdkPaintable* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = tuba_widgets_avatar_get_avatar (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = adw_avatar_get_custom_image (_tmp1_);
	_tmp3_ = _tmp2_;
	result = _tmp3_;
	return result;
}

AdwAvatar*
tuba_widgets_avatar_get_avatar (TubaWidgetsAvatar* self)
{
	AdwAvatar* result;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gtk_button_get_child ((GtkButton*) self);
	_tmp1_ = _tmp0_;
	result = G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, adw_avatar_get_type ()) ? ((AdwAvatar*) _tmp1_) : NULL;
	return result;
}

const gchar*
tuba_widgets_avatar_get_avatar_url (TubaWidgetsAvatar* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_avatar_url;
	result = _tmp0_;
	return result;
}

static void
_tuba_widgets_avatar_on_cache_response_tuba_helper_image_on_item_changed_fn (GdkPaintable* data,
                                                                             gpointer self)
{
	tuba_widgets_avatar_on_cache_response ((TubaWidgetsAvatar*) self, data);
}

void
tuba_widgets_avatar_set_avatar_url (TubaWidgetsAvatar* self,
                                    const gchar* value)
{
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_avatar_url);
	self->priv->_avatar_url = _tmp0_;
	if (value != NULL) {
		gboolean _tmp2_ = FALSE;
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp3_ = tuba_widgets_avatar_get_retry_on_network_changes (self);
		_tmp4_ = _tmp3_;
		if (!_tmp4_) {
			_tmp2_ = TRUE;
		} else {
			gboolean _tmp5_ = FALSE;
			gboolean _tmp6_;
			gboolean _tmp7_;
			_tmp6_ = tuba_widgets_avatar_get_retry_on_network_changes (self);
			_tmp7_ = _tmp6_;
			if (_tmp7_) {
				TubaApplication* _tmp8_;
				gboolean _tmp9_;
				gboolean _tmp10_;
				_tmp8_ = tuba_app;
				_tmp9_ = tuba_application_get_is_online (_tmp8_);
				_tmp10_ = _tmp9_;
				_tmp5_ = _tmp10_;
			} else {
				_tmp5_ = FALSE;
			}
			_tmp2_ = _tmp5_;
		}
		_tmp1_ = _tmp2_;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		tuba_helper_image_request_paintable (value, NULL, FALSE, _tuba_widgets_avatar_on_cache_response_tuba_helper_image_on_item_changed_fn, g_object_ref (self), g_object_unref, NULL);
	}
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_AVATAR_URL_PROPERTY]);
}

gboolean
tuba_widgets_avatar_get_retry_on_network_changes (TubaWidgetsAvatar* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_retry_on_network_changes;
	return result;
}

void
tuba_widgets_avatar_set_retry_on_network_changes (TubaWidgetsAvatar* self,
                                                  gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_retry_on_network_changes == value) {
		return;
	}
	if (value) {
		TubaApplication* _tmp0_;
		_tmp0_ = tuba_app;
		g_signal_connect_object ((GObject*) _tmp0_, "notify::is-online", (GCallback) _tuba_widgets_avatar_on_network_change_g_object_notify, self, 0);
	} else {
		TubaApplication* _tmp1_;
		guint _tmp2_;
		GQuark _tmp3_;
		_tmp1_ = tuba_app;
		g_signal_parse_name ("notify::is-online", G_TYPE_OBJECT, &_tmp2_, &_tmp3_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, _tmp3_, NULL, (GCallback) _tuba_widgets_avatar_on_network_change_g_object_notify, self);
	}
	self->priv->_retry_on_network_changes = value;
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_RETRY_ON_NETWORK_CHANGES_PROPERTY]);
}

static GObject *
tuba_widgets_avatar_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaWidgetsAvatar * self;
	AdwAvatar* _tmp0_;
	AdwAvatar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	parent_class = G_OBJECT_CLASS (tuba_widgets_avatar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_AVATAR, TubaWidgetsAvatar);
	_tmp0_ = (AdwAvatar*) adw_avatar_new (48, NULL, TRUE);
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	gtk_button_set_child ((GtkButton*) self, (GtkWidget*) _tmp1_);
	_g_object_unref0 (_tmp1_);
	gtk_widget_set_valign ((GtkWidget*) self, GTK_ALIGN_CENTER);
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_CENTER);
	_tmp2_ = g_strdup ("flat");
	_tmp3_ = g_strdup ("circular");
	_tmp4_ = g_strdup ("image-button");
	_tmp5_ = g_strdup ("ttl-flat-button");
	_tmp6_ = g_strdup ("wavi");
	_tmp7_ = g_new0 (gchar*, 5 + 1);
	_tmp7_[0] = _tmp2_;
	_tmp7_[1] = _tmp3_;
	_tmp7_[2] = _tmp4_;
	_tmp7_[3] = _tmp5_;
	_tmp7_[4] = _tmp6_;
	_tmp8_ = _tmp7_;
	_tmp8__length1 = 5;
	gtk_widget_set_css_classes ((GtkWidget*) self, _tmp8_);
	_tmp8_ = (_vala_array_free (_tmp8_, _tmp8__length1, (GDestroyNotify) g_free), NULL);
	tuba_widgets_avatar_on_invalidated (self, NULL);
	return obj;
}

static void
tuba_widgets_avatar_class_init (TubaWidgetsAvatarClass * klass,
                                gpointer klass_data)
{
	tuba_widgets_avatar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsAvatar_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_avatar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_avatar_set_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_widgets_avatar_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_avatar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AVATAR_ALTERNATIVE_TEXT_PROPERTY, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_ALTERNATIVE_TEXT_PROPERTY] = g_param_spec_string ("alternative-text", "alternative-text", "alternative-text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AVATAR_ACCOUNT_PROPERTY, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_ACCOUNT_PROPERTY] = g_param_spec_object ("account", "account", "account", TUBA_API_TYPE_ACCOUNT, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AVATAR_ALLOW_MINI_PROFILE_PROPERTY, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_ALLOW_MINI_PROFILE_PROPERTY] = g_param_spec_boolean ("allow-mini-profile", "allow-mini-profile", "allow-mini-profile", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AVATAR_SIZE_PROPERTY, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_SIZE_PROPERTY] = g_param_spec_int ("size", "size", "size", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AVATAR_CUSTOM_IMAGE_PROPERTY, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_CUSTOM_IMAGE_PROPERTY] = g_param_spec_object ("custom-image", "custom-image", "custom-image", gdk_paintable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AVATAR_AVATAR_PROPERTY, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_AVATAR_PROPERTY] = g_param_spec_object ("avatar", "avatar", "avatar", adw_avatar_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AVATAR_AVATAR_URL_PROPERTY, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_AVATAR_URL_PROPERTY] = g_param_spec_string ("avatar-url", "avatar-url", "avatar-url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AVATAR_RETRY_ON_NETWORK_CHANGES_PROPERTY, tuba_widgets_avatar_properties[TUBA_WIDGETS_AVATAR_RETRY_ON_NETWORK_CHANGES_PROPERTY] = g_param_spec_boolean ("retry-on-network-changes", "retry-on-network-changes", "retry-on-network-changes", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	tuba_widgets_avatar_signals[TUBA_WIDGETS_AVATAR_MINI_CLICKED_SIGNAL] = g_signal_new ("mini-clicked", TUBA_WIDGETS_TYPE_AVATAR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, TUBA_API_TYPE_ACCOUNT);
}

static void
tuba_widgets_avatar_instance_init (TubaWidgetsAvatar * self,
                                   gpointer klass)
{
	self->priv = tuba_widgets_avatar_get_instance_private (self);
	self->priv->_account = NULL;
	self->priv->_allow_mini_profile = FALSE;
	self->priv->_avatar_url = NULL;
	self->priv->_retry_on_network_changes = FALSE;
	self->priv->mini_profile = NULL;
}

static void
tuba_widgets_avatar_finalize (GObject * obj)
{
	TubaWidgetsAvatar * self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_TYPE_AVATAR, TubaWidgetsAvatar);
	_tmp0_ = tuba_widgets_avatar_get_retry_on_network_changes (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_) {
		TubaApplication* _tmp2_;
		guint _tmp3_;
		GQuark _tmp4_;
		_tmp2_ = tuba_app;
		g_signal_parse_name ("notify::is-online", G_TYPE_OBJECT, &_tmp3_, &_tmp4_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, _tmp4_, NULL, (GCallback) _tuba_widgets_avatar_on_network_change_g_object_notify, self);
	}
	tuba_widgets_avatar_clear_mini (self);
	_g_object_unref0 (self->priv->_account);
	_g_free0 (self->priv->_avatar_url);
	_g_object_unref0 (self->priv->mini_profile);
	G_OBJECT_CLASS (tuba_widgets_avatar_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_avatar_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsAvatarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_avatar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsAvatar), 0, (GInstanceInitFunc) tuba_widgets_avatar_instance_init, NULL };
	GType tuba_widgets_avatar_type_id;
	tuba_widgets_avatar_type_id = g_type_register_static (gtk_button_get_type (), "TubaWidgetsAvatar", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaWidgetsAvatar_private_offset = g_type_add_instance_private (tuba_widgets_avatar_type_id, sizeof (TubaWidgetsAvatarPrivate));
	return tuba_widgets_avatar_type_id;
}

GType
tuba_widgets_avatar_get_type (void)
{
	static GType tuba_widgets_avatar_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_widgets_avatar_type_id__once)) {
		GType tuba_widgets_avatar_type_id;
		tuba_widgets_avatar_type_id = tuba_widgets_avatar_get_type_once ();
		g_once_init_leave_pointer (&tuba_widgets_avatar_type_id__once, tuba_widgets_avatar_type_id);
	}
	return tuba_widgets_avatar_type_id__once;
}

static void
_vala_tuba_widgets_avatar_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	TubaWidgetsAvatar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_AVATAR, TubaWidgetsAvatar);
	switch (property_id) {
		case TUBA_WIDGETS_AVATAR_ALLOW_MINI_PROFILE_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_avatar_get_allow_mini_profile (self));
		break;
		case TUBA_WIDGETS_AVATAR_SIZE_PROPERTY:
		g_value_set_int (value, tuba_widgets_avatar_get_size (self));
		break;
		case TUBA_WIDGETS_AVATAR_CUSTOM_IMAGE_PROPERTY:
		g_value_set_object (value, tuba_widgets_avatar_get_custom_image (self));
		break;
		case TUBA_WIDGETS_AVATAR_AVATAR_PROPERTY:
		g_value_set_object (value, tuba_widgets_avatar_get_avatar (self));
		break;
		case TUBA_WIDGETS_AVATAR_AVATAR_URL_PROPERTY:
		g_value_set_string (value, tuba_widgets_avatar_get_avatar_url (self));
		break;
		case TUBA_WIDGETS_AVATAR_RETRY_ON_NETWORK_CHANGES_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_avatar_get_retry_on_network_changes (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_avatar_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	TubaWidgetsAvatar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_TYPE_AVATAR, TubaWidgetsAvatar);
	switch (property_id) {
		case TUBA_WIDGETS_AVATAR_ALTERNATIVE_TEXT_PROPERTY:
		tuba_widgets_avatar_set_alternative_text (self, g_value_get_string (value));
		break;
		case TUBA_WIDGETS_AVATAR_ACCOUNT_PROPERTY:
		tuba_widgets_avatar_set_account (self, g_value_get_object (value));
		break;
		case TUBA_WIDGETS_AVATAR_ALLOW_MINI_PROFILE_PROPERTY:
		tuba_widgets_avatar_set_allow_mini_profile (self, g_value_get_boolean (value));
		break;
		case TUBA_WIDGETS_AVATAR_SIZE_PROPERTY:
		tuba_widgets_avatar_set_size (self, g_value_get_int (value));
		break;
		case TUBA_WIDGETS_AVATAR_AVATAR_URL_PROPERTY:
		tuba_widgets_avatar_set_avatar_url (self, g_value_get_string (value));
		break;
		case TUBA_WIDGETS_AVATAR_RETRY_ON_NETWORK_CHANGES_PROPERTY:
		tuba_widgets_avatar_set_retry_on_network_changes (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

