/* VPNMenuItem.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from VPNMenuItem.vala, do not modify */

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

#include "network.h"
#include <NetworkManager.h>
#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <granite-7.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <pango/pango.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

enum  {
	NETWORK_VPN_MENU_ITEM_0_PROPERTY,
	NETWORK_VPN_MENU_ITEM_CONNECTION_PROPERTY,
	NETWORK_VPN_MENU_ITEM_STATE_PROPERTY,
	NETWORK_VPN_MENU_ITEM_NUM_PROPERTIES
};
static GParamSpec* network_vpn_menu_item_properties[NETWORK_VPN_MENU_ITEM_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))
enum  {
	NETWORK_VPN_MENU_ITEM_REMOVE_REQUEST_SIGNAL,
	NETWORK_VPN_MENU_ITEM_NUM_SIGNALS
};
static guint network_vpn_menu_item_signals[NETWORK_VPN_MENU_ITEM_NUM_SIGNALS] = {0};

struct _NetworkVPNMenuItemPrivate {
	NMRemoteConnection* _connection;
	NMDeviceState _state;
	GtkButton* connect_button;
	GtkImage* vpn_state;
	GtkLabel* state_label;
	GtkLabel* vpn_label;
};

static gint NetworkVPNMenuItem_private_offset;
static gpointer network_vpn_menu_item_parent_class = NULL;
static GtkSizeGroup* network_vpn_menu_item_size_group;
static GtkSizeGroup* network_vpn_menu_item_size_group = NULL;

static void network_vpn_menu_item_remove_row (NetworkVPNMenuItem* self);
static void _gtk_window_destroy_gtk_dialog_response (GtkDialog* _sender,
                                              gint response_id,
                                              gpointer self);
static void network_vpn_menu_item_update (NetworkVPNMenuItem* self);
static GObject * network_vpn_menu_item_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void _network_vpn_menu_item_update_g_object_notify (GObject* _sender,
                                                    GParamSpec* pspec,
                                                    gpointer self);
static void _network_vpn_menu_item_update_nm_connection_changed (NMConnection* _sender,
                                                          gpointer self);
static void _network_vpn_menu_item___lambda10_ (NetworkVPNMenuItem* self);
static void __network_vpn_menu_item___lambda10__gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void _network_vpn_menu_item_remove_row_gtk_button_clicked (GtkButton* _sender,
                                                           gpointer self);
static void _network_vpn_menu_item___lambda11_ (NetworkVPNMenuItem* self);
static void __network_vpn_menu_item___lambda11__gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self);
static void network_vpn_menu_item_finalize (GObject * obj);
static GType network_vpn_menu_item_get_type_once (void);
static void _vala_network_vpn_menu_item_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_network_vpn_menu_item_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);

static inline gpointer
network_vpn_menu_item_get_instance_private (NetworkVPNMenuItem* self)
{
	return G_STRUCT_MEMBER_P (self, NetworkVPNMenuItem_private_offset);
}

NetworkVPNMenuItem*
network_vpn_menu_item_construct (GType object_type,
                                 NMRemoteConnection* _connection)
{
	NetworkVPNMenuItem * self = NULL;
	g_return_val_if_fail (_connection != NULL, NULL);
	self = (NetworkVPNMenuItem*) g_object_new (object_type, "connection", _connection, NULL);
	return self;
}

NetworkVPNMenuItem*
network_vpn_menu_item_new (NMRemoteConnection* _connection)
{
	return network_vpn_menu_item_construct (NETWORK_TYPE_VPN_MENU_ITEM, _connection);
}

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

static void
_gtk_window_destroy_gtk_dialog_response (GtkDialog* _sender,
                                         gint response_id,
                                         gpointer self)
{
	gtk_window_destroy ((GtkWindow*) self);
}

