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

/*
 * Copyright 2011-2020 elementary, Inc. (https://elementary.io)
 *
 * 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>

#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 WINGPANEL_WIDGETS_TYPE_INDICATOR_POPOVER (wingpanel_widgets_indicator_popover_get_type ())
#define WINGPANEL_WIDGETS_INDICATOR_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINGPANEL_WIDGETS_TYPE_INDICATOR_POPOVER, WingpanelWidgetsIndicatorPopover))
#define WINGPANEL_WIDGETS_INDICATOR_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINGPANEL_WIDGETS_TYPE_INDICATOR_POPOVER, WingpanelWidgetsIndicatorPopoverClass))
#define WINGPANEL_WIDGETS_IS_INDICATOR_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINGPANEL_WIDGETS_TYPE_INDICATOR_POPOVER))
#define WINGPANEL_WIDGETS_IS_INDICATOR_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINGPANEL_WIDGETS_TYPE_INDICATOR_POPOVER))
#define WINGPANEL_WIDGETS_INDICATOR_POPOVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINGPANEL_WIDGETS_TYPE_INDICATOR_POPOVER, WingpanelWidgetsIndicatorPopoverClass))

typedef struct _WingpanelWidgetsIndicatorPopover WingpanelWidgetsIndicatorPopover;
typedef struct _WingpanelWidgetsIndicatorPopoverClass WingpanelWidgetsIndicatorPopoverClass;
typedef struct _WingpanelWidgetsIndicatorPopoverPrivate WingpanelWidgetsIndicatorPopoverPrivate;
enum  {
	WINGPANEL_WIDGETS_INDICATOR_POPOVER_0_PROPERTY,
	WINGPANEL_WIDGETS_INDICATOR_POPOVER_NUM_PROPERTIES
};
static GParamSpec* wingpanel_widgets_indicator_popover_properties[WINGPANEL_WIDGETS_INDICATOR_POPOVER_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 _WingpanelWidgetsIndicatorPopover {
	GtkPopover parent_instance;
	WingpanelWidgetsIndicatorPopoverPrivate * priv;
};

struct _WingpanelWidgetsIndicatorPopoverClass {
	GtkPopoverClass parent_class;
};

struct _WingpanelWidgetsIndicatorPopoverPrivate {
	GtkWidget* widget;
	GtkBox* container;
};

static gint WingpanelWidgetsIndicatorPopover_private_offset;
static gpointer wingpanel_widgets_indicator_popover_parent_class = NULL;

VALA_EXTERN GType wingpanel_widgets_indicator_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelWidgetsIndicatorPopover, g_object_unref)
VALA_EXTERN void wingpanel_widgets_indicator_popover_set_content (WingpanelWidgetsIndicatorPopover* self,
                                                      GtkWidget* content);
VALA_EXTERN WingpanelWidgetsIndicatorPopover* wingpanel_widgets_indicator_popover_new (void);
VALA_EXTERN WingpanelWidgetsIndicatorPopover* wingpanel_widgets_indicator_popover_construct (GType object_type);
static GObject * wingpanel_widgets_indicator_popover_constructor (GType type,
                                                           guint n_construct_properties,
                                                           GObjectConstructParam * construct_properties);
static void wingpanel_widgets_indicator_popover_finalize (GObject * obj);
static GType wingpanel_widgets_indicator_popover_get_type_once (void);

static inline gpointer
wingpanel_widgets_indicator_popover_get_instance_private (WingpanelWidgetsIndicatorPopover* self)
{
	return G_STRUCT_MEMBER_P (self, WingpanelWidgetsIndicatorPopover_private_offset);
}

void
wingpanel_widgets_indicator_popover_set_content (WingpanelWidgetsIndicatorPopover* self,
                                                 GtkWidget* content)
{
	GtkWidget* _tmp0_;
	GtkWidget* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->widget;
	if (content == _tmp0_) {
		return;
	}
	_tmp1_ = self->priv->widget;
	if (_tmp1_ != NULL) {
		GtkBox* _tmp2_;
		GtkWidget* _tmp3_;
		_tmp2_ = self->priv->container;
		_tmp3_ = self->priv->widget;
		gtk_container_remove ((GtkContainer*) _tmp2_, _tmp3_);
		self->priv->widget = NULL;
	}
	if (content != NULL) {
		GtkBox* _tmp4_;
		_tmp4_ = self->priv->container;
		gtk_container_add ((GtkContainer*) _tmp4_, content);
		self->priv->widget = content;
	}
}

WingpanelWidgetsIndicatorPopover*
wingpanel_widgets_indicator_popover_construct (GType object_type)
{
	WingpanelWidgetsIndicatorPopover * self = NULL;
	self = (WingpanelWidgetsIndicatorPopover*) g_object_new (object_type, NULL);
	return self;
}

WingpanelWidgetsIndicatorPopover*
wingpanel_widgets_indicator_popover_new (void)
{
	return wingpanel_widgets_indicator_popover_construct (WINGPANEL_WIDGETS_TYPE_INDICATOR_POPOVER);
}

static GObject *
wingpanel_widgets_indicator_popover_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WingpanelWidgetsIndicatorPopover * self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GtkBox* _tmp4_ = NULL;
	GtkBox* _tmp5_;
	parent_class = G_OBJECT_CLASS (wingpanel_widgets_indicator_popover_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_WIDGETS_TYPE_INDICATOR_POPOVER, WingpanelWidgetsIndicatorPopover);
	g_object_set ((GtkWidget*) self, "width-request", 256, NULL);
	gtk_popover_set_modal ((GtkPopover*) self, FALSE);
	_tmp0_ = gtk_widget_get_name ((GtkWidget*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat (_tmp1_, "/popover", NULL);
	_tmp3_ = _tmp2_;
	gtk_widget_set_name ((GtkWidget*) self, _tmp3_);
	_g_free0 (_tmp3_);
	gtk_popover_set_position ((GtkPopover*) self, GTK_POS_BOTTOM);
	_tmp4_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp4_, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp4_, 3);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->container);
	self->priv->container = _tmp4_;
	_tmp5_ = self->priv->container;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp5_);
	return obj;
}

static void
wingpanel_widgets_indicator_popover_class_init (WingpanelWidgetsIndicatorPopoverClass * klass,
                                                gpointer klass_data)
{
	wingpanel_widgets_indicator_popover_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WingpanelWidgetsIndicatorPopover_private_offset);
	G_OBJECT_CLASS (klass)->constructor = wingpanel_widgets_indicator_popover_constructor;
	G_OBJECT_CLASS (klass)->finalize = wingpanel_widgets_indicator_popover_finalize;
}

static void
wingpanel_widgets_indicator_popover_instance_init (WingpanelWidgetsIndicatorPopover * self,
                                                   gpointer klass)
{
	self->priv = wingpanel_widgets_indicator_popover_get_instance_private (self);
	self->priv->widget = NULL;
}

static void
wingpanel_widgets_indicator_popover_finalize (GObject * obj)
{
	WingpanelWidgetsIndicatorPopover * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_WIDGETS_TYPE_INDICATOR_POPOVER, WingpanelWidgetsIndicatorPopover);
	_g_object_unref0 (self->priv->container);
	G_OBJECT_CLASS (wingpanel_widgets_indicator_popover_parent_class)->finalize (obj);
}

static GType
wingpanel_widgets_indicator_popover_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WingpanelWidgetsIndicatorPopoverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) wingpanel_widgets_indicator_popover_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WingpanelWidgetsIndicatorPopover), 0, (GInstanceInitFunc) wingpanel_widgets_indicator_popover_instance_init, NULL };
	GType wingpanel_widgets_indicator_popover_type_id;
	wingpanel_widgets_indicator_popover_type_id = g_type_register_static (gtk_popover_get_type (), "WingpanelWidgetsIndicatorPopover", &g_define_type_info, 0);
	WingpanelWidgetsIndicatorPopover_private_offset = g_type_add_instance_private (wingpanel_widgets_indicator_popover_type_id, sizeof (WingpanelWidgetsIndicatorPopoverPrivate));
	return wingpanel_widgets_indicator_popover_type_id;
}

GType
wingpanel_widgets_indicator_popover_get_type (void)
{
	static volatile gsize wingpanel_widgets_indicator_popover_type_id__once = 0;
	if (g_once_init_enter (&wingpanel_widgets_indicator_popover_type_id__once)) {
		GType wingpanel_widgets_indicator_popover_type_id;
		wingpanel_widgets_indicator_popover_type_id = wingpanel_widgets_indicator_popover_get_type_once ();
		g_once_init_leave (&wingpanel_widgets_indicator_popover_type_id__once, wingpanel_widgets_indicator_popover_type_id);
	}
	return wingpanel_widgets_indicator_popover_type_id__once;
}

