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

/*
 * This file is part of budgie-desktop
 * 
 * Copyright (C) 2015-2016 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.
 */

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>


#define BUDGIE_TYPE_MAIN_VIEW (budgie_main_view_get_type ())
#define BUDGIE_MAIN_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUDGIE_TYPE_MAIN_VIEW, BudgieMainView))
#define BUDGIE_MAIN_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUDGIE_TYPE_MAIN_VIEW, BudgieMainViewClass))
#define BUDGIE_IS_MAIN_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUDGIE_TYPE_MAIN_VIEW))
#define BUDGIE_IS_MAIN_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUDGIE_TYPE_MAIN_VIEW))
#define BUDGIE_MAIN_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUDGIE_TYPE_MAIN_VIEW, BudgieMainViewClass))

typedef struct _BudgieMainView BudgieMainView;
typedef struct _BudgieMainViewClass BudgieMainViewClass;
typedef struct _BudgieMainViewPrivate BudgieMainViewPrivate;

#define TYPE_MPRIS_WIDGET (mpris_widget_get_type ())
#define MPRIS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_WIDGET, MprisWidget))
#define MPRIS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_WIDGET, MprisWidgetClass))
#define IS_MPRIS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_WIDGET))
#define IS_MPRIS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_WIDGET))
#define MPRIS_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_WIDGET, MprisWidgetClass))

typedef struct _MprisWidget MprisWidget;
typedef struct _MprisWidgetClass MprisWidgetClass;

#define TYPE_CALENDAR_WIDGET (calendar_widget_get_type ())
#define CALENDAR_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CALENDAR_WIDGET, CalendarWidget))
#define CALENDAR_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CALENDAR_WIDGET, CalendarWidgetClass))
#define IS_CALENDAR_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CALENDAR_WIDGET))
#define IS_CALENDAR_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CALENDAR_WIDGET))
#define CALENDAR_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CALENDAR_WIDGET, CalendarWidgetClass))

typedef struct _CalendarWidget CalendarWidget;
typedef struct _CalendarWidgetClass CalendarWidgetClass;

#define TYPE_SOUND_WIDGET (sound_widget_get_type ())
#define SOUND_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOUND_WIDGET, SoundWidget))
#define SOUND_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOUND_WIDGET, SoundWidgetClass))
#define IS_SOUND_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOUND_WIDGET))
#define IS_SOUND_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOUND_WIDGET))
#define SOUND_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOUND_WIDGET, SoundWidgetClass))

typedef struct _SoundWidget SoundWidget;
typedef struct _SoundWidgetClass SoundWidgetClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define BUDGIE_TYPE_NOTIFICATIONS_VIEW (budgie_notifications_view_get_type ())
#define BUDGIE_NOTIFICATIONS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUDGIE_TYPE_NOTIFICATIONS_VIEW, BudgieNotificationsView))
#define BUDGIE_NOTIFICATIONS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUDGIE_TYPE_NOTIFICATIONS_VIEW, BudgieNotificationsViewClass))
#define BUDGIE_IS_NOTIFICATIONS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUDGIE_TYPE_NOTIFICATIONS_VIEW))
#define BUDGIE_IS_NOTIFICATIONS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUDGIE_TYPE_NOTIFICATIONS_VIEW))
#define BUDGIE_NOTIFICATIONS_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUDGIE_TYPE_NOTIFICATIONS_VIEW, BudgieNotificationsViewClass))

typedef struct _BudgieNotificationsView BudgieNotificationsView;
typedef struct _BudgieNotificationsViewClass BudgieNotificationsViewClass;

#define BUDGIE_TYPE_RAVEN (budgie_raven_get_type ())
#define BUDGIE_RAVEN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUDGIE_TYPE_RAVEN, BudgieRaven))
#define BUDGIE_RAVEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUDGIE_TYPE_RAVEN, BudgieRavenClass))
#define BUDGIE_IS_RAVEN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUDGIE_TYPE_RAVEN))
#define BUDGIE_IS_RAVEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUDGIE_TYPE_RAVEN))
#define BUDGIE_RAVEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUDGIE_TYPE_RAVEN, BudgieRavenClass))

typedef struct _BudgieRaven BudgieRaven;
typedef struct _BudgieRavenClass BudgieRavenClass;