static void
network_vpn_menu_item_remove_row (NetworkVPNMenuItem* self)
{
	gboolean _tmp0_ = FALSE;
	NMDeviceState _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_state;
	if (_tmp1_ == NM_DEVICE_STATE_ACTIVATED) {
		_tmp0_ = TRUE;
	} else {
		NMDeviceState _tmp2_;
		_tmp2_ = self->priv->_state;
		_tmp0_ = _tmp2_ == NM_DEVICE_STATE_PREPARE;
	}
	if (_tmp0_) {
		GraniteMessageDialog* dialog = NULL;
		GThemedIcon* _tmp3_;
		GThemedIcon* _tmp4_;
		GThemedIcon* _tmp5_;
		GtkRoot* _tmp6_;
		GtkWindow* _tmp7_;
		GraniteMessageDialog* _tmp8_ = NULL;
		GraniteMessageDialog* _tmp9_;
		GraniteMessageDialog* _tmp10_;
		GraniteMessageDialog* _tmp11_;
		GraniteMessageDialog* _tmp12_;
		_tmp3_ = (GThemedIcon*) g_themed_icon_new ("network-vpn");
		_tmp4_ = _tmp3_;
		_tmp5_ = (GThemedIcon*) g_themed_icon_new ("dialog-error");
		_tmp6_ = gtk_widget_get_root ((GtkWidget*) self);
		_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_window_get_type (), GtkWindow));
		_tmp8_ = granite_message_dialog_new (_ ("Failed to remove VPN connection"), _ ("Cannot remove an active VPN connection."), (GIcon*) _tmp4_, GTK_BUTTONS_CLOSE);
		granite_message_dialog_set_badge_icon (_tmp8_, (GIcon*) _tmp5_);
		_g_object_unref0 (_tmp5_);
		gtk_window_set_modal ((GtkWindow*) _tmp8_, TRUE);
		gtk_window_set_transient_for ((GtkWindow*) _tmp8_, _tmp7_);
		_g_object_unref0 (_tmp7_);
		g_object_ref_sink (_tmp8_);
		_tmp9_ = _tmp8_;
		_g_object_unref0 (_tmp4_);
		dialog = _tmp9_;
		_tmp10_ = dialog;
		gtk_window_present ((GtkWindow*) _tmp10_);
		_tmp11_ = dialog;
		_tmp12_ = dialog;
		g_signal_connect_object ((GtkDialog*) _tmp11_, "response", (GCallback) _gtk_window_destroy_gtk_dialog_response, (GtkWindow*) _tmp12_, 0);
		_g_object_unref0 (dialog);
	} else {
		g_signal_emit (self, network_vpn_menu_item_signals[NETWORK_VPN_MENU_ITEM_REMOVE_REQUEST_SIGNAL], 0);
		gtk_widget_hide ((GtkWidget*) self);
	}
}

