/* prefs-keyservers.c generated by valac 0.56.3, the Vala compiler
 * generated from prefs-keyservers.vala, do not modify */

/*
 * Seahorse
 *
 * Copyright (C) 2004-2005 Stefan Walter
 * Copyright (C) 2017 Niels De Graef
 *
 * This program 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.
 *
 * 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 General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see
 * <http://www.gnu.org/licenses/>.
 */

#include "seahorse-common.h"
#include <gtk/gtk.h>
#include <glib-object.h>
#include <gio/gio.h>
#include "pgp/seahorse-pgp-backend.h"
#include <glib.h>
#include "pgp/seahorse-server-source.h"
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>

enum  {
	SEAHORSE_PREFS_KEYSERVERS_0_PROPERTY,
	SEAHORSE_PREFS_KEYSERVERS_NUM_PROPERTIES
};
static GParamSpec* seahorse_prefs_keyservers_properties[SEAHORSE_PREFS_KEYSERVERS_NUM_PROPERTIES];

#define SEAHORSE_PREFS_KEYSERVERS_TYPE_KEY_SERVER_ROW (seahorse_prefs_keyservers_key_server_row_get_type ())
#define SEAHORSE_PREFS_KEYSERVERS_KEY_SERVER_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_PREFS_KEYSERVERS_TYPE_KEY_SERVER_ROW, SeahorsePrefsKeyserversKeyServerRow))
#define SEAHORSE_PREFS_KEYSERVERS_KEY_SERVER_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_PREFS_KEYSERVERS_TYPE_KEY_SERVER_ROW, SeahorsePrefsKeyserversKeyServerRowClass))
#define SEAHORSE_PREFS_KEYSERVERS_IS_KEY_SERVER_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_PREFS_KEYSERVERS_TYPE_KEY_SERVER_ROW))
#define SEAHORSE_PREFS_KEYSERVERS_IS_KEY_SERVER_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_PREFS_KEYSERVERS_TYPE_KEY_SERVER_ROW))
#define SEAHORSE_PREFS_KEYSERVERS_KEY_SERVER_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_PREFS_KEYSERVERS_TYPE_KEY_SERVER_ROW, SeahorsePrefsKeyserversKeyServerRowClass))

typedef struct _SeahorsePrefsKeyserversKeyServerRow SeahorsePrefsKeyserversKeyServerRow;
typedef struct _SeahorsePrefsKeyserversKeyServerRowClass SeahorsePrefsKeyserversKeyServerRowClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _SeahorsePrefsKeyserversKeyServerRowPrivate SeahorsePrefsKeyserversKeyServerRowPrivate;
enum  {
	SEAHORSE_PREFS_KEYSERVERS_KEY_SERVER_ROW_0_PROPERTY,
	SEAHORSE_PREFS_KEYSERVERS_KEY_SERVER_ROW_NUM_PROPERTIES
};
static GParamSpec* seahorse_prefs_keyservers_key_server_row_properties[SEAHORSE_PREFS_KEYSERVERS_KEY_SERVER_ROW_NUM_PROPERTIES];

struct _SeahorsePrefsKeyserversPrivate {
	GtkListBox* keyservers_list;
	GtkBox* keyserver_publish;
	GtkLabel* keyserver_publish_to_label;
	GtkCheckButton* auto_retrieve;
	GtkCheckButton* auto_sync;
};

struct _SeahorsePrefsKeyserversKeyServerRow {
	GtkListBoxRow parent_instance;
	SeahorsePrefsKeyserversKeyServerRowPrivate * priv;
};

struct _SeahorsePrefsKeyserversKeyServerRowClass {
	GtkListBoxRowClass parent_class;
};

struct _SeahorsePrefsKeyserversKeyServerRowPrivate {
	SeahorseServerSource* server;
	GtkLabel* label;
	GtkEntry* entry;
};

