/* custom_statusbar.c generated by valac 0.40.0.227-717ea, the Vala compiler
 * generated from custom_statusbar.vala, do not modify */

/*
 * This file is part of GNOME LaTeX.
 *
 * Copyright © 2010-2011 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/>.
 */


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


#define TYPE_CUSTOM_STATUSBAR (custom_statusbar_get_type ())
#define CUSTOM_STATUSBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CUSTOM_STATUSBAR, CustomStatusbar))
#define CUSTOM_STATUSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CUSTOM_STATUSBAR, CustomStatusbarClass))
#define IS_CUSTOM_STATUSBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CUSTOM_STATUSBAR))
#define IS_CUSTOM_STATUSBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CUSTOM_STATUSBAR))
#define CUSTOM_STATUSBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CUSTOM_STATUSBAR, CustomStatusbarClass))

typedef struct _CustomStatusbar CustomStatusbar;
typedef struct _CustomStatusbarClass CustomStatusbarClass;
typedef struct _CustomStatusbarPrivate CustomStatusbarPrivate;
enum  {
	CUSTOM_STATUSBAR_0_PROPERTY,
	CUSTOM_STATUSBAR_NUM_PROPERTIES
};
static GParamSpec* custom_statusbar_properties[CUSTOM_STATUSBAR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _CustomStatusbar {
	GtkStatusbar parent_instance;
	CustomStatusbarPrivate * priv;
};

struct _CustomStatusbarClass {
	GtkStatusbarClass parent_class;
};

struct _CustomStatusbarPrivate {
	GtkStatusbar* cursor_position;
};


static gint CustomStatusbar_private_offset;
static gpointer custom_statusbar_parent_class = NULL;

GType custom_statusbar_get_type (void) G_GNUC_CONST;
CustomStatusbar* custom_statusbar_new (void);
CustomStatusbar* custom_statusbar_construct (GType object_type);
void custom_statusbar_set_cursor_position (CustomStatusbar* self,
                                           gint line,
                                           gint col);
static void custom_statusbar_finalize (GObject * obj);


static inline gpointer
custom_statusbar_get_instance_private (CustomStatusbar* self)
{
	return G_STRUCT_MEMBER_P (self, CustomStatusbar_private_offset);
}


CustomStatusbar*
custom_statusbar_construct (GType object_type)
{
	CustomStatusbar * self = NULL;
	GtkStatusbar* _tmp0_;
	GtkStatusbar* _tmp1_;
	GtkStatusbar* _tmp2_;
	GtkStatusbar* _tmp3_;
#line 26 "custom_statusbar.vala"
	self = (CustomStatusbar*) g_object_new (object_type, NULL);
#line 28 "custom_statusbar.vala"
	_tmp0_ = (GtkStatusbar*) gtk_statusbar_new ();
#line 28 "custom_statusbar.vala"
	g_object_ref_sink (_tmp0_);
#line 28 "custom_statusbar.vala"
	_g_object_unref0 (self->priv->cursor_position);
#line 28 "custom_statusbar.vala"
	self->priv->cursor_position = _tmp0_;
#line 29 "custom_statusbar.vala"
	_tmp1_ = self->priv->cursor_position;
#line 29 "custom_statusbar.vala"
	gtk_widget_set_size_request ((GtkWidget*) _tmp1_, 150, -1);
#line 30 "custom_statusbar.vala"
	_tmp2_ = self->priv->cursor_position;
#line 30 "custom_statusbar.vala"
	g_object_set ((GtkWidget*) _tmp2_, "margin", 0, NULL);
#line 31 "custom_statusbar.vala"
	_tmp3_ = self->priv->cursor_position;
#line 31 "custom_statusbar.vala"
	gtk_box_pack_end ((GtkBox*) self, (GtkWidget*) _tmp3_, FALSE, TRUE, (guint) 0);
#line 33 "custom_statusbar.vala"
	gtk_widget_set_margin_top ((GtkWidget*) self, 0);
#line 34 "custom_statusbar.vala"
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 0);
#line 26 "custom_statusbar.vala"
	return self;
#line 120 "custom_statusbar.c"
}


