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

/*
* Copyright (c) 2017 Robert San <robertsanseries@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 <granite.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>

#define CIANO_CONFIGS_PROPERTIES_TEXT_EMPTY_CONVERTING_LIST _ ("Empty conversion list")
#define CIANO_CONFIGS_PROPERTIES_TEXT_SELECT_OPTION_TO_CONVERT _ ("Select an option from the side menu to which you want to \n" \
" convert your file")
#define CIANO_CONFIGS_CONSTANTS_WELCOME_VIEW "welcome-view"
#define CIANO_CONFIGS_CONSTANTS_LIST_BOX_VIEW "list-box-view"
#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 CIANO_WIDGETS_TYPE_LIST_CONVERSION (ciano_widgets_list_conversion_get_type ())
#define CIANO_WIDGETS_LIST_CONVERSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CIANO_WIDGETS_TYPE_LIST_CONVERSION, CianoWidgetsListConversion))
#define CIANO_WIDGETS_LIST_CONVERSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CIANO_WIDGETS_TYPE_LIST_CONVERSION, CianoWidgetsListConversionClass))
#define CIANO_WIDGETS_IS_LIST_CONVERSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CIANO_WIDGETS_TYPE_LIST_CONVERSION))
#define CIANO_WIDGETS_IS_LIST_CONVERSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CIANO_WIDGETS_TYPE_LIST_CONVERSION))
#define CIANO_WIDGETS_LIST_CONVERSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CIANO_WIDGETS_TYPE_LIST_CONVERSION, CianoWidgetsListConversionClass))

typedef struct _CianoWidgetsListConversion CianoWidgetsListConversion;
typedef struct _CianoWidgetsListConversionClass CianoWidgetsListConversionClass;
typedef struct _CianoWidgetsListConversionPrivate CianoWidgetsListConversionPrivate;
enum  {
	CIANO_WIDGETS_LIST_CONVERSION_0_PROPERTY,
	CIANO_WIDGETS_LIST_CONVERSION_NUM_PROPERTIES
};
static GParamSpec* ciano_widgets_list_conversion_properties[CIANO_WIDGETS_LIST_CONVERSION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _CianoWidgetsListConversion {
	GtkGrid parent_instance;
	CianoWidgetsListConversionPrivate * priv;
	GtkStack* stack;
	GtkListBox* list_box;
	GraniteWidgetsWelcome* welcome;
	gint item_quantity;
};

struct _CianoWidgetsListConversionClass {
	GtkGridClass parent_class;
};

static gpointer ciano_widgets_list_conversion_parent_class = NULL;

VALA_EXTERN GType ciano_widgets_list_conversion_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CianoWidgetsListConversion, g_object_unref)
VALA_EXTERN CianoWidgetsListConversion* ciano_widgets_list_conversion_new (void);
VALA_EXTERN CianoWidgetsListConversion* ciano_widgets_list_conversion_construct (GType object_type);
static void ciano_widgets_list_conversion_finalize (GObject * obj);
static GType ciano_widgets_list_conversion_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

/**
         * Constructs a new {@code ListConversion} object displaying the list of items being converted/converted
         * or welcome view in {@code Gtk.Stack}.
         *
         * @see Ciano.Configs.Constants
         * @see Ciano.Configs.Properties
         * @see Granite.Widgets.Welcome
         */