static void
network_vpn_menu_item_update (NetworkVPNMenuItem* self)
{
	GtkLabel* _tmp0_;
	NMRemoteConnection* _tmp1_;
	const gchar* _tmp2_;
	NMDeviceState _tmp3_;
	GtkLabel* _tmp22_;
	NMDeviceState _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->vpn_label;
	_tmp1_ = self->priv->_connection;
	_tmp2_ = nm_connection_get_id ((NMConnection*) _tmp1_);
	gtk_label_set_label (_tmp0_, _tmp2_);
	_tmp3_ = self->priv->_state;
	switch (_tmp3_) {
		case NM_DEVICE_STATE_FAILED:
		{
			GtkImage* _tmp4_;
			GtkButton* _tmp5_;
			GtkButton* _tmp6_;
			GtkButton* _tmp7_;
			_tmp4_ = self->priv->vpn_state;
			g_object_set (_tmp4_, "icon-name", "emblem-error", NULL);
			_tmp5_ = self->priv->connect_button;
			gtk_button_set_label (_tmp5_, _ ("Connect"));
			_tmp6_ = self->priv->connect_button;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp6_, TRUE);
			_tmp7_ = self->priv->connect_button;
			gtk_widget_remove_css_class ((GtkWidget*) _tmp7_, GRANITE_STYLE_CLASS_DESTRUCTIVE_ACTION);
			break;
		}
		case NM_DEVICE_STATE_PREPARE:
		{
			GtkImage* _tmp8_;
			GtkButton* _tmp9_;
			GtkButton* _tmp10_;
			_tmp8_ = self->priv->vpn_state;
			g_object_set (_tmp8_, "icon-name", "emblem-mixed", NULL);
			_tmp9_ = self->priv->connect_button;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp9_, FALSE);
			_tmp10_ = self->priv->connect_button;
			gtk_widget_remove_css_class ((GtkWidget*) _tmp10_, GRANITE_STYLE_CLASS_DESTRUCTIVE_ACTION);
			break;
		}
		case NM_DEVICE_STATE_ACTIVATED:
		{
			GtkImage* _tmp11_;
			GtkButton* _tmp12_;
			GtkButton* _tmp13_;
			GtkButton* _tmp14_;
			_tmp11_ = self->priv->vpn_state;
			g_object_set (_tmp11_, "icon-name", "emblem-enabled", NULL);
			_tmp12_ = self->priv->connect_button;
			gtk_button_set_label (_tmp12_, _ ("Disconnect"));
			_tmp13_ = self->priv->connect_button;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp13_, TRUE);
			_tmp14_ = self->priv->connect_button;
			gtk_widget_add_css_class ((GtkWidget*) _tmp14_, GRANITE_STYLE_CLASS_DESTRUCTIVE_ACTION);
			break;
		}
		case NM_DEVICE_STATE_DISCONNECTED:
		{
			GtkImage* _tmp15_;
			GtkButton* _tmp16_;
			GtkButton* _tmp17_;
			GtkButton* _tmp18_;
			_tmp15_ = self->priv->vpn_state;
			g_object_set (_tmp15_, "icon-name", "emblem-disabled", NULL);
			_tmp16_ = self->priv->connect_button;
			gtk_button_set_label (_tmp16_, _ ("Connect"));
			_tmp17_ = self->priv->connect_button;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp17_, TRUE);
			_tmp18_ = self->priv->connect_button;
			gtk_widget_remove_css_class ((GtkWidget*) _tmp18_, GRANITE_STYLE_CLASS_DESTRUCTIVE_ACTION);
			break;
		}
		default:
		{
			GtkButton* _tmp19_;
			GtkButton* _tmp20_;
			GtkButton* _tmp21_;
			_tmp19_ = self->priv->connect_button;
			gtk_button_set_label (_tmp19_, _ ("Connect"));
			_tmp20_ = self->priv->connect_button;
			gtk_widget_set_sensitive ((GtkWidget*) _tmp20_, TRUE);
			_tmp21_ = self->priv->connect_button;
			gtk_widget_remove_css_class ((GtkWidget*) _tmp21_, GRANITE_STYLE_CLASS_DESTRUCTIVE_ACTION);
			break;
		}
	}
	_tmp22_ = self->priv->state_label;
	_tmp23_ = self->priv->_state;
	_tmp24_ = network_utils_state_to_string (_tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_markup_printf_escaped ("<span font_size='small'>%s</span>", _tmp25_);
	_tmp27_ = _tmp26_;
	gtk_label_set_label (_tmp22_, _tmp27_);
	_g_free0 (_tmp27_);
	_g_free0 (_tmp25_);
}

NMRemoteConnection*
network_vpn_menu_item_get_connection (NetworkVPNMenuItem* self)
{
	NMRemoteConnection* result;
	NMRemoteConnection* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_connection;
	result = _tmp0_;
	return result;
}

static void
network_vpn_menu_item_set_connection (NetworkVPNMenuItem* self,
                                      NMRemoteConnection* value)
{
	NMRemoteConnection* old_value;
	g_return_if_fail (self != NULL);
	old_value = network_vpn_menu_item_get_connection (self);
	if (old_value != value) {
		NMRemoteConnection* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_connection);
		self->priv->_connection = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, network_vpn_menu_item_properties[NETWORK_VPN_MENU_ITEM_CONNECTION_PROPERTY]);
	}
}

NMDeviceState
network_vpn_menu_item_get_state (NetworkVPNMenuItem* self)
{
	NMDeviceState result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_state;
	return result;
}

