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

/* Copyright 2016 Jens Georg <mail@jensge.org>
 *
 * This software is licensed under the GNU LGPL (version 2.1 or later).
 * See the COPYING file in this distribution.
 */

#include "shotwell-plugin-common.h"
#include "shotwell-plugin-dev-1.0.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.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  {
	SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_0_PROPERTY,
	SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_PREFERRED_GEOMETRY_PROPERTY,
	SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_LOGIN_URI_PROPERTY,
	SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_NUM_PROPERTIES
};
static GParamSpec* shotwell_plugins_common_external_web_pane_properties[SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_BROWSER_TOGGLED_SIGNAL,
	SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_NUM_SIGNALS
};
static guint shotwell_plugins_common_external_web_pane_signals[SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_NUM_SIGNALS] = {0};

struct _ShotwellPluginsCommonExternalWebPanePrivate {
	SpitPublishingDialogPaneGeometryOptions _preferred_geometry;
	gchar* _login_uri;
};

static gint ShotwellPluginsCommonExternalWebPane_private_offset;
static gpointer shotwell_plugins_common_external_web_pane_parent_class = NULL;
static SpitPublishingDialogPaneIface * shotwell_plugins_common_external_web_pane_spit_publishing_dialog_pane_parent_iface = NULL;

static void shotwell_plugins_common_external_web_pane_real_constructed (GObject* base);
static void __lambda6_ (ShotwellPluginsCommonExternalWebPane* self);
static void ___lambda6__gtk_button_clicked (GtkButton* _sender,
                                     gpointer self);
static SpitPublishingDialogPaneGeometryOptions shotwell_plugins_common_external_web_pane_real_get_preferred_geometry (SpitPublishingDialogPane* base);
static GtkWidget* shotwell_plugins_common_external_web_pane_real_get_widget (SpitPublishingDialogPane* base);
static void shotwell_plugins_common_external_web_pane_real_on_pane_installed (SpitPublishingDialogPane* base);
static void shotwell_plugins_common_external_web_pane_real_on_pane_uninstalled (SpitPublishingDialogPane* base);
static void shotwell_plugins_common_external_web_pane_finalize (GObject * obj);
static GType shotwell_plugins_common_external_web_pane_get_type_once (void);
static void _vala_shotwell_plugins_common_external_web_pane_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec);
static void _vala_shotwell_plugins_common_external_web_pane_set_property (GObject * object,
                                                                   guint property_id,
                                                                   const GValue * value,
                                                                   GParamSpec * pspec);

static inline gpointer
shotwell_plugins_common_external_web_pane_get_instance_private (ShotwellPluginsCommonExternalWebPane* self)
{
	return G_STRUCT_MEMBER_P (self, ShotwellPluginsCommonExternalWebPane_private_offset);
}

ShotwellPluginsCommonExternalWebPane*
shotwell_plugins_common_external_web_pane_construct (GType object_type,
                                                     const gchar* uri)
{
	ShotwellPluginsCommonExternalWebPane * self = NULL;
	g_return_val_if_fail (uri != NULL, NULL);
	self = (ShotwellPluginsCommonExternalWebPane*) g_object_new (object_type, "login-uri", uri, NULL);
	return self;
}

ShotwellPluginsCommonExternalWebPane*
shotwell_plugins_common_external_web_pane_new (const gchar* uri)
{
	return shotwell_plugins_common_external_web_pane_construct (SHOTWELL_PLUGINS_COMMON_TYPE_EXTERNAL_WEB_PANE, uri);
}

static void
__lambda6_ (ShotwellPluginsCommonExternalWebPane* self)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	_tmp0_ = shotwell_plugins_common_external_web_pane_get_login_uri (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	g_app_info_launch_default_for_uri_async (_tmp2_, NULL, NULL, NULL, NULL);
	_g_free0 (_tmp2_);
	g_signal_emit (self, shotwell_plugins_common_external_web_pane_signals[SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_BROWSER_TOGGLED_SIGNAL], 0);
}

static void
___lambda6__gtk_button_clicked (GtkButton* _sender,
                                gpointer self)
{
	__lambda6_ ((ShotwellPluginsCommonExternalWebPane*) self);
}

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

