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

/*
* Copyright (c) 2015-2016 elementary LLC (http://launchpad.net/wingpanel-indicator-network)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Library 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 Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
*/

#include "networkapplet.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gdesktopappinfo.h>
#include <gio/gio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	NETWORK_WIDGETS_POPOVER_WIDGET_0_PROPERTY,
	NETWORK_WIDGETS_POPOVER_WIDGET_NUM_PROPERTIES
};
static GParamSpec* network_widgets_popover_widget_properties[NETWORK_WIDGETS_POPOVER_WIDGET_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block7Data Block7Data;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	NETWORK_WIDGETS_POPOVER_WIDGET_SETTINGS_SHOWN_SIGNAL,
	NETWORK_WIDGETS_POPOVER_WIDGET_NUM_SIGNALS
};
static guint network_widgets_popover_widget_signals[NETWORK_WIDGETS_POPOVER_WIDGET_NUM_SIGNALS] = {0};

struct _NetworkWidgetsPopoverWidgetPrivate {
	GtkBox* other_box;
	GtkBox* wifi_box;
	GtkBox* vpn_box;
	GtkModelButton* show_settings_button;
	GtkModelButton* hidden_item;
};

struct _Block7Data {
	int _ref_count_;
	NetworkWidgetsPopoverWidget* self;
	gboolean hidden_sensitivity;
};

static gint NetworkWidgetsPopoverWidget_private_offset;
static gpointer network_widgets_popover_widget_parent_class = NULL;
static GType network_widgets_popover_widget_type_id = 0;

static void network_widgets_popover_widget_real_build_ui (NetworkWidgetsNMVisualizer* base);
static void network_widgets_popover_widget_real_remove_interface (NetworkWidgetsNMVisualizer* base,
                                                           NetworkWidgetNMInterface* widget_interface);
static void network_widgets_popover_widget_real_add_interface (NetworkWidgetsNMVisualizer* base,
                                                        NetworkWidgetNMInterface* widget_interface);
static void ___lambda37_ (NetworkWidgetsPopoverWidget* self);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static void __lambda38_ (Block7Data* _data7_,
                  GtkWidget* child);
static void ___lambda38__gfunc (gconstpointer data,
                         gpointer self);
static void ____lambda37__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void network_widgets_popover_widget_show_settings (NetworkWidgetsPopoverWidget* self);
static void _network_widgets_popover_widget_show_settings_network_widget_nm_interface_need_settings (NetworkWidgetNMInterface* _sender,
                                                                                              gpointer self);
static void network_widgets_popover_widget_show_hidden_network_settings (NetworkWidgetsPopoverWidget* self);
static GObject * network_widgets_popover_widget_constructor (GType type,
                                                      guint n_construct_properties,
                                                      GObjectConstructParam * construct_properties);
static void _network_widgets_popover_widget_show_settings_gtk_button_clicked (GtkButton* _sender,
                                                                       gpointer self);
static void _network_widgets_popover_widget_show_hidden_network_settings_gtk_button_clicked (GtkButton* _sender,
                                                                                      gpointer self);
static void network_widgets_popover_widget_finalize (GObject * obj);

static inline gpointer
network_widgets_popover_widget_get_instance_private (NetworkWidgetsPopoverWidget* self)
{
	return G_STRUCT_MEMBER_P (self, NetworkWidgetsPopoverWidget_private_offset);
}

static void
network_widgets_popover_widget_real_build_ui (NetworkWidgetsNMVisualizer* base)
{
	NetworkWidgetsPopoverWidget * self;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkModelButton* _tmp6_;
	GtkModelButton* _tmp7_;
	GtkModelButton* _tmp8_;
	GtkModelButton* _tmp9_;
	GtkModelButton* _tmp10_;
	GtkModelButton* _tmp11_;
	GtkModelButton* _tmp12_;
	self = (NetworkWidgetsPopoverWidget*) base;
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->other_box);
	self->priv->other_box = _tmp0_;
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->wifi_box);
	self->priv->wifi_box = _tmp1_;
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->vpn_box);
	self->priv->vpn_box = _tmp2_;
	_tmp3_ = self->priv->other_box;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp3_);
	_tmp4_ = self->priv->wifi_box;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp4_);
	_tmp5_ = self->priv->vpn_box;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp5_);
	_tmp6_ = (GtkModelButton*) gtk_model_button_new ();
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->hidden_item);
	self->priv->hidden_item = _tmp6_;
	_tmp7_ = self->priv->hidden_item;
	g_object_set (_tmp7_, "text", _ ("Connect to Hidden Network…"), NULL);
	_tmp8_ = self->priv->hidden_item;
	gtk_widget_set_no_show_all ((GtkWidget*) _tmp8_, TRUE);
	_tmp9_ = (GtkModelButton*) gtk_model_button_new ();
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->show_settings_button);
	self->priv->show_settings_button = _tmp9_;
	_tmp10_ = self->priv->show_settings_button;
	g_object_set (_tmp10_, "text", _ ("Network Settings…"), NULL);
	_tmp11_ = self->priv->hidden_item;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp11_);
	_tmp12_ = self->priv->show_settings_button;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp12_);
}

