/* main_window_structure.c generated by valac 0.40.0.227-717ea, the Vala compiler
 * generated from main_window_structure.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 <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.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 gint MainWindowStructure_private_offset;
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;
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, N_ ("S_tructure")}, {"StructureCut", "edit-cut", N_ ("Cu_t"), "", N_ ("Cut the selected structure item"), (GCallback) _main_window_structure_on_cut_gtk_action_callback}, {"StructureCopy", "edit-copy", N_ ("_Copy"), "", N_ ("Copy the selected structure item"), (GCallback) _main_window_structure_on_copy_gtk_action_callback}, {"StructureDelete", "edit-delete", N_ ("_Delete"), "", N_ ("Delete the selected structure item"), (GCallback) _main_window_structure_on_delete_gtk_action_callback}, {"StructureSelect", "edit-select-all", N_ ("_Select"), "", N_ ("Select the contents of the selected structure item"), (GCallback) _main_window_structure_on_select_gtk_action_callback}, {"StructureComment", NULL, N_ ("_Comment"), NULL, N_ ("Comment the selected structure item"), (GCallback) _main_window_structure_on_comment_gtk_action_callback}, {"StructureShiftLeft", "go-previous", N_ ("Shift _Left"), "", N_ ("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", N_ ("Shift _Right"), "", N_ ("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", N_ ("_Open File"), "", N_ ("Open the file referenced by the selected structure item"), (GCallback) _main_window_structure_on_open_file_gtk_action_callback}};

static inline gpointer
main_window_structure_get_instance_private (MainWindowStructure* self)
{
	return G_STRUCT_MEMBER_P (self, MainWindowStructure_private_offset);
}


static void
_main_window_structure_on_cut_gtk_action_callback (GtkAction* action,
                                                   gpointer self)
{
#line 28 "main_window_structure.vala"
	main_window_structure_on_cut ((MainWindowStructure*) self);
#line 214 "main_window_structure.c"
}


static void
_main_window_structure_on_copy_gtk_action_callback (GtkAction* action,
                                                    gpointer self)
{
#line 28 "main_window_structure.vala"
	main_window_structure_on_copy ((MainWindowStructure*) self);
#line 224 "main_window_structure.c"
}


static void
_main_window_structure_on_delete_gtk_action_callback (GtkAction* action,
                                                      gpointer self)
{
#line 28 "main_window_structure.vala"
	main_window_structure_on_delete ((MainWindowStructure*) self);
#line 234 "main_window_structure.c"
}


static void
_main_window_structure_on_select_gtk_action_callback (GtkAction* action,
                                                      gpointer self)
{
#line 28 "main_window_structure.vala"
	main_window_structure_on_select ((MainWindowStructure*) self);
#line 244 "main_window_structure.c"
}


static void
_main_window_structure_on_comment_gtk_action_callback (GtkAction* action,
                                                       gpointer self)
{
#line 28 "main_window_structure.vala"
	main_window_structure_on_comment ((MainWindowStructure*) self);
#line 254 "main_window_structure.c"
}


static void
_main_window_structure_on_shift_left_gtk_action_callback (GtkAction* action,
                                                          gpointer self)
{
#line 28 "main_window_structure.vala"
	main_window_structure_on_shift_left ((MainWindowStructure*) self);
#line 264 "main_window_structure.c"
}


static void
_main_window_structure_on_shift_right_gtk_action_callback (GtkAction* action,
                                                           gpointer self)
{
#line 28 "main_window_structure.vala"
	main_window_structure_on_shift_right ((MainWindowStructure*) self);
#line 274 "main_window_structure.c"
}


static void
_main_window_structure_on_open_file_gtk_action_callback (GtkAction* action,
                                                         gpointer self)
{
#line 28 "main_window_structure.vala"
	main_window_structure_on_open_file ((MainWindowStructure*) self);
#line 284 "main_window_structure.c"
}


static gpointer
_g_object_ref0 (gpointer self)
{
#line 65 "main_window_structure.vala"
	return self ? g_object_ref (self) : NULL;
#line 293 "main_window_structure.c"
}


MainWindowStructure*
main_window_structure_construct (GType object_type,
                                 GtkUIManager* ui_manager)
{
	MainWindowStructure* self = NULL;
	GtkUIManager* _tmp0_;
	GtkActionGroup* action_group = NULL;
	GtkActionGroup* _tmp1_;
#line 63 "main_window_structure.vala"
	g_return_val_if_fail (ui_manager != NULL, NULL);
#line 63 "main_window_structure.vala"
	self = (MainWindowStructure*) g_type_create_instance (object_type);
#line 65 "main_window_structure.vala"
	_tmp0_ = _g_object_ref0 (ui_manager);
#line 65 "main_window_structure.vala"
	_g_object_unref0 (self->priv->_ui_manager);
#line 65 "main_window_structure.vala"
	self->priv->_ui_manager = _tmp0_;
#line 67 "main_window_structure.vala"
	_tmp1_ = gtk_action_group_new ("StructureActionGroup");
#line 67 "main_window_structure.vala"
	action_group = _tmp1_;
#line 68 "main_window_structure.vala"
	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
#line 69 "main_window_structure.vala"
	gtk_action_group_add_actions (action_group, MAIN_WINDOW_STRUCTURE__action_entries, (guint) G_N_ELEMENTS (MAIN_WINDOW_STRUCTURE__action_entries), self);
#line 71 "main_window_structure.vala"
	gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
#line 63 "main_window_structure.vala"
	_g_object_unref0 (action_group);
#line 63 "main_window_structure.vala"
	return self;
#line 329 "main_window_structure.c"
}


MainWindowStructure*
main_window_structure_new (GtkUIManager* ui_manager)
{
#line 63 "main_window_structure.vala"
	return main_window_structure_construct (TYPE_MAIN_WINDOW_STRUCTURE, ui_manager);
#line 338 "main_window_structure.c"
}


static void
_main_window_structure_show_popup_menu_structure_show_popup_menu (Structure* _sender,
                                                                  GdkEventButton* event,
                                                                  gpointer self)
{
#line 78 "main_window_structure.vala"
	main_window_structure_show_popup_menu ((MainWindowStructure*) self, event);
#line 349 "main_window_structure.c"
}


static void
_main_window_structure_set_menu_insensitive_gtk_widget_hide (GtkWidget* _sender,
                                                             gpointer self)
{
#line 79 "main_window_structure.vala"
	main_window_structure_set_menu_insensitive ((MainWindowStructure*) self);
#line 359 "main_window_structure.c"
}


static void
_main_window_structure_set_menu_insensitive_structure_no_items_selected (Structure* _sender,
                                                                         gpointer self)
{
#line 80 "main_window_structure.vala"
	main_window_structure_set_menu_insensitive ((MainWindowStructure*) self);
#line 369 "main_window_structure.c"
}


static void
_main_window_structure_set_actions_sensitivity_structure_item_selected (Structure* _sender,
                                                                        StructType type,
                                                                        gpointer self)
{
#line 81 "main_window_structure.vala"
	main_window_structure_set_actions_sensitivity ((MainWindowStructure*) self, type);
#line 380 "main_window_structure.c"
}


void
main_window_structure_set_structure (MainWindowStructure* self,
                                     Structure* structure)
{
	Structure* _tmp0_;
#line 74 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 74 "main_window_structure.vala"
	g_return_if_fail (structure != NULL);
#line 76 "main_window_structure.vala"
	_tmp0_ = _g_object_ref0 (structure);
#line 76 "main_window_structure.vala"
	_g_object_unref0 (self->priv->_structure);
#line 76 "main_window_structure.vala"
	self->priv->_structure = _tmp0_;
#line 78 "main_window_structure.vala"
	g_signal_connect (structure, "show-popup-menu", (GCallback) _main_window_structure_show_popup_menu_structure_show_popup_menu, self);
#line 79 "main_window_structure.vala"
	g_signal_connect ((GtkWidget*) structure, "hide", (GCallback) _main_window_structure_set_menu_insensitive_gtk_widget_hide, self);
#line 80 "main_window_structure.vala"
	g_signal_connect (structure, "no-items-selected", (GCallback) _main_window_structure_set_menu_insensitive_structure_no_items_selected, self);
#line 81 "main_window_structure.vala"
	g_signal_connect (structure, "item-selected", (GCallback) _main_window_structure_set_actions_sensitivity_structure_item_selected, self);
#line 407 "main_window_structure.c"
}


void
main_window_structure_save_state (MainWindowStructure* self)
{
	Structure* _tmp0_;
	Structure* _tmp1_;
#line 84 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 86 "main_window_structure.vala"
	_tmp0_ = self->priv->_structure;
#line 86 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 87 "main_window_structure.vala"
	_tmp1_ = self->priv->_structure;
#line 87 "main_window_structure.vala"
	structure_save_state (_tmp1_);
#line 426 "main_window_structure.c"
}


void
main_window_structure_refresh (MainWindowStructure* self)
{
	Structure* _tmp0_;
	Structure* _tmp1_;
#line 90 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 92 "main_window_structure.vala"
	_tmp0_ = self->priv->_structure;
#line 92 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 93 "main_window_structure.vala"
	_tmp1_ = self->priv->_structure;
#line 93 "main_window_structure.vala"
	structure_refresh (_tmp1_);
#line 445 "main_window_structure.c"
}


static void
main_window_structure_show_popup_menu (MainWindowStructure* self,
                                       GdkEventButton* event)
{
	GtkMenu* popup_menu = NULL;
	GtkUIManager* _tmp0_;
	GtkWidget* _tmp1_;
	GtkMenu* _tmp2_;
#line 96 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 98 "main_window_structure.vala"
	_tmp0_ = self->priv->_ui_manager;
#line 98 "main_window_structure.vala"
	_tmp1_ = gtk_ui_manager_get_widget (_tmp0_, "/StructurePopup");
#line 98 "main_window_structure.vala"
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, gtk_menu_get_type ()) ? ((GtkMenu*) _tmp1_) : NULL);
#line 98 "main_window_structure.vala"
	popup_menu = _tmp2_;
#line 99 "main_window_structure.vala"
	gtk_menu_popup_at_pointer (popup_menu, (GdkEvent*) event);
#line 96 "main_window_structure.vala"
	_g_object_unref0 (popup_menu);
#line 471 "main_window_structure.c"
}


static void
main_window_structure_set_menu_insensitive (MainWindowStructure* self)
{
	GtkUIManager* _tmp0_;
	GtkAction* menu = NULL;
	GtkUIManager* _tmp1_;
	GtkAction* _tmp2_;
	GtkAction* _tmp3_;
#line 102 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 104 "main_window_structure.vala"
	_tmp0_ = self->priv->_ui_manager;
#line 104 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 106 "main_window_structure.vala"
	_tmp1_ = self->priv->_ui_manager;
#line 106 "main_window_structure.vala"
	_tmp2_ = gtk_ui_manager_get_action (_tmp1_, "/MainMenu/Structure");
#line 106 "main_window_structure.vala"
	_tmp3_ = _g_object_ref0 (_tmp2_);
#line 106 "main_window_structure.vala"
	menu = _tmp3_;
#line 107 "main_window_structure.vala"
	gtk_action_set_sensitive (menu, FALSE);
#line 102 "main_window_structure.vala"
	_g_object_unref0 (menu);
#line 501 "main_window_structure.c"
}


static void
main_window_structure_set_actions_sensitivity (MainWindowStructure* self,
                                               StructType type)
{
	GtkAction* menu = NULL;
	GtkUIManager* _tmp0_;
	GtkAction* _tmp1_;
	GtkAction* _tmp2_;
	GtkAction* _tmp3_;
	GtkAction* shift_left = NULL;
	GtkUIManager* _tmp4_;
	GtkAction* _tmp5_;
	GtkAction* _tmp6_;
	gboolean _tmp7_ = FALSE;
	GtkAction* _tmp8_;
	GtkAction* shift_right = NULL;
	GtkUIManager* _tmp9_;
	GtkAction* _tmp10_;
	GtkAction* _tmp11_;
	gboolean _tmp12_ = FALSE;
	GtkAction* _tmp13_;
	GtkAction* open_file = NULL;
	GtkUIManager* _tmp14_;
	GtkAction* _tmp15_;
	GtkAction* _tmp16_;
	gboolean _tmp17_ = FALSE;
	GtkAction* _tmp18_;
#line 110 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 112 "main_window_structure.vala"
	_tmp0_ = self->priv->_ui_manager;
#line 112 "main_window_structure.vala"
	_tmp1_ = gtk_ui_manager_get_action (_tmp0_, "/MainMenu/Structure");
#line 112 "main_window_structure.vala"
	_tmp2_ = _g_object_ref0 (_tmp1_);
#line 112 "main_window_structure.vala"
	menu = _tmp2_;
#line 113 "main_window_structure.vala"
	_tmp3_ = menu;
#line 113 "main_window_structure.vala"
	gtk_action_set_sensitive (_tmp3_, TRUE);
#line 115 "main_window_structure.vala"
	_tmp4_ = self->priv->_ui_manager;
#line 115 "main_window_structure.vala"
	_tmp5_ = gtk_ui_manager_get_action (_tmp4_, "/StructurePopup/StructureShiftLeft");
#line 115 "main_window_structure.vala"
	_tmp6_ = _g_object_ref0 (_tmp5_);
#line 115 "main_window_structure.vala"
	shift_left = _tmp6_;
#line 118 "main_window_structure.vala"
	if (STRUCT_TYPE_PART < type) {
#line 118 "main_window_structure.vala"
		_tmp7_ = type <= STRUCT_TYPE_SUBPARAGRAPH;
#line 558 "main_window_structure.c"
	} else {
#line 118 "main_window_structure.vala"
		_tmp7_ = FALSE;
#line 562 "main_window_structure.c"
	}
#line 118 "main_window_structure.vala"
	_tmp8_ = shift_left;
#line 118 "main_window_structure.vala"
	gtk_action_set_sensitive (_tmp8_, _tmp7_);
#line 120 "main_window_structure.vala"
	_tmp9_ = self->priv->_ui_manager;
#line 120 "main_window_structure.vala"
	_tmp10_ = gtk_ui_manager_get_action (_tmp9_, "/StructurePopup/StructureShiftRight");
#line 120 "main_window_structure.vala"
	_tmp11_ = _g_object_ref0 (_tmp10_);
#line 120 "main_window_structure.vala"
	shift_right = _tmp11_;
#line 123 "main_window_structure.vala"
	if (STRUCT_TYPE_PART <= type) {
#line 123 "main_window_structure.vala"
		_tmp12_ = type < STRUCT_TYPE_SUBPARAGRAPH;
#line 580 "main_window_structure.c"
	} else {
#line 123 "main_window_structure.vala"
		_tmp12_ = FALSE;
#line 584 "main_window_structure.c"
	}
#line 123 "main_window_structure.vala"
	_tmp13_ = shift_right;
#line 123 "main_window_structure.vala"
	gtk_action_set_sensitive (_tmp13_, _tmp12_);
#line 125 "main_window_structure.vala"
	_tmp14_ = self->priv->_ui_manager;
#line 125 "main_window_structure.vala"
	_tmp15_ = gtk_ui_manager_get_action (_tmp14_, "/StructurePopup/StructureOpenFile");
#line 125 "main_window_structure.vala"
	_tmp16_ = _g_object_ref0 (_tmp15_);
#line 125 "main_window_structure.vala"
	open_file = _tmp16_;
#line 128 "main_window_structure.vala"
	if (type == STRUCT_TYPE_INCLUDE) {
#line 128 "main_window_structure.vala"
		_tmp17_ = TRUE;
#line 602 "main_window_structure.c"
	} else {
#line 128 "main_window_structure.vala"
		_tmp17_ = type == STRUCT_TYPE_IMAGE;
#line 606 "main_window_structure.c"
	}
#line 128 "main_window_structure.vala"
	_tmp18_ = open_file;
#line 128 "main_window_structure.vala"
	gtk_action_set_sensitive (_tmp18_, _tmp17_);
#line 110 "main_window_structure.vala"
	_g_object_unref0 (open_file);
#line 110 "main_window_structure.vala"
	_g_object_unref0 (shift_right);
#line 110 "main_window_structure.vala"
	_g_object_unref0 (shift_left);
#line 110 "main_window_structure.vala"
	_g_object_unref0 (menu);
#line 620 "main_window_structure.c"
}


void
main_window_structure_on_cut (MainWindowStructure* self)
{
	Structure* _tmp0_;
	Structure* _tmp1_;
#line 133 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 135 "main_window_structure.vala"
	_tmp0_ = self->priv->_structure;
#line 135 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 136 "main_window_structure.vala"
	_tmp1_ = self->priv->_structure;
#line 136 "main_window_structure.vala"
	structure_do_action (_tmp1_, STRUCT_ACTION_CUT);
#line 639 "main_window_structure.c"
}


void
main_window_structure_on_copy (MainWindowStructure* self)
{
	Structure* _tmp0_;
	Structure* _tmp1_;
#line 139 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 141 "main_window_structure.vala"
	_tmp0_ = self->priv->_structure;
#line 141 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 142 "main_window_structure.vala"
	_tmp1_ = self->priv->_structure;
#line 142 "main_window_structure.vala"
	structure_do_action (_tmp1_, STRUCT_ACTION_COPY);
#line 658 "main_window_structure.c"
}


void
main_window_structure_on_delete (MainWindowStructure* self)
{
	Structure* _tmp0_;
	Structure* _tmp1_;
#line 145 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 147 "main_window_structure.vala"
	_tmp0_ = self->priv->_structure;
#line 147 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 148 "main_window_structure.vala"
	_tmp1_ = self->priv->_structure;
#line 148 "main_window_structure.vala"
	structure_do_action (_tmp1_, STRUCT_ACTION_DELETE);
#line 677 "main_window_structure.c"
}


void
main_window_structure_on_select (MainWindowStructure* self)
{
	Structure* _tmp0_;
	Structure* _tmp1_;
#line 151 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 153 "main_window_structure.vala"
	_tmp0_ = self->priv->_structure;
#line 153 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 154 "main_window_structure.vala"
	_tmp1_ = self->priv->_structure;
#line 154 "main_window_structure.vala"
	structure_do_action (_tmp1_, STRUCT_ACTION_SELECT);
#line 696 "main_window_structure.c"
}


void
main_window_structure_on_comment (MainWindowStructure* self)
{
	Structure* _tmp0_;
	Structure* _tmp1_;
#line 157 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 159 "main_window_structure.vala"
	_tmp0_ = self->priv->_structure;
#line 159 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 160 "main_window_structure.vala"
	_tmp1_ = self->priv->_structure;
#line 160 "main_window_structure.vala"
	structure_do_action (_tmp1_, STRUCT_ACTION_COMMENT);
#line 715 "main_window_structure.c"
}


void
main_window_structure_on_shift_left (MainWindowStructure* self)
{
	Structure* _tmp0_;
	Structure* _tmp1_;
#line 163 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 165 "main_window_structure.vala"
	_tmp0_ = self->priv->_structure;
#line 165 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 166 "main_window_structure.vala"
	_tmp1_ = self->priv->_structure;
#line 166 "main_window_structure.vala"
	structure_do_action (_tmp1_, STRUCT_ACTION_SHIFT_LEFT);
#line 734 "main_window_structure.c"
}


void
main_window_structure_on_shift_right (MainWindowStructure* self)
{
	Structure* _tmp0_;
	Structure* _tmp1_;
#line 169 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 171 "main_window_structure.vala"
	_tmp0_ = self->priv->_structure;
#line 171 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 172 "main_window_structure.vala"
	_tmp1_ = self->priv->_structure;
#line 172 "main_window_structure.vala"
	structure_do_action (_tmp1_, STRUCT_ACTION_SHIFT_RIGHT);
#line 753 "main_window_structure.c"
}


void
main_window_structure_on_open_file (MainWindowStructure* self)
{
	Structure* _tmp0_;
	Structure* _tmp1_;
#line 175 "main_window_structure.vala"
	g_return_if_fail (self != NULL);
#line 177 "main_window_structure.vala"
	_tmp0_ = self->priv->_structure;
#line 177 "main_window_structure.vala"
	g_return_if_fail (_tmp0_ != NULL);
#line 178 "main_window_structure.vala"
	_tmp1_ = self->priv->_structure;
#line 178 "main_window_structure.vala"
	structure_do_action (_tmp1_, STRUCT_ACTION_OPEN_FILE);
#line 772 "main_window_structure.c"
}


static void
value_main_window_structure_init (GValue* value)
{
#line 26 "main_window_structure.vala"
	value->data[0].v_pointer = NULL;
#line 781 "main_window_structure.c"
}


static void
value_main_window_structure_free_value (GValue* value)
{
#line 26 "main_window_structure.vala"
	if (value->data[0].v_pointer) {
#line 26 "main_window_structure.vala"
		main_window_structure_unref (value->data[0].v_pointer);
#line 792 "main_window_structure.c"
	}
}


static void
value_main_window_structure_copy_value (const GValue* src_value,
                                        GValue* dest_value)
{
#line 26 "main_window_structure.vala"
	if (src_value->data[0].v_pointer) {
#line 26 "main_window_structure.vala"
		dest_value->data[0].v_pointer = main_window_structure_ref (src_value->data[0].v_pointer);
#line 805 "main_window_structure.c"
	} else {
#line 26 "main_window_structure.vala"
		dest_value->data[0].v_pointer = NULL;
#line 809 "main_window_structure.c"
	}
}


static gpointer
value_main_window_structure_peek_pointer (const GValue* value)
{
#line 26 "main_window_structure.vala"
	return value->data[0].v_pointer;
#line 819 "main_window_structure.c"
}


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


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;
#line 26 "main_window_structure.vala"
	if (!object_p) {
#line 26 "main_window_structure.vala"
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 870 "main_window_structure.c"
	}
#line 26 "main_window_structure.vala"
	if (!value->data[0].v_pointer) {
#line 26 "main_window_structure.vala"
		*object_p = NULL;
#line 876 "main_window_structure.c"
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 26 "main_window_structure.vala"
		*object_p = value->data[0].v_pointer;
#line 880 "main_window_structure.c"
	} else {
#line 26 "main_window_structure.vala"
		*object_p = main_window_structure_ref (value->data[0].v_pointer);
#line 884 "main_window_structure.c"
	}
#line 26 "main_window_structure.vala"
	return NULL;
#line 888 "main_window_structure.c"
}


GParamSpec*
param_spec_main_window_structure (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags)
{
	ParamSpecMainWindowStructure* spec;
#line 26 "main_window_structure.vala"
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAIN_WINDOW_STRUCTURE), NULL);
#line 26 "main_window_structure.vala"
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
#line 26 "main_window_structure.vala"
	G_PARAM_SPEC (spec)->value_type = object_type;
#line 26 "main_window_structure.vala"
	return G_PARAM_SPEC (spec);
#line 908 "main_window_structure.c"
}


gpointer
value_get_main_window_structure (const GValue* value)
{
#line 26 "main_window_structure.vala"
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_STRUCTURE), NULL);
#line 26 "main_window_structure.vala"
	return value->data[0].v_pointer;
#line 919 "main_window_structure.c"
}


void
value_set_main_window_structure (GValue* value,
                                 gpointer v_object)
{
	MainWindowStructure * old;
#line 26 "main_window_structure.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_STRUCTURE));
#line 26 "main_window_structure.vala"
	old = value->data[0].v_pointer;
#line 26 "main_window_structure.vala"
	if (v_object) {
#line 26 "main_window_structure.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN_WINDOW_STRUCTURE));
#line 26 "main_window_structure.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 26 "main_window_structure.vala"
		value->data[0].v_pointer = v_object;
#line 26 "main_window_structure.vala"
		main_window_structure_ref (value->data[0].v_pointer);
#line 942 "main_window_structure.c"
	} else {
#line 26 "main_window_structure.vala"
		value->data[0].v_pointer = NULL;
#line 946 "main_window_structure.c"
	}
#line 26 "main_window_structure.vala"
	if (old) {
#line 26 "main_window_structure.vala"
		main_window_structure_unref (old);
#line 952 "main_window_structure.c"
	}
}


void
value_take_main_window_structure (GValue* value,
                                  gpointer v_object)
{
	MainWindowStructure * old;
#line 26 "main_window_structure.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_STRUCTURE));
#line 26 "main_window_structure.vala"
	old = value->data[0].v_pointer;
#line 26 "main_window_structure.vala"
	if (v_object) {
#line 26 "main_window_structure.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN_WINDOW_STRUCTURE));
#line 26 "main_window_structure.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 26 "main_window_structure.vala"
		value->data[0].v_pointer = v_object;
#line 974 "main_window_structure.c"
	} else {
#line 26 "main_window_structure.vala"
		value->data[0].v_pointer = NULL;
#line 978 "main_window_structure.c"
	}
#line 26 "main_window_structure.vala"
	if (old) {
#line 26 "main_window_structure.vala"
		main_window_structure_unref (old);
#line 984 "main_window_structure.c"
	}
}


static void
main_window_structure_class_init (MainWindowStructureClass * klass)
{
#line 26 "main_window_structure.vala"
	main_window_structure_parent_class = g_type_class_peek_parent (klass);
#line 26 "main_window_structure.vala"
	((MainWindowStructureClass *) klass)->finalize = main_window_structure_finalize;
#line 26 "main_window_structure.vala"
	g_type_class_adjust_private_offset (klass, &MainWindowStructure_private_offset);
#line 998 "main_window_structure.c"
}


static void
main_window_structure_instance_init (MainWindowStructure * self)
{
#line 26 "main_window_structure.vala"
	self->priv = main_window_structure_get_instance_private (self);
#line 26 "main_window_structure.vala"
	self->ref_count = 1;
#line 1009 "main_window_structure.c"
}


static void
main_window_structure_finalize (MainWindowStructure * obj)
{
	MainWindowStructure * self;
#line 26 "main_window_structure.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW_STRUCTURE, MainWindowStructure);
#line 26 "main_window_structure.vala"
	g_signal_handlers_destroy (self);
#line 60 "main_window_structure.vala"
	_g_object_unref0 (self->priv->_ui_manager);
#line 61 "main_window_structure.vala"
	_g_object_unref0 (self->priv->_structure);
#line 1025 "main_window_structure.c"
}


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);
		MainWindowStructure_private_offset = g_type_add_instance_private (main_window_structure_type_id, sizeof (MainWindowStructurePrivate));
		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;
#line 26 "main_window_structure.vala"
	g_atomic_int_inc (&self->ref_count);
#line 26 "main_window_structure.vala"
	return instance;
#line 1055 "main_window_structure.c"
}


void
main_window_structure_unref (gpointer instance)
{
	MainWindowStructure * self;
	self = instance;
#line 26 "main_window_structure.vala"
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
#line 26 "main_window_structure.vala"
		MAIN_WINDOW_STRUCTURE_GET_CLASS (self)->finalize (self);
#line 26 "main_window_structure.vala"
		g_type_free_instance ((GTypeInstance *) self);
#line 1070 "main_window_structure.c"
	}
}