struct _BudgieMainView {
	GtkBox parent_instance;
	BudgieMainViewPrivate * priv;
};

struct _BudgieMainViewClass {
	GtkBoxClass parent_class;
};

struct _BudgieMainViewPrivate {
	MprisWidget* mpris;
	CalendarWidget* cal;
	SoundWidget* sound;
	GtkStack* main_stack;
	GtkStackSwitcher* switcher;
};


static gpointer budgie_main_view_parent_class = NULL;

GType budgie_main_view_get_type (void) G_GNUC_CONST;
GType mpris_widget_get_type (void) G_GNUC_CONST;
GType calendar_widget_get_type (void) G_GNUC_CONST;
GType sound_widget_get_type (void) G_GNUC_CONST;
#define BUDGIE_MAIN_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BUDGIE_TYPE_MAIN_VIEW, BudgieMainViewPrivate))
enum  {
	BUDGIE_MAIN_VIEW_DUMMY_PROPERTY
};
void budgie_main_view_expose_notification (BudgieMainView* self);
BudgieMainView* budgie_main_view_new (void);
BudgieMainView* budgie_main_view_construct (GType object_type);
static void __lambda27_ (BudgieMainView* self);
static void ___lambda27__gtk_button_clicked (GtkButton* _sender, gpointer self);
GType budgie_notifications_view_get_type (void) G_GNUC_CONST;
guint budgie_notifications_view_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
BudgieNotificationsView* budgie_notifications_view_new (void);
BudgieNotificationsView* budgie_notifications_view_construct (GType object_type);
CalendarWidget* calendar_widget_new (void);
CalendarWidget* calendar_widget_construct (GType object_type);
SoundWidget* sound_widget_new (void);
SoundWidget* sound_widget_construct (GType object_type);
MprisWidget* mpris_widget_new (void);
MprisWidget* mpris_widget_construct (GType object_type);
static void budgie_main_view_on_name_change (BudgieMainView* self);
static void _budgie_main_view_on_name_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
GType budgie_raven_get_type (void) G_GNUC_CONST;
BudgieRaven* budgie_raven_get_instance (void);
void budgie_raven_ReadNotifications (BudgieRaven* self);
void budgie_main_view_set_clean (BudgieMainView* self);
static void budgie_main_view_finalize (GObject* obj);


void budgie_main_view_expose_notification (BudgieMainView* self) {
	GtkStack* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->main_stack;
	gtk_stack_set_visible_child_name (_tmp0_, "notifications");
}


static void __lambda27_ (BudgieMainView* self) {
	g_signal_emit_by_name (self, "view-switch");
}


static void ___lambda27__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda27_ ((BudgieMainView*) self);
}


static void _budgie_main_view_on_name_change_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	budgie_main_view_on_name_change ((BudgieMainView*) self);
}