static void
shotwell_plugins_common_external_web_pane_real_constructed (GObject* base)
{
	ShotwellPluginsCommonExternalWebPane * self;
	GtkBox* box = NULL;
	GtkBox* _tmp0_;
	GtkImage* image = NULL;
	GtkImage* _tmp1_;
	GtkStyleContext* _tmp2_;
	GtkLabel* label = NULL;
	GtkLabel* _tmp3_;
	GtkStyleContext* _tmp4_;
	GtkButton* button = NULL;
	GtkButton* _tmp5_;
	GtkStyleContext* _tmp6_;
	GtkWidget* _tmp7_;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SHOTWELL_PLUGINS_COMMON_TYPE_EXTERNAL_WEB_PANE, ShotwellPluginsCommonExternalWebPane);
	G_OBJECT_CLASS (shotwell_plugins_common_external_web_pane_parent_class)->constructed (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject));
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
	g_object_ref_sink (_tmp0_);
	box = _tmp0_;
	gtk_widget_set_halign (G_TYPE_CHECK_INSTANCE_CAST (box, gtk_widget_get_type (), GtkWidget), GTK_ALIGN_CENTER);
	gtk_widget_set_hexpand (G_TYPE_CHECK_INSTANCE_CAST (box, gtk_widget_get_type (), GtkWidget), TRUE);
	gtk_widget_set_valign (G_TYPE_CHECK_INSTANCE_CAST (box, gtk_widget_get_type (), GtkWidget), GTK_ALIGN_CENTER);
	gtk_widget_set_vexpand (G_TYPE_CHECK_INSTANCE_CAST (box, gtk_widget_get_type (), GtkWidget), TRUE);
	_tmp1_ = (GtkImage*) gtk_image_new_from_icon_name ("web-browser-symbolic", (GtkIconSize) GTK_ICON_SIZE_DIALOG);
	g_object_ref_sink (_tmp1_);
	image = _tmp1_;
	_tmp2_ = gtk_widget_get_style_context (G_TYPE_CHECK_INSTANCE_CAST (image, gtk_widget_get_type (), GtkWidget));
	gtk_style_context_add_class (_tmp2_, "dim-label");
	gtk_image_set_pixel_size (image, 128);
	gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (box, gtk_container_get_type (), GtkContainer), G_TYPE_CHECK_INSTANCE_CAST (image, gtk_widget_get_type (), GtkWidget));
	_tmp3_ = (GtkLabel*) gtk_label_new (_ ("Sign in with your browser to setup an account"));
	g_object_ref_sink (_tmp3_);
	label = _tmp3_;
	_tmp4_ = gtk_widget_get_style_context (G_TYPE_CHECK_INSTANCE_CAST (label, gtk_widget_get_type (), GtkWidget));
	gtk_style_context_add_class (_tmp4_, "heading");
	gtk_container_add (G_TYPE_CHECK_INSTANCE_CAST (box, gtk_container_get_type (), GtkContainer), G_TYPE_CHECK_INSTANCE_CAST (label, gtk_widget_get_type (), GtkWidget));
	_tmp5_ = (GtkButton*) gtk_button_new_with_label (_ ("Continue"));
	g_object_ref_sink (_tmp5_);
	button = _tmp5_;
	gtk_widget_set_halign (G_TYPE_CHECK_INSTANCE_CAST (button, gtk_widget_get_type (), GtkWidget), GTK_ALIGN_CENTER);
	_tmp6_ = gtk_widget_get_style_context (G_TYPE_CHECK_INSTANCE_CAST (button, gtk_widget_get_type (), GtkWidget));
	gtk_style_context_add_class (_tmp6_, "suggested-action");
	g_signal_connect_object (button, "clicked", (GCallback) ___lambda6__gtk_button_clicked, self, 0);
	gtk_box_pack_end (box, G_TYPE_CHECK_INSTANCE_CAST (button, gtk_widget_get_type (), GtkWidget), TRUE, TRUE, (guint) 0);
	_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (box, gtk_widget_get_type (), GtkWidget));
	_g_object_unref0 (self->widget);
	self->widget = _tmp7_;
	_g_object_unref0 (button);
	_g_object_unref0 (label);
	_g_object_unref0 (image);
	_g_object_unref0 (box);
}

static SpitPublishingDialogPaneGeometryOptions
shotwell_plugins_common_external_web_pane_real_get_preferred_geometry (SpitPublishingDialogPane* base)
{
	ShotwellPluginsCommonExternalWebPane * self;
	SpitPublishingDialogPaneGeometryOptions _tmp0_;
	SpitPublishingDialogPaneGeometryOptions result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SHOTWELL_PLUGINS_COMMON_TYPE_EXTERNAL_WEB_PANE, ShotwellPluginsCommonExternalWebPane);
	_tmp0_ = self->priv->_preferred_geometry;
	result = _tmp0_;
	return result;
}

static GtkWidget*
shotwell_plugins_common_external_web_pane_real_get_widget (SpitPublishingDialogPane* base)
{
	ShotwellPluginsCommonExternalWebPane * self;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SHOTWELL_PLUGINS_COMMON_TYPE_EXTERNAL_WEB_PANE, ShotwellPluginsCommonExternalWebPane);
	_tmp0_ = self->widget;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