static gint SeahorsePrefsKeyservers_private_offset;
static gpointer seahorse_prefs_keyservers_parent_class = NULL;
static gint SeahorsePrefsKeyserversKeyServerRow_private_offset;
static gpointer seahorse_prefs_keyservers_key_server_row_parent_class = NULL;

static GtkWidget* __lambda15_ (SeahorsePrefsKeyservers* self,
                        GObject* item);
static SeahorsePrefsKeyserversKeyServerRow* seahorse_prefs_keyservers_key_server_row_new (SeahorseServerSource* server);
static SeahorsePrefsKeyserversKeyServerRow* seahorse_prefs_keyservers_key_server_row_construct (GType object_type,
                                                                                         SeahorseServerSource* server);
static GType seahorse_prefs_keyservers_key_server_row_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static GtkWidget* ___lambda15__gtk_list_box_create_widget_func (GObject* item,
                                                         gpointer self);
static void seahorse_prefs_keyservers_on_add_button_clicked (SeahorsePrefsKeyservers* self,
                                                      GtkButton* button);
static void _seahorse_prefs_keyservers_on_add_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self);
static void seahorse_prefs_keyservers_key_server_row_on_entry_activated (SeahorsePrefsKeyserversKeyServerRow* self,
                                                                  GtkEntry* entry);
static void _seahorse_prefs_keyservers_key_server_row_on_entry_activated_gtk_entry_activate (GtkEntry* _sender,
                                                                                      gpointer self);
static void seahorse_prefs_keyservers_key_server_row_on_remove_button_clicked (SeahorsePrefsKeyserversKeyServerRow* self,
                                                                        GtkButton* remove_button);
static void _seahorse_prefs_keyservers_key_server_row_on_remove_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                            gpointer self);
static void seahorse_prefs_keyservers_key_server_row_on_edit_button_clicked (SeahorsePrefsKeyserversKeyServerRow* self,
                                                                      GtkButton* edit_button);
static void _seahorse_prefs_keyservers_key_server_row_on_edit_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                          gpointer self);
static void seahorse_prefs_keyservers_key_server_row_finalize (GObject * obj);
static GType seahorse_prefs_keyservers_key_server_row_get_type_once (void);
static void seahorse_prefs_keyservers_finalize (GObject * obj);
static GType seahorse_prefs_keyservers_get_type_once (void);

static inline gpointer
seahorse_prefs_keyservers_get_instance_private (SeahorsePrefsKeyservers* self)
{
	return G_STRUCT_MEMBER_P (self, SeahorsePrefsKeyservers_private_offset);
}

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

static GtkWidget*
__lambda15_ (SeahorsePrefsKeyservers* self,
             GObject* item)
{
	SeahorsePrefsKeyserversKeyServerRow* _tmp0_;
	GtkWidget* result;
	g_return_val_if_fail (item != NULL, NULL);
	_tmp0_ = seahorse_prefs_keyservers_key_server_row_new (G_TYPE_CHECK_INSTANCE_TYPE (item, SEAHORSE_TYPE_SERVER_SOURCE) ? ((SeahorseServerSource*) item) : NULL);
	g_object_ref_sink (_tmp0_);
	result = (GtkWidget*) _tmp0_;
	return result;
}

static GtkWidget*
___lambda15__gtk_list_box_create_widget_func (GObject* item,
                                              gpointer self)
{
	GtkWidget* result;
	result = __lambda15_ ((SeahorsePrefsKeyservers*) self, item);
	return result;
}

