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

/*
 * Copyright (c) 2011-2015 Ikey Doherty <ikey@solus-project.com>
 *
 * 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 <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <cairo-gobject.h>
#include <float.h>
#include <math.h>
#include "wingpanel.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_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;
typedef struct _WingpanelServicesPopoverManagerPrivate WingpanelServicesPopoverManagerPrivate;

#define WINGPANEL_TYPE_PANEL_WINDOW (wingpanel_panel_window_get_type ())
#define WINGPANEL_PANEL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINGPANEL_TYPE_PANEL_WINDOW, WingpanelPanelWindow))
#define WINGPANEL_PANEL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINGPANEL_TYPE_PANEL_WINDOW, WingpanelPanelWindowClass))
#define WINGPANEL_IS_PANEL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINGPANEL_TYPE_PANEL_WINDOW))
#define WINGPANEL_IS_PANEL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINGPANEL_TYPE_PANEL_WINDOW))
#define WINGPANEL_PANEL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINGPANEL_TYPE_PANEL_WINDOW, WingpanelPanelWindowClass))

typedef struct _WingpanelPanelWindow WingpanelPanelWindow;
typedef struct _WingpanelPanelWindowClass WingpanelPanelWindowClass;

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

#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;
enum  {
	WINGPANEL_SERVICES_POPOVER_MANAGER_0_PROPERTY,
	WINGPANEL_SERVICES_POPOVER_MANAGER_CURRENT_INDICATOR_PROPERTY,
	WINGPANEL_SERVICES_POPOVER_MANAGER_NUM_PROPERTIES
};
static GParamSpec* wingpanel_services_popover_manager_properties[WINGPANEL_SERVICES_POPOVER_MANAGER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block5Data Block5Data;
typedef struct _Block6Data Block6Data;

struct _WingpanelServicesPopoverManager {
	GObject parent_instance;
	WingpanelServicesPopoverManagerPrivate * priv;
};

struct _WingpanelServicesPopoverManagerClass {
	GObjectClass parent_class;
};

struct _WingpanelServicesPopoverManagerPrivate {
	WingpanelPanelWindow* owner;
	gboolean grabbed;
	gboolean mousing;
	GeeHashMap* registered_indicators;
	WingpanelWidgetsIndicatorPopover* popover;
	WingpanelWidgetsIndicatorEntry* _current_indicator;
};

struct _Block5Data {
	int _ref_count_;
	WingpanelServicesPopoverManager* self;
	WingpanelPanelWindow* owner;
};

struct _Block6Data {
	int _ref_count_;
	WingpanelServicesPopoverManager* self;
	WingpanelWidgetsIndicatorEntry* widg;
};

static gint WingpanelServicesPopoverManager_private_offset;
static gpointer wingpanel_services_popover_manager_parent_class = NULL;

VALA_EXTERN GType wingpanel_services_popover_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelServicesPopoverManager, g_object_unref)
VALA_EXTERN GType wingpanel_panel_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelPanelWindow, g_object_unref)
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_popover_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelWidgetsIndicatorPopover, g_object_unref)
VALA_EXTERN WingpanelServicesPopoverManager* wingpanel_services_popover_manager_new (WingpanelPanelWindow* owner);
VALA_EXTERN WingpanelServicesPopoverManager* wingpanel_services_popover_manager_construct (GType object_type,
                                                                               WingpanelPanelWindow* owner);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
VALA_EXTERN WingpanelWidgetsIndicatorPopover* wingpanel_widgets_indicator_popover_new (void);
VALA_EXTERN WingpanelWidgetsIndicatorPopover* wingpanel_widgets_indicator_popover_construct (GType object_type);
static gboolean __lambda16_ (WingpanelServicesPopoverManager* self,
                      GdkEventCrossing* e);
VALA_EXTERN void wingpanel_services_popover_manager_set_current_indicator (WingpanelServicesPopoverManager* self,
                                                               WingpanelWidgetsIndicatorEntry* value);
static gboolean ___lambda16__gtk_widget_leave_notify_event (GtkWidget* _sender,
                                                     GdkEventCrossing* event,
                                                     gpointer self);
static void __lambda17_ (WingpanelServicesPopoverManager* self);
static void wingpanel_services_popover_manager_make_modal (WingpanelServicesPopoverManager* self,
                                                    GtkPopover* pop,
                                                    gboolean modal);
static void ___lambda17__gtk_popover_closed (GtkPopover* _sender,
                                      gpointer self);
static void __lambda18_ (Block5Data* _data5_);
VALA_EXTERN void wingpanel_panel_window_set_expanded (WingpanelPanelWindow* self,
                                          gboolean expand);
static void ___lambda18__gtk_widget_unmap (GtkWidget* _sender,
                                    gpointer self);
static gboolean __lambda19_ (WingpanelServicesPopoverManager* self,
                      GdkEventFocus* e);
VALA_EXTERN WingpanelWidgetsIndicatorEntry* wingpanel_services_popover_manager_get_current_indicator (WingpanelServicesPopoverManager* self);
static gboolean ___lambda19__gtk_widget_focus_out_event (GtkWidget* _sender,
                                                  GdkEventFocus* event,
                                                  gpointer self);
static gboolean __lambda20_ (Block5Data* _data5_,
                      GtkWidget* w,
                      GdkEventButton* e);
static gboolean ___lambda20__gtk_widget_button_press_event (GtkWidget* _sender,
                                                     GdkEventButton* event,
                                                     gpointer self);
VALA_EXTERN void wingpanel_services_popover_manager_set_popover_visible (WingpanelServicesPopoverManager* self,
                                                             const gchar* code_name,
                                                             gboolean visible);
VALA_EXTERN WingpanelIndicator* wingpanel_widgets_indicator_entry_get_base_indicator (WingpanelWidgetsIndicatorEntry* self);
VALA_EXTERN void wingpanel_services_popover_manager_toggle_popover_visible (WingpanelServicesPopoverManager* self,
                                                                const gchar* code_name);
VALA_EXTERN gboolean wingpanel_services_popover_manager_get_visible (WingpanelServicesPopoverManager* self,
                                                         WingpanelWidgetsIndicatorEntry* entry);
static void wingpanel_services_popover_manager_update_has_tooltip (WingpanelServicesPopoverManager* self,
                                                            GtkWidget* display_widget,
                                                            gboolean enable);
VALA_EXTERN void wingpanel_services_popover_manager_close (WingpanelServicesPopoverManager* self);
VALA_EXTERN void wingpanel_services_popover_manager_unregister_indicator (WingpanelServicesPopoverManager* self,
                                                              WingpanelWidgetsIndicatorEntry* widg);
VALA_EXTERN void wingpanel_services_popover_manager_register_indicator (WingpanelServicesPopoverManager* self,
                                                            WingpanelWidgetsIndicatorEntry* widg);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static gboolean __lambda9_ (Block6Data* _data6_,
                     GtkWidget* w,
                     GdkEventCrossing* e);
static gboolean ___lambda9__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                                    GdkEventCrossing* event,
                                                    gpointer self);
static void __lambda10_ (Block6Data* _data6_);
static void ___lambda10__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
VALA_EXTERN GtkWidget* wingpanel_widgets_indicator_entry_get_display_widget (WingpanelWidgetsIndicatorEntry* self);
VALA_EXTERN void wingpanel_widgets_indicator_popover_set_content (WingpanelWidgetsIndicatorPopover* self,
                                                      GtkWidget* content);
VALA_EXTERN GtkWidget* wingpanel_widgets_indicator_entry_get_indicator_widget (WingpanelWidgetsIndicatorEntry* self);
static void wingpanel_services_popover_manager_finalize (GObject * obj);
static GType wingpanel_services_popover_manager_get_type_once (void);
static void _vala_wingpanel_services_popover_manager_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static void _vala_wingpanel_services_popover_manager_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec);

static inline gpointer
wingpanel_services_popover_manager_get_instance_private (WingpanelServicesPopoverManager* self)
{
	return G_STRUCT_MEMBER_P (self, WingpanelServicesPopoverManager_private_offset);
}

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

static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		WingpanelServicesPopoverManager* self;
		self = _data5_->self;
		_g_object_unref0 (_data5_->owner);
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static gboolean
__lambda16_ (WingpanelServicesPopoverManager* self,
             GdkEventCrossing* e)
{
	GtkAllocation allocation = {0};
	WingpanelWidgetsIndicatorPopover* _tmp0_;
	GtkAllocation _tmp1_ = {0};
	gboolean _tmp2_ = FALSE;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = self->priv->popover;
	gtk_widget_get_allocation ((GtkWidget*) _tmp0_, &_tmp1_);
	allocation = _tmp1_;
	if (e->mode != GDK_CROSSING_NORMAL) {
		GdkWindow* _tmp3_;
		_tmp3_ = e->subwindow;
		_tmp2_ = _tmp3_ == NULL;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		wingpanel_services_popover_manager_set_current_indicator (self, NULL);
	}
	result = GDK_EVENT_PROPAGATE;
	return result;
}

static gboolean
___lambda16__gtk_widget_leave_notify_event (GtkWidget* _sender,
                                            GdkEventCrossing* event,
                                            gpointer self)
{
	gboolean result;
	result = __lambda16_ ((WingpanelServicesPopoverManager*) self, event);
	return result;
}

static void
__lambda17_ (WingpanelServicesPopoverManager* self)
{
	WingpanelWidgetsIndicatorPopover* _tmp0_;
	_tmp0_ = self->priv->popover;
	wingpanel_services_popover_manager_make_modal (self, (GtkPopover*) _tmp0_, FALSE);
}

static void
___lambda17__gtk_popover_closed (GtkPopover* _sender,
                                 gpointer self)
{
	__lambda17_ ((WingpanelServicesPopoverManager*) self);
}

static void
__lambda18_ (Block5Data* _data5_)
{
	WingpanelServicesPopoverManager* self;
	self = _data5_->self;
	if (!self->priv->grabbed) {
		wingpanel_panel_window_set_expanded (_data5_->owner, FALSE);
	}
}

static void
___lambda18__gtk_widget_unmap (GtkWidget* _sender,
                               gpointer self)
{
	__lambda18_ (self);
}

static gboolean
__lambda19_ (WingpanelServicesPopoverManager* self,
             GdkEventFocus* e)
{
	gboolean _tmp0_ = FALSE;
	WingpanelWidgetsIndicatorEntry* _tmp1_;
	WingpanelWidgetsIndicatorEntry* _tmp2_;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	if (self->priv->mousing) {
		result = GDK_EVENT_PROPAGATE;
		return result;
	}
	_tmp1_ = wingpanel_services_popover_manager_get_current_indicator (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		GdkWindow* _tmp3_;
		_tmp3_ = e->window;
		_tmp0_ = _tmp3_ == NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		wingpanel_services_popover_manager_set_current_indicator (self, NULL);
	}
	result = GDK_EVENT_PROPAGATE;
	return result;
}

static gboolean
___lambda19__gtk_widget_focus_out_event (GtkWidget* _sender,
                                         GdkEventFocus* event,
                                         gpointer self)
{
	gboolean result;
	result = __lambda19_ ((WingpanelServicesPopoverManager*) self, event);
	return result;
}

static gboolean
__lambda20_ (Block5Data* _data5_,
             GtkWidget* w,
             GdkEventButton* e)
{
	WingpanelServicesPopoverManager* self;
	GdkWindow* _tmp0_;
	GdkWindow* _tmp1_;
	GtkAllocation allocation = {0};
	WingpanelWidgetsIndicatorPopover* _tmp2_;
	GtkAllocation _tmp3_ = {0};
	GtkAllocation indicator_allocation = {0};
	WingpanelWidgetsIndicatorEntry* _tmp4_;
	WingpanelWidgetsIndicatorEntry* _tmp5_;
	GtkAllocation _tmp6_ = {0};
	GtkAllocation container_allocation = {0};
	WingpanelWidgetsIndicatorEntry* _tmp7_;
	WingpanelWidgetsIndicatorEntry* _tmp8_;
	GtkContainer* _tmp9_;
	GtkAllocation _tmp10_ = {0};
	gint wingpanel_width = 0;
	GtkAllocation _tmp11_;
	GtkAllocation _tmp12_;
	GtkAllocation _tmp13_;
	GtkAllocation _tmp14_;
	GtkAllocation _tmp15_;
	GtkAllocation _tmp16_;
	GtkAllocation _tmp17_;
	gboolean _tmp19_ = FALSE;
	gboolean _tmp20_ = FALSE;
	GtkAllocation _tmp21_;
	gboolean result;
	self = _data5_->self;
	g_return_val_if_fail (w != NULL, FALSE);
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = e->window;
	_tmp1_ = gtk_widget_get_window ((GtkWidget*) _data5_->owner);
	if (_tmp0_ != _tmp1_) {
		result = GDK_EVENT_PROPAGATE;
		return result;
	}
	_tmp2_ = self->priv->popover;
	gtk_widget_get_allocation ((GtkWidget*) _tmp2_, &_tmp3_);
	allocation = _tmp3_;
	_tmp4_ = wingpanel_services_popover_manager_get_current_indicator (self);
	_tmp5_ = _tmp4_;
	gtk_widget_get_allocation ((GtkWidget*) _tmp5_, &_tmp6_);
	indicator_allocation = _tmp6_;
	_tmp7_ = wingpanel_services_popover_manager_get_current_indicator (self);
	_tmp8_ = _tmp7_;
	_tmp9_ = gtk_widget_get_parent ((GtkWidget*) _tmp8_);
	gtk_widget_get_allocation ((GtkWidget*) _tmp9_, &_tmp10_);
	container_allocation = _tmp10_;
	wingpanel_width = gtk_widget_get_allocated_width ((GtkWidget*) _data5_->owner);
	_tmp11_ = indicator_allocation;
	_tmp12_ = container_allocation;
	_tmp13_ = allocation;
	_tmp14_ = indicator_allocation;
	allocation.x = allocation.x + ((_tmp11_.x + _tmp12_.x) - ((_tmp13_.width - _tmp14_.width) / 2));
	_tmp15_ = allocation;
	if (_tmp15_.x < 0) {
		allocation.x = 0;
	}
	_tmp16_ = allocation;
	_tmp17_ = allocation;
	if ((_tmp16_.x + _tmp17_.width) > wingpanel_width) {
		GtkAllocation _tmp18_;
		_tmp18_ = allocation;
		allocation.x = wingpanel_width - _tmp18_.width;
	}
	_tmp21_ = allocation;
	if (e->x < ((gdouble) _tmp21_.x)) {
		_tmp20_ = TRUE;
	} else {
		GtkAllocation _tmp22_;
		GtkAllocation _tmp23_;
		_tmp22_ = allocation;
		_tmp23_ = allocation;
		_tmp20_ = e->x > ((gdouble) (_tmp22_.x + _tmp23_.width));
	}
	if (_tmp20_) {
		_tmp19_ = TRUE;
	} else {
		gboolean _tmp24_ = FALSE;
		GtkAllocation _tmp25_;
		_tmp25_ = allocation;
		if (e->y < ((gdouble) _tmp25_.y)) {
			_tmp24_ = TRUE;
		} else {
			GtkAllocation _tmp26_;
			GtkAllocation _tmp27_;
			_tmp26_ = allocation;
			_tmp27_ = allocation;
			_tmp24_ = e->y > ((gdouble) (_tmp26_.y + _tmp27_.height));
		}
		_tmp19_ = _tmp24_;
	}
	if (_tmp19_) {
		wingpanel_services_popover_manager_set_current_indicator (self, NULL);
	}
	result = GDK_EVENT_STOP;
	return result;
}

static gboolean
___lambda20__gtk_widget_button_press_event (GtkWidget* _sender,
                                            GdkEventButton* event,
                                            gpointer self)
{
	gboolean result;
	result = __lambda20_ (self, _sender, event);
	return result;
}

WingpanelServicesPopoverManager*
wingpanel_services_popover_manager_construct (GType object_type,
                                              WingpanelPanelWindow* owner)
{
	WingpanelServicesPopoverManager * self = NULL;
	Block5Data* _data5_;
	WingpanelPanelWindow* _tmp0_;
	GeeHashMap* _tmp1_;
	WingpanelWidgetsIndicatorPopover* _tmp2_;
	WingpanelWidgetsIndicatorPopover* _tmp3_;
	WingpanelWidgetsIndicatorPopover* _tmp4_;
	WingpanelWidgetsIndicatorPopover* _tmp5_;
	_data5_ = g_slice_new0 (Block5Data);
	_data5_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (owner);
	_g_object_unref0 (_data5_->owner);
	_data5_->owner = _tmp0_;
	self = (WingpanelServicesPopoverManager*) g_object_new (object_type, NULL);
	_data5_->self = g_object_ref (self);
	_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->registered_indicators);
	self->priv->registered_indicators = _tmp1_;
	self->priv->owner = _data5_->owner;
	_tmp2_ = wingpanel_widgets_indicator_popover_new ();
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->popover);
	self->priv->popover = _tmp2_;
	_tmp3_ = self->priv->popover;
	g_signal_connect_object ((GtkWidget*) _tmp3_, "leave-notify-event", (GCallback) ___lambda16__gtk_widget_leave_notify_event, self, 0);
	_tmp4_ = self->priv->popover;
	g_signal_connect_object ((GtkPopover*) _tmp4_, "closed", (GCallback) ___lambda17__gtk_popover_closed, self, 0);
	_tmp5_ = self->priv->popover;
	g_signal_connect_data ((GtkWidget*) _tmp5_, "unmap", (GCallback) ___lambda18__gtk_widget_unmap, block5_data_ref (_data5_), (GClosureNotify) block5_data_unref, 0);
	g_signal_connect_object ((GtkWidget*) _data5_->owner, "focus-out-event", (GCallback) ___lambda19__gtk_widget_focus_out_event, self, 0);
	g_signal_connect_data ((GtkWidget*) _data5_->owner, "button-press-event", (GCallback) ___lambda20__gtk_widget_button_press_event, block5_data_ref (_data5_), (GClosureNotify) block5_data_unref, 0);
	gtk_widget_add_events ((GtkWidget*) _data5_->owner, (gint) ((GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK) | GDK_BUTTON_PRESS_MASK));
	block5_data_unref (_data5_);
	_data5_ = NULL;
	return self;
}

WingpanelServicesPopoverManager*
wingpanel_services_popover_manager_new (WingpanelPanelWindow* owner)
{
	return wingpanel_services_popover_manager_construct (WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, owner);
}

void
wingpanel_services_popover_manager_set_popover_visible (WingpanelServicesPopoverManager* self,
                                                        const gchar* code_name,
                                                        gboolean visible)
{
	GeeHashMap* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (code_name != NULL);
	_tmp0_ = self->priv->registered_indicators;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, code_name)) {
		WingpanelWidgetsIndicatorEntry* new_indicator = NULL;
		GeeHashMap* _tmp1_;
		gpointer _tmp2_;
		gboolean _tmp3_ = FALSE;
		_tmp1_ = self->priv->registered_indicators;
		_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, code_name);
		new_indicator = (WingpanelWidgetsIndicatorEntry*) _tmp2_;
		if (visible) {
			gboolean _tmp4_ = FALSE;
			WingpanelWidgetsIndicatorEntry* _tmp5_;
			WingpanelWidgetsIndicatorEntry* _tmp6_;
			_tmp5_ = wingpanel_services_popover_manager_get_current_indicator (self);
			_tmp6_ = _tmp5_;
			if (_tmp6_ == NULL) {
				_tmp4_ = TRUE;
			} else {
				WingpanelWidgetsIndicatorEntry* _tmp7_;
				WingpanelWidgetsIndicatorEntry* _tmp8_;
				WingpanelIndicator* _tmp9_;
				WingpanelIndicator* _tmp10_;
				const gchar* _tmp11_;
				const gchar* _tmp12_;
				WingpanelWidgetsIndicatorEntry* _tmp13_;
				WingpanelIndicator* _tmp14_;
				WingpanelIndicator* _tmp15_;
				const gchar* _tmp16_;
				const gchar* _tmp17_;
				_tmp7_ = wingpanel_services_popover_manager_get_current_indicator (self);
				_tmp8_ = _tmp7_;
				_tmp9_ = wingpanel_widgets_indicator_entry_get_base_indicator (_tmp8_);
				_tmp10_ = _tmp9_;
				_tmp11_ = wingpanel_indicator_get_code_name (_tmp10_);
				_tmp12_ = _tmp11_;
				_tmp13_ = new_indicator;
				_tmp14_ = wingpanel_widgets_indicator_entry_get_base_indicator (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp16_ = wingpanel_indicator_get_code_name (_tmp15_);
				_tmp17_ = _tmp16_;
				_tmp4_ = g_strcmp0 (_tmp12_, _tmp17_) != 0;
			}
			_tmp3_ = _tmp4_;
		} else {
			_tmp3_ = FALSE;
		}
		if (_tmp3_) {
			WingpanelWidgetsIndicatorEntry* _tmp18_;
			_tmp18_ = new_indicator;
			wingpanel_services_popover_manager_set_current_indicator (self, _tmp18_);
		} else {
			gboolean _tmp19_ = FALSE;
			WingpanelWidgetsIndicatorEntry* _tmp20_;
			WingpanelWidgetsIndicatorEntry* _tmp21_;
			WingpanelIndicator* _tmp22_;
			WingpanelIndicator* _tmp23_;
			const gchar* _tmp24_;
			const gchar* _tmp25_;
			WingpanelWidgetsIndicatorEntry* _tmp26_;
			WingpanelIndicator* _tmp27_;
			WingpanelIndicator* _tmp28_;
			const gchar* _tmp29_;
			const gchar* _tmp30_;
			_tmp20_ = wingpanel_services_popover_manager_get_current_indicator (self);
			_tmp21_ = _tmp20_;
			_tmp22_ = wingpanel_widgets_indicator_entry_get_base_indicator (_tmp21_);
			_tmp23_ = _tmp22_;
			_tmp24_ = wingpanel_indicator_get_code_name (_tmp23_);
			_tmp25_ = _tmp24_;
			_tmp26_ = new_indicator;
			_tmp27_ = wingpanel_widgets_indicator_entry_get_base_indicator (_tmp26_);
			_tmp28_ = _tmp27_;
			_tmp29_ = wingpanel_indicator_get_code_name (_tmp28_);
			_tmp30_ = _tmp29_;
			if (g_strcmp0 (_tmp25_, _tmp30_) == 0) {
				_tmp19_ = !visible;
			} else {
				_tmp19_ = FALSE;
			}
			if (_tmp19_) {
				wingpanel_services_popover_manager_set_current_indicator (self, NULL);
			}
		}
		_g_object_unref0 (new_indicator);
	}
}

void
wingpanel_services_popover_manager_toggle_popover_visible (WingpanelServicesPopoverManager* self,
                                                           const gchar* code_name)
{
	GeeHashMap* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (code_name != NULL);
	_tmp0_ = self->priv->registered_indicators;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, code_name)) {
		GeeHashMap* _tmp1_;
		gpointer _tmp2_;
		WingpanelWidgetsIndicatorEntry* _tmp3_;
		_tmp1_ = self->priv->registered_indicators;
		_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, code_name);
		_tmp3_ = (WingpanelWidgetsIndicatorEntry*) _tmp2_;
		wingpanel_services_popover_manager_set_current_indicator (self, _tmp3_);
		_g_object_unref0 (_tmp3_);
	}
}

gboolean
wingpanel_services_popover_manager_get_visible (WingpanelServicesPopoverManager* self,
                                                WingpanelWidgetsIndicatorEntry* entry)
{
	gboolean _tmp0_ = FALSE;
	WingpanelWidgetsIndicatorEntry* _tmp1_;
	WingpanelWidgetsIndicatorEntry* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	_tmp1_ = wingpanel_services_popover_manager_get_current_indicator (self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		WingpanelWidgetsIndicatorEntry* _tmp3_;
		WingpanelWidgetsIndicatorEntry* _tmp4_;
		WingpanelIndicator* _tmp5_;
		WingpanelIndicator* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		WingpanelIndicator* _tmp9_;
		WingpanelIndicator* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		_tmp3_ = wingpanel_services_popover_manager_get_current_indicator (self);
		_tmp4_ = _tmp3_;
		_tmp5_ = wingpanel_widgets_indicator_entry_get_base_indicator (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = wingpanel_indicator_get_code_name (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = wingpanel_widgets_indicator_entry_get_base_indicator (entry);
		_tmp10_ = _tmp9_;
		_tmp11_ = wingpanel_indicator_get_code_name (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp0_ = g_strcmp0 (_tmp8_, _tmp12_) == 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static void
wingpanel_services_popover_manager_update_has_tooltip (WingpanelServicesPopoverManager* self,
                                                       GtkWidget* display_widget,
                                                       gboolean enable)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (display_widget != NULL);
	if (display_widget != NULL) {
		gtk_widget_set_has_tooltip (display_widget, enable);
	}
}

static void
wingpanel_services_popover_manager_make_modal (WingpanelServicesPopoverManager* self,
                                               GtkPopover* pop,
                                               gboolean modal)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp3_ = FALSE;
	g_return_if_fail (self != NULL);
	if (pop == NULL) {
		_tmp1_ = TRUE;
	} else {
		GdkWindow* _tmp2_;
		_tmp2_ = gtk_widget_get_window ((GtkWidget*) pop);
		_tmp1_ = _tmp2_ == NULL;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->priv->mousing;
	}
	if (_tmp0_) {
		return;
	}
	if (modal) {
		_tmp3_ = !self->priv->grabbed;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		WingpanelPanelWindow* _tmp4_;
		WingpanelPanelWindow* _tmp5_;
		self->priv->grabbed = TRUE;
		_tmp4_ = self->priv->owner;
		gtk_grab_add ((GtkWidget*) _tmp4_);
		_tmp5_ = self->priv->owner;
		gtk_window_set_focus ((GtkWindow*) _tmp5_, NULL);
		gtk_widget_grab_focus ((GtkWidget*) pop);
	} else {
		gboolean _tmp6_ = FALSE;
		if (!modal) {
			_tmp6_ = self->priv->grabbed;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			WingpanelPanelWindow* _tmp7_;
			WingpanelPanelWindow* _tmp8_;
			self->priv->grabbed = FALSE;
			_tmp7_ = self->priv->owner;
			gtk_grab_remove ((GtkWidget*) _tmp7_);
			_tmp8_ = self->priv->owner;
			gtk_widget_grab_focus ((GtkWidget*) _tmp8_);
		}
	}
}

void
wingpanel_services_popover_manager_close (WingpanelServicesPopoverManager* self)
{
	WingpanelWidgetsIndicatorEntry* _tmp0_;
	WingpanelWidgetsIndicatorEntry* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = wingpanel_services_popover_manager_get_current_indicator (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != NULL) {
		wingpanel_services_popover_manager_set_current_indicator (self, NULL);
	}
}

void
wingpanel_services_popover_manager_unregister_indicator (WingpanelServicesPopoverManager* self,
                                                         WingpanelWidgetsIndicatorEntry* widg)
{
	GeeHashMap* _tmp0_;
	WingpanelIndicator* _tmp1_;
	WingpanelIndicator* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->registered_indicators;
	_tmp1_ = wingpanel_widgets_indicator_entry_get_base_indicator (widg);
	_tmp2_ = _tmp1_;
	_tmp3_ = wingpanel_indicator_get_code_name (_tmp2_);
	_tmp4_ = _tmp3_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, _tmp4_)) {
		GeeHashMap* _tmp5_;
		WingpanelIndicator* _tmp6_;
		WingpanelIndicator* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		_tmp5_ = self->priv->registered_indicators;
		_tmp6_ = wingpanel_widgets_indicator_entry_get_base_indicator (widg);
		_tmp7_ = _tmp6_;
		_tmp8_ = wingpanel_indicator_get_code_name (_tmp7_);
		_tmp9_ = _tmp8_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp5_, _tmp9_, NULL);
	}
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		WingpanelServicesPopoverManager* self;
		self = _data6_->self;
		_g_object_unref0 (_data6_->widg);
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static gboolean
__lambda9_ (Block6Data* _data6_,
            GtkWidget* w,
            GdkEventCrossing* e)
{
	WingpanelServicesPopoverManager* self;
	gboolean result;
	self = _data6_->self;
	g_return_val_if_fail (w != NULL, FALSE);
	g_return_val_if_fail (e != NULL, FALSE);
	if (self->priv->mousing) {
		result = GDK_EVENT_PROPAGATE;
		return result;
	}
	if (self->priv->grabbed) {
		gboolean _tmp0_ = FALSE;
		if (!wingpanel_services_popover_manager_get_visible (self, _data6_->widg)) {
			_tmp0_ = e->mode != GDK_CROSSING_TOUCH_BEGIN;
		} else {
			_tmp0_ = FALSE;
		}
		if (_tmp0_) {
			self->priv->mousing = TRUE;
			wingpanel_services_popover_manager_set_current_indicator (self, _data6_->widg);
			self->priv->mousing = FALSE;
		}
		result = GDK_EVENT_STOP;
		return result;
	}
	result = GDK_EVENT_PROPAGATE;
	return result;
}

static gboolean
___lambda9__gtk_widget_enter_notify_event (GtkWidget* _sender,
                                           GdkEventCrossing* event,
                                           gpointer self)
{
	gboolean result;
	result = __lambda9_ (self, _sender, event);
	return result;
}

static void
__lambda10_ (Block6Data* _data6_)
{
	WingpanelServicesPopoverManager* self;
	gboolean _tmp0_ = FALSE;
	self = _data6_->self;
	if (self->priv->mousing) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->priv->grabbed;
	}
	if (_tmp0_) {
		return;
	}
	if (wingpanel_services_popover_manager_get_visible (self, _data6_->widg)) {
		wingpanel_services_popover_manager_set_current_indicator (self, NULL);
	}
}

static void
___lambda10__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda10_ (self);
}

void
wingpanel_services_popover_manager_register_indicator (WingpanelServicesPopoverManager* self,
                                                       WingpanelWidgetsIndicatorEntry* widg)
{
	Block6Data* _data6_;
	WingpanelWidgetsIndicatorEntry* _tmp0_;
	GeeHashMap* _tmp1_;
	WingpanelIndicator* _tmp2_;
	WingpanelIndicator* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	GeeHashMap* _tmp6_;
	WingpanelIndicator* _tmp7_;
	WingpanelIndicator* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	g_return_if_fail (self != NULL);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (widg);
	_g_object_unref0 (_data6_->widg);
	_data6_->widg = _tmp0_;
	_tmp1_ = self->priv->registered_indicators;
	_tmp2_ = wingpanel_widgets_indicator_entry_get_base_indicator (_data6_->widg);
	_tmp3_ = _tmp2_;
	_tmp4_ = wingpanel_indicator_get_code_name (_tmp3_);
	_tmp5_ = _tmp4_;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp1_, _tmp5_)) {
		block6_data_unref (_data6_);
		_data6_ = NULL;
		return;
	}
	_tmp6_ = self->priv->registered_indicators;
	_tmp7_ = wingpanel_widgets_indicator_entry_get_base_indicator (_data6_->widg);
	_tmp8_ = _tmp7_;
	_tmp9_ = wingpanel_indicator_get_code_name (_tmp8_);
	_tmp10_ = _tmp9_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp6_, _tmp10_, _data6_->widg);
	g_signal_connect_data ((GtkWidget*) _data6_->widg, "enter-notify-event", (GCallback) ___lambda9__gtk_widget_enter_notify_event, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	g_signal_connect_data ((GObject*) _data6_->widg, "notify::visible", (GCallback) ___lambda10__g_object_notify, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	block6_data_unref (_data6_);
	_data6_ = NULL;
}

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

void
wingpanel_services_popover_manager_set_current_indicator (WingpanelServicesPopoverManager* self,
                                                          WingpanelWidgetsIndicatorEntry* value)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp2_ = FALSE;
	WingpanelWidgetsIndicatorEntry* _tmp3_;
	WingpanelWidgetsIndicatorEntry* _tmp29_;
	g_return_if_fail (self != NULL);
	if (value == NULL) {
		WingpanelWidgetsIndicatorEntry* _tmp1_;
		_tmp1_ = self->priv->_current_indicator;
		_tmp0_ = _tmp1_ == NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = self->priv->_current_indicator;
	if (_tmp3_ == NULL) {
		_tmp2_ = value != NULL;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		WingpanelWidgetsIndicatorEntry* _tmp4_;
		_tmp4_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_current_indicator);
		self->priv->_current_indicator = _tmp4_;
	} else {
		gboolean _tmp5_ = FALSE;
		if (value == NULL) {
			WingpanelWidgetsIndicatorEntry* _tmp6_;
			_tmp6_ = self->priv->_current_indicator;
			_tmp5_ = _tmp6_ != NULL;
		} else {
			_tmp5_ = FALSE;
		}
		if (_tmp5_) {
			WingpanelWidgetsIndicatorEntry* _tmp7_;
			WingpanelIndicator* _tmp8_;
			WingpanelIndicator* _tmp9_;
			_tmp7_ = self->priv->_current_indicator;
			_tmp8_ = wingpanel_widgets_indicator_entry_get_base_indicator (_tmp7_);
			_tmp9_ = _tmp8_;
			wingpanel_indicator_closed (_tmp9_);
			_g_object_unref0 (self->priv->_current_indicator);
			self->priv->_current_indicator = NULL;
		} else {
			WingpanelWidgetsIndicatorEntry* _tmp10_;
			WingpanelIndicator* _tmp11_;
			WingpanelIndicator* _tmp12_;
			const gchar* _tmp13_;
			const gchar* _tmp14_;
			WingpanelIndicator* _tmp15_;
			WingpanelIndicator* _tmp16_;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			_tmp10_ = self->priv->_current_indicator;
			_tmp11_ = wingpanel_widgets_indicator_entry_get_base_indicator (_tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = wingpanel_indicator_get_code_name (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = wingpanel_widgets_indicator_entry_get_base_indicator (value);
			_tmp16_ = _tmp15_;
			_tmp17_ = wingpanel_indicator_get_code_name (_tmp16_);
			_tmp18_ = _tmp17_;
			if (g_strcmp0 (_tmp14_, _tmp18_) == 0) {
				WingpanelWidgetsIndicatorEntry* _tmp19_;
				WingpanelIndicator* _tmp20_;
				WingpanelIndicator* _tmp21_;
				_tmp19_ = self->priv->_current_indicator;
				_tmp20_ = wingpanel_widgets_indicator_entry_get_base_indicator (_tmp19_);
				_tmp21_ = _tmp20_;
				wingpanel_indicator_closed (_tmp21_);
				_g_object_unref0 (self->priv->_current_indicator);
				self->priv->_current_indicator = NULL;
			} else {
				WingpanelWidgetsIndicatorEntry* _tmp22_;
				GtkWidget* _tmp23_;
				GtkWidget* _tmp24_;
				WingpanelWidgetsIndicatorEntry* _tmp25_;
				WingpanelIndicator* _tmp26_;
				WingpanelIndicator* _tmp27_;
				WingpanelWidgetsIndicatorEntry* _tmp28_;
				_tmp22_ = self->priv->_current_indicator;
				_tmp23_ = wingpanel_widgets_indicator_entry_get_display_widget (_tmp22_);
				_tmp24_ = _tmp23_;
				wingpanel_services_popover_manager_update_has_tooltip (self, _tmp24_, TRUE);
				_tmp25_ = self->priv->_current_indicator;
				_tmp26_ = wingpanel_widgets_indicator_entry_get_base_indicator (_tmp25_);
				_tmp27_ = _tmp26_;
				wingpanel_indicator_closed (_tmp27_);
				_tmp28_ = _g_object_ref0 (value);
				_g_object_unref0 (self->priv->_current_indicator);
				self->priv->_current_indicator = _tmp28_;
			}
		}
	}
	_tmp29_ = self->priv->_current_indicator;
	if (_tmp29_ != NULL) {
		WingpanelWidgetsIndicatorPopover* _tmp30_;
		WingpanelWidgetsIndicatorEntry* _tmp31_;
		GtkWidget* _tmp32_;
		GtkWidget* _tmp33_;
		WingpanelWidgetsIndicatorPopover* _tmp34_;
		WingpanelWidgetsIndicatorEntry* _tmp35_;
		WingpanelWidgetsIndicatorEntry* _tmp36_;
		GtkWidget* _tmp37_;
		GtkWidget* _tmp38_;
		WingpanelPanelWindow* _tmp39_;
		WingpanelWidgetsIndicatorPopover* _tmp40_;
		WingpanelPanelWindow* _tmp41_;
		WingpanelWidgetsIndicatorPopover* _tmp42_;
		WingpanelWidgetsIndicatorPopover* _tmp43_;
		WingpanelWidgetsIndicatorEntry* _tmp44_;
		WingpanelIndicator* _tmp45_;
		WingpanelIndicator* _tmp46_;
		_tmp30_ = self->priv->popover;
		_tmp31_ = self->priv->_current_indicator;
		_tmp32_ = wingpanel_widgets_indicator_entry_get_indicator_widget (_tmp31_);
		_tmp33_ = _tmp32_;
		wingpanel_widgets_indicator_popover_set_content (_tmp30_, _tmp33_);
		_tmp34_ = self->priv->popover;
		_tmp35_ = self->priv->_current_indicator;
		gtk_popover_set_relative_to ((GtkPopover*) _tmp34_, (GtkWidget*) _tmp35_);
		_tmp36_ = self->priv->_current_indicator;
		_tmp37_ = wingpanel_widgets_indicator_entry_get_display_widget (_tmp36_);
		_tmp38_ = _tmp37_;
		wingpanel_services_popover_manager_update_has_tooltip (self, _tmp38_, FALSE);
		_tmp39_ = self->priv->owner;
		wingpanel_panel_window_set_expanded (_tmp39_, TRUE);
		_tmp40_ = self->priv->popover;
		wingpanel_services_popover_manager_make_modal (self, (GtkPopover*) _tmp40_, TRUE);
		_tmp41_ = self->priv->owner;
		gtk_window_present ((GtkWindow*) _tmp41_);
		_tmp42_ = self->priv->popover;
		gtk_popover_popup ((GtkPopover*) _tmp42_);
		_tmp43_ = self->priv->popover;
		gtk_widget_show_all ((GtkWidget*) _tmp43_);
		_tmp44_ = self->priv->_current_indicator;
		_tmp45_ = wingpanel_widgets_indicator_entry_get_base_indicator (_tmp44_);
		_tmp46_ = _tmp45_;
		wingpanel_indicator_opened (_tmp46_);
	} else {
		WingpanelWidgetsIndicatorPopover* _tmp47_;
		GtkWidget* _tmp48_;
		GtkWidget* _tmp49_;
		GtkWidget* _tmp50_;
		WingpanelWidgetsIndicatorPopover* _tmp51_;
		_tmp47_ = self->priv->popover;
		_tmp48_ = gtk_popover_get_relative_to ((GtkPopover*) _tmp47_);
		_tmp49_ = wingpanel_widgets_indicator_entry_get_display_widget (G_TYPE_CHECK_INSTANCE_CAST (_tmp48_, WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, WingpanelWidgetsIndicatorEntry));
		_tmp50_ = _tmp49_;
		wingpanel_services_popover_manager_update_has_tooltip (self, _tmp50_, TRUE);
		_tmp51_ = self->priv->popover;
		gtk_popover_popdown ((GtkPopover*) _tmp51_);
	}
	g_object_notify_by_pspec ((GObject *) self, wingpanel_services_popover_manager_properties[WINGPANEL_SERVICES_POPOVER_MANAGER_CURRENT_INDICATOR_PROPERTY]);
}

static void
wingpanel_services_popover_manager_class_init (WingpanelServicesPopoverManagerClass * klass,
                                               gpointer klass_data)
{
	wingpanel_services_popover_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WingpanelServicesPopoverManager_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_wingpanel_services_popover_manager_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_wingpanel_services_popover_manager_set_property;
	G_OBJECT_CLASS (klass)->finalize = wingpanel_services_popover_manager_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WINGPANEL_SERVICES_POPOVER_MANAGER_CURRENT_INDICATOR_PROPERTY, wingpanel_services_popover_manager_properties[WINGPANEL_SERVICES_POPOVER_MANAGER_CURRENT_INDICATOR_PROPERTY] = g_param_spec_object ("current-indicator", "current-indicator", "current-indicator", WINGPANEL_WIDGETS_TYPE_INDICATOR_ENTRY, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
wingpanel_services_popover_manager_instance_init (WingpanelServicesPopoverManager * self,
                                                  gpointer klass)
{
	self->priv = wingpanel_services_popover_manager_get_instance_private (self);
	self->priv->grabbed = FALSE;
	self->priv->mousing = FALSE;
	self->priv->_current_indicator = NULL;
}

static void
wingpanel_services_popover_manager_finalize (GObject * obj)
{
	WingpanelServicesPopoverManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, WingpanelServicesPopoverManager);
	_g_object_unref0 (self->priv->registered_indicators);
	_g_object_unref0 (self->priv->popover);
	_g_object_unref0 (self->priv->_current_indicator);
	G_OBJECT_CLASS (wingpanel_services_popover_manager_parent_class)->finalize (obj);
}

static GType
wingpanel_services_popover_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WingpanelServicesPopoverManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) wingpanel_services_popover_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WingpanelServicesPopoverManager), 0, (GInstanceInitFunc) wingpanel_services_popover_manager_instance_init, NULL };
	GType wingpanel_services_popover_manager_type_id;
	wingpanel_services_popover_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "WingpanelServicesPopoverManager", &g_define_type_info, 0);
	WingpanelServicesPopoverManager_private_offset = g_type_add_instance_private (wingpanel_services_popover_manager_type_id, sizeof (WingpanelServicesPopoverManagerPrivate));
	return wingpanel_services_popover_manager_type_id;
}

GType
wingpanel_services_popover_manager_get_type (void)
{
	static volatile gsize wingpanel_services_popover_manager_type_id__once = 0;
	if (g_once_init_enter (&wingpanel_services_popover_manager_type_id__once)) {
		GType wingpanel_services_popover_manager_type_id;
		wingpanel_services_popover_manager_type_id = wingpanel_services_popover_manager_get_type_once ();
		g_once_init_leave (&wingpanel_services_popover_manager_type_id__once, wingpanel_services_popover_manager_type_id);
	}
	return wingpanel_services_popover_manager_type_id__once;
}

static void
_vala_wingpanel_services_popover_manager_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	WingpanelServicesPopoverManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, WingpanelServicesPopoverManager);
	switch (property_id) {
		case WINGPANEL_SERVICES_POPOVER_MANAGER_CURRENT_INDICATOR_PROPERTY:
		g_value_set_object (value, wingpanel_services_popover_manager_get_current_indicator (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_wingpanel_services_popover_manager_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec)
{
	WingpanelServicesPopoverManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, WingpanelServicesPopoverManager);
	switch (property_id) {
		case WINGPANEL_SERVICES_POPOVER_MANAGER_CURRENT_INDICATOR_PROPERTY:
		wingpanel_services_popover_manager_set_current_indicator (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

