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

/*
* Copyright 2021 elementary, Inc. <https://elementary.io>
*           2011-2013 Yorba Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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 "io.elementary.photos.h"
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.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  {
	EDITING_TOOLS_EDITING_TOOL_WINDOW_0_PROPERTY,
	EDITING_TOOLS_EDITING_TOOL_WINDOW_CONTENT_AREA_PROPERTY,
	EDITING_TOOLS_EDITING_TOOL_WINDOW_NUM_PROPERTIES
};
static GParamSpec* editing_tools_editing_tool_window_properties[EDITING_TOOLS_EDITING_TOOL_WINDOW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _EditingToolsEditingToolWindowPrivate {
	GtkGrid* _content_area;
};

static gint EditingToolsEditingToolWindow_private_offset;
static gpointer editing_tools_editing_tool_window_parent_class = NULL;

static gboolean editing_tools_editing_tool_window_real_key_press_event (GtkWidget* base,
                                                                 GdkEventKey* event);
static gboolean editing_tools_editing_tool_window_real_button_press_event (GtkWidget* base,
                                                                    GdkEventButton* event);
static void editing_tools_editing_tool_window_set_content_area (EditingToolsEditingToolWindow* self,
                                                         GtkGrid* value);
static GObject * editing_tools_editing_tool_window_constructor (GType type,
                                                         guint n_construct_properties,
                                                         GObjectConstructParam * construct_properties);
static void _suppress_warnings_glog_func (const gchar* log_domain,
                                   GLogLevelFlags log_levels,
                                   const gchar* message,
                                   gpointer self);
static void editing_tools_editing_tool_window_finalize (GObject * obj);
static GType editing_tools_editing_tool_window_get_type_once (void);
static void _vala_editing_tools_editing_tool_window_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec);
static void _vala_editing_tools_editing_tool_window_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec);

static inline gpointer
editing_tools_editing_tool_window_get_instance_private (EditingToolsEditingToolWindow* self)
{
	return G_STRUCT_MEMBER_P (self, EditingToolsEditingToolWindow_private_offset);
}

EditingToolsEditingToolWindow*
editing_tools_editing_tool_window_construct (GType object_type,
                                             GtkWindow* container)
{
	EditingToolsEditingToolWindow * self = NULL;
	g_return_val_if_fail (container != NULL, NULL);
	self = (EditingToolsEditingToolWindow*) g_object_new (object_type, "transient-for", container, NULL);
	return self;
}

static gboolean
editing_tools_editing_tool_window_real_key_press_event (GtkWidget* base,
                                                        GdkEventKey* event)
{
	EditingToolsEditingToolWindow * self;
	AppWindow* _tmp0_;
	AppWindow* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_;
	gboolean result;
	self = (EditingToolsEditingToolWindow*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	if (GTK_WIDGET_CLASS (editing_tools_editing_tool_window_parent_class)->key_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, hdy_window_get_type (), HdyWindow), event)) {
		result = TRUE;
		return result;
	}
	_tmp0_ = app_window_get_instance ();
	_tmp1_ = _tmp0_;
	g_signal_emit_by_name ((GtkWidget*) _tmp1_, "key-press-event", event, &_tmp2_);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static gboolean
editing_tools_editing_tool_window_real_button_press_event (GtkWidget* base,
                                                           GdkEventButton* event)
{
	EditingToolsEditingToolWindow * self;
	gboolean result;
	self = (EditingToolsEditingToolWindow*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	if (event->button != ((guint) 1)) {
		gboolean _tmp0_ = FALSE;
		if (GTK_WIDGET_CLASS (editing_tools_editing_tool_window_parent_class)->button_press_event != NULL) {
			_tmp0_ = GTK_WIDGET_CLASS (editing_tools_editing_tool_window_parent_class)->button_press_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, hdy_window_get_type (), HdyWindow), event);
		} else {
			_tmp0_ = TRUE;
		}
		result = _tmp0_;
		return result;
	}
	gtk_window_begin_move_drag ((GtkWindow*) self, (gint) event->button, (gint) event->x_root, (gint) event->y_root, event->time);
	result = TRUE;
	return result;
}

GtkGrid*
editing_tools_editing_tool_window_get_content_area (EditingToolsEditingToolWindow* self)
{
	GtkGrid* result;
	GtkGrid* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_content_area;
	result = _tmp0_;
	return result;
}

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

static void
editing_tools_editing_tool_window_set_content_area (EditingToolsEditingToolWindow* self,
                                                    GtkGrid* value)
{
	GtkGrid* old_value;
	g_return_if_fail (self != NULL);
	old_value = editing_tools_editing_tool_window_get_content_area (self);
	if (old_value != value) {
		GtkGrid* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_content_area);
		self->priv->_content_area = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, editing_tools_editing_tool_window_properties[EDITING_TOOLS_EDITING_TOOL_WINDOW_CONTENT_AREA_PROPERTY]);
	}
}

static void
_suppress_warnings_glog_func (const gchar* log_domain,
                              GLogLevelFlags log_levels,
                              const gchar* message,
                              gpointer self)
{
	suppress_warnings (log_domain, log_levels, message);
}

static GObject *
editing_tools_editing_tool_window_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	EditingToolsEditingToolWindow * self;
	GtkGrid* _tmp0_ = NULL;
	GtkGrid* _tmp1_;
	GtkGrid* _tmp2_;
	parent_class = G_OBJECT_CLASS (editing_tools_editing_tool_window_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_TYPE_EDITING_TOOL_WINDOW, EditingToolsEditingToolWindow);
	_tmp0_ = (GtkGrid*) gtk_grid_new ();
	g_object_set ((GtkWidget*) _tmp0_, "margin", 12, NULL);
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	editing_tools_editing_tool_window_set_content_area (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = self->priv->_content_area;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp2_);
	gtk_window_set_accept_focus ((GtkWindow*) self, TRUE);
	gtk_widget_set_can_focus ((GtkWidget*) self, TRUE);
	gtk_window_set_focus_on_map ((GtkWindow*) self, TRUE);
	gtk_window_set_resizable ((GtkWindow*) self, FALSE);
	gtk_widget_add_events ((GtkWidget*) self, (gint) (GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK));
	g_log_set_handler ("Gdk", G_LOG_LEVEL_WARNING, _suppress_warnings_glog_func, NULL);
	return obj;
}

static void
editing_tools_editing_tool_window_class_init (EditingToolsEditingToolWindowClass * klass,
                                              gpointer klass_data)
{
	editing_tools_editing_tool_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &EditingToolsEditingToolWindow_private_offset);
	((GtkWidgetClass *) klass)->key_press_event = (gboolean (*) (GtkWidget*, GdkEventKey*)) editing_tools_editing_tool_window_real_key_press_event;
	((GtkWidgetClass *) klass)->button_press_event = (gboolean (*) (GtkWidget*, GdkEventButton*)) editing_tools_editing_tool_window_real_button_press_event;
	G_OBJECT_CLASS (klass)->get_property = _vala_editing_tools_editing_tool_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_editing_tools_editing_tool_window_set_property;
	G_OBJECT_CLASS (klass)->constructor = editing_tools_editing_tool_window_constructor;
	G_OBJECT_CLASS (klass)->finalize = editing_tools_editing_tool_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), EDITING_TOOLS_EDITING_TOOL_WINDOW_CONTENT_AREA_PROPERTY, editing_tools_editing_tool_window_properties[EDITING_TOOLS_EDITING_TOOL_WINDOW_CONTENT_AREA_PROPERTY] = g_param_spec_object ("content-area", "content-area", "content-area", gtk_grid_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
editing_tools_editing_tool_window_instance_init (EditingToolsEditingToolWindow * self,
                                                 gpointer klass)
{
	self->priv = editing_tools_editing_tool_window_get_instance_private (self);
}

static void
editing_tools_editing_tool_window_finalize (GObject * obj)
{
	EditingToolsEditingToolWindow * self;
	GLogFunc _tmp0_;
	gpointer _tmp0__target;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, EDITING_TOOLS_TYPE_EDITING_TOOL_WINDOW, EditingToolsEditingToolWindow);
	_tmp0_ = g_log_default_handler;
	_tmp0__target = NULL;
	g_log_set_handler ("Gdk", G_LOG_LEVEL_WARNING, _tmp0_, _tmp0__target);
	_g_object_unref0 (self->priv->_content_area);
	G_OBJECT_CLASS (editing_tools_editing_tool_window_parent_class)->finalize (obj);
}

static GType
editing_tools_editing_tool_window_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EditingToolsEditingToolWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) editing_tools_editing_tool_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EditingToolsEditingToolWindow), 0, (GInstanceInitFunc) editing_tools_editing_tool_window_instance_init, NULL };
	GType editing_tools_editing_tool_window_type_id;
	editing_tools_editing_tool_window_type_id = g_type_register_static (hdy_window_get_type (), "EditingToolsEditingToolWindow", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	EditingToolsEditingToolWindow_private_offset = g_type_add_instance_private (editing_tools_editing_tool_window_type_id, sizeof (EditingToolsEditingToolWindowPrivate));
	return editing_tools_editing_tool_window_type_id;
}

GType
editing_tools_editing_tool_window_get_type (void)
{
	static volatile gsize editing_tools_editing_tool_window_type_id__once = 0;
	if (g_once_init_enter (&editing_tools_editing_tool_window_type_id__once)) {
		GType editing_tools_editing_tool_window_type_id;
		editing_tools_editing_tool_window_type_id = editing_tools_editing_tool_window_get_type_once ();
		g_once_init_leave (&editing_tools_editing_tool_window_type_id__once, editing_tools_editing_tool_window_type_id);
	}
	return editing_tools_editing_tool_window_type_id__once;
}

static void
_vala_editing_tools_editing_tool_window_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec)
{
	EditingToolsEditingToolWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, EDITING_TOOLS_TYPE_EDITING_TOOL_WINDOW, EditingToolsEditingToolWindow);
	switch (property_id) {
		case EDITING_TOOLS_EDITING_TOOL_WINDOW_CONTENT_AREA_PROPERTY:
		g_value_set_object (value, editing_tools_editing_tool_window_get_content_area (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_editing_tools_editing_tool_window_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec)
{
	EditingToolsEditingToolWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, EDITING_TOOLS_TYPE_EDITING_TOOL_WINDOW, EditingToolsEditingToolWindow);
	switch (property_id) {
		case EDITING_TOOLS_EDITING_TOOL_WINDOW_CONTENT_AREA_PROPERTY:
		editing_tools_editing_tool_window_set_content_area (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