SeahorsePrefsKeyservers*
seahorse_prefs_keyservers_construct (GType object_type)
{
	SeahorsePrefsKeyservers * self = NULL;
	GListModel* model = NULL;
	SeahorsePgpBackend* _tmp0_;
	GListModel* _tmp1_;
	GListModel* _tmp2_;
	GtkListBox* _tmp3_;
	SeahorseKeyserverControl* skc = NULL;
	SeahorseKeyserverControl* _tmp4_;
	GtkBox* _tmp5_;
	GtkBox* _tmp6_;
	GtkLabel* _tmp7_;
	SeahorseAppSettings* _tmp8_;
	SeahorseAppSettings* _tmp9_;
	GtkCheckButton* _tmp10_;
	SeahorseAppSettings* _tmp11_;
	SeahorseAppSettings* _tmp12_;
	GtkCheckButton* _tmp13_;
	self = (SeahorsePrefsKeyservers*) g_object_new (object_type, NULL);
	_tmp0_ = seahorse_pgp_backend_get ();
	_tmp1_ = seahorse_pgp_backend_get_remotes (_tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	model = _tmp2_;
	_tmp3_ = self->priv->keyservers_list;
	gtk_list_box_bind_model (_tmp3_, model, ___lambda15__gtk_list_box_create_widget_func, g_object_ref (self), g_object_unref);
	_tmp4_ = seahorse_keyserver_control_new ("server-publish-to", _ ("None: Don’t publish keys"));
	g_object_ref_sink (_tmp4_);
	skc = _tmp4_;
	_tmp5_ = self->priv->keyserver_publish;
	gtk_container_add ((GtkContainer*) _tmp5_, (GtkWidget*) skc);
	_tmp6_ = self->priv->keyserver_publish;
	gtk_widget_show_all ((GtkWidget*) _tmp6_);
	_tmp7_ = self->priv->keyserver_publish_to_label;
	gtk_label_set_mnemonic_widget (_tmp7_, (GtkWidget*) skc);
	_tmp8_ = seahorse_app_settings_instance ();
	_tmp9_ = _tmp8_;
	_tmp10_ = self->priv->auto_retrieve;
	g_settings_bind ((GSettings*) _tmp9_, "server-auto-retrieve", (GObject*) _tmp10_, "active", G_SETTINGS_BIND_DEFAULT);
	_g_object_unref0 (_tmp9_);
	_tmp11_ = seahorse_app_settings_instance ();
	_tmp12_ = _tmp11_;
	_tmp13_ = self->priv->auto_sync;
	g_settings_bind ((GSettings*) _tmp12_, "server-auto-publish", (GObject*) _tmp13_, "active", G_SETTINGS_BIND_DEFAULT);
	_g_object_unref0 (_tmp12_);
	_g_object_unref0 (skc);
	_g_object_unref0 (model);
	return self;
}

SeahorsePrefsKeyservers*
seahorse_prefs_keyservers_new (void)
{
	return seahorse_prefs_keyservers_construct (SEAHORSE_TYPE_PREFS_KEYSERVERS);
}

static void
seahorse_prefs_keyservers_on_add_button_clicked (SeahorsePrefsKeyservers* self,
                                                 GtkButton* button)
{
	SeahorseAddKeyserverDialog* dialog = NULL;
	GtkWidget* _tmp0_;
	SeahorseAddKeyserverDialog* _tmp1_;
	SeahorseAddKeyserverDialog* _tmp2_;
	SeahorseAddKeyserverDialog* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_tmp0_ = gtk_widget_get_toplevel ((GtkWidget*) self);
	_tmp1_ = seahorse_add_keyserver_dialog_new (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_window_get_type ()) ? ((GtkWindow*) _tmp0_) : NULL);
	g_object_ref_sink (_tmp1_);
	dialog = _tmp1_;
	_tmp2_ = dialog;
	if (gtk_dialog_run ((GtkDialog*) _tmp2_) == ((gint) GTK_RESPONSE_OK)) {
		gchar* _result_ = NULL;
		SeahorseAddKeyserverDialog* _tmp3_;
		gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp3_ = dialog;
		_tmp4_ = seahorse_add_keyserver_dialog_calculate_keyserver_uri (_tmp3_);
		_result_ = _tmp4_;
		_tmp5_ = _result_;
		if (_tmp5_ != NULL) {
			SeahorsePgpBackend* _tmp6_;
			const gchar* _tmp7_;
			_tmp6_ = seahorse_pgp_backend_get ();
			_tmp7_ = _result_;
			seahorse_pgp_backend_add_remote (_tmp6_, _tmp7_, TRUE);
		}
		_g_free0 (_result_);
	}
	_tmp8_ = dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp8_);
	_g_object_unref0 (dialog);
}

