/* gitg-ref-action-delete.c generated by valac 0.56.19, the Vala compiler
 * generated from gitg-ref-action-delete.vala, do not modify */

/*
 * This file is part of gitg
 *
 * Copyright (C) 2014 - Jesse van den Kieboom
 *
 * gitg is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * gitg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gitg. If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib-object.h>
#include "libgitg-ext.h"
#include "libgitg.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "config.h"
#include <libgit2-glib/ggit.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <stdio.h>

#define GITG_REF_ACTION_DELETE_version VERSION
#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 GITG_TYPE_REF_ACTION_DELETE (gitg_ref_action_delete_get_type ())
#define GITG_REF_ACTION_DELETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_REF_ACTION_DELETE, GitgRefActionDelete))
#define GITG_REF_ACTION_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_REF_ACTION_DELETE, GitgRefActionDeleteClass))
#define GITG_IS_REF_ACTION_DELETE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_REF_ACTION_DELETE))
#define GITG_IS_REF_ACTION_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_REF_ACTION_DELETE))
#define GITG_REF_ACTION_DELETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_REF_ACTION_DELETE, GitgRefActionDeleteClass))

typedef struct _GitgRefActionDelete GitgRefActionDelete;
typedef struct _GitgRefActionDeleteClass GitgRefActionDeleteClass;
typedef struct _GitgRefActionDeletePrivate GitgRefActionDeletePrivate;
enum  {
	GITG_REF_ACTION_DELETE_0_PROPERTY,
	GITG_REF_ACTION_DELETE_APPLICATION_PROPERTY,
	GITG_REF_ACTION_DELETE_ACTION_INTERFACE_PROPERTY,
	GITG_REF_ACTION_DELETE_REFERENCE_PROPERTY,
	GITG_REF_ACTION_DELETE_ID_PROPERTY,
	GITG_REF_ACTION_DELETE_DISPLAY_NAME_PROPERTY,
	GITG_REF_ACTION_DELETE_DESCRIPTION_PROPERTY,
	GITG_REF_ACTION_DELETE_ENABLED_PROPERTY,
	GITG_REF_ACTION_DELETE_NUM_PROPERTIES
};
static GParamSpec* gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_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 _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define GITG_TYPE_REMOTE_NOTIFICATION (gitg_remote_notification_get_type ())
#define GITG_REMOTE_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_REMOTE_NOTIFICATION, GitgRemoteNotification))
#define GITG_REMOTE_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_REMOTE_NOTIFICATION, GitgRemoteNotificationClass))
#define GITG_IS_REMOTE_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_REMOTE_NOTIFICATION))
#define GITG_IS_REMOTE_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_REMOTE_NOTIFICATION))
#define GITG_REMOTE_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_REMOTE_NOTIFICATION, GitgRemoteNotificationClass))

typedef struct _GitgRemoteNotification GitgRemoteNotification;
typedef struct _GitgRemoteNotificationClass GitgRemoteNotificationClass;
typedef struct _GitgRefActionDeleteDeleteRemoteBranchData GitgRefActionDeleteDeleteRemoteBranchData;

struct _GitgRefActionDelete {
	GObject parent_instance;
	GitgRefActionDeletePrivate * priv;
};

struct _GitgRefActionDeleteClass {
	GObjectClass parent_class;
};

struct _GitgRefActionDeletePrivate {
	GitgExtApplication* _application;
	GitgExtRefActionInterface* _action_interface;
	GitgRef* _reference;
};

struct _GitgRefActionDeleteDeleteRemoteBranchData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GitgRefActionDelete* self;
	GitgRemote* remote;
	gchar* remote_branch;
	gboolean result;
	GitgRemoteNotification* notification;
	GitgRemoteNotification* _tmp0_;
	GitgExtApplication* _tmp1_;
	GitgExtApplication* _tmp2_;
	GitgExtApplication* _tmp3_;
	GitgExtNotifications* _tmp4_;
	GitgExtNotifications* _tmp5_;
	GitgExtNotifications* _tmp6_;
	GitgRemoteNotification* _tmp7_;
	GitgRemoteNotification* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	GitgExtApplication* _tmp12_;
	GitgExtApplication* _tmp13_;
	GtkApplicationWindow* _tmp14_;
	GError* e;
	GitgRemoteNotification* _tmp15_;
	const gchar* _tmp16_;
	GError* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	FILE* _tmp21_;
	GError* _tmp22_;
	const gchar* _tmp23_;
	GitgRemoteNotification* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	GError* _inner_error0_;
};

static gint GitgRefActionDelete_private_offset;
static gpointer gitg_ref_action_delete_parent_class = NULL;
static GitgExtUIElementIface * gitg_ref_action_delete_gitg_ext_ui_element_parent_iface = NULL;
static GitgExtActionIface * gitg_ref_action_delete_gitg_ext_action_parent_iface = NULL;
static GitgExtRefActionIface * gitg_ref_action_delete_gitg_ext_ref_action_parent_iface = NULL;

VALA_EXTERN GType gitg_ref_action_delete_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GitgRefActionDelete, g_object_unref)
VALA_EXTERN GitgRefActionDelete* gitg_ref_action_delete_new (GitgExtApplication* application,
                                                 GitgExtRefActionInterface* action_interface,
                                                 GitgRef* reference);
VALA_EXTERN GitgRefActionDelete* gitg_ref_action_delete_construct (GType object_type,
                                                       GitgExtApplication* application,
                                                       GitgExtRefActionInterface* action_interface,
                                                       GitgRef* reference);
static void gitg_ref_action_delete_real_activate (GitgExtUIElement* base);
static gboolean gitg_ref_action_delete_on_response (GitgRefActionDelete* self,
                                             GtkResponseType response);
static gboolean _gitg_ref_action_delete_on_response_gitg_ext_user_query_response (GitgExtUserQuery* _sender,
                                                                           GtkResponseType response_type,
                                                                           gpointer self);
VALA_EXTERN void gitg_ref_action_delete_delete_remote_branch (GitgRefActionDelete* self,
                                                  GitgRemote* remote,
                                                  const gchar* remote_branch,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
VALA_EXTERN gboolean gitg_ref_action_delete_delete_remote_branch_finish (GitgRefActionDelete* self,
                                                             GAsyncResult* _res_);
static void ____lambda219_ (GitgRefActionDelete* self,
                     GObject* obj,
                     GAsyncResult* res);
static void _____lambda219__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
static void gitg_ref_action_delete_delete_remote_branch_data_free (gpointer _data);
static gboolean gitg_ref_action_delete_delete_remote_branch_co (GitgRefActionDeleteDeleteRemoteBranchData* _data_);
VALA_EXTERN GType gitg_remote_notification_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GitgRemoteNotification, g_object_unref)
VALA_EXTERN GitgRemoteNotification* gitg_remote_notification_new (GitgRemote* remote);
VALA_EXTERN GitgRemoteNotification* gitg_remote_notification_construct (GType object_type,
                                                            GitgRemote* remote);
VALA_EXTERN void gitg_remote_notification_set_text (GitgRemoteNotification* self,
                                        const gchar* value);
static void gitg_ref_action_delete_delete_remote_branch_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
VALA_EXTERN void gitg_remote_notification_error (GitgRemoteNotification* self,
                                     const gchar* text);
VALA_EXTERN void gitg_remote_notification_success (GitgRemoteNotification* self,
                                       const gchar* text);
static void gitg_ref_action_delete_finalize (GObject * obj);
static GType gitg_ref_action_delete_get_type_once (void);
static void _vala_gitg_ref_action_delete_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec);
static void _vala_gitg_ref_action_delete_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
gitg_ref_action_delete_get_instance_private (GitgRefActionDelete* self)
{
	return G_STRUCT_MEMBER_P (self, GitgRefActionDelete_private_offset);
}

GitgRefActionDelete*
gitg_ref_action_delete_construct (GType object_type,
                                  GitgExtApplication* application,
                                  GitgExtRefActionInterface* action_interface,
                                  GitgRef* reference)
{
	GitgRefActionDelete * self = NULL;
	g_return_val_if_fail (application != NULL, NULL);
	g_return_val_if_fail (action_interface != NULL, NULL);
	g_return_val_if_fail (reference != NULL, NULL);
	self = (GitgRefActionDelete*) g_object_new (object_type, "application", application, "action-interface", action_interface, "reference", reference, NULL);
	return self;
}

GitgRefActionDelete*
gitg_ref_action_delete_new (GitgExtApplication* application,
                            GitgExtRefActionInterface* action_interface,
                            GitgRef* reference)
{
	return gitg_ref_action_delete_construct (GITG_TYPE_REF_ACTION_DELETE, application, action_interface, reference);
}

static gboolean
_gitg_ref_action_delete_on_response_gitg_ext_user_query_response (GitgExtUserQuery* _sender,
                                                                  GtkResponseType response_type,
                                                                  gpointer self)
{
	gboolean result;
	result = gitg_ref_action_delete_on_response ((GitgRefActionDelete*) self, response_type);
	return result;
}

static void
gitg_ref_action_delete_real_activate (GitgExtUIElement* base)
{
	GitgRefActionDelete * self;
	GitgExtUserQuery* query = NULL;
	GitgExtUserQuery* _tmp0_;
	gchar* name = NULL;
	GitgRef* _tmp1_;
	GitgRef* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	GitgRef* _tmp5_;
	GitgRef* _tmp6_;
	GitgExtUserQuery* _tmp30_;
	GitgExtUserQueryResponse* _tmp31_;
	GitgExtUserQueryResponse* _tmp32_;
	GitgExtUserQueryResponse** _tmp33_;
	GitgExtUserQueryResponse** _tmp34_;
	gint _tmp34__length1;
	GitgExtUserQuery* _tmp35_;
	GitgExtUserQuery* _tmp36_;
	GitgExtRefActionInterface* _tmp37_;
	GitgExtRefActionInterface* _tmp38_;
	GitgExtApplication* _tmp39_;
	GitgExtApplication* _tmp40_;
	GitgExtApplication* _tmp41_;
	GitgExtUserQuery* _tmp42_;
	self = (GitgRefActionDelete*) base;
	_tmp0_ = gitg_ext_user_query_new ();
	query = _tmp0_;
	_tmp1_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = ggit_ref_get_shorthand ((GgitRef*) _tmp2_);
	_tmp4_ = g_strdup (_tmp3_);
	name = _tmp4_;
	_tmp5_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
	_tmp6_ = _tmp5_;
	if (ggit_ref_is_branch ((GgitRef*) _tmp6_)) {
		GitgExtUserQuery* _tmp7_;
		GitgExtUserQuery* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		GitgExtUserQuery* _tmp12_;
		GitgExtUserQuery* _tmp13_;
		_tmp7_ = query;
		gitg_ext_user_query_set_title (_tmp7_, _ ("Confirm branch deletion"));
		_tmp8_ = query;
		_tmp9_ = name;
		_tmp10_ = g_strdup_printf (_ ("Are you sure that you want to permanently delete the branch <b><i>“%s”" \
"</i></b>?"), _tmp9_);
		_tmp11_ = _tmp10_;
		gitg_ext_user_query_set_message (_tmp8_, _tmp11_);
		_g_free0 (_tmp11_);
		_tmp12_ = query;
		gitg_ext_user_query_set_default_is_destructive (_tmp12_, TRUE);
		_tmp13_ = query;
		gitg_ext_user_query_set_message_use_markup (_tmp13_, TRUE);
	} else {
		GitgRef* _tmp14_;
		GitgRef* _tmp15_;
		_tmp14_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
		_tmp15_ = _tmp14_;
		if (ggit_ref_is_tag ((GgitRef*) _tmp15_)) {
			GitgExtUserQuery* _tmp16_;
			GitgExtUserQuery* _tmp17_;
			const gchar* _tmp18_;
			gchar* _tmp19_;
			gchar* _tmp20_;
			GitgExtUserQuery* _tmp21_;
			GitgExtUserQuery* _tmp22_;
			_tmp16_ = query;
			gitg_ext_user_query_set_title (_tmp16_, _ ("Confirm tag deletion"));
			_tmp17_ = query;
			_tmp18_ = name;
			_tmp19_ = g_strdup_printf (_ ("Are you sure that you want to permanently delete the tag <b><i>“%s”</i" \
"></b>?"), _tmp18_);
			_tmp20_ = _tmp19_;
			gitg_ext_user_query_set_message (_tmp17_, _tmp20_);
			_g_free0 (_tmp20_);
			_tmp21_ = query;
			gitg_ext_user_query_set_default_is_destructive (_tmp21_, TRUE);
			_tmp22_ = query;
			gitg_ext_user_query_set_message_use_markup (_tmp22_, TRUE);
		} else {
			GitgExtUserQuery* _tmp23_;
			GitgExtUserQuery* _tmp24_;
			const gchar* _tmp25_;
			gchar* _tmp26_;
			gchar* _tmp27_;
			GitgExtUserQuery* _tmp28_;
			GitgExtUserQuery* _tmp29_;
			_tmp23_ = query;
			gitg_ext_user_query_set_title (_tmp23_, _ ("Confirm remote branch deletion"));
			_tmp24_ = query;
			_tmp25_ = name;
			_tmp26_ = g_strdup_printf (_ ("Are you sure that you want to permanently delete the remote branch <b>" \
"<i>“%s”</i></b>?"), _tmp25_);
			_tmp27_ = _tmp26_;
			gitg_ext_user_query_set_message (_tmp24_, _tmp27_);
			_g_free0 (_tmp27_);
			_tmp28_ = query;
			gitg_ext_user_query_set_default_is_destructive (_tmp28_, TRUE);
			_tmp29_ = query;
			gitg_ext_user_query_set_message_use_markup (_tmp29_, TRUE);
		}
	}
	_tmp30_ = query;
	_tmp31_ = gitg_ext_user_query_response_new (_ ("Cancel"), GTK_RESPONSE_CANCEL);
	_tmp32_ = gitg_ext_user_query_response_new (_ ("Delete"), GTK_RESPONSE_OK);
	_tmp33_ = g_new0 (GitgExtUserQueryResponse*, 2 + 1);
	_tmp33_[0] = _tmp31_;
	_tmp33_[1] = _tmp32_;
	_tmp34_ = _tmp33_;
	_tmp34__length1 = 2;
	gitg_ext_user_query_set_responses (_tmp30_, _tmp34_, (gint) 2);
	_tmp34_ = (_vala_array_free (_tmp34_, _tmp34__length1, (GDestroyNotify) g_object_unref), NULL);
	_tmp35_ = query;
	gitg_ext_user_query_set_default_response (_tmp35_, GTK_RESPONSE_OK);
	_tmp36_ = query;
	g_signal_connect_object (_tmp36_, "response", (GCallback) _gitg_ref_action_delete_on_response_gitg_ext_user_query_response, self, 0);
	_tmp37_ = gitg_ext_ref_action_get_action_interface ((GitgExtRefAction*) self);
	_tmp38_ = _tmp37_;
	_tmp39_ = gitg_ext_ref_action_interface_get_application (_tmp38_);
	_tmp40_ = _tmp39_;
	_tmp41_ = _tmp40_;
	_tmp42_ = query;
	gitg_ext_application_user_query (_tmp41_, _tmp42_);
	_g_object_unref0 (_tmp41_);
	_g_free0 (name);
	_g_object_unref0 (query);
}

static void
____lambda219_ (GitgRefActionDelete* self,
                GObject* obj,
                GAsyncResult* res)
{
	g_return_if_fail (res != NULL);
	gitg_ref_action_delete_delete_remote_branch_finish (self, res);
}

static void
_____lambda219__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	____lambda219_ ((GitgRefActionDelete*) self, source_object, res);
	g_object_unref (self);
}

static gboolean
gitg_ref_action_delete_on_response (GitgRefActionDelete* self,
                                    GtkResponseType response)
{
	GitgExtRefActionInterface* _tmp67_;
	GitgExtRefActionInterface* _tmp68_;
	GitgRef* _tmp69_;
	GitgRef* _tmp70_;
	GitgExtRefActionInterface* _tmp71_;
	GitgExtRefActionInterface* _tmp72_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (response != GTK_RESPONSE_OK) {
		result = TRUE;
		return result;
	}
	{
		GitgRef* _tmp0_;
		GitgRef* _tmp1_;
		_tmp0_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
		_tmp1_ = _tmp0_;
		if (ggit_ref_is_remote ((GgitRef*) _tmp1_)) {
			gchar* remote_name = NULL;
			GitgRef* _tmp2_;
			GitgRef* _tmp3_;
			GitgParsedRefName* _tmp4_;
			GitgParsedRefName* _tmp5_;
			GitgParsedRefName* _tmp6_;
			gchar* _tmp7_;
			gchar* _tmp8_;
			gchar* _tmp9_;
			GitgRemote* remote = NULL;
			GitgExtApplication* _tmp10_;
			GitgExtApplication* _tmp11_;
			GitgExtApplication* _tmp12_;
			GitgExtRemoteLookup* _tmp13_;
			GitgExtRemoteLookup* _tmp14_;
			GitgExtRemoteLookup* _tmp15_;
			const gchar* _tmp16_;
			GitgRemote* _tmp17_;
			GitgRemote* _tmp18_;
			gchar* remote_branch = NULL;
			GitgRef* _tmp19_;
			GitgRef* _tmp20_;
			GitgParsedRefName* _tmp21_;
			GitgParsedRefName* _tmp22_;
			GitgParsedRefName* _tmp23_;
			gchar* _tmp24_;
			gchar* _tmp25_;
			gchar* _tmp26_;
			gchar* _tmp27_;
			gchar* _tmp28_;
			GitgRemote* _tmp29_;
			const gchar* _tmp30_;
			_tmp2_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
			_tmp3_ = _tmp2_;
			_tmp4_ = gitg_ref_get_parsed_name (_tmp3_);
			_tmp5_ = _tmp4_;
			_tmp6_ = _tmp5_;
			_tmp7_ = gitg_parsed_ref_name_get_remote_name (_tmp6_);
			_tmp8_ = _tmp7_;
			_tmp9_ = _tmp8_;
			_g_object_unref0 (_tmp6_);
			remote_name = _tmp9_;
			_tmp10_ = gitg_ext_ui_element_get_application ((GitgExtUIElement*) self);
			_tmp11_ = _tmp10_;
			_tmp12_ = _tmp11_;
			_tmp13_ = gitg_ext_application_get_remote_lookup (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = _tmp14_;
			_tmp16_ = remote_name;
			_tmp17_ = gitg_ext_remote_lookup_lookup (_tmp15_, _tmp16_);
			_tmp18_ = _tmp17_;
			_g_object_unref0 (_tmp15_);
			_g_object_unref0 (_tmp12_);
			remote = _tmp18_;
			_tmp19_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
			_tmp20_ = _tmp19_;
			_tmp21_ = gitg_ref_get_parsed_name (_tmp20_);
			_tmp22_ = _tmp21_;
			_tmp23_ = _tmp22_;
			_tmp24_ = gitg_parsed_ref_name_get_remote_branch (_tmp23_);
			_tmp25_ = _tmp24_;
			_tmp26_ = _tmp25_;
			_tmp27_ = g_strdup_printf ("refs/heads/%s", _tmp26_);
			_tmp28_ = _tmp27_;
			_g_free0 (_tmp26_);
			_g_object_unref0 (_tmp23_);
			remote_branch = _tmp28_;
			_tmp29_ = remote;
			_tmp30_ = remote_branch;
			gitg_ref_action_delete_delete_remote_branch (self, _tmp29_, _tmp30_, _____lambda219__gasync_ready_callback, g_object_ref (self));
			_g_free0 (remote_branch);
			_g_object_unref0 (remote);
			_g_free0 (remote_name);
		} else {
			GitgRef* _tmp31_;
			GitgRef* _tmp32_;
			_tmp31_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
			_tmp32_ = _tmp31_;
			ggit_ref_delete ((GgitRef*) _tmp32_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		gchar* title = NULL;
		gchar* message = NULL;
		gchar* name = NULL;
		GitgRef* _tmp33_;
		GitgRef* _tmp34_;
		const gchar* _tmp35_;
		gchar* _tmp36_;
		GitgRef* _tmp37_;
		GitgRef* _tmp38_;
		GitgExtRefActionInterface* _tmp59_;
		GitgExtRefActionInterface* _tmp60_;
		GitgExtApplication* _tmp61_;
		GitgExtApplication* _tmp62_;
		GitgExtApplication* _tmp63_;
		const gchar* _tmp64_;
		const gchar* _tmp65_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp33_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
		_tmp34_ = _tmp33_;
		_tmp35_ = ggit_ref_get_shorthand ((GgitRef*) _tmp34_);
		_tmp36_ = g_strdup (_tmp35_);
		name = _tmp36_;
		_tmp37_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
		_tmp38_ = _tmp37_;
		if (ggit_ref_is_tag ((GgitRef*) _tmp38_)) {
			const gchar* _tmp39_;
			gchar* _tmp40_;
			const gchar* _tmp41_;
			GError* _tmp42_;
			const gchar* _tmp43_;
			gchar* _tmp44_;
			_tmp39_ = name;
			_tmp40_ = g_strdup_printf (_ ("Failed to delete tag %s"), _tmp39_);
			_g_free0 (title);
			title = _tmp40_;
			_tmp41_ = name;
			_tmp42_ = e;
			_tmp43_ = _tmp42_->message;
			_tmp44_ = g_strdup_printf (_ ("The tag %s could not be deleted: %s"), _tmp41_, _tmp43_);
			_g_free0 (message);
			message = _tmp44_;
		} else {
			GitgRef* _tmp45_;
			GitgRef* _tmp46_;
			_tmp45_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
			_tmp46_ = _tmp45_;
			if (ggit_ref_is_branch ((GgitRef*) _tmp46_)) {
				const gchar* _tmp47_;
				gchar* _tmp48_;
				const gchar* _tmp49_;
				GError* _tmp50_;
				const gchar* _tmp51_;
				gchar* _tmp52_;
				_tmp47_ = name;
				_tmp48_ = g_strdup_printf (_ ("Failed to delete branch %s"), _tmp47_);
				_g_free0 (title);
				title = _tmp48_;
				_tmp49_ = name;
				_tmp50_ = e;
				_tmp51_ = _tmp50_->message;
				_tmp52_ = g_strdup_printf (_ ("The branch %s could not be deleted: %s"), _tmp49_, _tmp51_);
				_g_free0 (message);
				message = _tmp52_;
			} else {
				const gchar* _tmp53_;
				gchar* _tmp54_;
				const gchar* _tmp55_;
				GError* _tmp56_;
				const gchar* _tmp57_;
				gchar* _tmp58_;
				_tmp53_ = name;
				_tmp54_ = g_strdup_printf (_ ("Failed to delete remote branch %s"), _tmp53_);
				_g_free0 (title);
				title = _tmp54_;
				_tmp55_ = name;
				_tmp56_ = e;
				_tmp57_ = _tmp56_->message;
				_tmp58_ = g_strdup_printf (_ ("The remote branch %s could not be deleted: %s"), _tmp55_, _tmp57_);
				_g_free0 (message);
				message = _tmp58_;
			}
		}
		_tmp59_ = gitg_ext_ref_action_get_action_interface ((GitgExtRefAction*) self);
		_tmp60_ = _tmp59_;
		_tmp61_ = gitg_ext_ref_action_interface_get_application (_tmp60_);
		_tmp62_ = _tmp61_;
		_tmp63_ = _tmp62_;
		_tmp64_ = title;
		_tmp65_ = message;
		gitg_ext_application_show_infobar (_tmp63_, _tmp64_, _tmp65_, GTK_MESSAGE_ERROR);
		_g_object_unref0 (_tmp63_);
		result = TRUE;
		_g_free0 (name);
		_g_free0 (message);
		_g_free0 (title);
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp66_ = FALSE;
		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 _tmp66_;
	}
	_tmp67_ = gitg_ext_ref_action_get_action_interface ((GitgExtRefAction*) self);
	_tmp68_ = _tmp67_;
	_tmp69_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
	_tmp70_ = _tmp69_;
	gitg_ext_ref_action_interface_remove_ref (_tmp68_, _tmp70_);
	_tmp71_ = gitg_ext_ref_action_get_action_interface ((GitgExtRefAction*) self);
	_tmp72_ = _tmp71_;
	gitg_ext_ref_action_interface_refresh (_tmp72_);
	result = TRUE;
	return result;
}

static void
gitg_ref_action_delete_delete_remote_branch_data_free (gpointer _data)
{
	GitgRefActionDeleteDeleteRemoteBranchData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->remote);
	_g_free0 (_data_->remote_branch);
	_g_object_unref0 (_data_->self);
	g_slice_free (GitgRefActionDeleteDeleteRemoteBranchData, _data_);
}

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

void
gitg_ref_action_delete_delete_remote_branch (GitgRefActionDelete* self,
                                             GitgRemote* remote,
                                             const gchar* remote_branch,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	GitgRefActionDeleteDeleteRemoteBranchData* _data_;
	GitgRefActionDelete* _tmp0_;
	GitgRemote* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (remote != NULL);
	g_return_if_fail (remote_branch != NULL);
	_data_ = g_slice_new0 (GitgRefActionDeleteDeleteRemoteBranchData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gitg_ref_action_delete_delete_remote_branch_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (remote);
	_g_object_unref0 (_data_->remote);
	_data_->remote = _tmp1_;
	_tmp2_ = g_strdup (remote_branch);
	_g_free0 (_data_->remote_branch);
	_data_->remote_branch = _tmp2_;
	gitg_ref_action_delete_delete_remote_branch_co (_data_);
}

gboolean
gitg_ref_action_delete_delete_remote_branch_finish (GitgRefActionDelete* self,
                                                    GAsyncResult* _res_)
{
	gboolean result;
	GitgRefActionDeleteDeleteRemoteBranchData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
gitg_ref_action_delete_delete_remote_branch_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	GitgRefActionDeleteDeleteRemoteBranchData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gitg_ref_action_delete_delete_remote_branch_co (_data_);
}

static gboolean
gitg_ref_action_delete_delete_remote_branch_co (GitgRefActionDeleteDeleteRemoteBranchData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gitg_remote_notification_new (_data_->remote);
	g_object_ref_sink (_data_->_tmp0_);
	_data_->notification = _data_->_tmp0_;
	_data_->_tmp1_ = gitg_ext_ui_element_get_application ((GitgExtUIElement*) _data_->self);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = gitg_ext_application_get_notifications (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = _data_->notification;
	gitg_ext_notifications_add (_data_->_tmp6_, (GitgExtNotification*) _data_->_tmp7_);
	_g_object_unref0 (_data_->_tmp6_);
	_g_object_unref0 (_data_->_tmp3_);
	_data_->_tmp8_ = _data_->notification;
	_data_->_tmp9_ = ggit_remote_get_url ((GgitRemote*) _data_->remote);
	_data_->_tmp10_ = g_strdup_printf (_ ("Deleting branch %s from %s"), _data_->remote_branch, _data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	gitg_remote_notification_set_text (_data_->_tmp8_, _data_->_tmp11_);
	_g_free0 (_data_->_tmp11_);
	{
		_data_->_state_ = 1;
		gitg_remote_push (_data_->remote, FALSE, "", _data_->remote_branch, NULL, gitg_ref_action_delete_delete_remote_branch_ready, _data_);
		return FALSE;
		_state_1:
		gitg_remote_push_finish (_data_->remote, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp12_ = gitg_ext_ui_element_get_application ((GitgExtUIElement*) _data_->self);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp13_, gtk_application_window_get_type (), GtkApplicationWindow);
		g_action_group_activate_action ((GActionGroup*) _data_->_tmp14_, "reload", NULL);
		_g_object_unref0 (_data_->_tmp14_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp15_ = _data_->notification;
		_data_->_tmp16_ = ggit_remote_get_url ((GgitRemote*) _data_->remote);
		_data_->_tmp17_ = _data_->e;
		_data_->_tmp18_ = _data_->_tmp17_->message;
		_data_->_tmp19_ = g_strdup_printf (_ ("Failed to delete branch %s from %s: %s"), _data_->remote_branch, _data_->_tmp16_, _data_->_tmp18_);
		_data_->_tmp20_ = _data_->_tmp19_;
		gitg_remote_notification_error (_data_->_tmp15_, _data_->_tmp20_);
		_g_free0 (_data_->_tmp20_);
		_data_->_tmp21_ = stderr;
		_data_->_tmp22_ = _data_->e;
		_data_->_tmp23_ = _data_->_tmp22_->message;
		fprintf (_data_->_tmp21_, "Failed to delete: %s\n", _data_->_tmp23_);
		_data_->result = FALSE;
		_g_error_free0 (_data_->e);
		_g_object_unref0 (_data_->notification);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->notification);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp24_ = _data_->notification;
	_data_->_tmp25_ = ggit_remote_get_url ((GgitRemote*) _data_->remote);
	_data_->_tmp26_ = g_strdup_printf (_ ("Deleted from %s"), _data_->_tmp25_);
	_data_->_tmp27_ = _data_->_tmp26_;
	gitg_remote_notification_success (_data_->_tmp24_, _data_->_tmp27_);
	_g_free0 (_data_->_tmp27_);
	_data_->result = TRUE;
	_g_object_unref0 (_data_->notification);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static GitgExtApplication*
gitg_ref_action_delete_real_get_application (GitgExtUIElement* base)
{
	GitgExtApplication* result;
	GitgRefActionDelete* self;
	GitgExtApplication* _tmp0_;
	GitgExtApplication* _tmp1_;
	self = (GitgRefActionDelete*) base;
	_tmp0_ = self->priv->_application;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
gitg_ref_action_delete_real_set_application (GitgExtUIElement* base,
                                             GitgExtApplication* value)
{
	GitgRefActionDelete* self;
	GitgExtApplication* old_value;
	self = (GitgRefActionDelete*) base;
	old_value = gitg_ref_action_delete_real_get_application (base);
	if (old_value != value) {
		GitgExtApplication* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_application);
		self->priv->_application = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_APPLICATION_PROPERTY]);
	}
	_g_object_unref0 (old_value);
}

static GitgExtRefActionInterface*
gitg_ref_action_delete_real_get_action_interface (GitgExtRefAction* base)
{
	GitgExtRefActionInterface* result;
	GitgRefActionDelete* self;
	GitgExtRefActionInterface* _tmp0_;
	self = (GitgRefActionDelete*) base;
	_tmp0_ = self->priv->_action_interface;
	result = _tmp0_;
	return result;
}

static void
gitg_ref_action_delete_real_set_action_interface (GitgExtRefAction* base,
                                                  GitgExtRefActionInterface* value)
{
	GitgRefActionDelete* self;
	GitgExtRefActionInterface* old_value;
	self = (GitgRefActionDelete*) base;
	old_value = gitg_ref_action_delete_real_get_action_interface (base);
	if (old_value != value) {
		GitgExtRefActionInterface* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_action_interface);
		self->priv->_action_interface = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_ACTION_INTERFACE_PROPERTY]);
	}
}

static GitgRef*
gitg_ref_action_delete_real_get_reference (GitgExtRefAction* base)
{
	GitgRef* result;
	GitgRefActionDelete* self;
	GitgRef* _tmp0_;
	self = (GitgRefActionDelete*) base;
	_tmp0_ = self->priv->_reference;
	result = _tmp0_;
	return result;
}

static void
gitg_ref_action_delete_real_set_reference (GitgExtRefAction* base,
                                           GitgRef* value)
{
	GitgRefActionDelete* self;
	GitgRef* old_value;
	self = (GitgRefActionDelete*) base;
	old_value = gitg_ref_action_delete_real_get_reference (base);
	if (old_value != value) {
		GitgRef* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_reference);
		self->priv->_reference = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_REFERENCE_PROPERTY]);
	}
}

static gchar*
gitg_ref_action_delete_real_get_id (GitgExtUIElement* base)
{
	gchar* result;
	GitgRefActionDelete* self;
	gchar* _tmp0_;
	self = (GitgRefActionDelete*) base;
	_tmp0_ = g_strdup ("/org/gnome/gitg/ref-actions/delete");
	result = _tmp0_;
	return result;
}

static gchar*
gitg_ref_action_delete_real_get_display_name (GitgExtUIElement* base)
{
	gchar* result;
	GitgRefActionDelete* self;
	gchar* _tmp0_;
	self = (GitgRefActionDelete*) base;
	_tmp0_ = g_strdup (_ ("Delete…"));
	result = _tmp0_;
	return result;
}

static gchar*
gitg_ref_action_delete_real_get_description (GitgExtUIElement* base)
{
	gchar* result;
	GitgRefActionDelete* self;
	gchar* _tmp0_;
	self = (GitgRefActionDelete*) base;
	_tmp0_ = g_strdup (_ ("Delete the selected reference"));
	result = _tmp0_;
	return result;
}

static gboolean
gitg_ref_action_delete_real_get_enabled (GitgExtUIElement* base)
{
	gboolean result;
	GitgRefActionDelete* self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GitgRef* _tmp3_;
	GitgRef* _tmp4_;
	GError* _inner_error0_ = NULL;
	self = (GitgRefActionDelete*) base;
	_tmp3_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
	_tmp4_ = _tmp3_;
	if (ggit_ref_is_branch ((GgitRef*) _tmp4_)) {
		gboolean _tmp5_ = FALSE;
		GitgRef* _tmp6_;
		GitgRef* _tmp7_;
		_tmp6_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
		_tmp7_ = _tmp6_;
		_tmp5_ = ggit_branch_is_head (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, ggit_branch_get_type (), GgitBranch), &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp8_ = FALSE;
			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 _tmp8_;
		}
		_tmp2_ = !_tmp5_;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		GitgRef* _tmp9_;
		GitgRef* _tmp10_;
		_tmp9_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
		_tmp10_ = _tmp9_;
		_tmp1_ = ggit_ref_is_tag ((GgitRef*) _tmp10_);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		GitgRef* _tmp11_;
		GitgRef* _tmp12_;
		_tmp11_ = gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self);
		_tmp12_ = _tmp11_;
		_tmp0_ = ggit_ref_is_remote ((GgitRef*) _tmp12_);
	}
	result = _tmp0_;
	return result;
}

static void
gitg_ref_action_delete_class_init (GitgRefActionDeleteClass * klass,
                                   gpointer klass_data)
{
	gitg_ref_action_delete_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgRefActionDelete_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_ref_action_delete_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gitg_ref_action_delete_set_property;
	G_OBJECT_CLASS (klass)->finalize = gitg_ref_action_delete_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_ACTION_DELETE_APPLICATION_PROPERTY, gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_APPLICATION_PROPERTY] = g_param_spec_object ("application", "application", "application", GITG_EXT_TYPE_APPLICATION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_ACTION_DELETE_ACTION_INTERFACE_PROPERTY, gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_ACTION_INTERFACE_PROPERTY] = g_param_spec_object ("action-interface", "action-interface", "action-interface", GITG_EXT_TYPE_REF_ACTION_INTERFACE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_ACTION_DELETE_REFERENCE_PROPERTY, gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_REFERENCE_PROPERTY] = g_param_spec_object ("reference", "reference", "reference", GITG_TYPE_REF, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_ACTION_DELETE_ID_PROPERTY, gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_ACTION_DELETE_DISPLAY_NAME_PROPERTY, gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_DISPLAY_NAME_PROPERTY] = g_param_spec_string ("display-name", "display-name", "display-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_ACTION_DELETE_DESCRIPTION_PROPERTY, gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_DESCRIPTION_PROPERTY] = g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_ACTION_DELETE_ENABLED_PROPERTY, gitg_ref_action_delete_properties[GITG_REF_ACTION_DELETE_ENABLED_PROPERTY] = g_param_spec_boolean ("enabled", "enabled", "enabled", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gitg_ref_action_delete_gitg_ext_ui_element_interface_init (GitgExtUIElementIface * iface,
                                                           gpointer iface_data)
{
	gitg_ref_action_delete_gitg_ext_ui_element_parent_iface = g_type_interface_peek_parent (iface);
	iface->activate = (void (*) (GitgExtUIElement*)) gitg_ref_action_delete_real_activate;
	iface->get_application = gitg_ref_action_delete_real_get_application;
	iface->set_application = gitg_ref_action_delete_real_set_application;
	iface->get_id = gitg_ref_action_delete_real_get_id;
	iface->get_display_name = gitg_ref_action_delete_real_get_display_name;
	iface->get_description = gitg_ref_action_delete_real_get_description;
	iface->get_enabled = gitg_ref_action_delete_real_get_enabled;
}

static void
gitg_ref_action_delete_gitg_ext_action_interface_init (GitgExtActionIface * iface,
                                                       gpointer iface_data)
{
	gitg_ref_action_delete_gitg_ext_action_parent_iface = g_type_interface_peek_parent (iface);
}

static void
gitg_ref_action_delete_gitg_ext_ref_action_interface_init (GitgExtRefActionIface * iface,
                                                           gpointer iface_data)
{
	gitg_ref_action_delete_gitg_ext_ref_action_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_action_interface = gitg_ref_action_delete_real_get_action_interface;
	iface->set_action_interface = gitg_ref_action_delete_real_set_action_interface;
	iface->get_reference = gitg_ref_action_delete_real_get_reference;
	iface->set_reference = gitg_ref_action_delete_real_set_reference;
}

static void
gitg_ref_action_delete_instance_init (GitgRefActionDelete * self,
                                      gpointer klass)
{
	self->priv = gitg_ref_action_delete_get_instance_private (self);
}

static void
gitg_ref_action_delete_finalize (GObject * obj)
{
	GitgRefActionDelete * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_REF_ACTION_DELETE, GitgRefActionDelete);
	_g_object_unref0 (self->priv->_application);
	_g_object_unref0 (self->priv->_action_interface);
	_g_object_unref0 (self->priv->_reference);
	G_OBJECT_CLASS (gitg_ref_action_delete_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_ref_action_delete_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgRefActionDeleteClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_ref_action_delete_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgRefActionDelete), 0, (GInstanceInitFunc) gitg_ref_action_delete_instance_init, NULL };
	static const GInterfaceInfo gitg_ext_ui_element_info = { (GInterfaceInitFunc) gitg_ref_action_delete_gitg_ext_ui_element_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gitg_ext_action_info = { (GInterfaceInitFunc) gitg_ref_action_delete_gitg_ext_action_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gitg_ext_ref_action_info = { (GInterfaceInitFunc) gitg_ref_action_delete_gitg_ext_ref_action_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gitg_ref_action_delete_type_id;
	gitg_ref_action_delete_type_id = g_type_register_static (G_TYPE_OBJECT, "GitgRefActionDelete", &g_define_type_info, 0);
	g_type_add_interface_static (gitg_ref_action_delete_type_id, GITG_EXT_TYPE_UI_ELEMENT, &gitg_ext_ui_element_info);
	g_type_add_interface_static (gitg_ref_action_delete_type_id, GITG_EXT_TYPE_ACTION, &gitg_ext_action_info);
	g_type_add_interface_static (gitg_ref_action_delete_type_id, GITG_EXT_TYPE_REF_ACTION, &gitg_ext_ref_action_info);
	GitgRefActionDelete_private_offset = g_type_add_instance_private (gitg_ref_action_delete_type_id, sizeof (GitgRefActionDeletePrivate));
	return gitg_ref_action_delete_type_id;
}

GType
gitg_ref_action_delete_get_type (void)
{
	static gsize gitg_ref_action_delete_type_id__once = 0;
	if (g_once_init_enter (&gitg_ref_action_delete_type_id__once)) {
		GType gitg_ref_action_delete_type_id;
		gitg_ref_action_delete_type_id = gitg_ref_action_delete_get_type_once ();
		g_once_init_leave (&gitg_ref_action_delete_type_id__once, gitg_ref_action_delete_type_id);
	}
	return gitg_ref_action_delete_type_id__once;
}

static void
_vala_gitg_ref_action_delete_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	GitgRefActionDelete * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_REF_ACTION_DELETE, GitgRefActionDelete);
	switch (property_id) {
		case GITG_REF_ACTION_DELETE_APPLICATION_PROPERTY:
		g_value_take_object (value, gitg_ext_ui_element_get_application ((GitgExtUIElement*) self));
		break;
		case GITG_REF_ACTION_DELETE_ACTION_INTERFACE_PROPERTY:
		g_value_set_object (value, gitg_ext_ref_action_get_action_interface ((GitgExtRefAction*) self));
		break;
		case GITG_REF_ACTION_DELETE_REFERENCE_PROPERTY:
		g_value_set_object (value, gitg_ext_ref_action_get_reference ((GitgExtRefAction*) self));
		break;
		case GITG_REF_ACTION_DELETE_ID_PROPERTY:
		g_value_take_string (value, gitg_ext_ui_element_get_id ((GitgExtUIElement*) self));
		break;
		case GITG_REF_ACTION_DELETE_DISPLAY_NAME_PROPERTY:
		g_value_take_string (value, gitg_ext_ui_element_get_display_name ((GitgExtUIElement*) self));
		break;
		case GITG_REF_ACTION_DELETE_DESCRIPTION_PROPERTY:
		g_value_take_string (value, gitg_ext_ui_element_get_description ((GitgExtUIElement*) self));
		break;
		case GITG_REF_ACTION_DELETE_ENABLED_PROPERTY:
		g_value_set_boolean (value, gitg_ext_ui_element_get_enabled ((GitgExtUIElement*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gitg_ref_action_delete_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	GitgRefActionDelete * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_REF_ACTION_DELETE, GitgRefActionDelete);
	switch (property_id) {
		case GITG_REF_ACTION_DELETE_APPLICATION_PROPERTY:
		gitg_ext_ui_element_set_application ((GitgExtUIElement*) self, g_value_get_object (value));
		break;
		case GITG_REF_ACTION_DELETE_ACTION_INTERFACE_PROPERTY:
		gitg_ext_ref_action_set_action_interface ((GitgExtRefAction*) self, g_value_get_object (value));
		break;
		case GITG_REF_ACTION_DELETE_REFERENCE_PROPERTY:
		gitg_ext_ref_action_set_reference ((GitgExtRefAction*) self, g_value_get_object (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);
}

