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

/*
 * This file is part of GNOME LaTeX.
 *
 * Copyright © 2012, 2015, 2017 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 <amtk/amtk.h>
#include <gio/gio.h>
#include <tepl/tepl.h>
#include <stdlib.h>
#include <string.h>
#include <gtksourceview/gtksource.h>
#include <gobject/gvaluecollector.h>


#define TYPE_MAIN_WINDOW_EDIT (main_window_edit_get_type ())
#define MAIN_WINDOW_EDIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW_EDIT, MainWindowEdit))
#define MAIN_WINDOW_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW_EDIT, MainWindowEditClass))
#define IS_MAIN_WINDOW_EDIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW_EDIT))
#define IS_MAIN_WINDOW_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW_EDIT))
#define MAIN_WINDOW_EDIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW_EDIT, MainWindowEditClass))

typedef struct _MainWindowEdit MainWindowEdit;
typedef struct _MainWindowEditClass MainWindowEditClass;
typedef struct _MainWindowEditPrivate MainWindowEditPrivate;

#define TYPE_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_GLATEX_APP (glatex_app_get_type ())
#define GLATEX_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GLATEX_APP, GlatexApp))
#define GLATEX_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GLATEX_APP, GlatexAppClass))
#define IS_GLATEX_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GLATEX_APP))
#define IS_GLATEX_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GLATEX_APP))
#define GLATEX_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GLATEX_APP, GlatexAppClass))

typedef struct _GlatexApp GlatexApp;
typedef struct _GlatexAppClass GlatexAppClass;

#define TYPE_DOCUMENT_TAB (document_tab_get_type ())
#define DOCUMENT_TAB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DOCUMENT_TAB, DocumentTab))
#define DOCUMENT_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOCUMENT_TAB, DocumentTabClass))
#define IS_DOCUMENT_TAB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DOCUMENT_TAB))
#define IS_DOCUMENT_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOCUMENT_TAB))
#define DOCUMENT_TAB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOCUMENT_TAB, DocumentTabClass))

typedef struct _DocumentTab DocumentTab;
typedef struct _DocumentTabClass DocumentTabClass;
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_DOCUMENT (document_get_type ())
#define DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DOCUMENT, Document))
#define DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOCUMENT, DocumentClass))
#define IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DOCUMENT))
#define IS_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOCUMENT))
#define DOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOCUMENT, DocumentClass))

typedef struct _Document Document;
typedef struct _DocumentClass DocumentClass;

#define TYPE_DOCUMENT_VIEW (document_view_get_type ())
#define DOCUMENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DOCUMENT_VIEW, DocumentView))
#define DOCUMENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DOCUMENT_VIEW, DocumentViewClass))
#define IS_DOCUMENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DOCUMENT_VIEW))
#define IS_DOCUMENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DOCUMENT_VIEW))
#define DOCUMENT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DOCUMENT_VIEW, DocumentViewClass))

typedef struct _DocumentView DocumentView;
typedef struct _DocumentViewClass DocumentViewClass;
typedef struct _ParamSpecMainWindowEdit ParamSpecMainWindowEdit;

struct _MainWindowEdit {
	GTypeInstance parent_instance;
	volatile int ref_count;
	MainWindowEditPrivate * priv;
};

struct _MainWindowEditClass {
	GTypeClass parent_class;
	void (*finalize) (MainWindowEdit *self);
};

struct _MainWindowEditPrivate {
	MainWindow* _main_window;
	GtkActionGroup* _action_group;
};

struct _ParamSpecMainWindowEdit {
	GParamSpec parent_instance;
};


static gint MainWindowEdit_private_offset;
static gpointer main_window_edit_parent_class = NULL;

gpointer main_window_edit_ref (gpointer instance);
void main_window_edit_unref (gpointer instance);
GParamSpec* param_spec_main_window_edit (const gchar* name,
                                         const gchar* nick,
                                         const gchar* blurb,
                                         GType object_type,
                                         GParamFlags flags);
void value_set_main_window_edit (GValue* value,
                                 gpointer v_object);
void value_take_main_window_edit (GValue* value,
                                  gpointer v_object);
gpointer value_get_main_window_edit (const GValue* value);
GType main_window_edit_get_type (void) G_GNUC_CONST;
GType main_window_get_type (void) G_GNUC_CONST;
void main_window_edit_on_comment (MainWindowEdit* self);
static void _main_window_edit_on_comment_gtk_action_callback (GtkAction* action,
                                                       gpointer self);
void main_window_edit_on_uncomment (MainWindowEdit* self);
static void _main_window_edit_on_uncomment_gtk_action_callback (GtkAction* action,
                                                         gpointer self);
void main_window_edit_on_completion (MainWindowEdit* self);
static void _main_window_edit_on_completion_gtk_action_callback (GtkAction* action,
                                                          gpointer self);
MainWindowEdit* main_window_edit_new (MainWindow* main_window,
                                      GtkUIManager* ui_manager);
MainWindowEdit* main_window_edit_construct (GType object_type,
                                            MainWindow* main_window,
                                            GtkUIManager* ui_manager);
GType glatex_app_get_type (void) G_GNUC_CONST;
GlatexApp* glatex_app_get_instance (void);
void main_window_edit_update_sensitivity (MainWindowEdit* self);
GType document_tab_get_type (void) G_GNUC_CONST;
DocumentTab* main_window_get_active_tab (MainWindow* self);
GType document_get_type (void) G_GNUC_CONST;
Document* main_window_get_active_document (MainWindow* self);
void document_comment_selected_lines (Document* self);
void document_uncomment_selected_lines (Document* self);
GType document_view_get_type (void) G_GNUC_CONST;
DocumentView* main_window_get_active_view (MainWindow* self);
static void main_window_edit_finalize (MainWindowEdit * obj);
static void _vala_array_destroy (gpointer array,
                          gint array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gint array_length,
                       GDestroyNotify destroy_func);

static const GtkActionEntry MAIN_WINDOW_EDIT__action_entries[14] = {{"Edit", NULL, N_ ("_Edit")}, {"EditUndo", "edit-undo", N_ ("_Undo"), "<Control>Z", N_ ("Undo the last action")}, {"EditRedo", "edit-redo", N_ ("_Redo"), "<Shift><Control>Z", N_ ("Redo the last undone action")}, {"EditCut", "edit-cut", N_ ("Cu_t"), "<Control>X", N_ ("Cut the selection")}, {"EditCopy", "edit-copy", N_ ("_Copy"), "<Control>C", N_ ("Copy the selection")}, {"EditPaste", "edit-paste", N_ ("_Paste"), "", N_ ("Paste the clipboard")}, {"EditDelete", "edit-delete", N_ ("_Delete"), NULL, N_ ("Delete the selected text")}, {"EditSelectAll", "edit-select-all", N_ ("Select _All"), "<Control>A", N_ ("Select the entire document")}, {"EditIndent", "format-indent-more", N_ ("_Indent"), "Tab", N_ ("Indent the selected lines")}, {"EditUnindent", "format-indent-less", N_ ("_Unindent"), "<Shift>Tab", N_ ("Unindent the selected lines")}, {"EditComment", NULL, N_ ("_Comment"), "<Control>M", N_ ("Comment the selected lines (add the character “%”)"), (GCallback) _main_window_edit_on_comment_gtk_action_callback}, {"EditUncomment", NULL, N_ ("_Uncomment"), "<Shift><Control>M", N_ ("Uncomment the selected lines (remove the character “%”)"), (GCallback) _main_window_edit_on_uncomment_gtk_action_callback}, {"EditCompletion", NULL, N_ ("_Completion"), "<Control>space", N_ ("Complete the LaTeX command"), (GCallback) _main_window_edit_on_completion_gtk_action_callback}, {"EditPreferences", "preferences-system", N_ ("_Preferences"), NULL, N_ ("Configure the application")}};

static inline gpointer
main_window_edit_get_instance_private (MainWindowEdit* self)
{
	return G_STRUCT_MEMBER_P (self, MainWindowEdit_private_offset);
}


static void
_main_window_edit_on_comment_gtk_action_callback (GtkAction* action,
                                                  gpointer self)
{
#line 28 "main_window_edit.vala"
	main_window_edit_on_comment ((MainWindowEdit*) self);
#line 191 "main_window_edit.c"
}


static void
_main_window_edit_on_uncomment_gtk_action_callback (GtkAction* action,
                                                    gpointer self)
{
#line 28 "main_window_edit.vala"
	main_window_edit_on_uncomment ((MainWindowEdit*) self);
#line 201 "main_window_edit.c"
}


static void
_main_window_edit_on_completion_gtk_action_callback (GtkAction* action,
                                                     gpointer self)
{
#line 28 "main_window_edit.vala"
	main_window_edit_on_completion ((MainWindowEdit*) self);
#line 211 "main_window_edit.c"
}


MainWindowEdit*
main_window_edit_construct (GType object_type,
                            MainWindow* main_window,
                            GtkUIManager* ui_manager)
{
	MainWindowEdit* self = NULL;
	GtkActionGroup* _tmp0_;
	GtkActionGroup* _tmp1_;
	GtkActionGroup* _tmp2_;
	GtkActionGroup* _tmp3_;
	GlatexApp* app = NULL;
	GlatexApp* _tmp4_;
	GtkActionGroup* _tmp5_;
	GtkActionGroup* _tmp6_;
	GtkActionGroup* _tmp7_;
	GtkActionGroup* _tmp8_;
	GtkActionGroup* _tmp9_;
	GtkActionGroup* _tmp10_;
	GtkActionGroup* _tmp11_;
	GtkActionGroup* _tmp12_;
	GtkActionGroup* _tmp13_;
	GtkActionGroup* _tmp14_;
#line 81 "main_window_edit.vala"
	g_return_val_if_fail (main_window != NULL, NULL);
#line 81 "main_window_edit.vala"
	g_return_val_if_fail (ui_manager != NULL, NULL);
#line 81 "main_window_edit.vala"
	self = (MainWindowEdit*) g_type_create_instance (object_type);
#line 83 "main_window_edit.vala"
	self->priv->_main_window = main_window;
#line 85 "main_window_edit.vala"
	_tmp0_ = gtk_action_group_new ("EditMenuActionGroup");
#line 85 "main_window_edit.vala"
	_g_object_unref0 (self->priv->_action_group);
#line 85 "main_window_edit.vala"
	self->priv->_action_group = _tmp0_;
#line 86 "main_window_edit.vala"
	_tmp1_ = self->priv->_action_group;
#line 86 "main_window_edit.vala"
	gtk_action_group_set_translation_domain (_tmp1_, GETTEXT_PACKAGE);
#line 87 "main_window_edit.vala"
	_tmp2_ = self->priv->_action_group;
#line 87 "main_window_edit.vala"
	gtk_action_group_add_actions (_tmp2_, MAIN_WINDOW_EDIT__action_entries, (guint) G_N_ELEMENTS (MAIN_WINDOW_EDIT__action_entries), self);
#line 89 "main_window_edit.vala"
	_tmp3_ = self->priv->_action_group;
#line 89 "main_window_edit.vala"
	gtk_ui_manager_insert_action_group (ui_manager, _tmp3_, 0);
#line 91 "main_window_edit.vala"
	_tmp4_ = glatex_app_get_instance ();
#line 91 "main_window_edit.vala"
	app = _tmp4_;
#line 93 "main_window_edit.vala"
	_tmp5_ = self->priv->_action_group;
#line 93 "main_window_edit.vala"
	amtk_utils_bind_g_action_to_gtk_action ((GActionMap*) main_window, "tepl-undo", _tmp5_, "EditUndo");
#line 95 "main_window_edit.vala"
	_tmp6_ = self->priv->_action_group;
#line 95 "main_window_edit.vala"
	amtk_utils_bind_g_action_to_gtk_action ((GActionMap*) main_window, "tepl-redo", _tmp6_, "EditRedo");
#line 97 "main_window_edit.vala"
	_tmp7_ = self->priv->_action_group;
#line 97 "main_window_edit.vala"
	amtk_utils_bind_g_action_to_gtk_action ((GActionMap*) main_window, "tepl-cut", _tmp7_, "EditCut");
#line 99 "main_window_edit.vala"
	_tmp8_ = self->priv->_action_group;
#line 99 "main_window_edit.vala"
	amtk_utils_bind_g_action_to_gtk_action ((GActionMap*) main_window, "tepl-copy", _tmp8_, "EditCopy");
#line 101 "main_window_edit.vala"
	_tmp9_ = self->priv->_action_group;
#line 101 "main_window_edit.vala"
	amtk_utils_bind_g_action_to_gtk_action ((GActionMap*) main_window, "tepl-paste", _tmp9_, "EditPaste");
#line 103 "main_window_edit.vala"
	_tmp10_ = self->priv->_action_group;
#line 103 "main_window_edit.vala"
	amtk_utils_bind_g_action_to_gtk_action ((GActionMap*) main_window, "tepl-delete", _tmp10_, "EditDelete");
#line 105 "main_window_edit.vala"
	_tmp11_ = self->priv->_action_group;
#line 105 "main_window_edit.vala"
	amtk_utils_bind_g_action_to_gtk_action ((GActionMap*) main_window, "tepl-select-all", _tmp11_, "EditSelectAll");
#line 107 "main_window_edit.vala"
	_tmp12_ = self->priv->_action_group;
#line 107 "main_window_edit.vala"
	amtk_utils_bind_g_action_to_gtk_action ((GActionMap*) main_window, "tepl-indent", _tmp12_, "EditIndent");
#line 109 "main_window_edit.vala"
	_tmp13_ = self->priv->_action_group;
#line 109 "main_window_edit.vala"
	amtk_utils_bind_g_action_to_gtk_action ((GActionMap*) main_window, "tepl-unindent", _tmp13_, "EditUnindent");
#line 111 "main_window_edit.vala"
	_tmp14_ = self->priv->_action_group;
#line 111 "main_window_edit.vala"
	amtk_utils_bind_g_action_to_gtk_action ((GActionMap*) app, "preferences", _tmp14_, "EditPreferences");
#line 81 "main_window_edit.vala"
	_g_object_unref0 (app);
#line 81 "main_window_edit.vala"
	return self;
#line 311 "main_window_edit.c"
}


MainWindowEdit*
main_window_edit_new (MainWindow* main_window,
                      GtkUIManager* ui_manager)
{
#line 81 "main_window_edit.vala"
	return main_window_edit_construct (TYPE_MAIN_WINDOW_EDIT, main_window, ui_manager);
#line 321 "main_window_edit.c"
}


static gpointer
_g_object_ref0 (gpointer self)
{
#line 130 "main_window_edit.vala"
	return self ? g_object_ref (self) : NULL;
#line 330 "main_window_edit.c"
}


void
main_window_edit_update_sensitivity (MainWindowEdit* self)
{
	gboolean sensitive = FALSE;
	MainWindow* _tmp0_;
	DocumentTab* _tmp1_;
	DocumentTab* _tmp2_;
	gchar** action_names = NULL;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar** _tmp6_;
	gint action_names_length1;
	gint _action_names_size_;
	gchar** _tmp7_;
	gint _tmp7__length1;
#line 117 "main_window_edit.vala"
	g_return_if_fail (self != NULL);
#line 119 "main_window_edit.vala"
	_tmp0_ = self->priv->_main_window;
#line 119 "main_window_edit.vala"
	_tmp1_ = main_window_get_active_tab (_tmp0_);
#line 119 "main_window_edit.vala"
	_tmp2_ = _tmp1_;
#line 119 "main_window_edit.vala"
	sensitive = _tmp2_ != NULL;
#line 121 "main_window_edit.vala"
	_tmp3_ = g_strdup ("EditComment");
#line 121 "main_window_edit.vala"
	_tmp4_ = g_strdup ("EditUncomment");
#line 121 "main_window_edit.vala"
	_tmp5_ = g_strdup ("EditCompletion");
#line 121 "main_window_edit.vala"
	_tmp6_ = g_new0 (gchar*, 3 + 1);
#line 121 "main_window_edit.vala"
	_tmp6_[0] = _tmp3_;
#line 121 "main_window_edit.vala"
	_tmp6_[1] = _tmp4_;
#line 121 "main_window_edit.vala"
	_tmp6_[2] = _tmp5_;
#line 121 "main_window_edit.vala"
	action_names = _tmp6_;
#line 121 "main_window_edit.vala"
	action_names_length1 = 3;
#line 121 "main_window_edit.vala"
	_action_names_size_ = action_names_length1;
#line 128 "main_window_edit.vala"
	_tmp7_ = action_names;
#line 128 "main_window_edit.vala"
	_tmp7__length1 = action_names_length1;
#line 384 "main_window_edit.c"
	{
		gchar** action_name_collection = NULL;
		gint action_name_collection_length1 = 0;
		gint _action_name_collection_size_ = 0;
		gint action_name_it = 0;
#line 128 "main_window_edit.vala"
		action_name_collection = _tmp7_;
#line 128 "main_window_edit.vala"
		action_name_collection_length1 = _tmp7__length1;
#line 128 "main_window_edit.vala"
		for (action_name_it = 0; action_name_it < _tmp7__length1; action_name_it = action_name_it + 1) {
#line 396 "main_window_edit.c"
			gchar* _tmp8_;
			gchar* action_name = NULL;
#line 128 "main_window_edit.vala"
			_tmp8_ = g_strdup (action_name_collection[action_name_it]);
#line 128 "main_window_edit.vala"
			action_name = _tmp8_;
#line 403 "main_window_edit.c"
			{
				GtkAction* action = NULL;
				GtkActionGroup* _tmp9_;
				const gchar* _tmp10_;
				GtkAction* _tmp11_;
				GtkAction* _tmp12_;
				GtkAction* _tmp13_;
				gboolean _tmp14_;
#line 130 "main_window_edit.vala"
				_tmp9_ = self->priv->_action_group;
#line 130 "main_window_edit.vala"
				_tmp10_ = action_name;
#line 130 "main_window_edit.vala"
				_tmp11_ = gtk_action_group_get_action (_tmp9_, _tmp10_);
#line 130 "main_window_edit.vala"
				_tmp12_ = _g_object_ref0 (_tmp11_);
#line 130 "main_window_edit.vala"
				action = _tmp12_;
#line 131 "main_window_edit.vala"
				_tmp13_ = action;
#line 131 "main_window_edit.vala"
				_tmp14_ = sensitive;
#line 131 "main_window_edit.vala"
				gtk_action_set_sensitive (_tmp13_, _tmp14_);
#line 128 "main_window_edit.vala"
				_g_object_unref0 (action);
#line 128 "main_window_edit.vala"
				_g_free0 (action_name);
#line 432 "main_window_edit.c"
			}
		}
	}
#line 117 "main_window_edit.vala"
	action_names = (_vala_array_free (action_names, action_names_length1, (GDestroyNotify) g_free), NULL);
#line 438 "main_window_edit.c"
}


void
main_window_edit_on_comment (MainWindowEdit* self)
{
	MainWindow* _tmp0_;
	DocumentTab* _tmp1_;
	DocumentTab* _tmp2_;
	MainWindow* _tmp3_;
	Document* _tmp4_;
	Document* _tmp5_;
#line 137 "main_window_edit.vala"
	g_return_if_fail (self != NULL);
#line 139 "main_window_edit.vala"
	_tmp0_ = self->priv->_main_window;
#line 139 "main_window_edit.vala"
	_tmp1_ = main_window_get_active_tab (_tmp0_);
#line 139 "main_window_edit.vala"
	_tmp2_ = _tmp1_;
#line 139 "main_window_edit.vala"
	g_return_if_fail (_tmp2_ != NULL);
#line 140 "main_window_edit.vala"
	_tmp3_ = self->priv->_main_window;
#line 140 "main_window_edit.vala"
	_tmp4_ = main_window_get_active_document (_tmp3_);
#line 140 "main_window_edit.vala"
	_tmp5_ = _tmp4_;
#line 140 "main_window_edit.vala"
	document_comment_selected_lines (_tmp5_);
#line 469 "main_window_edit.c"
}


void
main_window_edit_on_uncomment (MainWindowEdit* self)
{
	MainWindow* _tmp0_;
	DocumentTab* _tmp1_;
	DocumentTab* _tmp2_;
	MainWindow* _tmp3_;
	Document* _tmp4_;
	Document* _tmp5_;
#line 143 "main_window_edit.vala"
	g_return_if_fail (self != NULL);
#line 145 "main_window_edit.vala"
	_tmp0_ = self->priv->_main_window;
#line 145 "main_window_edit.vala"
	_tmp1_ = main_window_get_active_tab (_tmp0_);
#line 145 "main_window_edit.vala"
	_tmp2_ = _tmp1_;
#line 145 "main_window_edit.vala"
	g_return_if_fail (_tmp2_ != NULL);
#line 146 "main_window_edit.vala"
	_tmp3_ = self->priv->_main_window;
#line 146 "main_window_edit.vala"
	_tmp4_ = main_window_get_active_document (_tmp3_);
#line 146 "main_window_edit.vala"
	_tmp5_ = _tmp4_;
#line 146 "main_window_edit.vala"
	document_uncomment_selected_lines (_tmp5_);
#line 500 "main_window_edit.c"
}


void
main_window_edit_on_completion (MainWindowEdit* self)
{
	MainWindow* _tmp0_;
	DocumentTab* _tmp1_;
	DocumentTab* _tmp2_;
	MainWindow* _tmp3_;
	DocumentView* _tmp4_;
	DocumentView* _tmp5_;
#line 149 "main_window_edit.vala"
	g_return_if_fail (self != NULL);
#line 151 "main_window_edit.vala"
	_tmp0_ = self->priv->_main_window;
#line 151 "main_window_edit.vala"
	_tmp1_ = main_window_get_active_tab (_tmp0_);
#line 151 "main_window_edit.vala"
	_tmp2_ = _tmp1_;
#line 151 "main_window_edit.vala"
	g_return_if_fail (_tmp2_ != NULL);
#line 152 "main_window_edit.vala"
	_tmp3_ = self->priv->_main_window;
#line 152 "main_window_edit.vala"
	_tmp4_ = main_window_get_active_view (_tmp3_);
#line 152 "main_window_edit.vala"
	_tmp5_ = _tmp4_;
#line 152 "main_window_edit.vala"
	g_signal_emit_by_name ((GtkSourceView*) _tmp5_, "show-completion");
#line 531 "main_window_edit.c"
}


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


static void
value_main_window_edit_free_value (GValue* value)
{
#line 26 "main_window_edit.vala"
	if (value->data[0].v_pointer) {
#line 26 "main_window_edit.vala"
		main_window_edit_unref (value->data[0].v_pointer);
#line 551 "main_window_edit.c"
	}
}


static void
value_main_window_edit_copy_value (const GValue* src_value,
                                   GValue* dest_value)
{
#line 26 "main_window_edit.vala"
	if (src_value->data[0].v_pointer) {
#line 26 "main_window_edit.vala"
		dest_value->data[0].v_pointer = main_window_edit_ref (src_value->data[0].v_pointer);
#line 564 "main_window_edit.c"
	} else {
#line 26 "main_window_edit.vala"
		dest_value->data[0].v_pointer = NULL;
#line 568 "main_window_edit.c"
	}
}


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


static gchar*
value_main_window_edit_collect_value (GValue* value,
                                      guint n_collect_values,
                                      GTypeCValue* collect_values,
                                      guint collect_flags)
{
#line 26 "main_window_edit.vala"
	if (collect_values[0].v_pointer) {
#line 590 "main_window_edit.c"
		MainWindowEdit * object;
		object = collect_values[0].v_pointer;
#line 26 "main_window_edit.vala"
		if (object->parent_instance.g_class == NULL) {
#line 26 "main_window_edit.vala"
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 597 "main_window_edit.c"
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
#line 26 "main_window_edit.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 601 "main_window_edit.c"
		}
#line 26 "main_window_edit.vala"
		value->data[0].v_pointer = main_window_edit_ref (object);
#line 605 "main_window_edit.c"
	} else {
#line 26 "main_window_edit.vala"
		value->data[0].v_pointer = NULL;
#line 609 "main_window_edit.c"
	}
#line 26 "main_window_edit.vala"
	return NULL;
#line 613 "main_window_edit.c"
}


static gchar*
value_main_window_edit_lcopy_value (const GValue* value,
                                    guint n_collect_values,
                                    GTypeCValue* collect_values,
                                    guint collect_flags)
{
	MainWindowEdit ** object_p;
	object_p = collect_values[0].v_pointer;
#line 26 "main_window_edit.vala"
	if (!object_p) {
#line 26 "main_window_edit.vala"
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 629 "main_window_edit.c"
	}
#line 26 "main_window_edit.vala"
	if (!value->data[0].v_pointer) {
#line 26 "main_window_edit.vala"
		*object_p = NULL;
#line 635 "main_window_edit.c"
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 26 "main_window_edit.vala"
		*object_p = value->data[0].v_pointer;
#line 639 "main_window_edit.c"
	} else {
#line 26 "main_window_edit.vala"
		*object_p = main_window_edit_ref (value->data[0].v_pointer);
#line 643 "main_window_edit.c"
	}
#line 26 "main_window_edit.vala"
	return NULL;
#line 647 "main_window_edit.c"
}


GParamSpec*
param_spec_main_window_edit (const gchar* name,
                             const gchar* nick,
                             const gchar* blurb,
                             GType object_type,
                             GParamFlags flags)
{
	ParamSpecMainWindowEdit* spec;
#line 26 "main_window_edit.vala"
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAIN_WINDOW_EDIT), NULL);
#line 26 "main_window_edit.vala"
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
#line 26 "main_window_edit.vala"
	G_PARAM_SPEC (spec)->value_type = object_type;
#line 26 "main_window_edit.vala"
	return G_PARAM_SPEC (spec);
#line 667 "main_window_edit.c"
}


gpointer
value_get_main_window_edit (const GValue* value)
{
#line 26 "main_window_edit.vala"
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_EDIT), NULL);
#line 26 "main_window_edit.vala"
	return value->data[0].v_pointer;
#line 678 "main_window_edit.c"
}


void
value_set_main_window_edit (GValue* value,
                            gpointer v_object)
{
	MainWindowEdit * old;
#line 26 "main_window_edit.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_EDIT));
#line 26 "main_window_edit.vala"
	old = value->data[0].v_pointer;
#line 26 "main_window_edit.vala"
	if (v_object) {
#line 26 "main_window_edit.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN_WINDOW_EDIT));
#line 26 "main_window_edit.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 26 "main_window_edit.vala"
		value->data[0].v_pointer = v_object;
#line 26 "main_window_edit.vala"
		main_window_edit_ref (value->data[0].v_pointer);
#line 701 "main_window_edit.c"
	} else {
#line 26 "main_window_edit.vala"
		value->data[0].v_pointer = NULL;
#line 705 "main_window_edit.c"
	}
#line 26 "main_window_edit.vala"
	if (old) {
#line 26 "main_window_edit.vala"
		main_window_edit_unref (old);
#line 711 "main_window_edit.c"
	}
}


void
value_take_main_window_edit (GValue* value,
                             gpointer v_object)
{
	MainWindowEdit * old;
#line 26 "main_window_edit.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN_WINDOW_EDIT));
#line 26 "main_window_edit.vala"
	old = value->data[0].v_pointer;
#line 26 "main_window_edit.vala"
	if (v_object) {
#line 26 "main_window_edit.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN_WINDOW_EDIT));
#line 26 "main_window_edit.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 26 "main_window_edit.vala"
		value->data[0].v_pointer = v_object;
#line 733 "main_window_edit.c"
	} else {
#line 26 "main_window_edit.vala"
		value->data[0].v_pointer = NULL;
#line 737 "main_window_edit.c"
	}
#line 26 "main_window_edit.vala"
	if (old) {
#line 26 "main_window_edit.vala"
		main_window_edit_unref (old);
#line 743 "main_window_edit.c"
	}
}


static void
main_window_edit_class_init (MainWindowEditClass * klass)
{
#line 26 "main_window_edit.vala"
	main_window_edit_parent_class = g_type_class_peek_parent (klass);
#line 26 "main_window_edit.vala"
	((MainWindowEditClass *) klass)->finalize = main_window_edit_finalize;
#line 26 "main_window_edit.vala"
	g_type_class_adjust_private_offset (klass, &MainWindowEdit_private_offset);
#line 757 "main_window_edit.c"
}


static void
main_window_edit_instance_init (MainWindowEdit * self)
{
#line 26 "main_window_edit.vala"
	self->priv = main_window_edit_get_instance_private (self);
#line 26 "main_window_edit.vala"
	self->ref_count = 1;
#line 768 "main_window_edit.c"
}


static void
main_window_edit_finalize (MainWindowEdit * obj)
{
	MainWindowEdit * self;
#line 26 "main_window_edit.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN_WINDOW_EDIT, MainWindowEdit);
#line 26 "main_window_edit.vala"
	g_signal_handlers_destroy (self);
#line 79 "main_window_edit.vala"
	_g_object_unref0 (self->priv->_action_group);
#line 782 "main_window_edit.c"
}


GType
main_window_edit_get_type (void)
{
	static volatile gsize main_window_edit_type_id__volatile = 0;
	if (g_once_init_enter (&main_window_edit_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_main_window_edit_init, value_main_window_edit_free_value, value_main_window_edit_copy_value, value_main_window_edit_peek_pointer, "p", value_main_window_edit_collect_value, "p", value_main_window_edit_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (MainWindowEditClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_window_edit_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MainWindowEdit), 0, (GInstanceInitFunc) main_window_edit_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_edit_type_id;
		main_window_edit_type_id = g_type_register_fundamental (g_type_fundamental_next (), "MainWindowEdit", &g_define_type_info, &g_define_type_fundamental_info, 0);
		MainWindowEdit_private_offset = g_type_add_instance_private (main_window_edit_type_id, sizeof (MainWindowEditPrivate));
		g_once_init_leave (&main_window_edit_type_id__volatile, main_window_edit_type_id);
	}
	return main_window_edit_type_id__volatile;
}


gpointer
main_window_edit_ref (gpointer instance)
{
	MainWindowEdit * self;
	self = instance;
#line 26 "main_window_edit.vala"
	g_atomic_int_inc (&self->ref_count);
#line 26 "main_window_edit.vala"
	return instance;
#line 812 "main_window_edit.c"
}


void
main_window_edit_unref (gpointer instance)
{
	MainWindowEdit * self;
	self = instance;
#line 26 "main_window_edit.vala"
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
#line 26 "main_window_edit.vala"
		MAIN_WINDOW_EDIT_GET_CLASS (self)->finalize (self);
#line 26 "main_window_edit.vala"
		g_type_free_instance ((GTypeInstance *) self);
#line 827 "main_window_edit.c"
	}
}


static void
_vala_array_destroy (gpointer array,
                     gint array_length,
                     GDestroyNotify destroy_func)
{
#line 27 "build_tools_preferences.vala"
	if ((array != NULL) && (destroy_func != NULL)) {
#line 839 "main_window_edit.c"
		int i;
#line 27 "build_tools_preferences.vala"
		for (i = 0; i < array_length; i = i + 1) {
#line 27 "build_tools_preferences.vala"
			if (((gpointer*) array)[i] != NULL) {
#line 27 "build_tools_preferences.vala"
				destroy_func (((gpointer*) array)[i]);
#line 847 "main_window_edit.c"
			}
		}
	}
}


static void
_vala_array_free (gpointer array,
                  gint array_length,
                  GDestroyNotify destroy_func)
{
#line 27 "build_tools_preferences.vala"
	_vala_array_destroy (array, array_length, destroy_func);
#line 27 "build_tools_preferences.vala"
	g_free (array);
#line 863 "main_window_edit.c"
}