static void
_seahorse_prefs_keyservers_on_add_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                     gpointer self)
{
	seahorse_prefs_keyservers_on_add_button_clicked ((SeahorsePrefsKeyservers*) self, _sender);
}

static inline gpointer
seahorse_prefs_keyservers_key_server_row_get_instance_private (SeahorsePrefsKeyserversKeyServerRow* self)
{
	return G_STRUCT_MEMBER_P (self, SeahorsePrefsKeyserversKeyServerRow_private_offset);
}

static void
_seahorse_prefs_keyservers_key_server_row_on_entry_activated_gtk_entry_activate (GtkEntry* _sender,
                                                                                 gpointer self)
{
	seahorse_prefs_keyservers_key_server_row_on_entry_activated ((SeahorsePrefsKeyserversKeyServerRow*) self, _sender);
}

static void
_seahorse_prefs_keyservers_key_server_row_on_remove_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                       gpointer self)
{
	seahorse_prefs_keyservers_key_server_row_on_remove_button_clicked ((SeahorsePrefsKeyserversKeyServerRow*) self, _sender);
}

static void
_seahorse_prefs_keyservers_key_server_row_on_edit_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                     gpointer self)
{
	seahorse_prefs_keyservers_key_server_row_on_edit_button_clicked ((SeahorsePrefsKeyserversKeyServerRow*) self, _sender);
}

static SeahorsePrefsKeyserversKeyServerRow*
seahorse_prefs_keyservers_key_server_row_construct (GType object_type,
                                                    SeahorseServerSource* server)
{
	SeahorsePrefsKeyserversKeyServerRow * self = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GtkLabel* _tmp4_;
	GtkLabel* _tmp5_;
	GtkEntry* _tmp6_;
	GtkEntry* _tmp7_;
	GtkEntry* _tmp8_;
	GtkEntry* _tmp9_;
	GtkEntry* _tmp10_;
	GtkButton* remove_button = NULL;
	GtkButton* _tmp11_;
	GtkStyleContext* _tmp12_;
	GtkButton* edit_button = NULL;
	GtkButton* _tmp13_;
	GtkStyleContext* _tmp14_;
	g_return_val_if_fail (server != NULL, NULL);
	self = (SeahorsePrefsKeyserversKeyServerRow*) g_object_new (object_type, NULL);
	self->priv->server = server;
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	g_object_set ((GtkWidget*) box, "margin", 6, NULL);
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) box);
	_tmp1_ = seahorse_place_get_uri ((SeahorsePlace*) server);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = (GtkLabel*) gtk_label_new (_tmp3_);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->label);
	self->priv->label = _tmp4_;
	_g_free0 (_tmp3_);
	_tmp5_ = self->priv->label;
	gtk_box_pack_start (box, (GtkWidget*) _tmp5_, FALSE, TRUE, (guint) 0);
	_tmp6_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->entry);
	self->priv->entry = _tmp6_;
	_tmp7_ = self->priv->entry;
	gtk_widget_set_no_show_all ((GtkWidget*) _tmp7_, TRUE);
	_tmp8_ = self->priv->entry;
	gtk_widget_hide ((GtkWidget*) _tmp8_);
	_tmp9_ = self->priv->entry;
	g_signal_connect_object (_tmp9_, "activate", (GCallback) _seahorse_prefs_keyservers_key_server_row_on_entry_activated_gtk_entry_activate, self, 0);
	_tmp10_ = self->priv->entry;
	gtk_box_pack_start (box, (GtkWidget*) _tmp10_, TRUE, TRUE, (guint) 0);
	_tmp11_ = (GtkButton*) gtk_button_new_from_icon_name ("list-remove-symbolic", (GtkIconSize) GTK_ICON_SIZE_BUTTON);
	g_object_ref_sink (_tmp11_);
	remove_button = _tmp11_;
	_tmp12_ = gtk_widget_get_style_context ((GtkWidget*) remove_button);
	gtk_style_context_add_class (_tmp12_, "flat");
	g_signal_connect_object (remove_button, "clicked", (GCallback) _seahorse_prefs_keyservers_key_server_row_on_remove_button_clicked_gtk_button_clicked, self, 0);
	gtk_box_pack_end (box, (GtkWidget*) remove_button, FALSE, TRUE, (guint) 0);
	_tmp13_ = (GtkButton*) gtk_button_new_from_icon_name ("document-edit-symbolic", (GtkIconSize) GTK_ICON_SIZE_BUTTON);
	g_object_ref_sink (_tmp13_);
	edit_button = _tmp13_;
	_tmp14_ = gtk_widget_get_style_context ((GtkWidget*) edit_button);
	gtk_style_context_add_class (_tmp14_, "flat");
	g_signal_connect_object (edit_button, "clicked", (GCallback) _seahorse_prefs_keyservers_key_server_row_on_edit_button_clicked_gtk_button_clicked, self, 0);
	gtk_box_pack_end (box, (GtkWidget*) edit_button, FALSE, TRUE, (guint) 0);
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (edit_button);
	_g_object_unref0 (remove_button);
	_g_object_unref0 (box);
	return self;
}

