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

/**/
/*  Copyright (C) 2011 Robert Dyer, Rico Tzschichholz*/
/**/
/*  This file is part of Plank.*/
/**/
/*  Plank is free software: you can redistribute it and/or modify*/
/*  it under the terms of the GNU General Public License as published by*/
/*  the Free Software Foundation, either version 3 of the License, or*/
/*  (at your option) any later version.*/
/**/
/*  Plank is distributed in the hope that it will be useful,*/
/*  but WITHOUT ANY WARRANTY; without even the implied warranty of*/
/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*/
/*  GNU General Public License for more details.*/
/**/
/*  You should have received a copy of the GNU General Public License*/
/*  along with this program.  If not, see <http://www.gnu.org/licenses/>.*/
/**/

#include "plank.h"
#include <glib.h>
#include <gdk/gdk.h>
#include <gee.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.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

enum  {
	PLANK_PLANK_DOCK_ITEM_0_PROPERTY,
	PLANK_PLANK_DOCK_ITEM_NUM_PROPERTIES
};
static GParamSpec* plank_plank_dock_item_properties[PLANK_PLANK_DOCK_ITEM_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer plank_plank_dock_item_parent_class = NULL;
static PlankPlankDockItem* plank_plank_dock_item_instance;
static PlankPlankDockItem* plank_plank_dock_item_instance = NULL;

static PlankPlankDockItem* plank_plank_dock_item_new (void);
static PlankPlankDockItem* plank_plank_dock_item_construct (GType object_type);
static gboolean plank_plank_dock_item_real_can_be_removed (PlankDockElement* base);
static PlankAnimationType plank_plank_dock_item_real_on_clicked (PlankDockElement* base,
                                                          PlankPopupButton button,
                                                          GdkModifierType mod,
                                                          guint32 event_time);
static GeeArrayList* plank_plank_dock_item_real_get_menu_items (PlankDockElement* base);
static void __lambda24_ (PlankPlankDockItem* self);
static void ___lambda24__gtk_menu_item_activate (GtkMenuItem* _sender,
                                          gpointer self);
static void __lambda25_ (PlankPlankDockItem* self);
static void ___lambda25__gtk_menu_item_activate (GtkMenuItem* _sender,
                                          gpointer self);
static void __lambda26_ (PlankPlankDockItem* self);
static void ___lambda26__gtk_menu_item_activate (GtkMenuItem* _sender,
                                          gpointer self);
static void __lambda27_ (PlankPlankDockItem* self);
static void ___lambda27__gtk_menu_item_activate (GtkMenuItem* _sender,
                                          gpointer self);
static void ___lambda28_ (PlankPlankDockItem* self);
static void ____lambda28__gtk_menu_item_activate (GtkMenuItem* _sender,
                                           gpointer self);
static GObject * plank_plank_dock_item_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void plank_plank_dock_item_finalize (GObject * obj);
static GType plank_plank_dock_item_get_type_once (void);

PlankPlankDockItem*
plank_plank_dock_item_get_instance (void)
{
	PlankPlankDockItem* _tmp0_;
	PlankPlankDockItem* _tmp2_;
	PlankPlankDockItem* result;
	_tmp0_ = plank_plank_dock_item_instance;
	if (_tmp0_ == NULL) {
		PlankPlankDockItem* _tmp1_;
		_tmp1_ = plank_plank_dock_item_new ();
		_g_object_unref0 (plank_plank_dock_item_instance);
		plank_plank_dock_item_instance = _tmp1_;
	}
	_tmp2_ = plank_plank_dock_item_instance;
	result = _tmp2_;
	return result;
}

static PlankPlankDockItem*
plank_plank_dock_item_construct (GType object_type)
{
	PlankPlankDockItem * self = NULL;
	PlankDockItemPreferences* _tmp0_;
	PlankDockItemPreferences* _tmp1_;
	_tmp0_ = plank_dock_item_preferences_new ();
	_tmp1_ = _tmp0_;
	self = (PlankPlankDockItem*) g_object_new (object_type, "Prefs", _tmp1_, "Text", "Plank", "Icon", "plank", NULL);
	_g_object_unref0 (_tmp1_);
	return self;
}

static PlankPlankDockItem*
plank_plank_dock_item_new (void)
{
	return plank_plank_dock_item_construct (PLANK_TYPE_PLANK_DOCK_ITEM);
}

/**
 * {@inheritDoc}
 */
static gboolean
plank_plank_dock_item_real_can_be_removed (PlankDockElement* base)
{
	PlankPlankDockItem * self;
	gboolean result;
	self = (PlankPlankDockItem*) base;
	result = FALSE;
	return result;
}

/**
 * {@inheritDoc}
 */
static PlankAnimationType
plank_plank_dock_item_real_on_clicked (PlankDockElement* base,
                                       PlankPopupButton button,
                                       GdkModifierType mod,
                                       guint32 event_time)
{
	PlankPlankDockItem * self;
	GApplication* _tmp0_;
	PlankAnimationType result;
	self = (PlankPlankDockItem*) base;
	_tmp0_ = g_application_get_default ();
	g_action_group_activate_action ((GActionGroup*) _tmp0_, "preferences", NULL);
	result = PLANK_ANIMATION_TYPE_DARKEN;
	return result;
}

/**
 * {@inheritDoc}
 */
static void
__lambda24_ (PlankPlankDockItem* self)
{
	GApplication* _tmp0_;
	_tmp0_ = g_application_get_default ();
	g_action_group_activate_action ((GActionGroup*) _tmp0_, "help", NULL);
}

static void
___lambda24__gtk_menu_item_activate (GtkMenuItem* _sender,
                                     gpointer self)
{
	__lambda24_ ((PlankPlankDockItem*) self);
}

static void
__lambda25_ (PlankPlankDockItem* self)
{
	GApplication* _tmp0_;
	_tmp0_ = g_application_get_default ();
	g_action_group_activate_action ((GActionGroup*) _tmp0_, "translate", NULL);
}

static void
___lambda25__gtk_menu_item_activate (GtkMenuItem* _sender,
                                     gpointer self)
{
	__lambda25_ ((PlankPlankDockItem*) self);
}

static void
__lambda26_ (PlankPlankDockItem* self)
{
	GApplication* _tmp0_;
	_tmp0_ = g_application_get_default ();
	g_action_group_activate_action ((GActionGroup*) _tmp0_, "preferences", NULL);
}

static void
___lambda26__gtk_menu_item_activate (GtkMenuItem* _sender,
                                     gpointer self)
{
	__lambda26_ ((PlankPlankDockItem*) self);
}

static void
__lambda27_ (PlankPlankDockItem* self)
{
	GApplication* _tmp0_;
	_tmp0_ = g_application_get_default ();
	g_action_group_activate_action ((GActionGroup*) _tmp0_, "about", NULL);
}

static void
___lambda27__gtk_menu_item_activate (GtkMenuItem* _sender,
                                     gpointer self)
{
	__lambda27_ ((PlankPlankDockItem*) self);
}

static void
___lambda28_ (PlankPlankDockItem* self)
{
	GApplication* _tmp0_;
	_tmp0_ = g_application_get_default ();
	g_action_group_activate_action ((GActionGroup*) _tmp0_, "quit", NULL);
}

static void
____lambda28__gtk_menu_item_activate (GtkMenuItem* _sender,
                                      gpointer self)
{
	___lambda28_ ((PlankPlankDockItem*) self);
}

static GeeArrayList*
plank_plank_dock_item_real_get_menu_items (PlankDockElement* base)
{
	PlankPlankDockItem * self;
	GeeArrayList* items = NULL;
	GeeArrayList* _tmp0_;
	GtkMenuItem* item = NULL;
	GtkMenuItem* _tmp1_;
	GtkMenuItem* _tmp2_;
	GeeArrayList* _tmp3_;
	GtkMenuItem* _tmp4_;
	GtkMenuItem* _tmp5_;
	GtkMenuItem* _tmp6_;
	GeeArrayList* _tmp7_;
	GtkMenuItem* _tmp8_;
	GeeArrayList* _tmp9_;
	GtkSeparatorMenuItem* _tmp10_;
	GtkSeparatorMenuItem* _tmp11_;
	GtkImageMenuItem* _tmp12_;
	GtkMenuItem* _tmp13_;
	GeeArrayList* _tmp14_;
	GtkMenuItem* _tmp15_;
	GtkImageMenuItem* _tmp16_;
	GtkMenuItem* _tmp17_;
	GeeArrayList* _tmp18_;
	GtkMenuItem* _tmp19_;
	GeeArrayList* result;
	self = (PlankPlankDockItem*) base;
	_tmp0_ = gee_array_list_new (gtk_menu_item_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	items = _tmp0_;
	_tmp1_ = plank_dock_element_create_menu_item (_ ("Get _Help Online..."), "help", FALSE);
	item = _tmp1_;
	_tmp2_ = item;
	g_signal_connect_object (_tmp2_, "activate", (GCallback) ___lambda24__gtk_menu_item_activate, self, 0);
	_tmp3_ = items;
	_tmp4_ = item;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, _tmp4_);
	_tmp5_ = plank_dock_element_create_menu_item (_ ("_Translate This Application..."), "locale", FALSE);
	_g_object_unref0 (item);
	item = _tmp5_;
	_tmp6_ = item;
	g_signal_connect_object (_tmp6_, "activate", (GCallback) ___lambda25__gtk_menu_item_activate, self, 0);
	_tmp7_ = items;
	_tmp8_ = item;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, _tmp8_);
	_tmp9_ = items;
	_tmp10_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
	g_object_ref_sink (_tmp10_);
	_tmp11_ = _tmp10_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, (GtkMenuItem*) _tmp11_);
	_g_object_unref0 (_tmp11_);
	_tmp12_ = (GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_PREFERENCES, NULL);
	g_object_ref_sink (_tmp12_);
	_g_object_unref0 (item);
	item = (GtkMenuItem*) _tmp12_;
	_tmp13_ = item;
	g_signal_connect_object (_tmp13_, "activate", (GCallback) ___lambda26__gtk_menu_item_activate, self, 0);
	_tmp14_ = items;
	_tmp15_ = item;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp15_);
	_tmp16_ = (GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL);
	g_object_ref_sink (_tmp16_);
	_g_object_unref0 (item);
	item = (GtkMenuItem*) _tmp16_;
	_tmp17_ = item;
	g_signal_connect_object (_tmp17_, "activate", (GCallback) ___lambda27__gtk_menu_item_activate, self, 0);
	_tmp18_ = items;
	_tmp19_ = item;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp18_, _tmp19_);
	if (!plank_environment_is_session_desktop (PLANK_XDG_SESSION_DESKTOP_PANTHEON)) {
		GeeArrayList* _tmp20_;
		GtkSeparatorMenuItem* _tmp21_;
		GtkSeparatorMenuItem* _tmp22_;
		GtkImageMenuItem* _tmp23_;
		GtkMenuItem* _tmp24_;
		GeeArrayList* _tmp25_;
		GtkMenuItem* _tmp26_;
		_tmp20_ = items;
		_tmp21_ = (GtkSeparatorMenuItem*) gtk_separator_menu_item_new ();
		g_object_ref_sink (_tmp21_);
		_tmp22_ = _tmp21_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp20_, (GtkMenuItem*) _tmp22_);
		_g_object_unref0 (_tmp22_);
		_tmp23_ = (GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, NULL);
		g_object_ref_sink (_tmp23_);
		_g_object_unref0 (item);
		item = (GtkMenuItem*) _tmp23_;
		_tmp24_ = item;
		g_signal_connect_object (_tmp24_, "activate", (GCallback) ____lambda28__gtk_menu_item_activate, self, 0);
		_tmp25_ = items;
		_tmp26_ = item;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp25_, _tmp26_);
	}
	result = items;
	_g_object_unref0 (item);
	return result;
}

