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

/**/
/*  Copyright (C) 2015 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-object.h>
#include <gdk/gdk.h>
#include <glib.h>
#include <gio/gio.h>
#include <libwnck/libwnck.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>

#define DOCKY_G_RESOURCE_PATH "/net/launchpad/plank/docklets/desktop"
#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 DOCKY_TYPE_DESKTOP_DOCK_ITEM (docky_desktop_dock_item_get_type ())
#define DOCKY_DESKTOP_DOCK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DOCKY_TYPE_DESKTOP_DOCK_ITEM, DockyDesktopDockItem))
#define DOCKY_DESKTOP_DOCK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DOCKY_TYPE_DESKTOP_DOCK_ITEM, DockyDesktopDockItemClass))
#define DOCKY_IS_DESKTOP_DOCK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DOCKY_TYPE_DESKTOP_DOCK_ITEM))
#define DOCKY_IS_DESKTOP_DOCK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DOCKY_TYPE_DESKTOP_DOCK_ITEM))
#define DOCKY_DESKTOP_DOCK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DOCKY_TYPE_DESKTOP_DOCK_ITEM, DockyDesktopDockItemClass))

typedef struct _DockyDesktopDockItem DockyDesktopDockItem;
typedef struct _DockyDesktopDockItemClass DockyDesktopDockItemClass;
typedef struct _DockyDesktopDockItemPrivate DockyDesktopDockItemPrivate;
enum  {
	DOCKY_DESKTOP_DOCK_ITEM_0_PROPERTY,
	DOCKY_DESKTOP_DOCK_ITEM_NUM_PROPERTIES
};
static GParamSpec* docky_desktop_dock_item_properties[DOCKY_DESKTOP_DOCK_ITEM_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _DockyDesktopDockItem {
	PlankDockletItem parent_instance;
	DockyDesktopDockItemPrivate * priv;
};

struct _DockyDesktopDockItemClass {
	PlankDockletItemClass parent_class;
};

static gpointer docky_desktop_dock_item_parent_class = NULL;

VALA_EXTERN GType docky_desktop_dock_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DockyDesktopDockItem, g_object_unref)
VALA_EXTERN DockyDesktopDockItem* docky_desktop_dock_item_new_with_dockitem_file (GFile* file);
VALA_EXTERN DockyDesktopDockItem* docky_desktop_dock_item_construct_with_dockitem_file (GType object_type,
                                                                            GFile* file);
static PlankAnimationType docky_desktop_dock_item_real_on_clicked (PlankDockElement* base,
                                                            PlankPopupButton button,
                                                            GdkModifierType mod,
                                                            guint32 event_time);
VALA_EXTERN DockyDesktopDockItem* docky_desktop_dock_item_new (void);
VALA_EXTERN DockyDesktopDockItem* docky_desktop_dock_item_construct (GType object_type);
static GObject * docky_desktop_dock_item_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties);
static void docky_desktop_dock_item_finalize (GObject * obj);
static GType docky_desktop_dock_item_get_type_once (void);

/**
 * {@inheritDoc}
 */
DockyDesktopDockItem*
docky_desktop_dock_item_construct_with_dockitem_file (GType object_type,
                                                      GFile* file)
{
	DockyDesktopDockItem * self = NULL;
	PlankDockItemPreferences* _tmp0_;
	PlankDockItemPreferences* _tmp1_;
	g_return_val_if_fail (file != NULL, NULL);
	_tmp0_ = plank_dock_item_preferences_new_with_file (file);
	_tmp1_ = _tmp0_;
	self = (DockyDesktopDockItem*) g_object_new (object_type, "Prefs", _tmp1_, NULL);
	_g_object_unref0 (_tmp1_);
	return self;
}

DockyDesktopDockItem*
docky_desktop_dock_item_new_with_dockitem_file (GFile* file)
{
	return docky_desktop_dock_item_construct_with_dockitem_file (DOCKY_TYPE_DESKTOP_DOCK_ITEM, file);
}