static void
network_widgets_popover_widget_real_remove_interface (NetworkWidgetsNMVisualizer* base,
                                                      NetworkWidgetNMInterface* widget_interface)
{
	NetworkWidgetsPopoverWidget * self;
	NetworkWidgetsSeparator* _tmp0_;
	NetworkWidgetsSeparator* _tmp1_;
	self = (NetworkWidgetsPopoverWidget*) base;
	g_return_if_fail (widget_interface != NULL);
	_tmp0_ = network_widget_nm_interface_get_sep (widget_interface);
	_tmp1_ = _tmp0_;
	gtk_widget_destroy ((GtkWidget*) _tmp1_);
	gtk_widget_destroy ((GtkWidget*) widget_interface);
}

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

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		NetworkWidgetsPopoverWidget* self;
		self = _data7_->self;
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

static void
__lambda38_ (Block7Data* _data7_,
             GtkWidget* child)
{
	NetworkWidgetsPopoverWidget* self;
	GtkModelButton* _tmp3_;
	self = _data7_->self;
	g_return_if_fail (child != NULL);
	if (NETWORK_IS_WIFI_INTERFACE (child)) {
		gboolean _tmp0_ = FALSE;
		if (_data7_->hidden_sensitivity) {
			_tmp0_ = TRUE;
		} else {
			gboolean _tmp1_;
			gboolean _tmp2_;
			_tmp1_ = network_wifi_interface_get_hidden_sensitivity (G_TYPE_CHECK_INSTANCE_CAST (child, NETWORK_TYPE_WIFI_INTERFACE, NetworkWifiInterface));
			_tmp2_ = _tmp1_;
			_tmp0_ = _tmp2_;
		}
		_data7_->hidden_sensitivity = _tmp0_;
	}
	_tmp3_ = self->priv->hidden_item;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, _data7_->hidden_sensitivity);
}

static void
___lambda38__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda38_ (self, (GtkWidget*) data);
}

static void
___lambda37_ (NetworkWidgetsPopoverWidget* self)
{
	Block7Data* _data7_;
	GtkBox* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_data7_->hidden_sensitivity = FALSE;
	_tmp0_ = self->priv->wifi_box;
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
	_tmp2_ = _tmp1_;
	g_list_foreach (_tmp2_, ___lambda38__gfunc, _data7_);
	(_tmp2_ == NULL) ? NULL : (_tmp2_ = (g_list_free (_tmp2_), NULL));
	block7_data_unref (_data7_);
	_data7_ = NULL;
}

static void
____lambda37__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	___lambda37_ ((NetworkWidgetsPopoverWidget*) self);
}

static void
_network_widgets_popover_widget_show_settings_network_widget_nm_interface_need_settings (NetworkWidgetNMInterface* _sender,
                                                                                         gpointer self)
{
	network_widgets_popover_widget_show_settings ((NetworkWidgetsPopoverWidget*) self);
}