static GObject *
plank_plank_dock_item_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	PlankPlankDockItem * self;
	parent_class = G_OBJECT_CLASS (plank_plank_dock_item_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PLANK_TYPE_PLANK_DOCK_ITEM, PlankPlankDockItem);
	plank_dock_item_set_Indicator ((PlankDockItem*) self, PLANK_INDICATOR_STATE_SINGLE);
	return obj;
}

static void
plank_plank_dock_item_class_init (PlankPlankDockItemClass * klass,
                                  gpointer klass_data)
{
	plank_plank_dock_item_parent_class = g_type_class_peek_parent (klass);
	((PlankDockElementClass *) klass)->can_be_removed = (gboolean (*) (PlankDockElement*)) plank_plank_dock_item_real_can_be_removed;
	((PlankDockElementClass *) klass)->on_clicked = (PlankAnimationType (*) (PlankDockElement*, PlankPopupButton, GdkModifierType, guint32)) plank_plank_dock_item_real_on_clicked;
	((PlankDockElementClass *) klass)->get_menu_items = (GeeArrayList* (*) (PlankDockElement*)) plank_plank_dock_item_real_get_menu_items;
	G_OBJECT_CLASS (klass)->constructor = plank_plank_dock_item_constructor;
	G_OBJECT_CLASS (klass)->finalize = plank_plank_dock_item_finalize;
}