void
network_vpn_menu_item_set_state (NetworkVPNMenuItem* self,
                                 NMDeviceState value)
{
	NMDeviceState old_value;
	g_return_if_fail (self != NULL);
	old_value = network_vpn_menu_item_get_state (self);
	if (old_value != value) {
		self->priv->_state = value;
		g_object_notify_by_pspec ((GObject *) self, network_vpn_menu_item_properties[NETWORK_VPN_MENU_ITEM_STATE_PROPERTY]);
	}
}

static void
_network_vpn_menu_item_update_g_object_notify (GObject* _sender,
                                               GParamSpec* pspec,
                                               gpointer self)
{
	network_vpn_menu_item_update ((NetworkVPNMenuItem*) self);
}

static void
_network_vpn_menu_item_update_nm_connection_changed (NMConnection* _sender,
                                                     gpointer self)
{
	network_vpn_menu_item_update ((NetworkVPNMenuItem*) self);
}

static void
_network_vpn_menu_item___lambda10_ (NetworkVPNMenuItem* self)
{
	g_signal_emit_by_name ((GtkListBoxRow*) self, "activate");
}

static void
__network_vpn_menu_item___lambda10__gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	_network_vpn_menu_item___lambda10_ ((NetworkVPNMenuItem*) self);
}

static void
_network_vpn_menu_item_remove_row_gtk_button_clicked (GtkButton* _sender,
                                                      gpointer self)
{
	network_vpn_menu_item_remove_row ((NetworkVPNMenuItem*) self);
}

static void
_network_vpn_menu_item___lambda11_ (NetworkVPNMenuItem* self)
{
	NetworkWidgetsVPNInfoDialog* vpn_info_dialog = NULL;
	NMRemoteConnection* _tmp0_;
	NMDeviceState _tmp1_;
	gchar* _tmp2_;
	GtkRoot* _tmp3_;
	GtkWindow* _tmp4_;
	NetworkWidgetsVPNInfoDialog* _tmp5_ = NULL;
	NetworkWidgetsVPNInfoDialog* _tmp6_;
	_tmp0_ = self->priv->_connection;
	_tmp1_ = self->priv->_state;
	_tmp2_ = network_utils_state_to_string (_tmp1_);
	_tmp3_ = gtk_widget_get_root ((GtkWidget*) self);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_window_get_type (), GtkWindow));
	_tmp5_ = network_widgets_vpn_info_dialog_new (_tmp0_);
	gtk_window_set_modal ((GtkWindow*) _tmp5_, TRUE);
	granite_message_dialog_set_secondary_text ((GraniteMessageDialog*) _tmp5_, _tmp2_);
	_g_free0 (_tmp2_);
	gtk_window_set_transient_for ((GtkWindow*) _tmp5_, _tmp4_);
	_g_object_unref0 (_tmp4_);
	g_object_ref_sink (_tmp5_);
	vpn_info_dialog = _tmp5_;
	_tmp6_ = vpn_info_dialog;
	gtk_window_present ((GtkWindow*) _tmp6_);
	_g_object_unref0 (vpn_info_dialog);
}

static void
__network_vpn_menu_item___lambda11__gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self)
{
	_network_vpn_menu_item___lambda11_ ((NetworkVPNMenuItem*) self);
}

