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

/*
 * SPDX-License-Identifier: GPL-2.0-or-later
 * SPDX-FileCopyrightText: 2013-2025 elementary, Inc. (https://elementary.io)
 *
 * Authored by: Corentin Noël <tintou@mailoo.org>
 */
/* This is needed in order to have good placement for widgets*/

#include "elementary-calendar.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gee.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

enum  {
	MAYA_PLACEMENT_WIDGET_0_PROPERTY,
	MAYA_PLACEMENT_WIDGET_NUM_PROPERTIES
};
static GParamSpec* maya_placement_widget_properties[MAYA_PLACEMENT_WIDGET_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))

static gpointer maya_placement_widget_parent_class = NULL;

static void maya_placement_widget_finalize (GObject * obj);
static GType maya_placement_widget_get_type_once (void);

MayaPlacementWidget*
maya_placement_widget_construct (GType object_type)
{
	MayaPlacementWidget * self = NULL;
	self = (MayaPlacementWidget*) g_object_new (object_type, NULL);
	return self;
}

MayaPlacementWidget*
maya_placement_widget_new (void)
{
	return maya_placement_widget_construct (MAYA_TYPE_PLACEMENT_WIDGET);
}

static void
maya_placement_widget_class_init (MayaPlacementWidgetClass * klass,
                                  gpointer klass_data)
{
	maya_placement_widget_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = maya_placement_widget_finalize;
}

static void
maya_placement_widget_instance_init (MayaPlacementWidget * self,
                                     gpointer klass)
{
	self->row = 0;
	self->column = 0;
	self->needed = FALSE;
}

static void
maya_placement_widget_finalize (GObject * obj)
{
	MayaPlacementWidget * self;
	GtkWidget* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAYA_TYPE_PLACEMENT_WIDGET, MayaPlacementWidget);
	_tmp0_ = self->widget;
	gtk_widget_destroy (_tmp0_);
	_g_object_unref0 (self->widget);
	_g_free0 (self->ref_name);
	G_OBJECT_CLASS (maya_placement_widget_parent_class)->finalize (obj);
}

static GType
maya_placement_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (MayaPlacementWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) maya_placement_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MayaPlacementWidget), 0, (GInstanceInitFunc) maya_placement_widget_instance_init, NULL };
	GType maya_placement_widget_type_id;
	maya_placement_widget_type_id = g_type_register_static (G_TYPE_OBJECT, "MayaPlacementWidget", &g_define_type_info, 0);
	return maya_placement_widget_type_id;
}

GType
maya_placement_widget_get_type (void)
{
	static volatile gsize maya_placement_widget_type_id__once = 0;
	if (g_once_init_enter (&maya_placement_widget_type_id__once)) {
		GType maya_placement_widget_type_id;
		maya_placement_widget_type_id = maya_placement_widget_get_type_once ();
		g_once_init_leave (&maya_placement_widget_type_id__once, maya_placement_widget_type_id);
	}
	return maya_placement_widget_type_id__once;
}

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

