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

/*
 * This file is part of LaTeXila.
 *
 * Copyright © 2012 Sébastien Wilmet
 *
 * LaTeXila 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.
 *
 * LaTeXila 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 LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Author: Sébastien Wilmet
 */

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


#define TYPE_BOTTOM_PANEL (bottom_panel_get_type ())
#define BOTTOM_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BOTTOM_PANEL, BottomPanel))
#define BOTTOM_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BOTTOM_PANEL, BottomPanelClass))
#define IS_BOTTOM_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BOTTOM_PANEL))
#define IS_BOTTOM_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BOTTOM_PANEL))
#define BOTTOM_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BOTTOM_PANEL, BottomPanelClass))

typedef struct _BottomPanel BottomPanel;
typedef struct _BottomPanelClass BottomPanelClass;
typedef struct _BottomPanelPrivate BottomPanelPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _BottomPanel {
	GtkGrid parent_instance;
	BottomPanelPrivate * priv;
};

struct _BottomPanelClass {
	GtkGridClass parent_class;
};


static gpointer bottom_panel_parent_class = NULL;

GType bottom_panel_get_type (void) G_GNUC_CONST;
enum  {
	BOTTOM_PANEL_DUMMY_PROPERTY
};
BottomPanel* bottom_panel_new (LatexilaBuildView* build_view, GtkToolbar* toolbar);
BottomPanel* bottom_panel_construct (GType object_type, LatexilaBuildView* build_view, GtkToolbar* toolbar);
GtkScrolledWindow* utils_add_scrollbar (GtkWidget* child);
static GtkButton* bottom_panel_get_close_button (BottomPanel* self);
static void __lambda24_ (BottomPanel* self);
static void ___lambda24__gtk_button_clicked (GtkButton* _sender, gpointer self);


BottomPanel* bottom_panel_construct (GType object_type, LatexilaBuildView* build_view, GtkToolbar* toolbar) {
	BottomPanel * self = NULL;
	GtkScrolledWindow* scrolled_window = NULL;
	LatexilaBuildView* _tmp0_;
	GtkScrolledWindow* _tmp1_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkToolbar* _tmp5_;
	GtkToolbar* _tmp6_;
	g_return_val_if_fail (build_view != NULL, NULL);
	g_return_val_if_fail (toolbar != NULL, NULL);
	self = (BottomPanel*) g_object_new (object_type, NULL);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_HORIZONTAL);
	_tmp0_ = build_view;
	_tmp1_ = utils_add_scrollbar ((GtkWidget*) _tmp0_);
	scrolled_window = _tmp1_;
	g_object_set ((GtkWidget*) scrolled_window, "expand", TRUE, NULL);
	gtk_widget_show_all ((GtkWidget*) scrolled_window);
	gtk_scrolled_window_set_shadow_type (scrolled_window, GTK_SHADOW_IN);
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) scrolled_window);
	_tmp2_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp2_);
	grid = _tmp2_;
	gtk_orientable_set_orientation ((GtkOrientable*) grid, GTK_ORIENTATION_VERTICAL);
	_tmp3_ = bottom_panel_get_close_button (self);
	_tmp4_ = _tmp3_;
	gtk_container_add ((GtkContainer*) grid, (GtkWidget*) _tmp4_);
	_g_object_unref0 (_tmp4_);
	_tmp5_ = toolbar;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp5_, TRUE);
	_tmp6_ = toolbar;
	gtk_container_add ((GtkContainer*) grid, (GtkWidget*) _tmp6_);
	gtk_widget_show_all ((GtkWidget*) grid);
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) grid);
	_g_object_unref0 (grid);
	_g_object_unref0 (scrolled_window);
	return self;
}


BottomPanel* bottom_panel_new (LatexilaBuildView* build_view, GtkToolbar* toolbar) {
	return bottom_panel_construct (TYPE_BOTTOM_PANEL, build_view, toolbar);
}


static void __lambda24_ (BottomPanel* self) {
	gtk_widget_hide ((GtkWidget*) self);
}


static void ___lambda24__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda24_ ((BottomPanel*) self);
}


static GtkButton* bottom_panel_get_close_button (BottomPanel* self) {
	GtkButton* result = NULL;
	GtkButton* close_button = NULL;
	GtkButton* _tmp0_;
	GtkImage* _tmp1_;
	GtkImage* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp0_);
	close_button = _tmp0_;
	gtk_button_set_relief (close_button, GTK_RELIEF_NONE);
	gtk_widget_set_focus_on_click ((GtkWidget*) close_button, FALSE);
	gtk_widget_set_tooltip_text ((GtkWidget*) close_button, _ ("Hide panel"));
	_tmp1_ = (GtkImage*) gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	gtk_container_add ((GtkContainer*) close_button, (GtkWidget*) _tmp2_);
	_g_object_unref0 (_tmp2_);
	g_signal_connect_object (close_button, "clicked", (GCallback) ___lambda24__gtk_button_clicked, self, 0);
	result = close_button;
	return result;
}


static void bottom_panel_class_init (BottomPanelClass * klass) {
	bottom_panel_parent_class = g_type_class_peek_parent (klass);
}


static void bottom_panel_instance_init (BottomPanel * self) {
}


GType bottom_panel_get_type (void) {
	static volatile gsize bottom_panel_type_id__volatile = 0;
	if (g_once_init_enter (&bottom_panel_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BottomPanelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bottom_panel_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BottomPanel), 0, (GInstanceInitFunc) bottom_panel_instance_init, NULL };
		GType bottom_panel_type_id;
		bottom_panel_type_id = g_type_register_static (gtk_grid_get_type (), "BottomPanel", &g_define_type_info, 0);
		g_once_init_leave (&bottom_panel_type_id__volatile, bottom_panel_type_id);
	}
	return bottom_panel_type_id__volatile;
}