static void
network_widgets_popover_widget_real_add_interface (NetworkWidgetsNMVisualizer* base,
                                                   NetworkWidgetNMInterface* widget_interface)
{
	NetworkWidgetsPopoverWidget * self;
	GtkBox* container_box = NULL;
	GtkBox* _tmp0_;
	GtkBox* _tmp1_;
	GList* _tmp8_;
	GList* _tmp9_;
	gboolean _tmp10_;
	GtkBox* _tmp14_;
	self = (NetworkWidgetsPopoverWidget*) base;
	g_return_if_fail (widget_interface != NULL);
	_tmp0_ = self->priv->other_box;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	container_box = _tmp1_;
	if (NETWORK_IS_WIFI_INTERFACE (widget_interface)) {
		GtkBox* _tmp2_;
		GtkBox* _tmp3_;
		GtkModelButton* _tmp4_;
		GtkModelButton* _tmp5_;
		_tmp2_ = self->priv->wifi_box;
		_tmp3_ = _g_object_ref0 (_tmp2_);
		_g_object_unref0 (container_box);
		container_box = _tmp3_;
		_tmp4_ = self->priv->hidden_item;
		gtk_widget_set_no_show_all ((GtkWidget*) _tmp4_, FALSE);
		_tmp5_ = self->priv->hidden_item;
		gtk_widget_show_all ((GtkWidget*) _tmp5_);
		g_signal_connect_object ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (widget_interface, NETWORK_TYPE_WIFI_INTERFACE, NetworkWifiInterface), "notify::hidden-sensitivity", (GCallback) ____lambda37__g_object_notify, self, 0);
	}
	if (NETWORK_IS_VPN_INTERFACE (widget_interface)) {
		GtkBox* _tmp6_;
		GtkBox* _tmp7_;
		_tmp6_ = self->priv->vpn_box;
		_tmp7_ = _g_object_ref0 (_tmp6_);
		_g_object_unref0 (container_box);
		container_box = _tmp7_;
	}
	_tmp8_ = gtk_container_get_children ((GtkContainer*) self);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_list_length (_tmp9_) > ((guint) 0);
	(_tmp9_ == NULL) ? NULL : (_tmp9_ = (g_list_free (_tmp9_), NULL));
	if (_tmp10_) {
		GtkBox* _tmp11_;
		NetworkWidgetsSeparator* _tmp12_;
		NetworkWidgetsSeparator* _tmp13_;
		_tmp11_ = container_box;
		_tmp12_ = network_widget_nm_interface_get_sep (widget_interface);
		_tmp13_ = _tmp12_;
		gtk_box_pack_end (_tmp11_, (GtkWidget*) _tmp13_, TRUE, TRUE, (guint) 0);
	}
	_tmp14_ = container_box;
	gtk_box_pack_end (_tmp14_, (GtkWidget*) widget_interface, TRUE, TRUE, (guint) 0);
	g_signal_connect_object (widget_interface, "need-settings", (GCallback) _network_widgets_popover_widget_show_settings_network_widget_nm_interface_need_settings, self, 0);
	_g_object_unref0 (container_box);
}

void
network_widgets_popover_widget_opened (NetworkWidgetsPopoverWidget* self)
{
	GtkBox* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->wifi_box;
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
	{
		GList* widget_collection = NULL;
		GList* widget_it = NULL;
		widget_collection = _tmp1_;
		for (widget_it = widget_collection; widget_it != NULL; widget_it = widget_it->next) {
			GtkWidget* widget = NULL;
			widget = (GtkWidget*) widget_it->data;
			{
				GtkWidget* _tmp2_;
				_tmp2_ = widget;
				if (NETWORK_IS_WIFI_INTERFACE (_tmp2_)) {
					GtkWidget* _tmp3_;
					_tmp3_ = widget;
					network_wifi_interface_start_scanning (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, NETWORK_TYPE_WIFI_INTERFACE, NetworkWifiInterface));
				}
			}
		}
		(widget_collection == NULL) ? NULL : (widget_collection = (g_list_free (widget_collection), NULL));
	}
}

void
network_widgets_popover_widget_closed (NetworkWidgetsPopoverWidget* self)
{
	GtkBox* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->wifi_box;
	_tmp1_ = gtk_container_get_children ((GtkContainer*) _tmp0_);
	{
		GList* widget_collection = NULL;
		GList* widget_it = NULL;
		widget_collection = _tmp1_;
		for (widget_it = widget_collection; widget_it != NULL; widget_it = widget_it->next) {
			GtkWidget* widget = NULL;
			widget = (GtkWidget*) widget_it->data;
			{
				GtkWidget* _tmp2_;
				_tmp2_ = widget;
				if (NETWORK_IS_WIFI_INTERFACE (_tmp2_)) {
					GtkWidget* _tmp3_;
					_tmp3_ = widget;
					network_wifi_interface_cancel_scanning (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, NETWORK_TYPE_WIFI_INTERFACE, NetworkWifiInterface));
				}
			}
		}
		(widget_collection == NULL) ? NULL : (widget_collection = (g_list_free (widget_collection), NULL));
	}
}