GeeLinkedList*
maya_default_placement_widgets_get_user (gint row,
                                         gboolean needed,
                                         const gchar* entry_text,
                                         const gchar* ph_text)
{
	const gchar* _tmp0_ = NULL;
	MayaPlacementWidget* user_entry = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GtkEntry* _tmp4_ = NULL;
	MayaPlacementWidget* _tmp5_ = NULL;
	MayaPlacementWidget* user_label = NULL;
	gchar* _tmp6_;
	GtkWidget* _tmp7_;
	GtkWidget* _tmp8_;
	GtkLabel* _tmp9_ = NULL;
	MayaPlacementWidget* _tmp10_ = NULL;
	GeeLinkedList* collection = NULL;
	GeeLinkedList* _tmp11_;
	GeeLinkedList* result;
	g_return_val_if_fail (entry_text != NULL, NULL);
	_tmp0_ = ph_text;
	if (_tmp0_ == NULL) {
		_tmp0_ = _ ("user.name");
	}
	_tmp1_ = g_strdup ("user_entry");
	_tmp2_ = g_strdup (_tmp0_);
	_tmp3_ = g_strdup (entry_text);
	_tmp4_ = (GtkEntry*) gtk_entry_new ();
	gtk_entry_set_placeholder_text (_tmp4_, _tmp2_);
	_g_free0 (_tmp2_);
	gtk_entry_set_text (_tmp4_, _tmp3_);
	_g_free0 (_tmp3_);
	g_object_ref_sink (_tmp4_);
	_tmp5_ = maya_placement_widget_new ();
	_tmp5_->column = 1;
	_tmp5_->row = row;
	_tmp5_->needed = needed;
	_g_free0 (_tmp5_->ref_name);
	_tmp5_->ref_name = _tmp1_;
	_g_object_unref0 (_tmp5_->widget);
	_tmp5_->widget = (GtkWidget*) _tmp4_;
	user_entry = _tmp5_;
	_tmp6_ = g_strdup ("user_label");
	_tmp7_ = user_entry->widget;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_tmp9_ = (GtkLabel*) gtk_label_new (_ ("User"));
	gtk_label_set_mnemonic_widget (_tmp9_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	gtk_label_set_xalign (_tmp9_, 1.0f);
	g_object_ref_sink (_tmp9_);
	_tmp10_ = maya_placement_widget_new ();
	_tmp10_->column = 0;
	_tmp10_->row = row;
	_g_free0 (_tmp10_->ref_name);
	_tmp10_->ref_name = _tmp6_;
	_g_object_unref0 (_tmp10_->widget);
	_tmp10_->widget = (GtkWidget*) _tmp9_;
	user_label = _tmp10_;
	_tmp11_ = gee_linked_list_new (MAYA_TYPE_PLACEMENT_WIDGET, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	collection = _tmp11_;
	gee_abstract_collection_add ((GeeAbstractCollection*) collection, user_label);
	gee_abstract_collection_add ((GeeAbstractCollection*) collection, user_entry);
	result = collection;
	_g_object_unref0 (user_label);
	_g_object_unref0 (user_entry);
	return result;
}

GeeLinkedList*
maya_default_placement_widgets_get_email (gint row,
                                          gboolean needed,
                                          const gchar* entry_text,
                                          const gchar* ph_text)
{
	const gchar* _tmp0_ = NULL;
	MayaPlacementWidget* user_entry = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GtkEntry* _tmp4_ = NULL;
	MayaPlacementWidget* _tmp5_ = NULL;
	MayaPlacementWidget* user_label = NULL;
	gchar* _tmp6_;
	GtkWidget* _tmp7_;
	GtkWidget* _tmp8_;
	GtkLabel* _tmp9_ = NULL;
	MayaPlacementWidget* _tmp10_ = NULL;
	GeeLinkedList* collection = NULL;
	GeeLinkedList* _tmp11_;
	GeeLinkedList* result;
	g_return_val_if_fail (entry_text != NULL, NULL);
	_tmp0_ = ph_text;
	if (_tmp0_ == NULL) {
		_tmp0_ = _ ("john@doe.com");
	}
	_tmp1_ = g_strdup ("email_entry");
	_tmp2_ = g_strdup (_tmp0_);
	_tmp3_ = g_strdup (entry_text);
	_tmp4_ = (GtkEntry*) gtk_entry_new ();
	gtk_entry_set_placeholder_text (_tmp4_, _tmp2_);
	_g_free0 (_tmp2_);
	gtk_entry_set_text (_tmp4_, _tmp3_);
	_g_free0 (_tmp3_);
	g_object_ref_sink (_tmp4_);
	_tmp5_ = maya_placement_widget_new ();
	_tmp5_->column = 1;
	_tmp5_->row = row;
	_tmp5_->needed = needed;
	_g_free0 (_tmp5_->ref_name);
	_tmp5_->ref_name = _tmp1_;
	_g_object_unref0 (_tmp5_->widget);
	_tmp5_->widget = (GtkWidget*) _tmp4_;
	user_entry = _tmp5_;
	_tmp6_ = g_strdup ("email_label");
	_tmp7_ = user_entry->widget;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_tmp9_ = (GtkLabel*) gtk_label_new (_ ("Email"));
	gtk_label_set_mnemonic_widget (_tmp9_, _tmp8_);
	_g_object_unref0 (_tmp8_);
	gtk_label_set_xalign (_tmp9_, 1.0f);
	g_object_ref_sink (_tmp9_);
	_tmp10_ = maya_placement_widget_new ();
	_tmp10_->column = 0;
	_tmp10_->row = row;
	_g_free0 (_tmp10_->ref_name);
	_tmp10_->ref_name = _tmp6_;
	_g_object_unref0 (_tmp10_->widget);
	_tmp10_->widget = (GtkWidget*) _tmp9_;
	user_label = _tmp10_;
	_tmp11_ = gee_linked_list_new (MAYA_TYPE_PLACEMENT_WIDGET, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	collection = _tmp11_;
	gee_abstract_collection_add ((GeeAbstractCollection*) collection, user_label);
	gee_abstract_collection_add ((GeeAbstractCollection*) collection, user_entry);
	result = collection;
	_g_object_unref0 (user_label);
	_g_object_unref0 (user_entry);
	return result;
}

MayaPlacementWidget*
maya_default_placement_widgets_get_keep_copy (gint row,
                                              gboolean default_value)
{
	MayaPlacementWidget* keep_check = NULL;
	gchar* _tmp0_;
	GtkCheckButton* _tmp1_ = NULL;
	MayaPlacementWidget* _tmp2_ = NULL;
	MayaPlacementWidget* result;
	_tmp0_ = g_strdup ("keep_copy");
	_tmp1_ = (GtkCheckButton*) gtk_check_button_new_with_label (_ ("Keep a copy locally"));
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp1_, default_value);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = maya_placement_widget_new ();
	_tmp2_->column = 1;
	_tmp2_->row = row;
	_g_free0 (_tmp2_->ref_name);
	_tmp2_->ref_name = _tmp0_;
	_g_object_unref0 (_tmp2_->widget);
	_tmp2_->widget = (GtkWidget*) _tmp1_;
	keep_check = _tmp2_;
	result = keep_check;
	return result;
}