BudgieMainView* budgie_main_view_construct (GType object_type) {
	BudgieMainView * self = NULL;
	GtkSizeGroup* group = NULL;
	GtkSizeGroup* _tmp0_ = NULL;
	GtkBox* header = NULL;
	GtkBox* _tmp1_ = NULL;
	GtkStyleContext* _tmp2_ = NULL;
	GtkStyleContext* _tmp3_ = NULL;
	GtkStack* _tmp4_ = NULL;
	GtkStack* _tmp5_ = NULL;
	GtkButton* settings = NULL;
	GtkButton* _tmp6_ = NULL;
	GtkStackSwitcher* _tmp7_ = NULL;
	GtkStackSwitcher* _tmp8_ = NULL;
	GtkStackSwitcher* _tmp9_ = NULL;
	GtkStackSwitcher* _tmp10_ = NULL;
	GtkStackSwitcher* _tmp11_ = NULL;
	GtkStackSwitcher* _tmp12_ = NULL;
	GtkStackSwitcher* _tmp13_ = NULL;
	GtkStack* _tmp14_ = NULL;
	GtkStackSwitcher* _tmp15_ = NULL;
	GtkStack* _tmp16_ = NULL;
	GtkScrolledWindow* scroll = NULL;
	GtkScrolledWindow* _tmp17_ = NULL;
	GtkStack* _tmp18_ = NULL;
	const gchar* _tmp19_ = NULL;
	BudgieNotificationsView* not = NULL;
	BudgieNotificationsView* _tmp20_ = NULL;
	GtkStack* _tmp21_ = NULL;
	const gchar* _tmp22_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp23_ = NULL;
	CalendarWidget* _tmp24_ = NULL;
	CalendarWidget* _tmp25_ = NULL;
	SoundWidget* _tmp26_ = NULL;
	SoundWidget* _tmp27_ = NULL;
	MprisWidget* _tmp28_ = NULL;
	MprisWidget* _tmp29_ = NULL;
	GtkStack* _tmp30_ = NULL;
	GtkStack* _tmp31_ = NULL;
	self = (BudgieMainView*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 0, NULL);
	_tmp0_ = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
	group = _tmp0_;
	_tmp1_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp1_);
	header = _tmp1_;
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) header);
	gtk_style_context_add_class (_tmp2_, "raven-header");
	_tmp3_ = gtk_widget_get_style_context ((GtkWidget*) header);
	gtk_style_context_add_class (_tmp3_, "top");
	_tmp4_ = (GtkStack*) gtk_stack_new ();
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->main_stack);
	self->priv->main_stack = _tmp4_;
	gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) header, FALSE, FALSE, (guint) 0);
	_tmp5_ = self->priv->main_stack;
	gtk_stack_set_transition_type (_tmp5_, GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT);
	_tmp6_ = (GtkButton*) gtk_button_new_from_icon_name ("applications-system-symbolic", GTK_ICON_SIZE_BUTTON);
	g_object_ref_sink (_tmp6_);
	settings = _tmp6_;
	g_signal_connect_object (settings, "clicked", (GCallback) ___lambda27__gtk_button_clicked, self, 0);
	gtk_widget_set_margin_top ((GtkWidget*) settings, 4);
	gtk_widget_set_margin_bottom ((GtkWidget*) settings, 4);
	gtk_widget_set_margin_right ((GtkWidget*) settings, 4);
	gtk_box_pack_end (header, (GtkWidget*) settings, FALSE, FALSE, (guint) 0);
	gtk_widget_set_valign ((GtkWidget*) settings, GTK_ALIGN_CENTER);
	_tmp7_ = (GtkStackSwitcher*) gtk_stack_switcher_new ();
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->switcher);
	self->priv->switcher = _tmp7_;
	_tmp8_ = self->priv->switcher;
	gtk_size_group_add_widget (group, (GtkWidget*) _tmp8_);
	gtk_size_group_add_widget (group, (GtkWidget*) settings);
	_tmp9_ = self->priv->switcher;
	gtk_widget_set_valign ((GtkWidget*) _tmp9_, GTK_ALIGN_CENTER);
	_tmp10_ = self->priv->switcher;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp10_, 4);
	_tmp11_ = self->priv->switcher;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp11_, 4);
	_tmp12_ = self->priv->switcher;
	gtk_widget_set_halign ((GtkWidget*) _tmp12_, GTK_ALIGN_CENTER);
	_tmp13_ = self->priv->switcher;
	_tmp14_ = self->priv->main_stack;
	gtk_stack_switcher_set_stack (_tmp13_, _tmp14_);
	_tmp15_ = self->priv->switcher;
	gtk_box_pack_start (header, (GtkWidget*) _tmp15_, TRUE, TRUE, (guint) 0);
	_tmp16_ = self->priv->main_stack;
	gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp16_, TRUE, TRUE, (guint) 0);
	_tmp17_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp17_);
	scroll = _tmp17_;
	_tmp18_ = self->priv->main_stack;
	_tmp19_ = _ ("Applets");
	gtk_stack_add_titled (_tmp18_, (GtkWidget*) scroll, "applets", _tmp19_);
	_tmp20_ = budgie_notifications_view_new ();
	g_object_ref_sink (_tmp20_);
	not = _tmp20_;
	_tmp21_ = self->priv->main_stack;
	_tmp22_ = _ ("Notifications");
	gtk_stack_add_titled (_tmp21_, (GtkWidget*) not, "notifications", _tmp22_);
	gtk_scrolled_window_set_policy (scroll, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	_tmp23_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp23_);
	box = _tmp23_;
	gtk_container_add ((GtkContainer*) scroll, (GtkWidget*) box);
	_tmp24_ = calendar_widget_new ();
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (self->priv->cal);
	self->priv->cal = _tmp24_;
	_tmp25_ = self->priv->cal;
	gtk_box_pack_start (box, (GtkWidget*) _tmp25_, FALSE, FALSE, (guint) 0);
	_tmp26_ = sound_widget_new ();
	g_object_ref_sink (_tmp26_);
	_g_object_unref0 (self->priv->sound);
	self->priv->sound = _tmp26_;
	_tmp27_ = self->priv->sound;
	gtk_box_pack_start (box, (GtkWidget*) _tmp27_, FALSE, FALSE, (guint) 0);
	_tmp28_ = mpris_widget_new ();
	g_object_ref_sink (_tmp28_);
	_g_object_unref0 (self->priv->mpris);
	self->priv->mpris = _tmp28_;
	_tmp29_ = self->priv->mpris;
	gtk_box_pack_start (box, (GtkWidget*) _tmp29_, FALSE, FALSE, (guint) 0);
	gtk_widget_show_all ((GtkWidget*) self);
	_tmp30_ = self->priv->main_stack;
	gtk_stack_set_visible_child_name (_tmp30_, "applets");
	_tmp31_ = self->priv->main_stack;
	g_signal_connect_object ((GObject*) _tmp31_, "notify::visible-child-name", (GCallback) _budgie_main_view_on_name_change_g_object_notify, self, 0);
	_g_object_unref0 (box);
	_g_object_unref0 (not);
	_g_object_unref0 (scroll);
	_g_object_unref0 (settings);
	_g_object_unref0 (header);
	_g_object_unref0 (group);
	return self;
}