static void
network_widgets_popover_widget_show_settings (NetworkWidgetsPopoverWidget* self)
{
	gchar* paneldesktop = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	GDesktopAppInfo* app_info = NULL;
	const gchar* _tmp5_;
	GDesktopAppInfo* _tmp6_;
	GDesktopAppInfo* _tmp7_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("gnome-wifi-panel.desktop");
	paneldesktop = _tmp0_;
	_tmp1_ = g_find_program_in_path ("budgie-control-center");
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ != NULL;
	_g_free0 (_tmp2_);
	if (_tmp3_) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup ("budgie-wifi-panel.desktop");
		_g_free0 (paneldesktop);
		paneldesktop = _tmp4_;
	}
	_tmp5_ = paneldesktop;
	_tmp6_ = g_desktop_app_info_new (_tmp5_);
	app_info = _tmp6_;
	_tmp7_ = app_info;
	if (_tmp7_ == NULL) {
		_g_object_unref0 (app_info);
		_g_free0 (paneldesktop);
		return;
	}
	{
		GDesktopAppInfo* _tmp8_;
		_tmp8_ = app_info;
		g_app_info_launch ((GAppInfo*) _tmp8_, NULL, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp9_;
		const gchar* _tmp10_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp9_ = e;
		_tmp10_ = _tmp9_->message;
		g_message ("PopoverWidget.vala:124: Unable to launch gnome-wifi-panel.desktop: %s", _tmp10_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (app_info);
		_g_free0 (paneldesktop);
		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;
	}
	g_signal_emit (self, network_widgets_popover_widget_signals[NETWORK_WIDGETS_POPOVER_WIDGET_SETTINGS_SHOWN_SIGNAL], 0);
	_g_object_unref0 (app_info);
	_g_free0 (paneldesktop);
}

static void
network_widgets_popover_widget_show_hidden_network_settings (NetworkWidgetsPopoverWidget* self)
{
	gchar* control_center = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	gchar* commandline = NULL;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("gnome-control-center");
	control_center = _tmp0_;
	_tmp1_ = g_find_program_in_path ("budgie-control-center");
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ != NULL;
	_g_free0 (_tmp2_);
	if (_tmp3_) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup ("budgie-control-center");
		_g_free0 (control_center);
		control_center = _tmp4_;
	}
	_tmp5_ = control_center;
	_tmp6_ = g_strjoin (" ", _tmp5_, "wifi", "connect-hidden-wifi", NULL);
	commandline = _tmp6_;
	{
		GAppInfo* appinfo = NULL;
		const gchar* _tmp7_;
		GAppInfo* _tmp8_;
		GAppInfo* _tmp9_;
		_tmp7_ = commandline;
		_tmp8_ = g_app_info_create_from_commandline (_tmp7_, NULL, G_APP_INFO_CREATE_NONE, &_inner_error0_);
		appinfo = _tmp8_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp9_ = appinfo;
		g_app_info_launch (_tmp9_, NULL, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (appinfo);
			goto __catch0_g_error;
		}
		_g_object_unref0 (appinfo);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp10_;
		GError* _tmp11_;
		const gchar* _tmp12_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp10_ = control_center;
		_tmp11_ = e;
		_tmp12_ = _tmp11_->message;
		g_message ("PopoverWidget.vala:142: Unable to launch %s: %s", _tmp10_, _tmp12_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (commandline);
		_g_free0 (control_center);
		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;
	}
	g_signal_emit (self, network_widgets_popover_widget_signals[NETWORK_WIDGETS_POPOVER_WIDGET_SETTINGS_SHOWN_SIGNAL], 0);
	_g_free0 (commandline);
	_g_free0 (control_center);
}

NetworkWidgetsPopoverWidget*
network_widgets_popover_widget_construct (GType object_type)
{
	NetworkWidgetsPopoverWidget * self = NULL;
	self = (NetworkWidgetsPopoverWidget*) network_widgets_nm_visualizer_construct (object_type);
	return self;
}

NetworkWidgetsPopoverWidget*
network_widgets_popover_widget_new (void)
{
	return network_widgets_popover_widget_construct (NETWORK_WIDGETS_TYPE_POPOVER_WIDGET);
}

static void
_network_widgets_popover_widget_show_settings_gtk_button_clicked (GtkButton* _sender,
                                                                  gpointer self)
{
	network_widgets_popover_widget_show_settings ((NetworkWidgetsPopoverWidget*) self);
}

static void
_network_widgets_popover_widget_show_hidden_network_settings_gtk_button_clicked (GtkButton* _sender,
                                                                                 gpointer self)
{
	network_widgets_popover_widget_show_hidden_network_settings ((NetworkWidgetsPopoverWidget*) self);
}

static GObject *
network_widgets_popover_widget_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	NetworkWidgetsPopoverWidget * self;
	GtkModelButton* _tmp0_;
	GtkModelButton* _tmp1_;
	parent_class = G_OBJECT_CLASS (network_widgets_popover_widget_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, NETWORK_WIDGETS_TYPE_POPOVER_WIDGET, NetworkWidgetsPopoverWidget);
	_tmp0_ = self->priv->show_settings_button;
	g_signal_connect_object ((GtkButton*) _tmp0_, "clicked", (GCallback) _network_widgets_popover_widget_show_settings_gtk_button_clicked, self, 0);
	_tmp1_ = self->priv->hidden_item;
	g_signal_connect_object ((GtkButton*) _tmp1_, "clicked", (GCallback) _network_widgets_popover_widget_show_hidden_network_settings_gtk_button_clicked, self, 0);
	return obj;
}