static GObject *
network_vpn_menu_item_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	NetworkVPNMenuItem * self;
	GtkImage* image = NULL;
	GtkImage* _tmp0_ = NULL;
	GtkImage* _tmp1_ = NULL;
	GtkLabel* _tmp2_ = NULL;
	GtkOverlay* overlay = NULL;
	GtkImage* _tmp3_;
	GtkWidget* _tmp4_;
	GtkOverlay* _tmp5_ = NULL;
	GtkOverlay* _tmp6_;
	GtkImage* _tmp7_;
	NMRemoteConnection* _tmp8_;
	const gchar* _tmp9_;
	GtkLabel* _tmp10_ = NULL;
	GtkButton* remove_button = NULL;
	gchar* _tmp11_;
	GtkButton* _tmp12_ = NULL;
	GtkButton* vpn_info_button = NULL;
	gchar* _tmp13_;
	GtkButton* _tmp14_ = NULL;
	gchar* _tmp15_;
	GtkButton* _tmp16_ = NULL;
	GtkSizeGroup* _tmp17_;
	GtkButton* _tmp18_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp19_ = NULL;
	GtkGrid* _tmp20_;
	GtkOverlay* _tmp21_;
	GtkGrid* _tmp22_;
	GtkLabel* _tmp23_;
	GtkGrid* _tmp24_;
	GtkLabel* _tmp25_;
	GtkGrid* _tmp26_;
	GtkButton* _tmp27_;
	GtkGrid* _tmp28_;
	GtkButton* _tmp29_;
	GtkGrid* _tmp30_;
	GtkButton* _tmp31_;
	GtkGrid* _tmp32_;
	NMRemoteConnection* _tmp33_;
	GtkButton* _tmp34_;
	GtkButton* _tmp35_;
	GtkButton* _tmp36_;
	parent_class = G_OBJECT_CLASS (network_vpn_menu_item_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, NETWORK_TYPE_VPN_MENU_ITEM, NetworkVPNMenuItem);
	_tmp0_ = (GtkImage*) gtk_image_new_from_icon_name ("network-vpn");
	gtk_image_set_icon_size (_tmp0_, GTK_ICON_SIZE_LARGE);
	g_object_ref_sink (_tmp0_);
	image = _tmp0_;
	_tmp1_ = (GtkImage*) gtk_image_new_from_icon_name ("emblem-disabled");
	gtk_widget_set_halign ((GtkWidget*) _tmp1_, GTK_ALIGN_END);
	gtk_widget_set_valign ((GtkWidget*) _tmp1_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->vpn_state);
	self->priv->vpn_state = _tmp1_;
	_tmp2_ = (GtkLabel*) gtk_label_new (NULL);
	gtk_label_set_xalign (_tmp2_, (gfloat) 0);
	gtk_label_set_use_markup (_tmp2_, TRUE);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->state_label);
	self->priv->state_label = _tmp2_;
	_tmp3_ = image;
	_tmp4_ = _g_object_ref0 ((GtkWidget*) _tmp3_);
	_tmp5_ = (GtkOverlay*) gtk_overlay_new ();
	gtk_overlay_set_child (_tmp5_, _tmp4_);
	_g_object_unref0 (_tmp4_);
	g_object_ref_sink (_tmp5_);
	overlay = _tmp5_;
	_tmp6_ = overlay;
	_tmp7_ = self->priv->vpn_state;
	gtk_overlay_add_overlay (_tmp6_, (GtkWidget*) _tmp7_);
	_tmp8_ = self->priv->_connection;
	_tmp9_ = nm_connection_get_id ((NMConnection*) _tmp8_);
	_tmp10_ = (GtkLabel*) gtk_label_new (_tmp9_);
	gtk_label_set_ellipsize (_tmp10_, PANGO_ELLIPSIZE_END);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp10_, TRUE);
	gtk_label_set_xalign (_tmp10_, (gfloat) 0);
	g_object_ref_sink (_tmp10_);
	_g_object_unref0 (self->priv->vpn_label);
	self->priv->vpn_label = _tmp10_;
	_tmp11_ = g_strdup (_ ("Forget connection"));
	_tmp12_ = (GtkButton*) gtk_button_new_from_icon_name ("edit-delete-symbolic");
	gtk_widget_set_margin_end ((GtkWidget*) _tmp12_, 3);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp12_, _tmp11_);
	_g_free0 (_tmp11_);
	gtk_widget_set_valign ((GtkWidget*) _tmp12_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp12_);
	remove_button = _tmp12_;
	_tmp13_ = g_strdup (_ ("Connection info"));
	_tmp14_ = (GtkButton*) gtk_button_new_from_icon_name ("view-more-horizontal-symbolic");
	gtk_widget_set_margin_end ((GtkWidget*) _tmp14_, 3);
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp14_, _tmp13_);
	_g_free0 (_tmp13_);
	gtk_widget_set_valign ((GtkWidget*) _tmp14_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp14_);
	vpn_info_button = _tmp14_;
	_tmp15_ = g_strdup (_ ("Connect"));
	_tmp16_ = (GtkButton*) gtk_button_new ();
	gtk_widget_set_valign ((GtkWidget*) _tmp16_, GTK_ALIGN_CENTER);
	gtk_button_set_label (_tmp16_, _tmp15_);
	_g_free0 (_tmp15_);
	g_object_ref_sink (_tmp16_);
	_g_object_unref0 (self->priv->connect_button);
	self->priv->connect_button = _tmp16_;
	_tmp17_ = network_vpn_menu_item_size_group;
	_tmp18_ = self->priv->connect_button;
	gtk_size_group_add_widget (_tmp17_, (GtkWidget*) _tmp18_);
	_tmp19_ = (GtkGrid*) gtk_grid_new ();
	gtk_grid_set_column_spacing (_tmp19_, 6);
	g_object_ref_sink (_tmp19_);
	grid = _tmp19_;
	_tmp20_ = grid;
	_tmp21_ = overlay;
	gtk_grid_attach (_tmp20_, (GtkWidget*) _tmp21_, 0, 0, 1, 2);
	_tmp22_ = grid;
	_tmp23_ = self->priv->vpn_label;
	gtk_grid_attach (_tmp22_, (GtkWidget*) _tmp23_, 1, 0, 1, 1);
	_tmp24_ = grid;
	_tmp25_ = self->priv->state_label;
	gtk_grid_attach (_tmp24_, (GtkWidget*) _tmp25_, 1, 1, 1, 1);
	_tmp26_ = grid;
	_tmp27_ = vpn_info_button;
	gtk_grid_attach (_tmp26_, (GtkWidget*) _tmp27_, 2, 0, 1, 2);
	_tmp28_ = grid;
	_tmp29_ = remove_button;
	gtk_grid_attach (_tmp28_, (GtkWidget*) _tmp29_, 3, 0, 1, 2);
	_tmp30_ = grid;
	_tmp31_ = self->priv->connect_button;
	gtk_grid_attach (_tmp30_, (GtkWidget*) _tmp31_, 4, 0, 1, 2);
	_tmp32_ = grid;
	gtk_list_box_row_set_child ((GtkListBoxRow*) self, (GtkWidget*) _tmp32_);
	g_signal_connect_object ((GObject*) self, "notify::state", (GCallback) _network_vpn_menu_item_update_g_object_notify, self, 0);
	_tmp33_ = self->priv->_connection;
	g_signal_connect_object ((NMConnection*) _tmp33_, "changed", (GCallback) _network_vpn_menu_item_update_nm_connection_changed, self, 0);
	network_vpn_menu_item_update (self);
	_tmp34_ = self->priv->connect_button;
	g_signal_connect_object (_tmp34_, "clicked", (GCallback) __network_vpn_menu_item___lambda10__gtk_button_clicked, self, 0);
	_tmp35_ = remove_button;
	g_signal_connect_object (_tmp35_, "clicked", (GCallback) _network_vpn_menu_item_remove_row_gtk_button_clicked, self, 0);
	_tmp36_ = vpn_info_button;
	g_signal_connect_object (_tmp36_, "clicked", (GCallback) __network_vpn_menu_item___lambda11__gtk_button_clicked, self, 0);
	_g_object_unref0 (grid);
	_g_object_unref0 (vpn_info_button);
	_g_object_unref0 (remove_button);
	_g_object_unref0 (overlay);
	_g_object_unref0 (image);
	return obj;
}