static SeahorsePrefsKeyserversKeyServerRow*
seahorse_prefs_keyservers_key_server_row_new (SeahorseServerSource* server)
{
	return seahorse_prefs_keyservers_key_server_row_construct (SEAHORSE_PREFS_KEYSERVERS_TYPE_KEY_SERVER_ROW, server);
}

static void
seahorse_prefs_keyservers_key_server_row_on_edit_button_clicked (SeahorsePrefsKeyserversKeyServerRow* self,
                                                                 GtkButton* edit_button)
{
	GtkLabel* _tmp0_;
	GtkEntry* _tmp1_;
	GtkLabel* _tmp2_;
	const gchar* _tmp3_;
	GtkEntry* _tmp4_;
	GtkEntry* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (edit_button != NULL);
	_tmp0_ = self->priv->label;
	gtk_widget_hide ((GtkWidget*) _tmp0_);
	_tmp1_ = self->priv->entry;
	_tmp2_ = self->priv->label;
	_tmp3_ = gtk_label_get_text (_tmp2_);
	gtk_entry_set_text (_tmp1_, _tmp3_);
	_tmp4_ = self->priv->entry;
	gtk_widget_show_now ((GtkWidget*) _tmp4_);
	_tmp5_ = self->priv->entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp5_);
}

