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

/*
 * BackupFinishBox.vala
 *
 * Copyright 2016 Tony George <tony.george.kol@gmail.com>
 *
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 *
 *
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_BACKUP_FINISH_BOX (backup_finish_box_get_type ())
#define BACKUP_FINISH_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BACKUP_FINISH_BOX, BackupFinishBox))
#define BACKUP_FINISH_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BACKUP_FINISH_BOX, BackupFinishBoxClass))
#define IS_BACKUP_FINISH_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BACKUP_FINISH_BOX))
#define IS_BACKUP_FINISH_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BACKUP_FINISH_BOX))
#define BACKUP_FINISH_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BACKUP_FINISH_BOX, BackupFinishBoxClass))

typedef struct _BackupFinishBox BackupFinishBox;
typedef struct _BackupFinishBoxClass BackupFinishBoxClass;
typedef struct _BackupFinishBoxPrivate BackupFinishBoxPrivate;
enum  {
	BACKUP_FINISH_BOX_0_PROPERTY,
	BACKUP_FINISH_BOX_NUM_PROPERTIES
};
static GParamSpec* backup_finish_box_properties[BACKUP_FINISH_BOX_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))

struct _BackupFinishBox {
	GtkBox parent_instance;
	BackupFinishBoxPrivate * priv;
};

struct _BackupFinishBoxClass {
	GtkBoxClass parent_class;
};

struct _BackupFinishBoxPrivate {
	GtkLabel* lbl_header;
	GtkLabel* lbl_message;
	GtkWindow* parent_window;
};

static gint BackupFinishBox_private_offset;
static gpointer backup_finish_box_parent_class = NULL;

VALA_EXTERN GType backup_finish_box_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BackupFinishBox, g_object_unref)
VALA_EXTERN BackupFinishBox* backup_finish_box_new (GtkWindow* _parent_window);
VALA_EXTERN BackupFinishBox* backup_finish_box_construct (GType object_type,
                                              GtkWindow* _parent_window);
VALA_EXTERN void tee_jee_logging_log_debug (const gchar* message);
VALA_EXTERN GtkLabel* tee_jee_gtk_helper_add_label_header (GtkBox* box,
                                               const gchar* text,
                                               gboolean large_heading);
VALA_EXTERN GtkLabel* tee_jee_gtk_helper_add_label_scrolled (GtkBox* box,
                                                 const gchar* text,
                                                 gboolean show_border,
                                                 gboolean wrap,
                                                 gint ellipsize_chars);
VALA_EXTERN void backup_finish_box_update_message (BackupFinishBox* self,
                                       gboolean success);
VALA_EXTERN gchar* tee_jee_gtk_helper_format_text (const gchar* text,
                                       gboolean bold,
                                       gboolean italic,
                                       gboolean large);
static void backup_finish_box_finalize (GObject * obj);
static GType backup_finish_box_get_type_once (void);

static inline gpointer
backup_finish_box_get_instance_private (BackupFinishBox* self)
{
	return G_STRUCT_MEMBER_P (self, BackupFinishBox_private_offset);
}

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

BackupFinishBox*
backup_finish_box_construct (GType object_type,
                             GtkWindow* _parent_window)
{
	BackupFinishBox * self = NULL;
	GtkWindow* _tmp0_;
	GtkLabel* _tmp1_;
	GtkLabel* _tmp2_;
	g_return_val_if_fail (_parent_window != NULL, NULL);
	tee_jee_logging_log_debug ("BackupFinishBox: BackupFinishBox()");
	self = (BackupFinishBox*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 6, NULL);
	_tmp0_ = _g_object_ref0 (_parent_window);
	_g_object_unref0 (self->priv->parent_window);
	self->priv->parent_window = _tmp0_;
	g_object_set ((GtkWidget*) self, "margin", 12, NULL);
	_tmp1_ = tee_jee_gtk_helper_add_label_header ((GtkBox*) self, _ ("Completed"), TRUE);
	_g_object_unref0 (self->priv->lbl_header);
	self->priv->lbl_header = _tmp1_;
	_tmp2_ = tee_jee_gtk_helper_add_label_scrolled ((GtkBox*) self, "", FALSE, TRUE, 0);
	_g_object_unref0 (self->priv->lbl_message);
	self->priv->lbl_message = _tmp2_;
	tee_jee_logging_log_debug ("BackupFinishBox: BackupFinishBox(): exit");
	return self;
}

BackupFinishBox*
backup_finish_box_new (GtkWindow* _parent_window)
{
	return backup_finish_box_construct (TYPE_BACKUP_FINISH_BOX, _parent_window);
}

void
backup_finish_box_update_message (BackupFinishBox* self,
                                  gboolean success)
{
	gchar* txt = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	GtkLabel* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* msg = NULL;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	GtkLabel* _tmp15_;
	const gchar* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("");
	txt = _tmp0_;
	_tmp1_ = g_strdup (_ ("Snapshot Created"));
	_g_free0 (txt);
	txt = _tmp1_;
	if (!success) {
		const gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp2_ = txt;
		_tmp3_ = g_strconcat (" ", _ ("With Errors"), NULL);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strconcat (_tmp2_, _tmp4_, NULL);
		_g_free0 (txt);
		txt = _tmp5_;
		_g_free0 (_tmp4_);
	}
	_tmp6_ = self->priv->lbl_header;
	_tmp7_ = txt;
	_tmp8_ = tee_jee_gtk_helper_format_text (_tmp7_, TRUE, FALSE, TRUE);
	_tmp9_ = _tmp8_;
	gtk_label_set_label (_tmp6_, _tmp9_);
	_g_free0 (_tmp9_);
	_tmp10_ = g_strdup ("");
	msg = _tmp10_;
	_tmp11_ = msg;
	_tmp12_ = g_strconcat (_ ("Close window to exit"), "\n\n", NULL);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strconcat (_tmp11_, _tmp13_, NULL);
	_g_free0 (msg);
	msg = _tmp14_;
	_g_free0 (_tmp13_);
	_tmp15_ = self->priv->lbl_message;
	_tmp16_ = msg;
	gtk_label_set_label (_tmp15_, _tmp16_);
	_g_free0 (msg);
	_g_free0 (txt);
}

static void
backup_finish_box_class_init (BackupFinishBoxClass * klass,
                              gpointer klass_data)
{
	backup_finish_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BackupFinishBox_private_offset);
	G_OBJECT_CLASS (klass)->finalize = backup_finish_box_finalize;
}

static void
backup_finish_box_instance_init (BackupFinishBox * self,
                                 gpointer klass)
{
	self->priv = backup_finish_box_get_instance_private (self);
}

static void
backup_finish_box_finalize (GObject * obj)
{
	BackupFinishBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BACKUP_FINISH_BOX, BackupFinishBox);
	_g_object_unref0 (self->priv->lbl_header);
	_g_object_unref0 (self->priv->lbl_message);
	_g_object_unref0 (self->priv->parent_window);
	G_OBJECT_CLASS (backup_finish_box_parent_class)->finalize (obj);
}

static GType
backup_finish_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BackupFinishBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) backup_finish_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BackupFinishBox), 0, (GInstanceInitFunc) backup_finish_box_instance_init, NULL };
	GType backup_finish_box_type_id;
	backup_finish_box_type_id = g_type_register_static (gtk_box_get_type (), "BackupFinishBox", &g_define_type_info, 0);
	BackupFinishBox_private_offset = g_type_add_instance_private (backup_finish_box_type_id, sizeof (BackupFinishBoxPrivate));
	return backup_finish_box_type_id;
}

GType
backup_finish_box_get_type (void)
{
	static volatile gsize backup_finish_box_type_id__once = 0;
	if (g_once_init_enter (&backup_finish_box_type_id__once)) {
		GType backup_finish_box_type_id;
		backup_finish_box_type_id = backup_finish_box_get_type_once ();
		g_once_init_leave (&backup_finish_box_type_id__once, backup_finish_box_type_id);
	}
	return backup_finish_box_type_id__once;
}