static void
network_vpn_menu_item_class_init (NetworkVPNMenuItemClass * klass,
                                  gpointer klass_data)
{
	GtkSizeGroup* _tmp0_;
	network_vpn_menu_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &NetworkVPNMenuItem_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_network_vpn_menu_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_network_vpn_menu_item_set_property;
	G_OBJECT_CLASS (klass)->constructor = network_vpn_menu_item_constructor;
	G_OBJECT_CLASS (klass)->finalize = network_vpn_menu_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), NETWORK_VPN_MENU_ITEM_CONNECTION_PROPERTY, network_vpn_menu_item_properties[NETWORK_VPN_MENU_ITEM_CONNECTION_PROPERTY] = g_param_spec_object ("connection", "connection", "connection", nm_remote_connection_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), NETWORK_VPN_MENU_ITEM_STATE_PROPERTY, network_vpn_menu_item_properties[NETWORK_VPN_MENU_ITEM_STATE_PROPERTY] = g_param_spec_enum ("state", "state", "state", nm_device_state_get_type (), NM_DEVICE_STATE_DISCONNECTED, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	network_vpn_menu_item_signals[NETWORK_VPN_MENU_ITEM_REMOVE_REQUEST_SIGNAL] = g_signal_new ("remove-request", NETWORK_TYPE_VPN_MENU_ITEM, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	_tmp0_ = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
	_g_object_unref0 (network_vpn_menu_item_size_group);
	network_vpn_menu_item_size_group = _tmp0_;
}

static void
network_vpn_menu_item_instance_init (NetworkVPNMenuItem * self,
                                     gpointer klass)
{
	self->priv = network_vpn_menu_item_get_instance_private (self);
	self->priv->_state = NM_DEVICE_STATE_DISCONNECTED;
}

static void
network_vpn_menu_item_finalize (GObject * obj)
{
	NetworkVPNMenuItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, NETWORK_TYPE_VPN_MENU_ITEM, NetworkVPNMenuItem);
	_g_object_unref0 (self->priv->_connection);
	_g_object_unref0 (self->priv->connect_button);
	_g_object_unref0 (self->priv->vpn_state);
	_g_object_unref0 (self->priv->state_label);
	_g_object_unref0 (self->priv->vpn_label);
	G_OBJECT_CLASS (network_vpn_menu_item_parent_class)->finalize (obj);
}

