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

/* view.vala
 *
 * Copyright (C) 2017 Red Hat, Inc.
 * Copyright (C) 2023–2024 Markus Göllnitz
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 *
 * Authors: Petr Štětka <pstetka@redhat.com>
 *          Markus Göllnitz <camelcasenick@bewares.it>
 */

#include <adwaita.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.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 USAGE_TYPE_VIEW (usage_view_get_type ())
#define USAGE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), USAGE_TYPE_VIEW, UsageView))
#define USAGE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), USAGE_TYPE_VIEW, UsageViewClass))
#define USAGE_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), USAGE_TYPE_VIEW))
#define USAGE_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), USAGE_TYPE_VIEW))
#define USAGE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), USAGE_TYPE_VIEW, UsageViewClass))

typedef struct _UsageView UsageView;
typedef struct _UsageViewClass UsageViewClass;
typedef struct _UsageViewPrivate UsageViewPrivate;
enum  {
	USAGE_VIEW_0_PROPERTY,
	USAGE_VIEW_NUM_PROPERTIES
};
static GParamSpec* usage_view_properties[USAGE_VIEW_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)))

struct _UsageView {
	AdwBreakpointBin parent_instance;
	UsageViewPrivate * priv;
	gchar* title;
	gchar* icon_name;
	GtkWidget* switcher_widget;
	gboolean search_available;
};

struct _UsageViewClass {
	AdwBreakpointBinClass parent_class;
	void (*set_search_text) (UsageView* self, const gchar* query);
	gboolean (*prerequisite_fulfilled) (UsageView* self);
};

static gpointer usage_view_parent_class = NULL;

VALA_EXTERN GType usage_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UsageView, g_object_unref)
VALA_EXTERN void usage_view_set_search_text (UsageView* self,
                                 const gchar* query);
VALA_EXTERN gboolean usage_view_prerequisite_fulfilled (UsageView* self);
VALA_EXTERN UsageView* usage_view_construct (GType object_type);
static void usage_view_real_set_search_text (UsageView* self,
                                      const gchar* query);
static gboolean usage_view_real_prerequisite_fulfilled (UsageView* self);
static GObject * usage_view_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties);
static void usage_view_finalize (GObject * obj);
static GType usage_view_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

UsageView*
usage_view_construct (GType object_type)
{
	UsageView * self = NULL;
	self = (UsageView*) g_object_new (object_type, NULL);
	return self;
}

static void
usage_view_real_set_search_text (UsageView* self,
                                 const gchar* query)
{
	g_return_if_fail (query != NULL);
	if (self->search_available) {
		g_critical ("view.vala:39: Search Feature Not Yet Implemented");
	}
}

void
usage_view_set_search_text (UsageView* self,
                            const gchar* query)
{
	UsageViewClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = USAGE_VIEW_GET_CLASS (self);
	if (_klass_->set_search_text) {
		_klass_->set_search_text (self, query);
	}
}

static gboolean
usage_view_real_prerequisite_fulfilled (UsageView* self)
{
	gboolean result;
	result = TRUE;
	return result;
}

gboolean
usage_view_prerequisite_fulfilled (UsageView* self)
{
	UsageViewClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = USAGE_VIEW_GET_CLASS (self);
	if (_klass_->prerequisite_fulfilled) {
		return _klass_->prerequisite_fulfilled (self);
	}
	return FALSE;
}

static GObject *
usage_view_constructor (GType type,
                        guint n_construct_properties,
                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	UsageView * self;
	parent_class = G_OBJECT_CLASS (usage_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, USAGE_TYPE_VIEW, UsageView);
	g_object_set ((GtkWidget*) self, "width-request", 360, NULL);
	g_object_set ((GtkWidget*) self, "height-request", 210, NULL);
	return obj;
}

static void
usage_view_class_init (UsageViewClass * klass,
                       gpointer klass_data)
{
	usage_view_parent_class = g_type_class_peek_parent (klass);
	((UsageViewClass *) klass)->set_search_text = (void (*) (UsageView*, const gchar*)) usage_view_real_set_search_text;
	((UsageViewClass *) klass)->prerequisite_fulfilled = (gboolean (*) (UsageView*)) usage_view_real_prerequisite_fulfilled;
	G_OBJECT_CLASS (klass)->constructor = usage_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = usage_view_finalize;
}

static void
usage_view_instance_init (UsageView * self,
                          gpointer klass)
{
	self->search_available = FALSE;
}

static void
usage_view_finalize (GObject * obj)
{
	UsageView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, USAGE_TYPE_VIEW, UsageView);
	_g_free0 (self->title);
	_g_free0 (self->icon_name);
	_g_object_unref0 (self->switcher_widget);
	G_OBJECT_CLASS (usage_view_parent_class)->finalize (obj);
}

static GType
usage_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (UsageViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) usage_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UsageView), 0, (GInstanceInitFunc) usage_view_instance_init, NULL };
	GType usage_view_type_id;
	usage_view_type_id = g_type_register_static (adw_breakpoint_bin_get_type (), "UsageView", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	return usage_view_type_id;
}

GType
usage_view_get_type (void)
{
	static volatile gsize usage_view_type_id__once = 0;
	if (g_once_init_enter (&usage_view_type_id__once)) {
		GType usage_view_type_id;
		usage_view_type_id = usage_view_get_type_once ();
		g_once_init_leave (&usage_view_type_id__once, usage_view_type_id);
	}
	return usage_view_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;
}