BudgieMainView* budgie_main_view_new (void) {
	return budgie_main_view_construct (BUDGIE_TYPE_MAIN_VIEW);
}


static void budgie_main_view_on_name_change (BudgieMainView* self) {
	GtkStack* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->main_stack;
	_tmp1_ = gtk_stack_get_visible_child_name (_tmp0_);
	if (g_strcmp0 (_tmp1_, "notifications") == 0) {
		BudgieRaven* _tmp2_ = NULL;
		_tmp2_ = budgie_raven_get_instance ();
		budgie_raven_ReadNotifications (_tmp2_);
	}
}


void budgie_main_view_set_clean (BudgieMainView* self) {
	GtkStack* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->main_stack;
	gtk_stack_set_visible_child_name (_tmp0_, "applets");
}


static void budgie_main_view_class_init (BudgieMainViewClass * klass) {
	budgie_main_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (BudgieMainViewPrivate));
	G_OBJECT_CLASS (klass)->finalize = budgie_main_view_finalize;
	g_signal_new ("view_switch", BUDGIE_TYPE_MAIN_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}


static void budgie_main_view_instance_init (BudgieMainView * self) {
	self->priv = BUDGIE_MAIN_VIEW_GET_PRIVATE (self);
	self->priv->mpris = NULL;
	self->priv->cal = NULL;
	self->priv->sound = NULL;
	self->priv->main_stack = NULL;
	self->priv->switcher = NULL;
}


static void budgie_main_view_finalize (GObject* obj) {
	BudgieMainView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BUDGIE_TYPE_MAIN_VIEW, BudgieMainView);
	_g_object_unref0 (self->priv->mpris);
	_g_object_unref0 (self->priv->cal);
	_g_object_unref0 (self->priv->sound);
	_g_object_unref0 (self->priv->main_stack);
	_g_object_unref0 (self->priv->switcher);
	G_OBJECT_CLASS (budgie_main_view_parent_class)->finalize (obj);
}


GType budgie_main_view_get_type (void) {
	static volatile gsize budgie_main_view_type_id__volatile = 0;
	if (g_once_init_enter (&budgie_main_view_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BudgieMainViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) budgie_main_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BudgieMainView), 0, (GInstanceInitFunc) budgie_main_view_instance_init, NULL };
		GType budgie_main_view_type_id;
		budgie_main_view_type_id = g_type_register_static (gtk_box_get_type (), "BudgieMainView", &g_define_type_info, 0);
		g_once_init_leave (&budgie_main_view_type_id__volatile, budgie_main_view_type_id);
	}
	return budgie_main_view_type_id__volatile;
}



