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

/*
 * This file is part of gitg
 *
 * Copyright (C) 2022 - Adwait Rawat
 *
 * 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 <stdlib.h>
#include <string.h>
#include <glib.h>
#include "libgitg.h"
#include "config.h"
#include <gtk/gtk.h>
#include <libgit2-glib/ggit.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>

#define GITG_EDIT_REMOTE_ACTION_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_EDIT_REMOTE_ACTION (gitg_edit_remote_action_get_type ())
#define GITG_EDIT_REMOTE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_EDIT_REMOTE_ACTION, GitgEditRemoteAction))
#define GITG_EDIT_REMOTE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_EDIT_REMOTE_ACTION, GitgEditRemoteActionClass))
#define GITG_IS_EDIT_REMOTE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_EDIT_REMOTE_ACTION))
#define GITG_IS_EDIT_REMOTE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_EDIT_REMOTE_ACTION))
#define GITG_EDIT_REMOTE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_EDIT_REMOTE_ACTION, GitgEditRemoteActionClass))

typedef struct _GitgEditRemoteAction GitgEditRemoteAction;
typedef struct _GitgEditRemoteActionClass GitgEditRemoteActionClass;
typedef struct _GitgEditRemoteActionPrivate GitgEditRemoteActionPrivate;
enum  {
	GITG_EDIT_REMOTE_ACTION_0_PROPERTY,
	GITG_EDIT_REMOTE_ACTION_APPLICATION_PROPERTY,
	GITG_EDIT_REMOTE_ACTION_ACTION_INTERFACE_PROPERTY,
	GITG_EDIT_REMOTE_ACTION_ID_PROPERTY,
	GITG_EDIT_REMOTE_ACTION_DISPLAY_NAME_PROPERTY,
	GITG_EDIT_REMOTE_ACTION_DESCRIPTION_PROPERTY,
	GITG_EDIT_REMOTE_ACTION_NUM_PROPERTIES
};
static GParamSpec* gitg_edit_remote_action_properties[GITG_EDIT_REMOTE_ACTION_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 GITG_TYPE_EDIT_REMOTE_DIALOG (gitg_edit_remote_dialog_get_type ())
#define GITG_EDIT_REMOTE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_EDIT_REMOTE_DIALOG, GitgEditRemoteDialog))
#define GITG_EDIT_REMOTE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_EDIT_REMOTE_DIALOG, GitgEditRemoteDialogClass))
#define GITG_IS_EDIT_REMOTE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_EDIT_REMOTE_DIALOG))
#define GITG_IS_EDIT_REMOTE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_EDIT_REMOTE_DIALOG))
#define GITG_EDIT_REMOTE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_EDIT_REMOTE_DIALOG, GitgEditRemoteDialogClass))

typedef struct _GitgEditRemoteDialog GitgEditRemoteDialog;
typedef struct _GitgEditRemoteDialogClass GitgEditRemoteDialogClass;
typedef struct _Block66Data Block66Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _GitgEditRemoteAction {
	GObject parent_instance;
	GitgEditRemoteActionPrivate * priv;
};

struct _GitgEditRemoteActionClass {
	GObjectClass parent_class;
};

struct _GitgEditRemoteActionPrivate {
	GitgExtApplication* _application;
	GitgExtRefActionInterface* _action_interface;
	gchar* remote_name;
	GitgRemote* d_remote;
};

struct _Block66Data {
	int _ref_count_;
	GitgEditRemoteAction* self;
	GitgEditRemoteDialog* dlg;
	gchar* old_name;
};

static gint GitgEditRemoteAction_private_offset;
static gpointer gitg_edit_remote_action_parent_class = NULL;
static GitgExtUIElementIface * gitg_edit_remote_action_gitg_ext_ui_element_parent_iface = NULL;
static GitgExtActionIface * gitg_edit_remote_action_gitg_ext_action_parent_iface = NULL;

VALA_EXTERN GType gitg_edit_remote_action_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GitgEditRemoteAction, g_object_unref)
VALA_EXTERN GitgEditRemoteAction* gitg_edit_remote_action_new (GitgExtApplication* application,
                                                   GitgExtRefActionInterface* action_interface,
                                                   const gchar* remote_name);
VALA_EXTERN GitgEditRemoteAction* gitg_edit_remote_action_construct (GType object_type,
                                                         GitgExtApplication* application,
                                                         GitgExtRefActionInterface* action_interface,
                                                         const gchar* remote_name);
static void gitg_edit_remote_action_real_activate (GitgExtUIElement* base);
VALA_EXTERN GType gitg_edit_remote_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GitgEditRemoteDialog, g_object_unref)
static Block66Data* block66_data_ref (Block66Data* _data66_);
static void block66_data_unref (void * _userdata_);
VALA_EXTERN GitgEditRemoteDialog* gitg_edit_remote_dialog_new (GtkWindow* parent);
VALA_EXTERN GitgEditRemoteDialog* gitg_edit_remote_dialog_construct (GType object_type,
                                                         GtkWindow* parent);
VALA_EXTERN void gitg_edit_remote_dialog_set_new_remote_name (GitgEditRemoteDialog* self,
                                                  const gchar* value);
VALA_EXTERN void gitg_edit_remote_dialog_set_new_remote_url (GitgEditRemoteDialog* self,
                                                 const gchar* value);
static void __lambda101_ (Block66Data* _data66_,
                   GtkDialog* d,
                   gint resp);
VALA_EXTERN gchar* gitg_edit_remote_dialog_get_new_remote_name (GitgEditRemoteDialog* self);
VALA_EXTERN gchar* gitg_edit_remote_dialog_get_new_remote_url (GitgEditRemoteDialog* self);
static void ___lambda101__gtk_dialog_response (GtkDialog* _sender,
                                        gint response_id,
                                        gpointer self);
VALA_EXTERN GitgExtRefActionInterface* gitg_edit_remote_action_get_action_interface (GitgEditRemoteAction* self);
VALA_EXTERN void gitg_edit_remote_action_set_action_interface (GitgEditRemoteAction* self,
                                                   GitgExtRefActionInterface* value);
static void gitg_edit_remote_action_finalize (GObject * obj);
static GType gitg_edit_remote_action_get_type_once (void);
static void _vala_gitg_edit_remote_action_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_gitg_edit_remote_action_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 gssize _vala_array_length (gpointer array);

static inline gpointer
gitg_edit_remote_action_get_instance_private (GitgEditRemoteAction* self)
{
	return G_STRUCT_MEMBER_P (self, GitgEditRemoteAction_private_offset);
}

GitgEditRemoteAction*
gitg_edit_remote_action_construct (GType object_type,
                                   GitgExtApplication* application,
                                   GitgExtRefActionInterface* action_interface,
                                   const gchar* remote_name)
{
	GitgEditRemoteAction * self = NULL;
	gchar* _tmp0_;
	GitgExtRemoteLookup* _tmp1_;
	GitgExtRemoteLookup* _tmp2_;
	GitgExtRemoteLookup* _tmp3_;
	GitgRemote* _tmp4_;
	g_return_val_if_fail (application != NULL, NULL);
	g_return_val_if_fail (action_interface != NULL, NULL);
	g_return_val_if_fail (remote_name != NULL, NULL);
	self = (GitgEditRemoteAction*) g_object_new (object_type, "application", application, "action-interface", action_interface, NULL);
	_tmp0_ = g_strdup (remote_name);
	_g_free0 (self->priv->remote_name);
	self->priv->remote_name = _tmp0_;
	_tmp1_ = gitg_ext_application_get_remote_lookup (application);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = gitg_ext_remote_lookup_lookup (_tmp3_, remote_name);
	_g_object_unref0 (self->priv->d_remote);
	self->priv->d_remote = _tmp4_;
	_g_object_unref0 (_tmp3_);
	return self;
}

GitgEditRemoteAction*
gitg_edit_remote_action_new (GitgExtApplication* application,
                             GitgExtRefActionInterface* action_interface,
                             const gchar* remote_name)
{
	return gitg_edit_remote_action_construct (GITG_TYPE_EDIT_REMOTE_ACTION, application, action_interface, remote_name);
}

static Block66Data*
block66_data_ref (Block66Data* _data66_)
{
	g_atomic_int_inc (&_data66_->_ref_count_);
	return _data66_;
}

static void
block66_data_unref (void * _userdata_)
{
	Block66Data* _data66_;
	_data66_ = (Block66Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data66_->_ref_count_)) {
		GitgEditRemoteAction* self;
		self = _data66_->self;
		_g_free0 (_data66_->old_name);
		_g_object_unref0 (_data66_->dlg);
		_g_object_unref0 (self);
		g_slice_free (Block66Data, _data66_);
	}
}

static void
__lambda101_ (Block66Data* _data66_,
              GtkDialog* d,
              gint resp)
{
	GitgEditRemoteAction* self;
	GError* _inner_error0_ = NULL;
	self = _data66_->self;
	g_return_if_fail (d != NULL);
	if (resp == ((gint) GTK_RESPONSE_OK)) {
		GitgRepository* repo = NULL;
		GitgExtApplication* _tmp0_;
		GitgExtApplication* _tmp1_;
		GitgExtApplication* _tmp2_;
		GitgRepository* _tmp3_;
		GitgRepository* _tmp4_;
		GitgRepository* _tmp5_;
		GitgExtApplication* _tmp29_;
		GitgExtApplication* _tmp30_;
		GtkApplicationWindow* _tmp31_;
		_g_object_unref0 (self->priv->d_remote);
		self->priv->d_remote = NULL;
		_tmp0_ = gitg_ext_ui_element_get_application ((GitgExtUIElement*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gitg_ext_application_get_repository (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp2_);
		repo = _tmp5_;
		{
			gchar* _tmp6_;
			gchar* _tmp7_;
			gchar* _tmp8_;
			gboolean _tmp9_;
			GitgRepository* _tmp17_;
			gchar* _tmp18_;
			gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			gchar* _tmp22_;
			gchar* _tmp23_;
			_tmp6_ = gitg_edit_remote_dialog_get_new_remote_name (_data66_->dlg);
			_tmp7_ = _tmp6_;
			_tmp8_ = _tmp7_;
			_tmp9_ = g_strcmp0 (_data66_->old_name, _tmp8_) != 0;
			_g_free0 (_tmp8_);
			if (_tmp9_) {
				GitgRepository* _tmp10_;
				gchar* _tmp11_;
				gchar* _tmp12_;
				gchar* _tmp13_;
				gchar** _tmp14_;
				gchar** _tmp15_;
				gchar** _tmp16_;
				gint _tmp16__length1;
				_tmp10_ = repo;
				_tmp11_ = gitg_edit_remote_dialog_get_new_remote_name (_data66_->dlg);
				_tmp12_ = _tmp11_;
				_tmp13_ = _tmp12_;
				_tmp15_ = _tmp14_ = ggit_repository_rename_remote ((GgitRepository*) _tmp10_, _data66_->old_name, _tmp13_, &_inner_error0_);
				_tmp16_ = _tmp15_;
				_tmp16__length1 = _vala_array_length (_tmp14_);
				_tmp16_ = (_vala_array_free (_tmp16_, _tmp16__length1, (GDestroyNotify) g_free), NULL);
				_g_free0 (_tmp13_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
			}
			_tmp17_ = repo;
			_tmp18_ = gitg_edit_remote_dialog_get_new_remote_name (_data66_->dlg);
			_tmp19_ = _tmp18_;
			_tmp20_ = _tmp19_;
			_tmp21_ = gitg_edit_remote_dialog_get_new_remote_url (_data66_->dlg);
			_tmp22_ = _tmp21_;
			_tmp23_ = _tmp22_;
			ggit_repository_set_remote_url ((GgitRepository*) _tmp17_, _tmp20_, _tmp23_, &_inner_error0_);
			_g_free0 (_tmp23_);
			_g_free0 (_tmp20_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GitgExtApplication* _tmp24_;
			GitgExtApplication* _tmp25_;
			GitgExtApplication* _tmp26_;
			GError* _tmp27_;
			const gchar* _tmp28_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp24_ = gitg_ext_ui_element_get_application ((GitgExtUIElement*) self);
			_tmp25_ = _tmp24_;
			_tmp26_ = _tmp25_;
			_tmp27_ = e;
			_tmp28_ = _tmp27_->message;
			gitg_ext_application_show_infobar (_tmp26_, _ ("Failed to edit remote"), _tmp28_, GTK_MESSAGE_ERROR);
			_g_object_unref0 (_tmp26_);
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (repo);
			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;
		}
		_tmp29_ = gitg_ext_ui_element_get_application ((GitgExtUIElement*) self);
		_tmp30_ = _tmp29_;
		_tmp31_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, gtk_application_window_get_type (), GtkApplicationWindow);
		g_action_group_activate_action ((GActionGroup*) _tmp31_, "reload", NULL);
		_g_object_unref0 (_tmp31_);
		_g_object_unref0 (repo);
	}
	gtk_widget_destroy ((GtkWidget*) _data66_->dlg);
}

static void
___lambda101__gtk_dialog_response (GtkDialog* _sender,
                                   gint response_id,
                                   gpointer self)
{
	__lambda101_ (self, _sender, response_id);
}

static void
gitg_edit_remote_action_real_activate (GitgExtUIElement* base)
{
	GitgEditRemoteAction * self;
	Block66Data* _data66_;
	GitgExtApplication* _tmp0_;
	GitgExtApplication* _tmp1_;
	GtkWindow* _tmp2_;
	GitgEditRemoteDialog* _tmp3_;
	GitgEditRemoteDialog* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	GitgRemote* _tmp8_;
	const gchar* _tmp9_;
	self = (GitgEditRemoteAction*) base;
	_data66_ = g_slice_new0 (Block66Data);
	_data66_->_ref_count_ = 1;
	_data66_->self = g_object_ref (self);
	_tmp0_ = gitg_ext_ui_element_get_application ((GitgExtUIElement*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_window_get_type (), GtkWindow);
	_tmp3_ = gitg_edit_remote_dialog_new (_tmp2_);
	g_object_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	_g_object_unref0 (_tmp2_);
	_data66_->dlg = _tmp4_;
	_tmp5_ = self->priv->remote_name;
	gitg_edit_remote_dialog_set_new_remote_name (_data66_->dlg, _tmp5_);
	_tmp6_ = self->priv->remote_name;
	_tmp7_ = g_strdup (_tmp6_);
	_data66_->old_name = _tmp7_;
	_tmp8_ = self->priv->d_remote;
	_tmp9_ = ggit_remote_get_url ((GgitRemote*) _tmp8_);
	gitg_edit_remote_dialog_set_new_remote_url (_data66_->dlg, _tmp9_);
	g_signal_connect_data ((GtkDialog*) _data66_->dlg, "response", (GCallback) ___lambda101__gtk_dialog_response, block66_data_ref (_data66_), (GClosureNotify) block66_data_unref, 0);
	gtk_widget_show ((GtkWidget*) _data66_->dlg);
	block66_data_unref (_data66_);
	_data66_ = NULL;
}

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

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

static void
gitg_edit_remote_action_real_set_application (GitgExtUIElement* base,
                                              GitgExtApplication* value)
{
	GitgEditRemoteAction* self;
	GitgExtApplication* old_value;
	self = (GitgEditRemoteAction*) base;
	old_value = gitg_edit_remote_action_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_edit_remote_action_properties[GITG_EDIT_REMOTE_ACTION_APPLICATION_PROPERTY]);
	}
	_g_object_unref0 (old_value);
}

GitgExtRefActionInterface*
gitg_edit_remote_action_get_action_interface (GitgEditRemoteAction* self)
{
	GitgExtRefActionInterface* result;
	GitgExtRefActionInterface* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_action_interface;
	result = _tmp0_;
	return result;
}

void
gitg_edit_remote_action_set_action_interface (GitgEditRemoteAction* self,
                                              GitgExtRefActionInterface* value)
{
	GitgExtRefActionInterface* old_value;
	g_return_if_fail (self != NULL);
	old_value = gitg_edit_remote_action_get_action_interface (self);
	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_edit_remote_action_properties[GITG_EDIT_REMOTE_ACTION_ACTION_INTERFACE_PROPERTY]);
	}
}

static gchar*
gitg_edit_remote_action_real_get_id (GitgExtUIElement* base)
{
	gchar* result;
	GitgEditRemoteAction* self;
	gchar* _tmp0_;
	self = (GitgEditRemoteAction*) base;
	_tmp0_ = g_strdup ("/org/gnome/gitg/ref-actions/edit-remote");
	result = _tmp0_;
	return result;
}

static gchar*
gitg_edit_remote_action_real_get_display_name (GitgExtUIElement* base)
{
	gchar* result;
	GitgEditRemoteAction* self;
	gchar* _tmp0_;
	self = (GitgEditRemoteAction*) base;
	_tmp0_ = g_strdup (_ ("Edit remote"));
	result = _tmp0_;
	return result;
}

static gchar*
gitg_edit_remote_action_real_get_description (GitgExtUIElement* base)
{
	gchar* result;
	GitgEditRemoteAction* self;
	gchar* _tmp0_;
	self = (GitgEditRemoteAction*) base;
	_tmp0_ = g_strdup (_ ("Edits the remote from the remotes list"));
	result = _tmp0_;
	return result;
}

static void
gitg_edit_remote_action_class_init (GitgEditRemoteActionClass * klass,
                                    gpointer klass_data)
{
	gitg_edit_remote_action_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgEditRemoteAction_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_edit_remote_action_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gitg_edit_remote_action_set_property;
	G_OBJECT_CLASS (klass)->finalize = gitg_edit_remote_action_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_EDIT_REMOTE_ACTION_APPLICATION_PROPERTY, gitg_edit_remote_action_properties[GITG_EDIT_REMOTE_ACTION_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_EDIT_REMOTE_ACTION_ACTION_INTERFACE_PROPERTY, gitg_edit_remote_action_properties[GITG_EDIT_REMOTE_ACTION_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_EDIT_REMOTE_ACTION_ID_PROPERTY, gitg_edit_remote_action_properties[GITG_EDIT_REMOTE_ACTION_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_EDIT_REMOTE_ACTION_DISPLAY_NAME_PROPERTY, gitg_edit_remote_action_properties[GITG_EDIT_REMOTE_ACTION_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_EDIT_REMOTE_ACTION_DESCRIPTION_PROPERTY, gitg_edit_remote_action_properties[GITG_EDIT_REMOTE_ACTION_DESCRIPTION_PROPERTY] = g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gitg_edit_remote_action_gitg_ext_ui_element_interface_init (GitgExtUIElementIface * iface,
                                                            gpointer iface_data)
{
	gitg_edit_remote_action_gitg_ext_ui_element_parent_iface = g_type_interface_peek_parent (iface);
	iface->activate = (void (*) (GitgExtUIElement*)) gitg_edit_remote_action_real_activate;
	iface->get_application = gitg_edit_remote_action_real_get_application;
	iface->set_application = gitg_edit_remote_action_real_set_application;
	iface->get_id = gitg_edit_remote_action_real_get_id;
	iface->get_display_name = gitg_edit_remote_action_real_get_display_name;
	iface->get_description = gitg_edit_remote_action_real_get_description;
}

static void
gitg_edit_remote_action_gitg_ext_action_interface_init (GitgExtActionIface * iface,
                                                        gpointer iface_data)
{
	gitg_edit_remote_action_gitg_ext_action_parent_iface = g_type_interface_peek_parent (iface);
}

static void
gitg_edit_remote_action_instance_init (GitgEditRemoteAction * self,
                                       gpointer klass)
{
	self->priv = gitg_edit_remote_action_get_instance_private (self);
}

static void
gitg_edit_remote_action_finalize (GObject * obj)
{
	GitgEditRemoteAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_EDIT_REMOTE_ACTION, GitgEditRemoteAction);
	_g_object_unref0 (self->priv->_application);
	_g_object_unref0 (self->priv->_action_interface);
	_g_free0 (self->priv->remote_name);
	_g_object_unref0 (self->priv->d_remote);
	G_OBJECT_CLASS (gitg_edit_remote_action_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_edit_remote_action_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgEditRemoteActionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_edit_remote_action_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgEditRemoteAction), 0, (GInstanceInitFunc) gitg_edit_remote_action_instance_init, NULL };
	static const GInterfaceInfo gitg_ext_ui_element_info = { (GInterfaceInitFunc) gitg_edit_remote_action_gitg_ext_ui_element_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gitg_ext_action_info = { (GInterfaceInitFunc) gitg_edit_remote_action_gitg_ext_action_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gitg_edit_remote_action_type_id;
	gitg_edit_remote_action_type_id = g_type_register_static (G_TYPE_OBJECT, "GitgEditRemoteAction", &g_define_type_info, 0);
	g_type_add_interface_static (gitg_edit_remote_action_type_id, GITG_EXT_TYPE_UI_ELEMENT, &gitg_ext_ui_element_info);
	g_type_add_interface_static (gitg_edit_remote_action_type_id, GITG_EXT_TYPE_ACTION, &gitg_ext_action_info);
	GitgEditRemoteAction_private_offset = g_type_add_instance_private (gitg_edit_remote_action_type_id, sizeof (GitgEditRemoteActionPrivate));
	return gitg_edit_remote_action_type_id;
}

GType
gitg_edit_remote_action_get_type (void)
{
	static gsize gitg_edit_remote_action_type_id__once = 0;
	if (g_once_init_enter (&gitg_edit_remote_action_type_id__once)) {
		GType gitg_edit_remote_action_type_id;
		gitg_edit_remote_action_type_id = gitg_edit_remote_action_get_type_once ();
		g_once_init_leave (&gitg_edit_remote_action_type_id__once, gitg_edit_remote_action_type_id);
	}
	return gitg_edit_remote_action_type_id__once;
}

static void
_vala_gitg_edit_remote_action_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	GitgEditRemoteAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_EDIT_REMOTE_ACTION, GitgEditRemoteAction);
	switch (property_id) {
		case GITG_EDIT_REMOTE_ACTION_APPLICATION_PROPERTY:
		g_value_take_object (value, gitg_ext_ui_element_get_application ((GitgExtUIElement*) self));
		break;
		case GITG_EDIT_REMOTE_ACTION_ACTION_INTERFACE_PROPERTY:
		g_value_set_object (value, gitg_edit_remote_action_get_action_interface (self));
		break;
		case GITG_EDIT_REMOTE_ACTION_ID_PROPERTY:
		g_value_take_string (value, gitg_ext_ui_element_get_id ((GitgExtUIElement*) self));
		break;
		case GITG_EDIT_REMOTE_ACTION_DISPLAY_NAME_PROPERTY:
		g_value_take_string (value, gitg_ext_ui_element_get_display_name ((GitgExtUIElement*) self));
		break;
		case GITG_EDIT_REMOTE_ACTION_DESCRIPTION_PROPERTY:
		g_value_take_string (value, gitg_ext_ui_element_get_description ((GitgExtUIElement*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gitg_edit_remote_action_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	GitgEditRemoteAction * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_EDIT_REMOTE_ACTION, GitgEditRemoteAction);
	switch (property_id) {
		case GITG_EDIT_REMOTE_ACTION_APPLICATION_PROPERTY:
		gitg_ext_ui_element_set_application ((GitgExtUIElement*) self, g_value_get_object (value));
		break;
		case GITG_EDIT_REMOTE_ACTION_ACTION_INTERFACE_PROPERTY:
		gitg_edit_remote_action_set_action_interface (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);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

