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

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

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

#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 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;
enum  {
	BOTTOM_PANEL_0_PROPERTY,
	BOTTOM_PANEL_NUM_PROPERTIES
};
static GParamSpec* bottom_panel_properties[BOTTOM_PANEL_NUM_PROPERTIES];
#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;

VALA_EXTERN GType bottom_panel_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BottomPanel, g_object_unref)
VALA_EXTERN BottomPanel* bottom_panel_new (LatexilaBuildView* build_view,
                               GtkToolbar* toolbar);
VALA_EXTERN BottomPanel* bottom_panel_construct (GType object_type,
                                     LatexilaBuildView* build_view,
                                     GtkToolbar* toolbar);
VALA_EXTERN GtkScrolledWindow* utils_add_scrollbar (GtkWidget* child);
static GtkButton* bottom_panel_get_close_button (BottomPanel* self);
static void __lambda4_ (BottomPanel* self);
static void ___lambda4__gtk_button_clicked (GtkButton* _sender,
                                     gpointer self);
static GType bottom_panel_get_type_once (void);

BottomPanel*
bottom_panel_construct (GType object_type,
                        LatexilaBuildView* build_view,
                        GtkToolbar* toolbar)
{
	BottomPanel * self = NULL;
	GtkScrolledWindow* scrolled_window = NULL;
	GtkScrolledWindow* _tmp0_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp1_;
	GtkButton* _tmp2_;
	GtkButton* _tmp3_;
	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_ = utils_add_scrollbar ((GtkWidget*) build_view);
	scrolled_window = _tmp0_;
	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);
	_tmp1_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp1_);
	grid = _tmp1_;
	gtk_orientable_set_orientation ((GtkOrientable*) grid, GTK_ORIENTATION_VERTICAL);
	_tmp2_ = bottom_panel_get_close_button (self);
	_tmp3_ = _tmp2_;
	gtk_container_add ((GtkContainer*) grid, (GtkWidget*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	gtk_widget_set_vexpand ((GtkWidget*) toolbar, TRUE);
	gtk_container_add ((GtkContainer*) grid, (GtkWidget*) toolbar);
	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 gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

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

static void
___lambda4__gtk_button_clicked (GtkButton* _sender,
                                gpointer self)
{
	__lambda4_ ((BottomPanel*) self);
}

static GtkButton*
bottom_panel_get_close_button (BottomPanel* self)
{
	GtkButton* close_button = NULL;
	GtkWidget* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = tepl_utils_create_close_button ();
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_button_get_type ()) ? ((GtkButton*) _tmp0_) : NULL);
	close_button = _tmp1_;
	gtk_widget_set_tooltip_text ((GtkWidget*) close_button, _ ("Hide panel"));
	g_object_set ((GtkWidget*) close_button, "margin", 3, NULL);
	g_signal_connect_object (close_button, "clicked", (GCallback) ___lambda4__gtk_button_clicked, self, 0);
	result = close_button;
	return result;
}

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

static void
bottom_panel_instance_init (BottomPanel * self,
                            gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
bottom_panel_get_type_once (void)
{
	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);
	return bottom_panel_type_id;
}

GType
bottom_panel_get_type (void)
{
	static gsize bottom_panel_type_id__once = 0;
	if (g_once_init_enter (&bottom_panel_type_id__once)) {
		GType bottom_panel_type_id;
		bottom_panel_type_id = bottom_panel_get_type_once ();
		g_once_init_leave (&bottom_panel_type_id__once, bottom_panel_type_id);
	}
	return bottom_panel_type_id__once;
}

