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

/*
 * Copyright 2024 elementary, Inc. (https://elementary.io)
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <granite-7.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 TASKS_TYPE_POPOVER_MENUITEM (tasks_popover_menuitem_get_type ())
#define TASKS_POPOVER_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TASKS_TYPE_POPOVER_MENUITEM, TasksPopoverMenuitem))
#define TASKS_POPOVER_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TASKS_TYPE_POPOVER_MENUITEM, TasksPopoverMenuitemClass))
#define TASKS_IS_POPOVER_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TASKS_TYPE_POPOVER_MENUITEM))
#define TASKS_IS_POPOVER_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TASKS_TYPE_POPOVER_MENUITEM))
#define TASKS_POPOVER_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TASKS_TYPE_POPOVER_MENUITEM, TasksPopoverMenuitemClass))

typedef struct _TasksPopoverMenuitem TasksPopoverMenuitem;
typedef struct _TasksPopoverMenuitemClass TasksPopoverMenuitemClass;
typedef struct _TasksPopoverMenuitemPrivate TasksPopoverMenuitemPrivate;
enum  {
	TASKS_POPOVER_MENUITEM_0_PROPERTY,
	TASKS_POPOVER_MENUITEM_TEXT_PROPERTY,
	TASKS_POPOVER_MENUITEM_NUM_PROPERTIES
};
static GParamSpec* tasks_popover_menuitem_properties[TASKS_POPOVER_MENUITEM_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 _TasksPopoverMenuitem {
	GtkButton parent_instance;
	TasksPopoverMenuitemPrivate * priv;
};

struct _TasksPopoverMenuitemClass {
	GtkButtonClass parent_class;
};

static gpointer tasks_popover_menuitem_parent_class = NULL;

VALA_EXTERN GType tasks_popover_menuitem_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TasksPopoverMenuitem, g_object_unref)
VALA_EXTERN TasksPopoverMenuitem* tasks_popover_menuitem_new (void);
VALA_EXTERN TasksPopoverMenuitem* tasks_popover_menuitem_construct (GType object_type);
VALA_EXTERN void tasks_popover_menuitem_set_text (TasksPopoverMenuitem* self,
                                      const gchar* value);
static GObject * tasks_popover_menuitem_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties);
static void _tasks_popover_menuitem___lambda47_ (TasksPopoverMenuitem* self);
static void __tasks_popover_menuitem___lambda47__gtk_button_clicked (GtkButton* _sender,
                                                              gpointer self);
static GType tasks_popover_menuitem_get_type_once (void);
static void _vala_tasks_popover_menuitem_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec);

TasksPopoverMenuitem*
tasks_popover_menuitem_construct (GType object_type)
{
	TasksPopoverMenuitem * self = NULL;
	self = (TasksPopoverMenuitem*) g_object_new (object_type, NULL);
	return self;
}

TasksPopoverMenuitem*
tasks_popover_menuitem_new (void)
{
	return tasks_popover_menuitem_construct (TASKS_TYPE_POPOVER_MENUITEM);
}

void
tasks_popover_menuitem_set_text (TasksPopoverMenuitem* self,
                                 const gchar* value)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	GraniteAccelLabel* _tmp3_ = NULL;
	GraniteAccelLabel* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_actionable_get_action_name ((GtkActionable*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup (_tmp1_);
	_tmp3_ = granite_accel_label_new (value, NULL);
	granite_accel_label_set_action_name (_tmp3_, _tmp2_);
	_g_free0 (_tmp2_);
	g_object_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	gtk_button_set_child ((GtkButton*) self, (GtkWidget*) _tmp4_);
	_g_object_unref0 (_tmp4_);
	gtk_accessible_update_property ((GtkAccessible*) self, GTK_ACCESSIBLE_PROPERTY_LABEL, value, -1, -1);
	g_object_notify_by_pspec ((GObject *) self, tasks_popover_menuitem_properties[TASKS_POPOVER_MENUITEM_TEXT_PROPERTY]);
}

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

static void
_tasks_popover_menuitem___lambda47_ (TasksPopoverMenuitem* self)
{
	GtkPopover* popover = NULL;
	GtkWidget* _tmp0_;
	GtkPopover* _tmp1_;
	GtkPopover* _tmp2_;
	_tmp0_ = gtk_widget_get_ancestor ((GtkWidget*) self, gtk_popover_get_type ());
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_popover_get_type (), GtkPopover));
	popover = _tmp1_;
	_tmp2_ = popover;
	if (_tmp2_ != NULL) {
		GtkPopover* _tmp3_;
		_tmp3_ = popover;
		gtk_popover_popdown (_tmp3_);
	}
	_g_object_unref0 (popover);
}

static void
__tasks_popover_menuitem___lambda47__gtk_button_clicked (GtkButton* _sender,
                                                         gpointer self)
{
	_tasks_popover_menuitem___lambda47_ ((TasksPopoverMenuitem*) self);
}

static GObject *
tasks_popover_menuitem_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TasksPopoverMenuitem * self;
	parent_class = G_OBJECT_CLASS (tasks_popover_menuitem_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TASKS_TYPE_POPOVER_MENUITEM, TasksPopoverMenuitem);
	g_object_set ((GtkAccessible*) self, "accessible-role", GTK_ACCESSIBLE_ROLE_MENU_ITEM, NULL);
	g_signal_connect_object ((GtkButton*) self, "clicked", (GCallback) __tasks_popover_menuitem___lambda47__gtk_button_clicked, self, 0);
	return obj;
}

static void
tasks_popover_menuitem_base_init (TasksPopoverMenuitemClass * klass)
{
	gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "modelbutton");
}

static void
tasks_popover_menuitem_class_init (TasksPopoverMenuitemClass * klass,
                                   gpointer klass_data)
{
	tasks_popover_menuitem_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->set_property = _vala_tasks_popover_menuitem_set_property;
	G_OBJECT_CLASS (klass)->constructor = tasks_popover_menuitem_constructor;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TASKS_POPOVER_MENUITEM_TEXT_PROPERTY, tasks_popover_menuitem_properties[TASKS_POPOVER_MENUITEM_TEXT_PROPERTY] = g_param_spec_string ("text", "text", "text", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
}

static void
tasks_popover_menuitem_instance_init (TasksPopoverMenuitem * self,
                                      gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
tasks_popover_menuitem_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TasksPopoverMenuitemClass), (GBaseInitFunc) tasks_popover_menuitem_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tasks_popover_menuitem_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TasksPopoverMenuitem), 0, (GInstanceInitFunc) tasks_popover_menuitem_instance_init, NULL };
	GType tasks_popover_menuitem_type_id;
	tasks_popover_menuitem_type_id = g_type_register_static (gtk_button_get_type (), "TasksPopoverMenuitem", &g_define_type_info, 0);
	return tasks_popover_menuitem_type_id;
}

GType
tasks_popover_menuitem_get_type (void)
{
	static gsize tasks_popover_menuitem_type_id__once = 0;
	if (g_once_init_enter (&tasks_popover_menuitem_type_id__once)) {
		GType tasks_popover_menuitem_type_id;
		tasks_popover_menuitem_type_id = tasks_popover_menuitem_get_type_once ();
		g_once_init_leave (&tasks_popover_menuitem_type_id__once, tasks_popover_menuitem_type_id);
	}
	return tasks_popover_menuitem_type_id__once;
}

static void
_vala_tasks_popover_menuitem_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	TasksPopoverMenuitem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TASKS_TYPE_POPOVER_MENUITEM, TasksPopoverMenuitem);
	switch (property_id) {
		case TASKS_POPOVER_MENUITEM_TEXT_PROPERTY:
		tasks_popover_menuitem_set_text (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