CianoWidgetsListConversion*
ciano_widgets_list_conversion_construct (GType object_type)
{
	CianoWidgetsListConversion * self = NULL;
	GtkStack* _tmp0_;
	GtkStack* _tmp1_;
	GraniteWidgetsWelcome* _tmp2_;
	GtkListBox* _tmp3_;
	GtkListBox* _tmp4_;
	GtkStack* _tmp5_;
	GraniteWidgetsWelcome* _tmp6_;
	GtkStack* _tmp7_;
	GtkListBox* _tmp8_;
	GtkScrolledWindow* scrolled = NULL;
	GtkScrolledWindow* _tmp9_;
	GtkStack* _tmp10_;
	self = (CianoWidgetsListConversion*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->stack);
	self->stack = _tmp0_;
	_tmp1_ = self->stack;
	gtk_stack_set_transition_type (_tmp1_, GTK_STACK_TRANSITION_TYPE_CROSSFADE);
	_tmp2_ = granite_widgets_welcome_new (CIANO_CONFIGS_PROPERTIES_TEXT_EMPTY_CONVERTING_LIST, CIANO_CONFIGS_PROPERTIES_TEXT_SELECT_OPTION_TO_CONVERT);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->welcome);
	self->welcome = _tmp2_;
	_tmp3_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->list_box);
	self->list_box = _tmp3_;
	_tmp4_ = self->list_box;
	g_object_set ((GtkWidget*) _tmp4_, "expand", TRUE, NULL);
	_tmp5_ = self->stack;
	_tmp6_ = self->welcome;
	gtk_stack_add_named (_tmp5_, (GtkWidget*) _tmp6_, CIANO_CONFIGS_CONSTANTS_WELCOME_VIEW);
	_tmp7_ = self->stack;
	_tmp8_ = self->list_box;
	gtk_stack_add_named (_tmp7_, (GtkWidget*) _tmp8_, CIANO_CONFIGS_CONSTANTS_LIST_BOX_VIEW);
	_tmp9_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp9_);
	scrolled = _tmp9_;
	g_object_set (scrolled, "hscrollbar-policy", GTK_POLICY_EXTERNAL, NULL);
	_tmp10_ = self->stack;
	gtk_container_add ((GtkContainer*) scrolled, (GtkWidget*) _tmp10_);
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) scrolled);
	_g_object_unref0 (scrolled);
	return self;
}

CianoWidgetsListConversion*
ciano_widgets_list_conversion_new (void)
{
	return ciano_widgets_list_conversion_construct (CIANO_WIDGETS_TYPE_LIST_CONVERSION);
}

static void
ciano_widgets_list_conversion_class_init (CianoWidgetsListConversionClass * klass,
                                          gpointer klass_data)
{
	ciano_widgets_list_conversion_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = ciano_widgets_list_conversion_finalize;
}

static void
ciano_widgets_list_conversion_instance_init (CianoWidgetsListConversion * self,
                                             gpointer klass)
{
	self->item_quantity = 0;
}

static void
ciano_widgets_list_conversion_finalize (GObject * obj)
{
	CianoWidgetsListConversion * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CIANO_WIDGETS_TYPE_LIST_CONVERSION, CianoWidgetsListConversion);
	_g_object_unref0 (self->stack);
	_g_object_unref0 (self->list_box);
	_g_object_unref0 (self->welcome);
	G_OBJECT_CLASS (ciano_widgets_list_conversion_parent_class)->finalize (obj);
}

/**
     * The {@code ListConversion} class is responsible for displaying list of items that
     * are being converted or have been converted   
     *
     * @see Gtk.Grid
     * @since 0.1.0
     */
static GType
ciano_widgets_list_conversion_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (CianoWidgetsListConversionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ciano_widgets_list_conversion_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CianoWidgetsListConversion), 0, (GInstanceInitFunc) ciano_widgets_list_conversion_instance_init, NULL };
	GType ciano_widgets_list_conversion_type_id;
	ciano_widgets_list_conversion_type_id = g_type_register_static (gtk_grid_get_type (), "CianoWidgetsListConversion", &g_define_type_info, 0);
	return ciano_widgets_list_conversion_type_id;
}

GType
ciano_widgets_list_conversion_get_type (void)
{
	static volatile gsize ciano_widgets_list_conversion_type_id__once = 0;
	if (g_once_init_enter (&ciano_widgets_list_conversion_type_id__once)) {
		GType ciano_widgets_list_conversion_type_id;
		ciano_widgets_list_conversion_type_id = ciano_widgets_list_conversion_get_type_once ();
		g_once_init_leave (&ciano_widgets_list_conversion_type_id__once, ciano_widgets_list_conversion_type_id);
	}
	return ciano_widgets_list_conversion_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