shotwell_plugins_common_external_web_pane_real_on_pane_installed (SpitPublishingDialogPane* base)
{
	ShotwellPluginsCommonExternalWebPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SHOTWELL_PLUGINS_COMMON_TYPE_EXTERNAL_WEB_PANE, ShotwellPluginsCommonExternalWebPane);
}

static void
shotwell_plugins_common_external_web_pane_real_on_pane_uninstalled (SpitPublishingDialogPane* base)
{
	ShotwellPluginsCommonExternalWebPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SHOTWELL_PLUGINS_COMMON_TYPE_EXTERNAL_WEB_PANE, ShotwellPluginsCommonExternalWebPane);
}

SpitPublishingDialogPaneGeometryOptions
shotwell_plugins_common_external_web_pane_get_preferred_geometry (ShotwellPluginsCommonExternalWebPane* self)
{
	SpitPublishingDialogPaneGeometryOptions result;
	g_return_val_if_fail (SHOTWELL_PLUGINS_COMMON_IS_EXTERNAL_WEB_PANE (self), 0);
	result = self->priv->_preferred_geometry;
	return result;
}

static void
shotwell_plugins_common_external_web_pane_set_preferred_geometry (ShotwellPluginsCommonExternalWebPane* self,
                                                                  SpitPublishingDialogPaneGeometryOptions value)
{
	SpitPublishingDialogPaneGeometryOptions old_value;
	g_return_if_fail (SHOTWELL_PLUGINS_COMMON_IS_EXTERNAL_WEB_PANE (self));
	old_value = shotwell_plugins_common_external_web_pane_get_preferred_geometry (self);
	if (old_value != value) {
		self->priv->_preferred_geometry = value;
		g_object_notify_by_pspec ((GObject *) self, shotwell_plugins_common_external_web_pane_properties[SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_PREFERRED_GEOMETRY_PROPERTY]);
	}
}

gchar*
shotwell_plugins_common_external_web_pane_get_login_uri (ShotwellPluginsCommonExternalWebPane* self)
{
	gchar* result;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (SHOTWELL_PLUGINS_COMMON_IS_EXTERNAL_WEB_PANE (self), NULL);
	_tmp0_ = self->priv->_login_uri;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
shotwell_plugins_common_external_web_pane_set_login_uri (ShotwellPluginsCommonExternalWebPane* self,
                                                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (SHOTWELL_PLUGINS_COMMON_IS_EXTERNAL_WEB_PANE (self));
	old_value = shotwell_plugins_common_external_web_pane_get_login_uri (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_login_uri);
		self->priv->_login_uri = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, shotwell_plugins_common_external_web_pane_properties[SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_LOGIN_URI_PROPERTY]);
	}
	_g_free0 (old_value);
}

