/* MainView.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from MainView.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 "notifications.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.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  {
	WIDGETS_MAIN_VIEW_0_PROPERTY,
	WIDGETS_MAIN_VIEW_NUM_PROPERTIES
};
static GParamSpec* widgets_main_view_properties[WIDGETS_MAIN_VIEW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_settings_schema_unref0(var) ((var == NULL) ? NULL : (var = (g_settings_schema_unref (var), NULL)))

struct _WidgetsMainViewPrivate {
	GtkPaned* main_widget;
};

static gint WidgetsMainView_private_offset;
static gpointer widgets_main_view_parent_class = NULL;

static GObject * widgets_main_view_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
static void widgets_main_view_finalize (GObject * obj);
static GType widgets_main_view_get_type_once (void);

static inline gpointer
widgets_main_view_get_instance_private (WidgetsMainView* self)
{
	return G_STRUCT_MEMBER_P (self, WidgetsMainView_private_offset);
}

WidgetsMainView*
widgets_main_view_construct (GType object_type)
{
	WidgetsMainView * self = NULL;
	self = (WidgetsMainView*) g_object_new (object_type, NULL);
	return self;
}

WidgetsMainView*
widgets_main_view_new (void)
{
	return widgets_main_view_construct (WIDGETS_TYPE_MAIN_VIEW);
}

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

static GObject *
widgets_main_view_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WidgetsMainView * self;
	WidgetsSidebar* sidebar = NULL;
	WidgetsSidebar* _tmp0_;
	WidgetsAppSettingsView* app_settings_view = NULL;
	WidgetsAppSettingsView* _tmp1_;
	WidgetsSidebar* _tmp2_;
	GtkWidget* _tmp3_;
	WidgetsAppSettingsView* _tmp4_;
	GtkWidget* _tmp5_;
	GtkPaned* _tmp6_ = NULL;
	GtkPaned* _tmp7_;
	GSettingsSchema* sss = NULL;
	GSettingsSchemaSource* _tmp8_;
	GSettingsSchema* _tmp9_;
	gboolean _tmp10_ = FALSE;
	GSettingsSchema* _tmp11_;
	parent_class = G_OBJECT_CLASS (widgets_main_view_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_MAIN_VIEW, WidgetsMainView);
	_tmp0_ = widgets_sidebar_new ();
	g_object_ref_sink (_tmp0_);
	sidebar = _tmp0_;
	_tmp1_ = widgets_app_settings_view_new ();
	g_object_ref_sink (_tmp1_);
	app_settings_view = _tmp1_;
	_tmp2_ = sidebar;
	_tmp3_ = _g_object_ref0 ((GtkWidget*) _tmp2_);
	_tmp4_ = app_settings_view;
	_tmp5_ = _g_object_ref0 ((GtkWidget*) _tmp4_);
	_tmp6_ = (GtkPaned*) gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_paned_set_start_child (_tmp6_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	gtk_paned_set_end_child (_tmp6_, _tmp5_);
	_g_object_unref0 (_tmp5_);
	gtk_paned_set_resize_start_child (_tmp6_, FALSE);
	gtk_paned_set_shrink_start_child (_tmp6_, FALSE);
	gtk_paned_set_shrink_end_child (_tmp6_, FALSE);
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->priv->main_widget);
	self->priv->main_widget = _tmp6_;
	_tmp7_ = self->priv->main_widget;
	gtk_widget_set_parent ((GtkWidget*) _tmp7_, (GtkWidget*) self);
	_tmp8_ = g_settings_schema_source_get_default ();
	_tmp9_ = g_settings_schema_source_lookup (_tmp8_, "io.elementary.settings", TRUE);
	sss = _tmp9_;
	_tmp11_ = sss;
	if (_tmp11_ != NULL) {
		GSettingsSchema* _tmp12_;
		_tmp12_ = sss;
		_tmp10_ = g_settings_schema_has_key (_tmp12_, "sidebar-position");
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		GSettings* settings = NULL;
		GSettings* _tmp13_;
		GSettings* _tmp14_;
		GtkPaned* _tmp15_;
		_tmp13_ = g_settings_new ("io.elementary.settings");
		settings = _tmp13_;
		_tmp14_ = settings;
		_tmp15_ = self->priv->main_widget;
		g_settings_bind (_tmp14_, "sidebar-position", (GObject*) _tmp15_, "position", G_SETTINGS_BIND_DEFAULT);
		_g_object_unref0 (settings);
	}
	_g_settings_schema_unref0 (sss);
	_g_object_unref0 (app_settings_view);
	_g_object_unref0 (sidebar);
	return obj;
}

static void
widgets_main_view_class_init (WidgetsMainViewClass * klass,
                              gpointer klass_data)
{
	widgets_main_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WidgetsMainView_private_offset);
	G_OBJECT_CLASS (klass)->constructor = widgets_main_view_constructor;
	G_OBJECT_CLASS (klass)->finalize = widgets_main_view_finalize;
	gtk_widget_class_set_layout_manager_type (GTK_WIDGET_CLASS (klass), gtk_bin_layout_get_type ());
}

static void
widgets_main_view_instance_init (WidgetsMainView * self,
                                 gpointer klass)
{
	self->priv = widgets_main_view_get_instance_private (self);
}

static void
widgets_main_view_finalize (GObject * obj)
{
	WidgetsMainView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WIDGETS_TYPE_MAIN_VIEW, WidgetsMainView);
	while (TRUE) {
		GtkWidget* _tmp0_;
		GtkWidget* _tmp1_;
		_tmp0_ = gtk_widget_get_last_child ((GtkWidget*) self);
		if (!(_tmp0_ != NULL)) {
			break;
		}
		_tmp1_ = gtk_widget_get_last_child ((GtkWidget*) self);
		gtk_widget_unparent (_tmp1_);
	}
	_g_object_unref0 (self->priv->main_widget);
	G_OBJECT_CLASS (widgets_main_view_parent_class)->finalize (obj);
}

static GType
widgets_main_view_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WidgetsMainViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) widgets_main_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WidgetsMainView), 0, (GInstanceInitFunc) widgets_main_view_instance_init, NULL };
	GType widgets_main_view_type_id;
	widgets_main_view_type_id = g_type_register_static (gtk_widget_get_type (), "WidgetsMainView", &g_define_type_info, 0);
	WidgetsMainView_private_offset = g_type_add_instance_private (widgets_main_view_type_id, sizeof (WidgetsMainViewPrivate));
	return widgets_main_view_type_id;
}

GType
widgets_main_view_get_type (void)
{
	static volatile gsize widgets_main_view_type_id__once = 0;
	if (g_once_init_enter (&widgets_main_view_type_id__once)) {
		GType widgets_main_view_type_id;
		widgets_main_view_type_id = widgets_main_view_get_type_once ();
		g_once_init_leave (&widgets_main_view_type_id__once, widgets_main_view_type_id);
	}
	return widgets_main_view_type_id__once;
}

