/* main_window_structure.c generated by valac 0.30.0, the Vala compiler
 * generated from main_window_structure.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 "config.h"
#include <gdk/gdk.h>
#include <gobject/gvaluecollector.h>


#define TYPE_MAIN_WINDOW_STRUCTURE (main_window_structure_get_type ())
#define MAIN_WINDOW_STRUCTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW_STRUCTURE, MainWindowStructure))
#define MAIN_WINDOW_STRUCTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW_STRUCTURE, MainWindowStructureClass))
#define IS_MAIN_WINDOW_STRUCTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW_STRUCTURE))
#define IS_MAIN_WINDOW_STRUCTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW_STRUCTURE))
#define MAIN_WINDOW_STRUCTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW_STRUCTURE, MainWindowStructureClass))

typedef struct _MainWindowStructure MainWindowStructure;
typedef struct _MainWindowStructureClass MainWindowStructureClass;
typedef struct _MainWindowStructurePrivate MainWindowStructurePrivate;

#define TYPE_STRUCTURE (structure_get_type ())
#define STRUCTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_STRUCTURE, Structure))
#define STRUCTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_STRUCTURE, StructureClass))
#define IS_STRUCTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_STRUCTURE))
#define IS_STRUCTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_STRUCTURE))
#define STRUCTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_STRUCTURE, StructureClass))

typedef struct _Structure Structure;
typedef struct _StructureClass StructureClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_STRUCT_TYPE (struct_type_get_type ())

#define TYPE_STRUCT_ACTION (struct_action_get_type ())
typedef struct _ParamSpecMainWindowStructure ParamSpecMainWindowStructure;

struct _MainWindowStructure {
	GTypeInstance parent_instance;
	volatile int ref_count;
	MainWindowStructurePrivate * priv;
};

struct _MainWindowStructureClass {
	GTypeClass parent_class;
	void (*finalize) (MainWindowStructure *self);
};

struct _MainWindowStructurePrivate {
	GtkUIManager* _ui_manager;
	Structure* _structure;
};

typedef enum  {
	STRUCT_TYPE_BEGIN_COMMON_TYPES,
	STRUCT_TYPE_PART,
	STRUCT_TYPE_CHAPTER,
	STRUCT_TYPE_SECTION,
	STRUCT_TYPE_SUBSECTION,
	STRUCT_TYPE_SUBSUBSECTION,
	STRUCT_TYPE_PARAGRAPH,
	STRUCT_TYPE_SUBPARAGRAPH,
	STRUCT_TYPE_LABEL,
	STRUCT_TYPE_INCLUDE,
	STRUCT_TYPE_IMAGE,
	STRUCT_TYPE_TODO,
	STRUCT_TYPE_FIXME,
	STRUCT_TYPE_END_COMMON_TYPES,
	STRUCT_TYPE_BEGIN_LOW_LEVEL_TYPES,
	STRUCT_TYPE_BEGIN_FIGURE,
	STRUCT_TYPE_END_FIGURE,
	STRUCT_TYPE_BEGIN_TABLE,
	STRUCT_TYPE_END_TABLE,
	STRUCT_TYPE_BEGIN_VERBATIM,
	STRUCT_TYPE_END_VERBATIM,
	STRUCT_TYPE_END_DOCUMENT,
	STRUCT_TYPE_CAPTION,
	STRUCT_TYPE_END_LOW_LEVEL_TYPES,
	STRUCT_TYPE_BEGIN_HIGH_LEVEL_TYPES,
	STRUCT_TYPE_TABLE,
	STRUCT_TYPE_FIGURE,
	STRUCT_TYPE_END_HIGH_LEVEL_TYPES,
	STRUCT_TYPE_NB_TYPES
} StructType;

typedef enum  {
	STRUCT_ACTION_CUT,
	STRUCT_ACTION_COPY,
	STRUCT_ACTION_DELETE,
	STRUCT_ACTION_SELECT,
	STRUCT_ACTION_COMMENT,
	STRUCT_ACTION_SHIFT_LEFT,
	STRUCT_ACTION_SHIFT_RIGHT,
	STRUCT_ACTION_OPEN_FILE,
	STRUCT_ACTION_NB_ACTIONS
} StructAction;

struct _ParamSpecMainWindowStructure {
	GParamSpec parent_instance;
};


static gpointer main_window_structure_parent_class = NULL;

gpointer main_window_structure_ref (gpointer instance);
void main_window_structure_unref (gpointer instance);
GParamSpec* param_spec_main_window_structure (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_main_window_structure (GValue* value, gpointer v_object);
void value_take_main_window_structure (GValue* value, gpointer v_object);
gpointer value_get_main_window_structure (const GValue* value);
GType main_window_structure_get_type (void) G_GNUC_CONST;
GType structure_get_type (void) G_GNUC_CONST;
#define MAIN_WINDOW_STRUCTURE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MAIN_WINDOW_STRUCTURE, MainWindowStructurePrivate))
enum  {
	MAIN_WINDOW_STRUCTURE_DUMMY_PROPERTY
};
void main_window_structure_on_cut (MainWindowStructure* self);
static void _main_window_structure_on_cut_gtk_action_callback (GtkAction* action, gpointer self);
void main_window_structure_on_copy (MainWindowStructure* self);
static void _main_window_structure_on_copy_gtk_action_callback (GtkAction* action, gpointer self);
void main_window_structure_on_delete (MainWindowStructure* self);
static void _main_window_structure_on_delete_gtk_action_callback (GtkAction* action, gpointer self);
void main_window_structure_on_select (MainWindowStructure* self);
static void _main_window_structure_on_select_gtk_action_callback (GtkAction* action, gpointer self);
void main_window_structure_on_comment (MainWindowStructure* self);
static void _main_window_structure_on_comment_gtk_action_callback (GtkAction* action, gpointer self);
void main_window_structure_on_shift_left (MainWindowStructure* self);
static void _main_window_structure_on_shift_left_gtk_action_callback (GtkAction* action, gpointer self);
void main_window_structure_on_shift_right (MainWindowStructure* self);
static void _main_window_structure_on_shift_right_gtk_action_callback (GtkAction* action, gpointer self);
void main_window_structure_on_open_file (MainWindowStructure* self);
static void _main_window_structure_on_open_file_gtk_action_callback (GtkAction* action, gpointer self);
MainWindowStructure* main_window_structure_new (GtkUIManager* ui_manager);
MainWindowStructure* main_window_structure_construct (GType object_type, GtkUIManager* ui_manager);
void main_window_structure_set_structure (MainWindowStructure* self, Structure* structure);
static void main_window_structure_show_popup_menu (MainWindowStructure* self, GdkEventButton* event);
static void _main_window_structure_show_popup_menu_structure_show_popup_menu (Structure* _sender, GdkEventButton* event, gpointer self);
static void main_window_structure_set_menu_insensitive (MainWindowStructure* self);
static void _main_window_structure_set_menu_insensitive_gtk_widget_hide (GtkWidget* _sender, gpointer self);
static void _main_window_structure_set_menu_insensitive_structure_no_items_selected (Structure* _sender, gpointer self);
GType struct_type_get_type (void) G_GNUC_CONST;
static void main_window_structure_set_actions_sensitivity (MainWindowStructure* self, StructType type);
static void _main_window_structure_set_actions_sensitivity_structure_item_selected (Structure* _sender, StructType type, gpointer self);
void main_window_structure_save_state (MainWindowStructure* self);
void structure_save_state (Structure* self);
void main_window_structure_refresh (MainWindowStructure* self);
void structure_refresh (Structure* self);
GType struct_action_get_type (void) G_GNUC_CONST;
void structure_do_action (Structure* self, StructAction action_type);
static void main_window_structure_finalize (MainWindowStructure* obj);

static const GtkActionEntry MAIN_WINDOW_STRUCTURE__action_entries[9] = {{"Structure", NULL, "S_tructure"}, {"StructureCut", "edit-cut", "Cu_t", "", "Cut the selected structure item", (GCallback) _main_window_structure_on_cut_gtk_action_callback}, {"StructureCopy", "edit-copy", "_Copy", "", "Copy the selected structure item", (GCallback) _main_window_structure_on_copy_gtk_action_callback}, {"StructureDelete", "edit-delete", "_Delete", "", "Delete the selected structure item", (GCallback) _main_window_structure_on_delete_gtk_action_callback}, {"StructureSelect", "edit-select-all", "_Select", "", "Select the contents of the selected structure item", (GCallback) _main_window_structure_on_select_gtk_action_callback}, {"StructureComment", NULL, "_Comment", NULL, "Comment the selected structure item", (GCallback) _main_window_structure_on_comment_gtk_action_callback}, {"StructureShiftLeft", "go-previous", "Shift _Left", "", "Shift the selected structure item to the left (e.g. section → chapter)", (GCallback) _main_window_structure_on_shift_left_gtk_action_callback}, {"StructureShiftRight", "go-next", "Shift _Right", "", "Shift the selected structure item to the right (e.g. chapter → section" \
")", (GCallback) _main_window_structure_on_shift_right_gtk_action_callback}, {"StructureOpenFile", "document-open", "_Open File", "", "Open the file referenced by the selected structure item", (GCallback) _main_window_structure_on_open_file_gtk_action_callback}};

static void _main_window_structure_on_cut_gtk_action_callback (GtkAction* action, gpointer self) {
	main_window_structure_on_cut ((MainWindowStructure*) self);
}


static void _main_window_structure_on_copy_gtk_action_callback (GtkAction* action, gpointer self) {
	main_window_structure_on_copy ((MainWindowStructure*) self);
}


static void _main_window_structure_on_delete_gtk_action_callback (GtkAction* action, gpointer self) {
	main_window_structure_on_delete ((MainWindowStructure*) self);
}


static void _main_window_structure_on_select_gtk_action_callback (GtkAction* action, gpointer self) {
	main_window_structure_on_select ((MainWindowStructure*) self);
}


static void _main_window_structure_on_comment_gtk_action_callback (GtkAction* action, gpointer self) {
	main_window_structure_on_comment ((MainWindowStructure*) self);
}


static void _main_window_structure_on_shift_left_gtk_action_callback (GtkAction* action, gpointer self) {
	main_window_structure_on_shift_left ((MainWindowStructure*) self);
}


static void _main_window_structure_on_shift_right_gtk_action_callback (GtkAction* action, gpointer self) {
	main_window_structure_on_shift_right ((MainWindowStructure*) self);
}


static void _main_window_structure_on_open_file_gtk_action_callback (GtkAction* action, gpointer self) {
	main_window_structure_on_open_file ((MainWindowStructure*) self);
}


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


MainWindowStructure* main_window_structure_construct (GType object_type, GtkUIManager* ui_manager) {
	MainWindowStructure* self = NULL;
	GtkUIManager* _tmp0_ = NULL;
	GtkUIManager* _tmp1_ = NULL;
	GtkActionGroup* action_group = NULL;
	GtkActionGroup* _tmp2_ = NULL;
	GtkUIManager* _tmp3_ = NULL;
	g_return_val_if_fail (ui_manager != NULL, NULL);
	self = (MainWindowStructure*) g_type_create_instance (object_type);
	_tmp0_ = ui_manager;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_ui_manager);
	self->priv->_ui_manager = _tmp1_;
	_tmp2_ = gtk_action_group_new ("StructureActionGroup");
	action_group = _tmp2_;
	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
	gtk_action_group_add_actions (action_group, MAIN_WINDOW_STRUCTURE__action_entries, G_N_ELEMENTS (MAIN_WINDOW_STRUCTURE__action_entries), self);
	_tmp3_ = ui_manager;
	gtk_ui_manager_insert_action_group (_tmp3_, action_group, 0);
	_g_object_unref0 (action_group);
	return self;
}


MainWindowStructure* main_window_structure_new (GtkUIManager* ui_manager) {
	return main_window_structure_construct (TYPE_MAIN_WINDOW_STRUCTURE, ui_manager);
}


static void _main_window_structure_show_popup_menu_structure_show_popup_menu (Structure* _sender, GdkEventButton* event, gpointer self) {
	main_window_structure_show_popup_menu ((MainWindowStructure*) self, event);
}


static void _main_window_structure_set_menu_insensitive_gtk_widget_hide (GtkWidget* _sender, gpointer self) {
	main_window_structure_set_menu_insensitive ((MainWindowStructure*) self);
}


static void _main_window_structure_set_menu_insensitive_structure_no_items_selected (Structure* _sender, gpointer self) {
	main_window_structure_set_menu_insensitive ((MainWindowStructure*) self);
}


static void _main_window_structure_set_actions_sensitivity_structure_item_selected (Structure* _sender, StructType type, gpointer self) {
	main_window_structure_set_actions_sensitivity ((MainWindowStructure*) self, type);
}


void main_window_structure_set_structure (MainWindowStructure* self, Structure* structure) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	Structure* _tmp2_ = NULL;
	Structure* _tmp3_ = NULL;
	Structure* _tmp4_ = NULL;
	Structure* _tmp5_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (structure != NULL);
	_tmp0_ = structure;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_structure);
	self->priv->_structure = _tmp1_;
	_tmp2_ = structure;
	g_signal_connect (_tmp2_, "show-popup-menu", (GCallback) _main_window_structure_show_popup_menu_structure_show_popup_menu, self);
	_tmp3_ = structure;
	g_signal_connect ((GtkWidget*) _tmp3_, "hide", (GCallback) _main_window_structure_set_menu_insensitive_gtk_widget_hide, self);
	_tmp4_ = structure;
	g_signal_connect (_tmp4_, "no-items-selected", (GCallback) _main_window_structure_set_menu_insensitive_structure_no_items_selected, self);
	_tmp5_ = structure;
	g_signal_connect (_tmp5_, "item-selected", (GCallback) _main_window_structure_set_actions_sensitivity_structure_item_selected, self);
}


void main_window_structure_save_state (MainWindowStructure* self) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_structure;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_structure;
	structure_save_state (_tmp1_);
}


void main_window_structure_refresh (MainWindowStructure* self) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_structure;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_structure;
	structure_refresh (_tmp1_);
}


static void main_window_structure_show_popup_menu (MainWindowStructure* self, GdkEventButton* event) {
	GtkMenu* popup_menu = NULL;
	GtkUIManager* _tmp0_ = NULL;
	GtkWidget* _tmp1_ = NULL;
	GtkMenu* _tmp2_ = NULL;
	GdkEventButton* _tmp3_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_ui_manager;
	_tmp1_ = gtk_ui_manager_get_widget (_tmp0_, "/StructurePopup");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, gtk_menu_get_type ()) ? ((GtkMenu*) _tmp1_) : NULL);
	popup_menu = _tmp2_;
	_tmp3_ = event;
	if (_tmp3_ != NULL) {
		GtkMenu* _tmp4_ = NULL;
		GdkEventButton* _tmp5_ = NULL;
		guint _tmp6_ = 0U;
		GdkEventButton* _tmp7_ = NULL;
		guint32 _tmp8_ = 0U;
		_tmp4_ = popup_menu;
		_tmp5_ = event;
		_tmp6_ = _tmp5_->button;
		_tmp7_ = event;
		_tmp8_ = _tmp7_->time;
		gtk_menu_popup (_tmp4_, NULL, NULL, NULL, NULL, _tmp6_, _tmp8_);
	} else {
		GtkMenu* _tmp9_ = NULL;
		guint32 _tmp10_ = 0U;
		_tmp9_ = popup_menu;
		_tmp10_ = gtk_get_current_event_time ();
		gtk_menu_popup (_tmp9_, NULL, NULL, NULL, NULL, (guint) 0, _tmp10_);
	}
	_g_object_unref0 (popup_menu);
}


static void main_window_structure_set_menu_insensitive (MainWindowStructure* self) {
	GtkUIManager* _tmp0_ = NULL;
	GtkAction* menu = NULL;
	GtkUIManager* _tmp1_ = NULL;
	GtkAction* _tmp2_ = NULL;
	GtkAction* _tmp3_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_ui_manager;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_ui_manager;
	_tmp2_ = gtk_ui_manager_get_action (_tmp1_, "/MainMenu/Structure");
	_tmp3_ = _g_object_ref0 (_tmp2_);
	menu = _tmp3_;
	gtk_action_set_sensitive (menu, FALSE);
	_g_object_unref0 (menu);
}


static void main_window_structure_set_actions_sensitivity (MainWindowStructure* self, StructType type) {
	GtkAction* menu = NULL;
	GtkUIManager* _tmp0_ = NULL;
	GtkAction* _tmp1_ = NULL;
	GtkAction* _tmp2_ = NULL;
	GtkAction* _tmp3_ = NULL;
	GtkAction* shift_left = NULL;
	GtkUIManager* _tmp4_ = NULL;
	GtkAction* _tmp5_ = NULL;
	GtkAction* _tmp6_ = NULL;
	gboolean _tmp7_ = FALSE;
	StructType _tmp8_ = 0;
	GtkAction* _tmp10_ = NULL;
	GtkAction* shift_right = NULL;
	GtkUIManager* _tmp11_ = NULL;
	GtkAction* _tmp12_ = NULL;
	GtkAction* _tmp13_ = NULL;
	gboolean _tmp14_ = FALSE;
	StructType _tmp15_ = 0;
	GtkAction* _tmp17_ = NULL;
	GtkAction* open_file = NULL;
	GtkUIManager* _tmp18_ = NULL;
	GtkAction* _tmp19_ = NULL;
	GtkAction* _tmp20_ = NULL;
	gboolean _tmp21_ = FALSE;
	StructType _tmp22_ = 0;
	GtkAction* _tmp24_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_ui_manager;
	_tmp1_ = gtk_ui_manager_get_action (_tmp0_, "/MainMenu/Structure");
	_tmp2_ = _g_object_ref0 (_tmp1_);
	menu = _tmp2_;
	_tmp3_ = menu;
	gtk_action_set_sensitive (_tmp3_, TRUE);
	_tmp4_ = self->priv->_ui_manager;
	_tmp5_ = gtk_ui_manager_get_action (_tmp4_, "/StructurePopup/StructureShiftLeft");
	_tmp6_ = _g_object_ref0 (_tmp5_);
	shift_left = _tmp6_;
	_tmp8_ = type;
	if (STRUCT_TYPE_PART < _tmp8_) {
		StructType _tmp9_ = 0;
		_tmp9_ = type;
		_tmp7_ = _tmp9_ <= STRUCT_TYPE_SUBPARAGRAPH;
	} else {
		_tmp7_ = FALSE;
	}
	_tmp10_ = shift_left;
	gtk_action_set_sensitive (_tmp10_, _tmp7_);
	_tmp11_ = self->priv->_ui_manager;
	_tmp12_ = gtk_ui_manager_get_action (_tmp11_, "/StructurePopup/StructureShiftRight");
	_tmp13_ = _g_object_ref0 (_tmp12_);
	shift_right = _tmp13_;
	_tmp15_ = type;
	if (STRUCT_TYPE_PART <= _tmp15_) {
		StructType _tmp16_ = 0;
		_tmp16_ = type;
		_tmp14_ = _tmp16_ < STRUCT_TYPE_SUBPARAGRAPH;
	} else {
		_tmp14_ = FALSE;
	}
	_tmp17_ = shift_right;
	gtk_action_set_sensitive (_tmp17_, _tmp14_);
	_tmp18_ = self->priv->_ui_manager;
	_tmp19_ = gtk_ui_manager_get_action (_tmp18_, "/StructurePopup/StructureOpenFile");
	_tmp20_ = _g_object_ref0 (_tmp19_);
	open_file = _tmp20_;
	_tmp22_ = type;
	if (_tmp22_ == STRUCT_TYPE_INCLUDE) {
		_tmp21_ = TRUE;
	} else {
		StructType _tmp23_ = 0;
		_tmp23_ = type;
		_tmp21_ = _tmp23_ == STRUCT_TYPE_IMAGE;
	}
	_tmp24_ = open_file;
	gtk_action_set_sensitive (_tmp24_, _tmp21_);
	_g_object_unref0 (open_file);
	_g_object_unref0 (shift_right);
	_g_object_unref0 (shift_left);
	_g_object_unref0 (menu);
}


void main_window_structure_on_cut (MainWindowStructure* self) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_structure;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_structure;
	structure_do_action (_tmp1_, STRUCT_ACTION_CUT);
}


void main_window_structure_on_copy (MainWindowStructure* self) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_structure;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_structure;
	structure_do_action (_tmp1_, STRUCT_ACTION_COPY);
}


void main_window_structure_on_delete (MainWindowStructure* self) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_structure;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_structure;
	structure_do_action (_tmp1_, STRUCT_ACTION_DELETE);
}


void main_window_structure_on_select (MainWindowStructure* self) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_structure;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_structure;
	structure_do_action (_tmp1_, STRUCT_ACTION_SELECT);
}


void main_window_structure_on_comment (MainWindowStructure* self) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_structure;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_structure;
	structure_do_action (_tmp1_, STRUCT_ACTION_COMMENT);
}


void main_window_structure_on_shift_left (MainWindowStructure* self) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_structure;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_structure;
	structure_do_action (_tmp1_, STRUCT_ACTION_SHIFT_LEFT);
}


void main_window_structure_on_shift_right (MainWindowStructure* self) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_structure;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_structure;
	structure_do_action (_tmp1_, STRUCT_ACTION_SHIFT_RIGHT);
}


void main_window_structure_on_open_file (MainWindowStructure* self) {
	Structure* _tmp0_ = NULL;
	Structure* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_structure;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_structure;
	structure_do_action (_tmp1_, STRUCT_ACTION_OPEN_FILE);
}


static void value_main_window_structure_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void value_main_window_structure_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		main_window_structure_unref (value->data[0].v_pointer);
	}
}


static void value_main_window_structure_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = main_window_structure_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer value_main_window_structure_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* value_main_window_structure_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		MainWindowStructure* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = main_window_structure_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* value_main_window_structure_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	MainWindowStructure** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = main_window_structure_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* param_spec_main_window_structure (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecMainWindowStructure* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAIN_WINDOW_STRUCTURE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer value_get_main_window_structure (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_STRUCTURE), NULL);
	return value->data[0].v_pointer;
}


void value_set_main_window_structure (GValue* value, gpointer v_object) {
	MainWindowStructure* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_STRUCTURE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN_WINDOW_STRUCTURE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		main_window_structure_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		main_window_structure_unref (old);
	}
}


void value_take_main_window_structure (GValue* value, gpointer v_object) {
	MainWindowStructure* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_STRUCTURE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN_WINDOW_STRUCTURE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		main_window_structure_unref (old);
	}
}


static void main_window_structure_class_init (MainWindowStructureClass * klass) {
	main_window_structure_parent_class = g_type_class_peek_parent (klass);
	((MainWindowStructureClass *) klass)->finalize = main_window_structure_finalize;
	g_type_class_add_private (klass, sizeof (MainWindowStructurePrivate));
}


static void main_window_structure_instance_init (MainWindowStructure * self) {
	self->priv = MAIN_WINDOW_STRUCTURE_GET_PRIVATE (self);
	self->ref_count = 1;
}


static void main_window_structure_finalize (MainWindowStructure* obj) {
	MainWindowStructure * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW_STRUCTURE, MainWindowStructure);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->_ui_manager);
	_g_object_unref0 (self->priv->_structure);
}


GType main_window_structure_get_type (void) {
	static volatile gsize main_window_structure_type_id__volatile = 0;
	if (g_once_init_enter (&main_window_structure_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_main_window_structure_init, value_main_window_structure_free_value, value_main_window_structure_copy_value, value_main_window_structure_peek_pointer, "p", value_main_window_structure_collect_value, "p", value_main_window_structure_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (MainWindowStructureClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_window_structure_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MainWindowStructure), 0, (GInstanceInitFunc) main_window_structure_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType main_window_structure_type_id;
		main_window_structure_type_id = g_type_register_fundamental (g_type_fundamental_next (), "MainWindowStructure", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&main_window_structure_type_id__volatile, main_window_structure_type_id);
	}
	return main_window_structure_type_id__volatile;
}


gpointer main_window_structure_ref (gpointer instance) {
	MainWindowStructure* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void main_window_structure_unref (gpointer instance) {
	MainWindowStructure* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		MAIN_WINDOW_STRUCTURE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



