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

/* Copyright 2016 Software Freedom Conservancy Inc.
 * Copyright 2019 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-internal-publishing-gui.h"
#include <gtk/gtk.h>
#include "shotwell-plugin-dev-1.0.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <glib-object.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  {
	PUBLISHING_UI_PROGRESS_PANE_0_PROPERTY,
	PUBLISHING_UI_PROGRESS_PANE_NUM_PROPERTIES
};
static GParamSpec* publishing_ui_progress_pane_properties[PUBLISHING_UI_PROGRESS_PANE_NUM_PROPERTIES];

struct _PublishingUIProgressPanePrivate {
	GtkProgressBar* progress_bar;
};

static gint PublishingUIProgressPane_private_offset;
static gpointer publishing_ui_progress_pane_parent_class = NULL;
static SpitPublishingDialogPaneIface * publishing_ui_progress_pane_spit_publishing_dialog_pane_parent_iface = NULL;

static GtkWidget* publishing_ui_progress_pane_real_get_widget (SpitPublishingDialogPane* base);
static SpitPublishingDialogPaneGeometryOptions publishing_ui_progress_pane_real_get_preferred_geometry (SpitPublishingDialogPane* base);
static void publishing_ui_progress_pane_real_on_pane_installed (SpitPublishingDialogPane* base);
static void publishing_ui_progress_pane_real_on_pane_uninstalled (SpitPublishingDialogPane* base);
static void publishing_ui_progress_pane_finalize (GObject * obj);
static GType publishing_ui_progress_pane_get_type_once (void);

static inline gpointer
publishing_ui_progress_pane_get_instance_private (PublishingUIProgressPane* self)
{
	return G_STRUCT_MEMBER_P (self, PublishingUIProgressPane_private_offset);
}

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

static GtkWidget*
publishing_ui_progress_pane_real_get_widget (SpitPublishingDialogPane* base)
{
	PublishingUIProgressPane * self;
	GtkWidget* _tmp0_;
	GtkWidget* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_UI_TYPE_PROGRESS_PANE, PublishingUIProgressPane);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
	result = _tmp0_;
	return result;
}

static SpitPublishingDialogPaneGeometryOptions
publishing_ui_progress_pane_real_get_preferred_geometry (SpitPublishingDialogPane* base)
{
	PublishingUIProgressPane * self;
	SpitPublishingDialogPaneGeometryOptions result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_UI_TYPE_PROGRESS_PANE, PublishingUIProgressPane);
	result = SPIT_PUBLISHING_DIALOG_PANE_GEOMETRY_OPTIONS_NONE;
	return result;
}

static void
publishing_ui_progress_pane_real_on_pane_installed (SpitPublishingDialogPane* base)
{
	PublishingUIProgressPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_UI_TYPE_PROGRESS_PANE, PublishingUIProgressPane);
}

static void
publishing_ui_progress_pane_real_on_pane_uninstalled (SpitPublishingDialogPane* base)
{
	PublishingUIProgressPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PUBLISHING_UI_TYPE_PROGRESS_PANE, PublishingUIProgressPane);
}

void
publishing_ui_progress_pane_set_text (PublishingUIProgressPane* self,
                                      const gchar* text)
{
	GtkProgressBar* _tmp0_;
	g_return_if_fail (PUBLISHING_UI_IS_PROGRESS_PANE (self));
	g_return_if_fail (text != NULL);
	_tmp0_ = self->priv->progress_bar;
	gtk_progress_bar_set_text (_tmp0_, text);
}

void
publishing_ui_progress_pane_set_progress (PublishingUIProgressPane* self,
                                          gdouble progress)
{
	GtkProgressBar* _tmp0_;
	g_return_if_fail (PUBLISHING_UI_IS_PROGRESS_PANE (self));
	_tmp0_ = self->priv->progress_bar;
	gtk_progress_bar_set_fraction (_tmp0_, progress);
}

void
publishing_ui_progress_pane_set_status (PublishingUIProgressPane* self,
                                        const gchar* status_text,
                                        gdouble progress)
{
	GtkProgressBar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (PUBLISHING_UI_IS_PROGRESS_PANE (self));
	g_return_if_fail (status_text != NULL);
	_tmp0_ = self->priv->progress_bar;
	_tmp1_ = gtk_progress_bar_get_text (_tmp0_);
	if (g_strcmp0 (status_text, _tmp1_) != 0) {
		GtkProgressBar* _tmp2_;
		_tmp2_ = self->priv->progress_bar;
		gtk_progress_bar_set_text (_tmp2_, status_text);
	}
	publishing_ui_progress_pane_set_progress (self, progress);
}

PublishingUIProgressPane*
publishing_ui_progress_pane_construct (GType object_type)
{
	PublishingUIProgressPane * self = NULL;
	self = (PublishingUIProgressPane*) g_object_new (object_type, NULL);
	return self;
}

PublishingUIProgressPane*
publishing_ui_progress_pane_new (void)
{
	return publishing_ui_progress_pane_construct (PUBLISHING_UI_TYPE_PROGRESS_PANE);
}

static void
publishing_ui_progress_pane_class_init (PublishingUIProgressPaneClass * klass,
                                        gpointer klass_data)
{
	publishing_ui_progress_pane_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PublishingUIProgressPane_private_offset);
	G_OBJECT_CLASS (klass)->finalize = publishing_ui_progress_pane_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Shotwell/ui/progress_pane_widget.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "progress_bar", FALSE, PublishingUIProgressPane_private_offset + G_STRUCT_OFFSET (PublishingUIProgressPanePrivate, progress_bar));
}

static void
publishing_ui_progress_pane_spit_publishing_dialog_pane_interface_init (SpitPublishingDialogPaneIface * iface,
                                                                        gpointer iface_data)
{
	publishing_ui_progress_pane_spit_publishing_dialog_pane_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_widget = (GtkWidget* (*) (SpitPublishingDialogPane*)) publishing_ui_progress_pane_real_get_widget;
	iface->get_preferred_geometry = (SpitPublishingDialogPaneGeometryOptions (*) (SpitPublishingDialogPane*)) publishing_ui_progress_pane_real_get_preferred_geometry;
	iface->on_pane_installed = (void (*) (SpitPublishingDialogPane*)) publishing_ui_progress_pane_real_on_pane_installed;
	iface->on_pane_uninstalled = (void (*) (SpitPublishingDialogPane*)) publishing_ui_progress_pane_real_on_pane_uninstalled;
}

static void
publishing_ui_progress_pane_instance_init (PublishingUIProgressPane * self,
                                           gpointer klass)
{
	self->priv = publishing_ui_progress_pane_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
publishing_ui_progress_pane_finalize (GObject * obj)
{
	PublishingUIProgressPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PUBLISHING_UI_TYPE_PROGRESS_PANE, PublishingUIProgressPane);
	G_OBJECT_CLASS (publishing_ui_progress_pane_parent_class)->finalize (obj);
}

static GType
publishing_ui_progress_pane_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PublishingUIProgressPaneClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) publishing_ui_progress_pane_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PublishingUIProgressPane), 0, (GInstanceInitFunc) publishing_ui_progress_pane_instance_init, NULL };
	static const GInterfaceInfo spit_publishing_dialog_pane_info = { (GInterfaceInitFunc) publishing_ui_progress_pane_spit_publishing_dialog_pane_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType publishing_ui_progress_pane_type_id;
	publishing_ui_progress_pane_type_id = g_type_register_static (gtk_box_get_type (), "PublishingUIProgressPane", &g_define_type_info, 0);
	g_type_add_interface_static (publishing_ui_progress_pane_type_id, SPIT_PUBLISHING_TYPE_DIALOG_PANE, &spit_publishing_dialog_pane_info);
	PublishingUIProgressPane_private_offset = g_type_add_instance_private (publishing_ui_progress_pane_type_id, sizeof (PublishingUIProgressPanePrivate));
	return publishing_ui_progress_pane_type_id;
}

GType
publishing_ui_progress_pane_get_type (void)
{
	static volatile gsize publishing_ui_progress_pane_type_id__once = 0;
	if (g_once_init_enter (&publishing_ui_progress_pane_type_id__once)) {
		GType publishing_ui_progress_pane_type_id;
		publishing_ui_progress_pane_type_id = publishing_ui_progress_pane_get_type_once ();
		g_once_init_leave (&publishing_ui_progress_pane_type_id__once, publishing_ui_progress_pane_type_id);
	}
	return publishing_ui_progress_pane_type_id__once;
}