static void
plank_plank_dock_item_instance_init (PlankPlankDockItem * self,
                                     gpointer klass)
{
}

static void
plank_plank_dock_item_finalize (GObject * obj)
{
	PlankPlankDockItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PLANK_TYPE_PLANK_DOCK_ITEM, PlankPlankDockItem);
	G_OBJECT_CLASS (plank_plank_dock_item_parent_class)->finalize (obj);
}

/**
 * A dock item for the dock itself.  Has things like about, help, quit etc.
 */
static GType
plank_plank_dock_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PlankPlankDockItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) plank_plank_dock_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PlankPlankDockItem), 0, (GInstanceInitFunc) plank_plank_dock_item_instance_init, NULL };
	GType plank_plank_dock_item_type_id;
	plank_plank_dock_item_type_id = g_type_register_static (PLANK_TYPE_DOCK_ITEM, "PlankPlankDockItem", &g_define_type_info, 0);
	return plank_plank_dock_item_type_id;
}

GType
plank_plank_dock_item_get_type (void)
{
	static volatile gsize plank_plank_dock_item_type_id__once = 0;
	if (g_once_init_enter (&plank_plank_dock_item_type_id__once)) {
		GType plank_plank_dock_item_type_id;
		plank_plank_dock_item_type_id = plank_plank_dock_item_get_type_once ();
		g_once_init_leave (&plank_plank_dock_item_type_id__once, plank_plank_dock_item_type_id);
	}
	return plank_plank_dock_item_type_id__once;
}