CustomStatusbar*
custom_statusbar_new (void)
{
#line 26 "custom_statusbar.vala"
	return custom_statusbar_construct (TYPE_CUSTOM_STATUSBAR);
#line 129 "custom_statusbar.c"
}


void
custom_statusbar_set_cursor_position (CustomStatusbar* self,
                                      gint line,
                                      gint col)
{
	GtkStatusbar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	GtkStatusbar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
#line 37 "custom_statusbar.vala"
	g_return_if_fail (self != NULL);
#line 39 "custom_statusbar.vala"
	_tmp0_ = self->priv->cursor_position;
#line 39 "custom_statusbar.vala"
	gtk_statusbar_pop (_tmp0_, (guint) 0);
#line 40 "custom_statusbar.vala"
	if (line == -1) {
#line 40 "custom_statusbar.vala"
		_tmp1_ = col == -1;
#line 153 "custom_statusbar.c"
	} else {
#line 40 "custom_statusbar.vala"
		_tmp1_ = FALSE;
#line 157 "custom_statusbar.c"
	}
#line 40 "custom_statusbar.vala"
	if (_tmp1_) {
#line 41 "custom_statusbar.vala"
		return;
#line 163 "custom_statusbar.c"
	}
#line 45 "custom_statusbar.vala"
	_tmp2_ = self->priv->cursor_position;
#line 45 "custom_statusbar.vala"
	_tmp3_ = g_strdup_printf (_ ("Ln %d, Col %d"), line, col);
#line 45 "custom_statusbar.vala"
	_tmp4_ = _tmp3_;
#line 45 "custom_statusbar.vala"
	gtk_statusbar_push (_tmp2_, (guint) 0, _tmp4_);
#line 45 "custom_statusbar.vala"
	_g_free0 (_tmp4_);
#line 175 "custom_statusbar.c"
}


static void
custom_statusbar_class_init (CustomStatusbarClass * klass)
{
#line 22 "custom_statusbar.vala"
	custom_statusbar_parent_class = g_type_class_peek_parent (klass);
#line 22 "custom_statusbar.vala"
	g_type_class_adjust_private_offset (klass, &CustomStatusbar_private_offset);
#line 22 "custom_statusbar.vala"
	G_OBJECT_CLASS (klass)->finalize = custom_statusbar_finalize;
#line 188 "custom_statusbar.c"
}


static void
custom_statusbar_instance_init (CustomStatusbar * self)
{
#line 22 "custom_statusbar.vala"
	self->priv = custom_statusbar_get_instance_private (self);
#line 197 "custom_statusbar.c"
}


static void
custom_statusbar_finalize (GObject * obj)
{
	CustomStatusbar * self;
#line 22 "custom_statusbar.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_CUSTOM_STATUSBAR, CustomStatusbar);
#line 24 "custom_statusbar.vala"
	_g_object_unref0 (self->priv->cursor_position);
#line 22 "custom_statusbar.vala"
	G_OBJECT_CLASS (custom_statusbar_parent_class)->finalize (obj);
#line 211 "custom_statusbar.c"
}


GType
custom_statusbar_get_type (void)
{
	static volatile gsize custom_statusbar_type_id__volatile = 0;
	if (g_once_init_enter (&custom_statusbar_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (CustomStatusbarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) custom_statusbar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CustomStatusbar), 0, (GInstanceInitFunc) custom_statusbar_instance_init, NULL };
		GType custom_statusbar_type_id;
		custom_statusbar_type_id = g_type_register_static (gtk_statusbar_get_type (), "CustomStatusbar", &g_define_type_info, 0);
		CustomStatusbar_private_offset = g_type_add_instance_private (custom_statusbar_type_id, sizeof (CustomStatusbarPrivate));
		g_once_init_leave (&custom_statusbar_type_id__volatile, custom_statusbar_type_id);
	}
	return custom_statusbar_type_id__volatile;
}