static void
network_widgets_popover_widget_class_init (NetworkWidgetsPopoverWidgetClass * klass,
                                           gpointer klass_data)
{
	network_widgets_popover_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &NetworkWidgetsPopoverWidget_private_offset);
	((NetworkWidgetsNMVisualizerClass *) klass)->build_ui = (void (*) (NetworkWidgetsNMVisualizer*)) network_widgets_popover_widget_real_build_ui;
	((NetworkWidgetsNMVisualizerClass *) klass)->remove_interface = (void (*) (NetworkWidgetsNMVisualizer*, NetworkWidgetNMInterface*)) network_widgets_popover_widget_real_remove_interface;
	((NetworkWidgetsNMVisualizerClass *) klass)->add_interface = (void (*) (NetworkWidgetsNMVisualizer*, NetworkWidgetNMInterface*)) network_widgets_popover_widget_real_add_interface;
	G_OBJECT_CLASS (klass)->constructor = network_widgets_popover_widget_constructor;
	G_OBJECT_CLASS (klass)->finalize = network_widgets_popover_widget_finalize;
	network_widgets_popover_widget_signals[NETWORK_WIDGETS_POPOVER_WIDGET_SETTINGS_SHOWN_SIGNAL] = g_signal_new ("settings-shown", NETWORK_WIDGETS_TYPE_POPOVER_WIDGET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
network_widgets_popover_widget_instance_init (NetworkWidgetsPopoverWidget * self,
                                              gpointer klass)
{
	self->priv = network_widgets_popover_widget_get_instance_private (self);
}

static void
network_widgets_popover_widget_finalize (GObject * obj)
{
	NetworkWidgetsPopoverWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, NETWORK_WIDGETS_TYPE_POPOVER_WIDGET, NetworkWidgetsPopoverWidget);
	_g_object_unref0 (self->priv->other_box);
	_g_object_unref0 (self->priv->wifi_box);
	_g_object_unref0 (self->priv->vpn_box);
	_g_object_unref0 (self->priv->show_settings_button);
	_g_object_unref0 (self->priv->hidden_item);
	G_OBJECT_CLASS (network_widgets_popover_widget_parent_class)->finalize (obj);
}

GType
network_widgets_popover_widget_get_type (void)
{
	return network_widgets_popover_widget_type_id;
}

GType
network_widgets_popover_widget_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (NetworkWidgetsPopoverWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) network_widgets_popover_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (NetworkWidgetsPopoverWidget), 0, (GInstanceInitFunc) network_widgets_popover_widget_instance_init, NULL };
	network_widgets_popover_widget_type_id = g_type_module_register_type (module, NETWORK_WIDGETS_TYPE_NM_VISUALIZER, "NetworkWidgetsPopoverWidget", &g_define_type_info, 0);
	NetworkWidgetsPopoverWidget_private_offset = sizeof (NetworkWidgetsPopoverWidgetPrivate);
	return network_widgets_popover_widget_type_id;
}