static GType
network_vpn_menu_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (NetworkVPNMenuItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) network_vpn_menu_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (NetworkVPNMenuItem), 0, (GInstanceInitFunc) network_vpn_menu_item_instance_init, NULL };
	GType network_vpn_menu_item_type_id;
	network_vpn_menu_item_type_id = g_type_register_static (gtk_list_box_row_get_type (), "NetworkVPNMenuItem", &g_define_type_info, 0);
	NetworkVPNMenuItem_private_offset = g_type_add_instance_private (network_vpn_menu_item_type_id, sizeof (NetworkVPNMenuItemPrivate));
	return network_vpn_menu_item_type_id;
}

GType
network_vpn_menu_item_get_type (void)
{
	static volatile gsize network_vpn_menu_item_type_id__once = 0;
	if (g_once_init_enter (&network_vpn_menu_item_type_id__once)) {
		GType network_vpn_menu_item_type_id;
		network_vpn_menu_item_type_id = network_vpn_menu_item_get_type_once ();
		g_once_init_leave (&network_vpn_menu_item_type_id__once, network_vpn_menu_item_type_id);
	}
	return network_vpn_menu_item_type_id__once;
}

static void
_vala_network_vpn_menu_item_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	NetworkVPNMenuItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, NETWORK_TYPE_VPN_MENU_ITEM, NetworkVPNMenuItem);
	switch (property_id) {
		case NETWORK_VPN_MENU_ITEM_CONNECTION_PROPERTY:
		g_value_set_object (value, network_vpn_menu_item_get_connection (self));
		break;
		case NETWORK_VPN_MENU_ITEM_STATE_PROPERTY:
		g_value_set_enum (value, network_vpn_menu_item_get_state (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_network_vpn_menu_item_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	NetworkVPNMenuItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, NETWORK_TYPE_VPN_MENU_ITEM, NetworkVPNMenuItem);
	switch (property_id) {
		case NETWORK_VPN_MENU_ITEM_CONNECTION_PROPERTY:
		network_vpn_menu_item_set_connection (self, g_value_get_object (value));
		break;
		case NETWORK_VPN_MENU_ITEM_STATE_PROPERTY:
		network_vpn_menu_item_set_state (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