static PlankAnimationType
docky_desktop_dock_item_real_on_clicked (PlankDockElement* base,
                                         PlankPopupButton button,
                                         GdkModifierType mod,
                                         guint32 event_time)
{
	DockyDesktopDockItem * self;
	PlankAnimationType result;
	self = (DockyDesktopDockItem*) base;
	if (button == PLANK_POPUP_BUTTON_LEFT) {
		WnckScreen* screen = NULL;
		WnckScreen* _tmp0_;
		WnckScreen* _tmp1_;
		WnckScreen* _tmp2_;
		_tmp0_ = wnck_screen_get_default ();
		screen = _tmp0_;
		_tmp1_ = screen;
		_tmp2_ = screen;
		wnck_screen_toggle_showing_desktop (_tmp1_, !wnck_screen_get_showing_desktop (_tmp2_));
		result = PLANK_ANIMATION_TYPE_BOUNCE;
		return result;
	}
	result = PLANK_ANIMATION_TYPE_NONE;
	return result;
}

DockyDesktopDockItem*
docky_desktop_dock_item_construct (GType object_type)
{
	DockyDesktopDockItem * self = NULL;
	self = (DockyDesktopDockItem*) plank_docklet_item_construct (object_type);
	return self;
}

DockyDesktopDockItem*
docky_desktop_dock_item_new (void)
{
	return docky_desktop_dock_item_construct (DOCKY_TYPE_DESKTOP_DOCK_ITEM);
}

static GObject *
docky_desktop_dock_item_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	DockyDesktopDockItem * self;
	parent_class = G_OBJECT_CLASS (docky_desktop_dock_item_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DOCKY_TYPE_DESKTOP_DOCK_ITEM, DockyDesktopDockItem);
	plank_dock_item_set_Icon ((PlankDockItem*) self, "show-desktop;;resource://" DOCKY_G_RESOURCE_PATH "/icons/show-desktop.svg");
	plank_dock_element_set_Text ((PlankDockElement*) self, _ ("Show Desktop"));
	return obj;
}

static void
docky_desktop_dock_item_class_init (DockyDesktopDockItemClass * klass,
                                    gpointer klass_data)
{
	docky_desktop_dock_item_parent_class = g_type_class_peek_parent (klass);
	((PlankDockElementClass *) klass)->on_clicked = (PlankAnimationType (*) (PlankDockElement*, PlankPopupButton, GdkModifierType, guint32)) docky_desktop_dock_item_real_on_clicked;
	G_OBJECT_CLASS (klass)->constructor = docky_desktop_dock_item_constructor;
	G_OBJECT_CLASS (klass)->finalize = docky_desktop_dock_item_finalize;
}

static void
docky_desktop_dock_item_instance_init (DockyDesktopDockItem * self,
                                       gpointer klass)
{
}

static void
docky_desktop_dock_item_finalize (GObject * obj)
{
	DockyDesktopDockItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DOCKY_TYPE_DESKTOP_DOCK_ITEM, DockyDesktopDockItem);
	G_OBJECT_CLASS (docky_desktop_dock_item_parent_class)->finalize (obj);
}

static GType
docky_desktop_dock_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DockyDesktopDockItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) docky_desktop_dock_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DockyDesktopDockItem), 0, (GInstanceInitFunc) docky_desktop_dock_item_instance_init, NULL };
	GType docky_desktop_dock_item_type_id;
	docky_desktop_dock_item_type_id = g_type_register_static (PLANK_TYPE_DOCKLET_ITEM, "DockyDesktopDockItem", &g_define_type_info, 0);
	return docky_desktop_dock_item_type_id;
}

GType
docky_desktop_dock_item_get_type (void)
{
	static volatile gsize docky_desktop_dock_item_type_id__once = 0;
	if (g_once_init_enter (&docky_desktop_dock_item_type_id__once)) {
		GType docky_desktop_dock_item_type_id;
		docky_desktop_dock_item_type_id = docky_desktop_dock_item_get_type_once ();
		g_once_init_leave (&docky_desktop_dock_item_type_id__once, docky_desktop_dock_item_type_id);
	}
	return docky_desktop_dock_item_type_id__once;
}