static void
seahorse_prefs_keyservers_key_server_row_on_remove_button_clicked (SeahorsePrefsKeyserversKeyServerRow* self,
                                                                   GtkButton* remove_button)
{
	SeahorsePgpBackend* _tmp0_;
	SeahorseServerSource* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (remove_button != NULL);
	_tmp0_ = seahorse_pgp_backend_get ();
	_tmp1_ = self->priv->server;
	_tmp2_ = seahorse_place_get_uri ((SeahorsePlace*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	seahorse_pgp_backend_remove_remote (_tmp0_, _tmp4_);
	_g_free0 (_tmp4_);
}

static void
seahorse_prefs_keyservers_key_server_row_on_entry_activated (SeahorsePrefsKeyserversKeyServerRow* self,
                                                             GtkEntry* entry)
{
	gchar* uri = NULL;
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	SeahorseServerSource* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gboolean _tmp8_;
	const gchar* _tmp10_;
	SeahorsePgpBackend* _tmp13_;
	SeahorseServerSource* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	SeahorsePgpBackend* _tmp18_;
	const gchar* _tmp19_;
	GtkEntry* _tmp20_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entry != NULL);
	_tmp0_ = self->priv->entry;
	_tmp1_ = gtk_entry_get_text (_tmp0_);
	_tmp2_ = g_strdup (_tmp1_);
	uri = _tmp2_;
	_tmp3_ = uri;
	_tmp4_ = self->priv->server;
	_tmp5_ = seahorse_place_get_uri ((SeahorsePlace*) _tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strcmp0 (_tmp3_, _tmp7_) == 0;
	_g_free0 (_tmp7_);
	if (_tmp8_) {
		GtkEntry* _tmp9_;
		_tmp9_ = self->priv->entry;
		gtk_widget_hide ((GtkWidget*) _tmp9_);
		_g_free0 (uri);
		return;
	}
	_tmp10_ = uri;
	if (!seahorse_server_category_is_valid_uri (_tmp10_)) {
		GtkEntry* _tmp11_;
		GtkStyleContext* _tmp12_;
		_tmp11_ = self->priv->entry;
		_tmp12_ = gtk_widget_get_style_context ((GtkWidget*) _tmp11_);
		gtk_style_context_add_class (_tmp12_, "error");
		_g_free0 (uri);
		return;
	}
	_tmp13_ = seahorse_pgp_backend_get ();
	_tmp14_ = self->priv->server;
	_tmp15_ = seahorse_place_get_uri ((SeahorsePlace*) _tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = _tmp16_;
	seahorse_pgp_backend_remove_remote (_tmp13_, _tmp17_);
	_g_free0 (_tmp17_);
	_tmp18_ = seahorse_pgp_backend_get ();
	_tmp19_ = uri;
	seahorse_pgp_backend_add_remote (_tmp18_, _tmp19_, TRUE);
	_tmp20_ = self->priv->entry;
	gtk_widget_hide ((GtkWidget*) _tmp20_);
	_g_free0 (uri);
}

static void
seahorse_prefs_keyservers_key_server_row_class_init (SeahorsePrefsKeyserversKeyServerRowClass * klass,
                                                     gpointer klass_data)
{
	seahorse_prefs_keyservers_key_server_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SeahorsePrefsKeyserversKeyServerRow_private_offset);
	G_OBJECT_CLASS (klass)->finalize = seahorse_prefs_keyservers_key_server_row_finalize;
}

static void
seahorse_prefs_keyservers_key_server_row_instance_init (SeahorsePrefsKeyserversKeyServerRow * self,
                                                        gpointer klass)
{
	self->priv = seahorse_prefs_keyservers_key_server_row_get_instance_private (self);
}

static void
seahorse_prefs_keyservers_key_server_row_finalize (GObject * obj)
{
	SeahorsePrefsKeyserversKeyServerRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEAHORSE_PREFS_KEYSERVERS_TYPE_KEY_SERVER_ROW, SeahorsePrefsKeyserversKeyServerRow);
	_g_object_unref0 (self->priv->label);
	_g_object_unref0 (self->priv->entry);
	G_OBJECT_CLASS (seahorse_prefs_keyservers_key_server_row_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
seahorse_prefs_keyservers_key_server_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SeahorsePrefsKeyserversKeyServerRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_prefs_keyservers_key_server_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorsePrefsKeyserversKeyServerRow), 0, (GInstanceInitFunc) seahorse_prefs_keyservers_key_server_row_instance_init, NULL };
	GType seahorse_prefs_keyservers_key_server_row_type_id;
	seahorse_prefs_keyservers_key_server_row_type_id = g_type_register_static (gtk_list_box_row_get_type (), "SeahorsePrefsKeyserversKeyServerRow", &g_define_type_info, 0);
	SeahorsePrefsKeyserversKeyServerRow_private_offset = g_type_add_instance_private (seahorse_prefs_keyservers_key_server_row_type_id, sizeof (SeahorsePrefsKeyserversKeyServerRowPrivate));
	return seahorse_prefs_keyservers_key_server_row_type_id;
}