static void
shotwell_plugins_common_external_web_pane_class_init (ShotwellPluginsCommonExternalWebPaneClass * klass,
                                                      gpointer klass_data)
{
	shotwell_plugins_common_external_web_pane_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ShotwellPluginsCommonExternalWebPane_private_offset);
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) shotwell_plugins_common_external_web_pane_real_constructed;
	G_OBJECT_CLASS (klass)->get_property = _vala_shotwell_plugins_common_external_web_pane_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_shotwell_plugins_common_external_web_pane_set_property;
	G_OBJECT_CLASS (klass)->finalize = shotwell_plugins_common_external_web_pane_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_PREFERRED_GEOMETRY_PROPERTY, shotwell_plugins_common_external_web_pane_properties[SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_PREFERRED_GEOMETRY_PROPERTY] = g_param_spec_enum ("preferred-geometry", "preferred-geometry", "preferred-geometry", SPIT_PUBLISHING_DIALOG_PANE_TYPE_GEOMETRY_OPTIONS, SPIT_PUBLISHING_DIALOG_PANE_GEOMETRY_OPTIONS_COLOSSAL_SIZE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_LOGIN_URI_PROPERTY, shotwell_plugins_common_external_web_pane_properties[SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_LOGIN_URI_PROPERTY] = g_param_spec_string ("login-uri", "login-uri", "login-uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	shotwell_plugins_common_external_web_pane_signals[SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_BROWSER_TOGGLED_SIGNAL] = g_signal_new ("browser-toggled", SHOTWELL_PLUGINS_COMMON_TYPE_EXTERNAL_WEB_PANE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
shotwell_plugins_common_external_web_pane_spit_publishing_dialog_pane_interface_init (SpitPublishingDialogPaneIface * iface,
                                                                                      gpointer iface_data)
{
	shotwell_plugins_common_external_web_pane_spit_publishing_dialog_pane_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_preferred_geometry = (SpitPublishingDialogPaneGeometryOptions (*) (SpitPublishingDialogPane*)) shotwell_plugins_common_external_web_pane_real_get_preferred_geometry;
	iface->get_widget = (GtkWidget* (*) (SpitPublishingDialogPane*)) shotwell_plugins_common_external_web_pane_real_get_widget;
	iface->on_pane_installed = (void (*) (SpitPublishingDialogPane*)) shotwell_plugins_common_external_web_pane_real_on_pane_installed;
	iface->on_pane_uninstalled = (void (*) (SpitPublishingDialogPane*)) shotwell_plugins_common_external_web_pane_real_on_pane_uninstalled;
}

static void
shotwell_plugins_common_external_web_pane_instance_init (ShotwellPluginsCommonExternalWebPane * self,
                                                         gpointer klass)
{
	self->priv = shotwell_plugins_common_external_web_pane_get_instance_private (self);
	self->priv->_preferred_geometry = SPIT_PUBLISHING_DIALOG_PANE_GEOMETRY_OPTIONS_COLOSSAL_SIZE;
}

static void
shotwell_plugins_common_external_web_pane_finalize (GObject * obj)
{
	ShotwellPluginsCommonExternalWebPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SHOTWELL_PLUGINS_COMMON_TYPE_EXTERNAL_WEB_PANE, ShotwellPluginsCommonExternalWebPane);
	_g_free0 (self->priv->_login_uri);
	_g_object_unref0 (self->widget);
	G_OBJECT_CLASS (shotwell_plugins_common_external_web_pane_parent_class)->finalize (obj);
}

static GType
shotwell_plugins_common_external_web_pane_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ShotwellPluginsCommonExternalWebPaneClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) shotwell_plugins_common_external_web_pane_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ShotwellPluginsCommonExternalWebPane), 0, (GInstanceInitFunc) shotwell_plugins_common_external_web_pane_instance_init, NULL };
	static const GInterfaceInfo spit_publishing_dialog_pane_info = { (GInterfaceInitFunc) shotwell_plugins_common_external_web_pane_spit_publishing_dialog_pane_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType shotwell_plugins_common_external_web_pane_type_id;
	shotwell_plugins_common_external_web_pane_type_id = g_type_register_static (G_TYPE_OBJECT, "ShotwellPluginsCommonExternalWebPane", &g_define_type_info, 0);
	g_type_add_interface_static (shotwell_plugins_common_external_web_pane_type_id, SPIT_PUBLISHING_TYPE_DIALOG_PANE, &spit_publishing_dialog_pane_info);
	ShotwellPluginsCommonExternalWebPane_private_offset = g_type_add_instance_private (shotwell_plugins_common_external_web_pane_type_id, sizeof (ShotwellPluginsCommonExternalWebPanePrivate));
	return shotwell_plugins_common_external_web_pane_type_id;
}

GType
shotwell_plugins_common_external_web_pane_get_type (void)
{
	static volatile gsize shotwell_plugins_common_external_web_pane_type_id__once = 0;
	if (g_once_init_enter (&shotwell_plugins_common_external_web_pane_type_id__once)) {
		GType shotwell_plugins_common_external_web_pane_type_id;
		shotwell_plugins_common_external_web_pane_type_id = shotwell_plugins_common_external_web_pane_get_type_once ();
		g_once_init_leave (&shotwell_plugins_common_external_web_pane_type_id__once, shotwell_plugins_common_external_web_pane_type_id);
	}
	return shotwell_plugins_common_external_web_pane_type_id__once;
}

static void
_vala_shotwell_plugins_common_external_web_pane_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec)
{
	ShotwellPluginsCommonExternalWebPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SHOTWELL_PLUGINS_COMMON_TYPE_EXTERNAL_WEB_PANE, ShotwellPluginsCommonExternalWebPane);
	switch (property_id) {
		case SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_PREFERRED_GEOMETRY_PROPERTY:
		g_value_set_enum (value, shotwell_plugins_common_external_web_pane_get_preferred_geometry (self));
		break;
		case SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_LOGIN_URI_PROPERTY:
		g_value_take_string (value, shotwell_plugins_common_external_web_pane_get_login_uri (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_shotwell_plugins_common_external_web_pane_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec)
{
	ShotwellPluginsCommonExternalWebPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SHOTWELL_PLUGINS_COMMON_TYPE_EXTERNAL_WEB_PANE, ShotwellPluginsCommonExternalWebPane);
	switch (property_id) {
		case SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_PREFERRED_GEOMETRY_PROPERTY:
		shotwell_plugins_common_external_web_pane_set_preferred_geometry (self, g_value_get_enum (value));
		break;
		case SHOTWELL_PLUGINS_COMMON_EXTERNAL_WEB_PANE_LOGIN_URI_PROPERTY:
		shotwell_plugins_common_external_web_pane_set_login_uri (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

