/* IndicatorEntry.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from IndicatorEntry.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 "wingpanel.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.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 WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY (wingpanel_widgets_indicator_entry_get_type ())
#define WINGPANEL_WIDGETS_INDICATOR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, WingpanelWidgetsIndicatorEntry))
#define WINGPANEL_WIDGETS_INDICATOR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, WingpanelWidgetsIndicatorEntryClass))
#define WINGPANEL_WIDGETS_IS_INDICATOR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY))
#define WINGPANEL_WIDGETS_IS_INDICATOR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY))
#define WINGPANEL_WIDGETS_INDICATOR_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, WingpanelWidgetsIndicatorEntryClass))

typedef struct _WingpanelWidgetsIndicatorEntry WingpanelWidgetsIndicatorEntry;
typedef struct _WingpanelWidgetsIndicatorEntryClass WingpanelWidgetsIndicatorEntryClass;
typedef struct _WingpanelWidgetsIndicatorEntryPrivate WingpanelWidgetsIndicatorEntryPrivate;

#define WINGPANEL_WIDGETS_TYPE_INDICATOR_BAR (wingpanel_widgets_indicator_bar_get_type ())
#define WINGPANEL_WIDGETS_INDICATOR_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINGPANEL_WIDGETS_TYPE_INDICATOR_BAR, WingpanelWidgetsIndicatorBar))
#define WINGPANEL_WIDGETS_INDICATOR_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINGPANEL_WIDGETS_TYPE_INDICATOR_BAR, WingpanelWidgetsIndicatorBarClass))
#define WINGPANEL_WIDGETS_IS_INDICATOR_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINGPANEL_WIDGETS_TYPE_INDICATOR_BAR))
#define WINGPANEL_WIDGETS_IS_INDICATOR_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINGPANEL_WIDGETS_TYPE_INDICATOR_BAR))
#define WINGPANEL_WIDGETS_INDICATOR_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINGPANEL_WIDGETS_TYPE_INDICATOR_BAR, WingpanelWidgetsIndicatorBarClass))

typedef struct _WingpanelWidgetsIndicatorBar WingpanelWidgetsIndicatorBar;
typedef struct _WingpanelWidgetsIndicatorBarClass WingpanelWidgetsIndicatorBarClass;

#define WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER (wingpanel_services_popover_manager_get_type ())
#define WINGPANEL_SERVICES_POPOVER_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, WingpanelServicesPopoverManager))
#define WINGPANEL_SERVICES_POPOVER_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, WingpanelServicesPopoverManagerClass))
#define WINGPANEL_SERVICES_IS_POPOVER_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER))
#define WINGPANEL_SERVICES_IS_POPOVER_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER))
#define WINGPANEL_SERVICES_POPOVER_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, WingpanelServicesPopoverManagerClass))

typedef struct _WingpanelServicesPopoverManager WingpanelServicesPopoverManager;
typedef struct _WingpanelServicesPopoverManagerClass WingpanelServicesPopoverManagerClass;
enum  {
	WINGPANEL_WIDGETS_INDICATOR_ENTRY_0_PROPERTY,
	WINGPANEL_WIDGETS_INDICATOR_ENTRY_BASE_INDICATOR_PROPERTY,
	WINGPANEL_WIDGETS_INDICATOR_ENTRY_POPOVER_MANAGER_PROPERTY,
	WINGPANEL_WIDGETS_INDICATOR_ENTRY_DISPLAY_WIDGET_PROPERTY,
	WINGPANEL_WIDGETS_INDICATOR_ENTRY_INDICATOR_WIDGET_PROPERTY,
	WINGPANEL_WIDGETS_INDICATOR_ENTRY_NUM_PROPERTIES
};
static GParamSpec* wingpanel_widgets_indicator_entry_properties[WINGPANEL_WIDGETS_INDICATOR_ENTRY_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 _WingpanelWidgetsIndicatorEntry {
	GtkEventBox parent_instance;
	WingpanelWidgetsIndicatorEntryPrivate * priv;
	WingpanelWidgetsIndicatorBar* indicator_bar;
};

struct _WingpanelWidgetsIndicatorEntryClass {
	GtkEventBoxClass parent_class;
};

struct _WingpanelWidgetsIndicatorEntryPrivate {
	WingpanelIndicator* _base_indicator;
	WingpanelServicesPopoverManager* _popover_manager;
	GtkWidget* _display_widget;
	GtkWidget* _indicator_widget;
	GtkRevealer* revealer;
	GtkGestureMultiPress* gesture_controller;
	GtkEventControllerMotion* motion_controller;
};

static gint WingpanelWidgetsIndicatorEntry_private_offset;
static gpointer wingpanel_widgets_indicator_entry_parent_class = NULL;

VALA_EXTERN GType wingpanel_widgets_indicator_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelWidgetsIndicatorEntry, g_object_unref)
VALA_EXTERN GType wingpanel_widgets_indicator_bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelWidgetsIndicatorBar, g_object_unref)
VALA_EXTERN GType wingpanel_services_popover_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelServicesPopoverManager, g_object_unref)
VALA_EXTERN WingpanelWidgetsIndicatorEntry* wingpanel_widgets_indicator_entry_new (WingpanelIndicator* base_indicator,
                                                                       WingpanelServicesPopoverManager* popover_manager);
VALA_EXTERN WingpanelWidgetsIndicatorEntry* wingpanel_widgets_indicator_entry_construct (GType object_type,
                                                                             WingpanelIndicator* base_indicator,
                                                                             WingpanelServicesPopoverManager* popover_manager);
static void wingpanel_widgets_indicator_entry_indicator_unmapped (WingpanelWidgetsIndicatorEntry* self);
VALA_EXTERN WingpanelIndicator* wingpanel_widgets_indicator_entry_get_base_indicator (WingpanelWidgetsIndicatorEntry* self);
static void _wingpanel_widgets_indicator_entry_indicator_unmapped_gtk_widget_unmap (GtkWidget* _sender,
                                                                             gpointer self);
VALA_EXTERN void wingpanel_widgets_indicator_entry_set_transition_type (WingpanelWidgetsIndicatorEntry* self,
                                                            GtkRevealerTransitionType transition_type);
static void wingpanel_widgets_indicator_entry_set_reveal (WingpanelWidgetsIndicatorEntry* self,
                                                   gboolean reveal);
VALA_EXTERN WingpanelServicesPopoverManager* wingpanel_widgets_indicator_entry_get_popover_manager (WingpanelWidgetsIndicatorEntry* self);
VALA_EXTERN gboolean wingpanel_services_popover_manager_get_visible (WingpanelServicesPopoverManager* self,
                                                         WingpanelWidgetsIndicatorEntry* entry);
VALA_EXTERN void wingpanel_services_popover_manager_set_current_indicator (WingpanelServicesPopoverManager* self,
                                                               WingpanelWidgetsIndicatorEntry* value);
static void wingpanel_widgets_indicator_entry_set_base_indicator (WingpanelWidgetsIndicatorEntry* self,
                                                           WingpanelIndicator* value);
static void wingpanel_widgets_indicator_entry_set_popover_manager (WingpanelWidgetsIndicatorEntry* self,
                                                            WingpanelServicesPopoverManager* value);
VALA_EXTERN GtkWidget* wingpanel_widgets_indicator_entry_get_display_widget (WingpanelWidgetsIndicatorEntry* self);
static void wingpanel_widgets_indicator_entry_set_display_widget (WingpanelWidgetsIndicatorEntry* self,
                                                           GtkWidget* value);
VALA_EXTERN GtkWidget* wingpanel_widgets_indicator_entry_get_indicator_widget (WingpanelWidgetsIndicatorEntry* self);
static GObject * wingpanel_widgets_indicator_entry_constructor (GType type,
                                                         guint n_construct_properties,
                                                         GObjectConstructParam * construct_properties);
VALA_EXTERN void wingpanel_services_popover_manager_register_indicator (WingpanelServicesPopoverManager* self,
                                                            WingpanelWidgetsIndicatorEntry* widg);
static void _wingpanel_widgets_indicator_entry___lambda8_ (WingpanelWidgetsIndicatorEntry* self);
VALA_EXTERN void wingpanel_services_popover_manager_close (WingpanelServicesPopoverManager* self);
static void __wingpanel_widgets_indicator_entry___lambda8__wingpanel_indicator_close (WingpanelIndicator* _sender,
                                                                               gpointer self);
static void _wingpanel_widgets_indicator_entry___lambda9_ (WingpanelWidgetsIndicatorEntry* self);
VALA_EXTERN void wingpanel_widgets_indicator_bar_insert_sorted (WingpanelWidgetsIndicatorBar* self,
                                                    WingpanelWidgetsIndicatorEntry* item);
VALA_EXTERN void wingpanel_services_popover_manager_unregister_indicator (WingpanelServicesPopoverManager* self,
                                                              WingpanelWidgetsIndicatorEntry* widg);
static void __wingpanel_widgets_indicator_entry___lambda9__g_object_notify (GObject* _sender,
                                                                     GParamSpec* pspec,
                                                                     gpointer self);
static gboolean _wingpanel_widgets_indicator_entry___lambda10_ (WingpanelWidgetsIndicatorEntry* self,
                                                         GdkEventScroll* e);
static gboolean __wingpanel_widgets_indicator_entry___lambda10__gtk_widget_scroll_event (GtkWidget* _sender,
                                                                                  GdkEventScroll* event,
                                                                                  gpointer self);
static gboolean _wingpanel_widgets_indicator_entry___lambda11_ (WingpanelWidgetsIndicatorEntry* self,
                                                         GdkEventButton* e);
static gboolean __wingpanel_widgets_indicator_entry___lambda11__gtk_widget_button_press_event (GtkWidget* _sender,
                                                                                        GdkEventButton* event,
                                                                                        gpointer self);
static void _wingpanel_widgets_indicator_entry___lambda12_ (WingpanelWidgetsIndicatorEntry* self);
static void __wingpanel_widgets_indicator_entry___lambda12__gtk_gesture_multi_press_pressed (GtkGestureMultiPress* _sender,
                                                                                      gint n_press,
                                                                                      gdouble x,
                                                                                      gdouble y,
                                                                                      gpointer self);
static void _wingpanel_widgets_indicator_entry___lambda13_ (WingpanelWidgetsIndicatorEntry* self);
VALA_EXTERN WingpanelWidgetsIndicatorEntry* wingpanel_services_popover_manager_get_current_indicator (WingpanelServicesPopoverManager* self);
static void __wingpanel_widgets_indicator_entry___lambda13__gtk_event_controller_motion_enter (GtkEventControllerMotion* _sender,
                                                                                        gdouble x,
                                                                                        gdouble y,
                                                                                        gpointer self);
static void wingpanel_widgets_indicator_entry_finalize (GObject * obj);
static GType wingpanel_widgets_indicator_entry_get_type_once (void);
static void _vala_wingpanel_widgets_indicator_entry_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec);
static void _vala_wingpanel_widgets_indicator_entry_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
wingpanel_widgets_indicator_entry_get_instance_private (WingpanelWidgetsIndicatorEntry* self)
{
	return G_STRUCT_MEMBER_P (self, WingpanelWidgetsIndicatorEntry_private_offset);
}

WingpanelWidgetsIndicatorEntry*
wingpanel_widgets_indicator_entry_construct (GType object_type,
                                             WingpanelIndicator* base_indicator,
                                             WingpanelServicesPopoverManager* popover_manager)
{
	WingpanelWidgetsIndicatorEntry * self = NULL;
	g_return_val_if_fail (base_indicator != NULL, NULL);
	g_return_val_if_fail (popover_manager != NULL, NULL);
	self = (WingpanelWidgetsIndicatorEntry*) g_object_new (object_type, "base-indicator", base_indicator, "popover-manager", popover_manager, NULL);
	return self;
}

WingpanelWidgetsIndicatorEntry*
wingpanel_widgets_indicator_entry_new (WingpanelIndicator* base_indicator,
                                       WingpanelServicesPopoverManager* popover_manager)
{
	return wingpanel_widgets_indicator_entry_construct (WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, base_indicator, popover_manager);
}

static void
_wingpanel_widgets_indicator_entry_indicator_unmapped_gtk_widget_unmap (GtkWidget* _sender,
                                                                        gpointer self)
{
	wingpanel_widgets_indicator_entry_indicator_unmapped ((WingpanelWidgetsIndicatorEntry*) self);
}

static void
wingpanel_widgets_indicator_entry_indicator_unmapped (WingpanelWidgetsIndicatorEntry* self)
{
	WingpanelIndicator* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	guint _tmp3_;
	WingpanelWidgetsIndicatorBar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_base_indicator;
	_tmp1_ = wingpanel_indicator_get_display_widget (_tmp0_);
	_tmp2_ = _tmp1_;
	g_signal_parse_name ("unmap", gtk_widget_get_type (), &_tmp3_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _wingpanel_widgets_indicator_entry_indicator_unmapped_gtk_widget_unmap, self);
	_g_object_unref0 (_tmp2_);
	_tmp4_ = self->indicator_bar;
	gtk_container_remove ((GtkContainer*) _tmp4_, (GtkWidget*) self);
}

void
wingpanel_widgets_indicator_entry_set_transition_type (WingpanelWidgetsIndicatorEntry* self,
                                                       GtkRevealerTransitionType transition_type)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->revealer;
	gtk_revealer_set_transition_type (_tmp0_, transition_type);
}

static void
wingpanel_widgets_indicator_entry_set_reveal (WingpanelWidgetsIndicatorEntry* self,
                                              gboolean reveal)
{
	gboolean _tmp0_ = FALSE;
	GtkRevealer* _tmp3_;
	g_return_if_fail (self != NULL);
	if (!reveal) {
		WingpanelServicesPopoverManager* _tmp1_;
		_tmp1_ = self->priv->_popover_manager;
		_tmp0_ = wingpanel_services_popover_manager_get_visible (_tmp1_, self);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		WingpanelServicesPopoverManager* _tmp2_;
		_tmp2_ = self->priv->_popover_manager;
		wingpanel_services_popover_manager_set_current_indicator (_tmp2_, NULL);
	}
	_tmp3_ = self->priv->revealer;
	gtk_revealer_set_reveal_child (_tmp3_, reveal);
}

WingpanelIndicator*
wingpanel_widgets_indicator_entry_get_base_indicator (WingpanelWidgetsIndicatorEntry* self)
{
	WingpanelIndicator* result;
	WingpanelIndicator* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_base_indicator;
	result = _tmp0_;
	return result;
}

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

static void
wingpanel_widgets_indicator_entry_set_base_indicator (WingpanelWidgetsIndicatorEntry* self,
                                                      WingpanelIndicator* value)
{
	WingpanelIndicator* old_value;
	g_return_if_fail (self != NULL);
	old_value = wingpanel_widgets_indicator_entry_get_base_indicator (self);
	if (old_value != value) {
		WingpanelIndicator* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_base_indicator);
		self->priv->_base_indicator = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, wingpanel_widgets_indicator_entry_properties[WINGPANEL_WIDGETS_INDICATOR_ENTRY_BASE_INDICATOR_PROPERTY]);
	}
}

WingpanelServicesPopoverManager*
wingpanel_widgets_indicator_entry_get_popover_manager (WingpanelWidgetsIndicatorEntry* self)
{
	WingpanelServicesPopoverManager* result;
	WingpanelServicesPopoverManager* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_popover_manager;
	result = _tmp0_;
	return result;
}

static void
wingpanel_widgets_indicator_entry_set_popover_manager (WingpanelWidgetsIndicatorEntry* self,
                                                       WingpanelServicesPopoverManager* value)
{
	WingpanelServicesPopoverManager* old_value;
	g_return_if_fail (self != NULL);
	old_value = wingpanel_widgets_indicator_entry_get_popover_manager (self);
	if (old_value != value) {
		WingpanelServicesPopoverManager* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_popover_manager);
		self->priv->_popover_manager = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, wingpanel_widgets_indicator_entry_properties[WINGPANEL_WIDGETS_INDICATOR_ENTRY_POPOVER_MANAGER_PROPERTY]);
	}
}

GtkWidget*
wingpanel_widgets_indicator_entry_get_display_widget (WingpanelWidgetsIndicatorEntry* self)
{
	GtkWidget* result;
	GtkWidget* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_display_widget;
	result = _tmp0_;
	return result;
}

static void
wingpanel_widgets_indicator_entry_set_display_widget (WingpanelWidgetsIndicatorEntry* self,
                                                      GtkWidget* value)
{
	GtkWidget* old_value;
	g_return_if_fail (self != NULL);
	old_value = wingpanel_widgets_indicator_entry_get_display_widget (self);
	if (old_value != value) {
		GtkWidget* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_display_widget);
		self->priv->_display_widget = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, wingpanel_widgets_indicator_entry_properties[WINGPANEL_WIDGETS_INDICATOR_ENTRY_DISPLAY_WIDGET_PROPERTY]);
	}
}

GtkWidget*
wingpanel_widgets_indicator_entry_get_indicator_widget (WingpanelWidgetsIndicatorEntry* self)
{
	GtkWidget* result;
	GtkWidget* _tmp0_;
	GtkWidget* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_indicator_widget;
	if (_tmp0_ == NULL) {
		WingpanelIndicator* _tmp1_;
		GtkWidget* _tmp2_;
		_tmp1_ = self->priv->_base_indicator;
		_tmp2_ = wingpanel_indicator_get_widget (_tmp1_);
		_g_object_unref0 (self->priv->_indicator_widget);
		self->priv->_indicator_widget = _tmp2_;
	}
	_tmp3_ = self->priv->_indicator_widget;
	result = _tmp3_;
	return result;
}

static void
_wingpanel_widgets_indicator_entry___lambda8_ (WingpanelWidgetsIndicatorEntry* self)
{
	WingpanelServicesPopoverManager* _tmp0_;
	_tmp0_ = self->priv->_popover_manager;
	wingpanel_services_popover_manager_close (_tmp0_);
}

static void
__wingpanel_widgets_indicator_entry___lambda8__wingpanel_indicator_close (WingpanelIndicator* _sender,
                                                                          gpointer self)
{
	_wingpanel_widgets_indicator_entry___lambda8_ ((WingpanelWidgetsIndicatorEntry*) self);
}

static void
_wingpanel_widgets_indicator_entry___lambda9_ (WingpanelWidgetsIndicatorEntry* self)
{
	WingpanelWidgetsIndicatorBar* _tmp0_;
	_tmp0_ = self->indicator_bar;
	if (_tmp0_ != NULL) {
		WingpanelServicesPopoverManager* _tmp1_;
		WingpanelIndicator* _tmp2_;
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp1_ = self->priv->_popover_manager;
		wingpanel_services_popover_manager_close (_tmp1_);
		_tmp2_ = self->priv->_base_indicator;
		_tmp3_ = wingpanel_indicator_get_visible (_tmp2_);
		_tmp4_ = _tmp3_;
		if (_tmp4_) {
			WingpanelServicesPopoverManager* _tmp5_;
			WingpanelWidgetsIndicatorBar* _tmp6_;
			WingpanelIndicator* _tmp7_;
			gboolean _tmp8_;
			gboolean _tmp9_;
			_tmp5_ = self->priv->_popover_manager;
			wingpanel_services_popover_manager_register_indicator (_tmp5_, self);
			_tmp6_ = self->indicator_bar;
			wingpanel_widgets_indicator_bar_insert_sorted (_tmp6_, self);
			_tmp7_ = self->priv->_base_indicator;
			_tmp8_ = wingpanel_indicator_get_visible (_tmp7_);
			_tmp9_ = _tmp8_;
			wingpanel_widgets_indicator_entry_set_reveal (self, _tmp9_);
		} else {
			WingpanelIndicator* _tmp10_;
			gboolean _tmp11_;
			gboolean _tmp12_;
			WingpanelServicesPopoverManager* _tmp13_;
			GtkWidget* _tmp14_;
			_tmp10_ = self->priv->_base_indicator;
			_tmp11_ = wingpanel_indicator_get_visible (_tmp10_);
			_tmp12_ = _tmp11_;
			wingpanel_widgets_indicator_entry_set_reveal (self, _tmp12_);
			_tmp13_ = self->priv->_popover_manager;
			wingpanel_services_popover_manager_unregister_indicator (_tmp13_, self);
			_tmp14_ = self->priv->_display_widget;
			g_signal_connect_object (_tmp14_, "unmap", (GCallback) _wingpanel_widgets_indicator_entry_indicator_unmapped_gtk_widget_unmap, self, 0);
		}
	} else {
		WingpanelIndicator* _tmp15_;
		gboolean _tmp16_;
		gboolean _tmp17_;
		_tmp15_ = self->priv->_base_indicator;
		_tmp16_ = wingpanel_indicator_get_visible (_tmp15_);
		_tmp17_ = _tmp16_;
		wingpanel_widgets_indicator_entry_set_reveal (self, _tmp17_);
	}
}

static void
__wingpanel_widgets_indicator_entry___lambda9__g_object_notify (GObject* _sender,
                                                                GParamSpec* pspec,
                                                                gpointer self)
{
	_wingpanel_widgets_indicator_entry___lambda9_ ((WingpanelWidgetsIndicatorEntry*) self);
}

static gboolean
_wingpanel_widgets_indicator_entry___lambda10_ (WingpanelWidgetsIndicatorEntry* self,
                                                GdkEventScroll* e)
{
	GtkWidget* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = self->priv->_display_widget;
	g_signal_emit_by_name (_tmp0_, "scroll-event", e, &_tmp1_);
	result = _tmp1_;
	return result;
}

static gboolean
__wingpanel_widgets_indicator_entry___lambda10__gtk_widget_scroll_event (GtkWidget* _sender,
                                                                         GdkEventScroll* event,
                                                                         gpointer self)
{
	gboolean result;
	result = _wingpanel_widgets_indicator_entry___lambda10_ ((WingpanelWidgetsIndicatorEntry*) self, event);
	return result;
}

static gboolean
_wingpanel_widgets_indicator_entry___lambda11_ (WingpanelWidgetsIndicatorEntry* self,
                                                GdkEventButton* e)
{
	GtkWidget* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = self->priv->_display_widget;
	g_signal_emit_by_name (_tmp0_, "button-press-event", e, &_tmp1_);
	result = _tmp1_;
	return result;
}

static gboolean
__wingpanel_widgets_indicator_entry___lambda11__gtk_widget_button_press_event (GtkWidget* _sender,
                                                                               GdkEventButton* event,
                                                                               gpointer self)
{
	gboolean result;
	result = _wingpanel_widgets_indicator_entry___lambda11_ ((WingpanelWidgetsIndicatorEntry*) self, event);
	return result;
}

static void
_wingpanel_widgets_indicator_entry___lambda12_ (WingpanelWidgetsIndicatorEntry* self)
{
	WingpanelServicesPopoverManager* _tmp0_;
	GtkGestureMultiPress* _tmp1_;
	_tmp0_ = self->priv->_popover_manager;
	wingpanel_services_popover_manager_set_current_indicator (_tmp0_, self);
	_tmp1_ = self->priv->gesture_controller;
	gtk_gesture_set_state ((GtkGesture*) _tmp1_, GTK_EVENT_SEQUENCE_CLAIMED);
}

static void
__wingpanel_widgets_indicator_entry___lambda12__gtk_gesture_multi_press_pressed (GtkGestureMultiPress* _sender,
                                                                                 gint n_press,
                                                                                 gdouble x,
                                                                                 gdouble y,
                                                                                 gpointer self)
{
	_wingpanel_widgets_indicator_entry___lambda12_ ((WingpanelWidgetsIndicatorEntry*) self);
}

static void
_wingpanel_widgets_indicator_entry___lambda13_ (WingpanelWidgetsIndicatorEntry* self)
{
	gboolean _tmp0_ = FALSE;
	WingpanelServicesPopoverManager* _tmp1_;
	WingpanelWidgetsIndicatorEntry* _tmp2_;
	WingpanelWidgetsIndicatorEntry* _tmp3_;
	_tmp1_ = self->priv->_popover_manager;
	_tmp2_ = wingpanel_services_popover_manager_get_current_indicator (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != NULL) {
		WingpanelServicesPopoverManager* _tmp4_;
		_tmp4_ = self->priv->_popover_manager;
		_tmp0_ = !wingpanel_services_popover_manager_get_visible (_tmp4_, self);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		WingpanelServicesPopoverManager* _tmp5_;
		_tmp5_ = self->priv->_popover_manager;
		wingpanel_services_popover_manager_set_current_indicator (_tmp5_, self);
	}
}

static void
__wingpanel_widgets_indicator_entry___lambda13__gtk_event_controller_motion_enter (GtkEventControllerMotion* _sender,
                                                                                   gdouble x,
                                                                                   gdouble y,
                                                                                   gpointer self)
{
	_wingpanel_widgets_indicator_entry___lambda13_ ((WingpanelWidgetsIndicatorEntry*) self);
}

static GObject *
wingpanel_widgets_indicator_entry_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WingpanelWidgetsIndicatorEntry * self;
	WingpanelIndicator* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	WingpanelIndicator* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GtkWidget* _tmp8_;
	GtkWidget* _tmp9_;
	GtkWidget* _tmp10_;
	GtkRevealer* _tmp11_ = NULL;
	GtkRevealer* _tmp12_;
	GtkStyleContext* _tmp13_;
	GtkRevealer* _tmp14_;
	WingpanelIndicator* _tmp15_;
	gboolean _tmp16_;
	gboolean _tmp17_;
	WingpanelIndicator* _tmp19_;
	WingpanelIndicator* _tmp20_;
	GtkGestureMultiPress* _tmp21_;
	GtkGestureMultiPress* _tmp22_;
	GtkEventControllerMotion* _tmp23_ = NULL;
	GtkEventControllerMotion* _tmp24_;
	WingpanelIndicator* _tmp25_;
	gboolean _tmp26_;
	gboolean _tmp27_;
	parent_class = G_OBJECT_CLASS (wingpanel_widgets_indicator_entry_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, WingpanelWidgetsIndicatorEntry);
	gtk_widget_set_can_focus ((GtkWidget*) self, FALSE);
	_tmp0_ = self->priv->_base_indicator;
	_tmp1_ = wingpanel_indicator_get_display_widget (_tmp0_);
	_tmp2_ = _tmp1_;
	wingpanel_widgets_indicator_entry_set_display_widget (self, _tmp2_);
	_g_object_unref0 (_tmp2_);
	gtk_widget_set_halign ((GtkWidget*) self, GTK_ALIGN_START);
	_tmp3_ = self->priv->_base_indicator;
	_tmp4_ = wingpanel_indicator_get_code_name (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strconcat (_tmp5_, "/entry", NULL);
	_tmp7_ = _tmp6_;
	gtk_widget_set_name ((GtkWidget*) self, _tmp7_);
	_g_free0 (_tmp7_);
	_tmp8_ = self->priv->_display_widget;
	if (_tmp8_ == NULL) {
		return obj;
	}
	_tmp9_ = self->priv->_display_widget;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	_tmp11_ = (GtkRevealer*) gtk_revealer_new ();
	g_object_set ((GtkContainer*) _tmp11_, "child", _tmp10_, NULL);
	_g_object_unref0 (_tmp10_);
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->revealer);
	self->priv->revealer = _tmp11_;
	_tmp12_ = self->priv->revealer;
	_tmp13_ = gtk_widget_get_style_context ((GtkWidget*) _tmp12_);
	gtk_style_context_add_class (_tmp13_, "composited-indicator");
	_tmp14_ = self->priv->revealer;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp14_);
	_tmp15_ = self->priv->_base_indicator;
	_tmp16_ = wingpanel_indicator_get_visible (_tmp15_);
	_tmp17_ = _tmp16_;
	if (_tmp17_) {
		WingpanelServicesPopoverManager* _tmp18_;
		_tmp18_ = self->priv->_popover_manager;
		wingpanel_services_popover_manager_register_indicator (_tmp18_, self);
	}
	_tmp19_ = self->priv->_base_indicator;
	g_signal_connect_object (_tmp19_, "close", (GCallback) __wingpanel_widgets_indicator_entry___lambda8__wingpanel_indicator_close, self, 0);
	_tmp20_ = self->priv->_base_indicator;
	g_signal_connect_object ((GObject*) _tmp20_, "notify::visible", (GCallback) __wingpanel_widgets_indicator_entry___lambda9__g_object_notify, self, 0);
	gtk_widget_add_events ((GtkWidget*) self, (gint) GDK_SCROLL_MASK);
	gtk_widget_add_events ((GtkWidget*) self, (gint) GDK_SMOOTH_SCROLL_MASK);
	g_signal_connect_object ((GtkWidget*) self, "scroll-event", (GCallback) __wingpanel_widgets_indicator_entry___lambda10__gtk_widget_scroll_event, self, 0);
	g_signal_connect_object ((GtkWidget*) self, "button-press-event", (GCallback) __wingpanel_widgets_indicator_entry___lambda11__gtk_widget_button_press_event, self, 0);
	_tmp21_ = (GtkGestureMultiPress*) gtk_gesture_multi_press_new ((GtkWidget*) self);
	_g_object_unref0 (self->priv->gesture_controller);
	self->priv->gesture_controller = _tmp21_;
	_tmp22_ = self->priv->gesture_controller;
	g_signal_connect_object (_tmp22_, "pressed", (GCallback) __wingpanel_widgets_indicator_entry___lambda12__gtk_gesture_multi_press_pressed, self, 0);
	_tmp23_ = (GtkEventControllerMotion*) gtk_event_controller_motion_new ((GtkWidget*) self);
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp23_, GTK_PHASE_CAPTURE);
	_g_object_unref0 (self->priv->motion_controller);
	self->priv->motion_controller = _tmp23_;
	_tmp24_ = self->priv->motion_controller;
	g_signal_connect_object (_tmp24_, "enter", (GCallback) __wingpanel_widgets_indicator_entry___lambda13__gtk_event_controller_motion_enter, self, 0);
	_tmp25_ = self->priv->_base_indicator;
	_tmp26_ = wingpanel_indicator_get_visible (_tmp25_);
	_tmp27_ = _tmp26_;
	wingpanel_widgets_indicator_entry_set_reveal (self, _tmp27_);
	return obj;
}

static void
wingpanel_widgets_indicator_entry_class_init (WingpanelWidgetsIndicatorEntryClass * klass,
                                              gpointer klass_data)
{
	wingpanel_widgets_indicator_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WingpanelWidgetsIndicatorEntry_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_wingpanel_widgets_indicator_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_wingpanel_widgets_indicator_entry_set_property;
	G_OBJECT_CLASS (klass)->constructor = wingpanel_widgets_indicator_entry_constructor;
	G_OBJECT_CLASS (klass)->finalize = wingpanel_widgets_indicator_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WINGPANEL_WIDGETS_INDICATOR_ENTRY_BASE_INDICATOR_PROPERTY, wingpanel_widgets_indicator_entry_properties[WINGPANEL_WIDGETS_INDICATOR_ENTRY_BASE_INDICATOR_PROPERTY] = g_param_spec_object ("base-indicator", "base-indicator", "base-indicator", WINGPANEL_TYPE_INDICATOR, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WINGPANEL_WIDGETS_INDICATOR_ENTRY_POPOVER_MANAGER_PROPERTY, wingpanel_widgets_indicator_entry_properties[WINGPANEL_WIDGETS_INDICATOR_ENTRY_POPOVER_MANAGER_PROPERTY] = g_param_spec_object ("popover-manager", "popover-manager", "popover-manager", WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WINGPANEL_WIDGETS_INDICATOR_ENTRY_DISPLAY_WIDGET_PROPERTY, wingpanel_widgets_indicator_entry_properties[WINGPANEL_WIDGETS_INDICATOR_ENTRY_DISPLAY_WIDGET_PROPERTY] = g_param_spec_object ("display-widget", "display-widget", "display-widget", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WINGPANEL_WIDGETS_INDICATOR_ENTRY_INDICATOR_WIDGET_PROPERTY, wingpanel_widgets_indicator_entry_properties[WINGPANEL_WIDGETS_INDICATOR_ENTRY_INDICATOR_WIDGET_PROPERTY] = g_param_spec_object ("indicator-widget", "indicator-widget", "indicator-widget", gtk_widget_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
wingpanel_widgets_indicator_entry_instance_init (WingpanelWidgetsIndicatorEntry * self,
                                                 gpointer klass)
{
	self->priv = wingpanel_widgets_indicator_entry_get_instance_private (self);
	self->priv->_indicator_widget = NULL;
}

static void
wingpanel_widgets_indicator_entry_finalize (GObject * obj)
{
	WingpanelWidgetsIndicatorEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, WingpanelWidgetsIndicatorEntry);
	_g_object_unref0 (self->priv->_base_indicator);
	_g_object_unref0 (self->priv->_popover_manager);
	_g_object_unref0 (self->indicator_bar);
	_g_object_unref0 (self->priv->_display_widget);
	_g_object_unref0 (self->priv->_indicator_widget);
	_g_object_unref0 (self->priv->revealer);
	_g_object_unref0 (self->priv->gesture_controller);
	_g_object_unref0 (self->priv->motion_controller);
	G_OBJECT_CLASS (wingpanel_widgets_indicator_entry_parent_class)->finalize (obj);
}

static GType
wingpanel_widgets_indicator_entry_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WingpanelWidgetsIndicatorEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) wingpanel_widgets_indicator_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WingpanelWidgetsIndicatorEntry), 0, (GInstanceInitFunc) wingpanel_widgets_indicator_entry_instance_init, NULL };
	GType wingpanel_widgets_indicator_entry_type_id;
	wingpanel_widgets_indicator_entry_type_id = g_type_register_static (gtk_event_box_get_type (), "WingpanelWidgetsIndicatorEntry", &g_define_type_info, 0);
	WingpanelWidgetsIndicatorEntry_private_offset = g_type_add_instance_private (wingpanel_widgets_indicator_entry_type_id, sizeof (WingpanelWidgetsIndicatorEntryPrivate));
	return wingpanel_widgets_indicator_entry_type_id;
}

GType
wingpanel_widgets_indicator_entry_get_type (void)
{
	static volatile gsize wingpanel_widgets_indicator_entry_type_id__once = 0;
	if (g_once_init_enter (&wingpanel_widgets_indicator_entry_type_id__once)) {
		GType wingpanel_widgets_indicator_entry_type_id;
		wingpanel_widgets_indicator_entry_type_id = wingpanel_widgets_indicator_entry_get_type_once ();
		g_once_init_leave (&wingpanel_widgets_indicator_entry_type_id__once, wingpanel_widgets_indicator_entry_type_id);
	}
	return wingpanel_widgets_indicator_entry_type_id__once;
}

static void
_vala_wingpanel_widgets_indicator_entry_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec)
{
	WingpanelWidgetsIndicatorEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, WingpanelWidgetsIndicatorEntry);
	switch (property_id) {
		case WINGPANEL_WIDGETS_INDICATOR_ENTRY_BASE_INDICATOR_PROPERTY:
		g_value_set_object (value, wingpanel_widgets_indicator_entry_get_base_indicator (self));
		break;
		case WINGPANEL_WIDGETS_INDICATOR_ENTRY_POPOVER_MANAGER_PROPERTY:
		g_value_set_object (value, wingpanel_widgets_indicator_entry_get_popover_manager (self));
		break;
		case WINGPANEL_WIDGETS_INDICATOR_ENTRY_DISPLAY_WIDGET_PROPERTY:
		g_value_set_object (value, wingpanel_widgets_indicator_entry_get_display_widget (self));
		break;
		case WINGPANEL_WIDGETS_INDICATOR_ENTRY_INDICATOR_WIDGET_PROPERTY:
		g_value_set_object (value, wingpanel_widgets_indicator_entry_get_indicator_widget (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_wingpanel_widgets_indicator_entry_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec)
{
	WingpanelWidgetsIndicatorEntry * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, WingpanelWidgetsIndicatorEntry);
	switch (property_id) {
		case WINGPANEL_WIDGETS_INDICATOR_ENTRY_BASE_INDICATOR_PROPERTY:
		wingpanel_widgets_indicator_entry_set_base_indicator (self, g_value_get_object (value));
		break;
		case WINGPANEL_WIDGETS_INDICATOR_ENTRY_POPOVER_MANAGER_PROPERTY:
		wingpanel_widgets_indicator_entry_set_popover_manager (self, g_value_get_object (value));
		break;
		case WINGPANEL_WIDGETS_INDICATOR_ENTRY_DISPLAY_WIDGET_PROPERTY:
		wingpanel_widgets_indicator_entry_set_display_widget (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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;
}