static GType
seahorse_prefs_keyservers_key_server_row_get_type (void)
{
	static volatile gsize seahorse_prefs_keyservers_key_server_row_type_id__once = 0;
	if (g_once_init_enter (&seahorse_prefs_keyservers_key_server_row_type_id__once)) {
		GType seahorse_prefs_keyservers_key_server_row_type_id;
		seahorse_prefs_keyservers_key_server_row_type_id = seahorse_prefs_keyservers_key_server_row_get_type_once ();
		g_once_init_leave (&seahorse_prefs_keyservers_key_server_row_type_id__once, seahorse_prefs_keyservers_key_server_row_type_id);
	}
	return seahorse_prefs_keyservers_key_server_row_type_id__once;
}

static void
seahorse_prefs_keyservers_class_init (SeahorsePrefsKeyserversClass * klass,
                                      gpointer klass_data)
{
	seahorse_prefs_keyservers_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SeahorsePrefsKeyservers_private_offset);
	G_OBJECT_CLASS (klass)->finalize = seahorse_prefs_keyservers_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Seahorse/seahorse-prefs-keyservers.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "keyserver_tab", FALSE, G_STRUCT_OFFSET (SeahorsePrefsKeyservers, keyserver_tab));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "keyservers_list", FALSE, SeahorsePrefsKeyservers_private_offset + G_STRUCT_OFFSET (SeahorsePrefsKeyserversPrivate, keyservers_list));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "keyserver_publish", FALSE, SeahorsePrefsKeyservers_private_offset + G_STRUCT_OFFSET (SeahorsePrefsKeyserversPrivate, keyserver_publish));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "keyserver_publish_to_label", FALSE, SeahorsePrefsKeyservers_private_offset + G_STRUCT_OFFSET (SeahorsePrefsKeyserversPrivate, keyserver_publish_to_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "auto_retrieve", FALSE, SeahorsePrefsKeyservers_private_offset + G_STRUCT_OFFSET (SeahorsePrefsKeyserversPrivate, auto_retrieve));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "auto_sync", FALSE, SeahorsePrefsKeyservers_private_offset + G_STRUCT_OFFSET (SeahorsePrefsKeyserversPrivate, auto_sync));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_add_button_clicked", G_CALLBACK(_seahorse_prefs_keyservers_on_add_button_clicked_gtk_button_clicked));
}

static void
seahorse_prefs_keyservers_instance_init (SeahorsePrefsKeyservers * self,
                                         gpointer klass)
{
	self->priv = seahorse_prefs_keyservers_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
seahorse_prefs_keyservers_finalize (GObject * obj)
{
	SeahorsePrefsKeyservers * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SEAHORSE_TYPE_PREFS_KEYSERVERS, SeahorsePrefsKeyservers);
	G_OBJECT_CLASS (seahorse_prefs_keyservers_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
seahorse_prefs_keyservers_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SeahorsePrefsKeyserversClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_prefs_keyservers_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorsePrefsKeyservers), 0, (GInstanceInitFunc) seahorse_prefs_keyservers_instance_init, NULL };
	GType seahorse_prefs_keyservers_type_id;
	seahorse_prefs_keyservers_type_id = g_type_register_static (hdy_preferences_page_get_type (), "SeahorsePrefsKeyservers", &g_define_type_info, 0);
	SeahorsePrefsKeyservers_private_offset = g_type_add_instance_private (seahorse_prefs_keyservers_type_id, sizeof (SeahorsePrefsKeyserversPrivate));
	return seahorse_prefs_keyservers_type_id;
}

GType
seahorse_prefs_keyservers_get_type (void)
{
	static volatile gsize seahorse_prefs_keyservers_type_id__once = 0;
	if (g_once_init_enter (&seahorse_prefs_keyservers_type_id__once)) {
		GType seahorse_prefs_keyservers_type_id;
		seahorse_prefs_keyservers_type_id = seahorse_prefs_keyservers_get_type_once ();
		g_once_init_leave (&seahorse_prefs_keyservers_type_id__once, seahorse_prefs_keyservers_type_id);
	}
	return seahorse_prefs_keyservers_type_id__once;
}

