/* search.c generated by valac 0.21.1.31-3473e, the Vala compiler
 * generated from search.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>
#include <gtksourceview/gtksource.h>
#include <float.h>
#include <math.h>


#define TYPE_GOTO_LINE (goto_line_get_type ())
#define GOTO_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GOTO_LINE, GotoLine))
#define GOTO_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GOTO_LINE, GotoLineClass))
#define IS_GOTO_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GOTO_LINE))
#define IS_GOTO_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GOTO_LINE))
#define GOTO_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GOTO_LINE, GotoLineClass))

typedef struct _GotoLine GotoLine;
typedef struct _GotoLineClass GotoLineClass;
typedef struct _GotoLinePrivate GotoLinePrivate;

#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 TYPE_ERROR_ENTRY (error_entry_get_type ())
#define ERROR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ERROR_ENTRY, ErrorEntry))
#define ERROR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ERROR_ENTRY, ErrorEntryClass))
#define IS_ERROR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ERROR_ENTRY))
#define IS_ERROR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ERROR_ENTRY))
#define ERROR_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ERROR_ENTRY, ErrorEntryClass))

typedef struct _ErrorEntry ErrorEntry;
typedef struct _ErrorEntryClass ErrorEntryClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#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;

#define TYPE_SEARCH_AND_REPLACE (search_and_replace_get_type ())
#define SEARCH_AND_REPLACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SEARCH_AND_REPLACE, SearchAndReplace))
#define SEARCH_AND_REPLACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SEARCH_AND_REPLACE, SearchAndReplaceClass))
#define IS_SEARCH_AND_REPLACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SEARCH_AND_REPLACE))
#define IS_SEARCH_AND_REPLACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SEARCH_AND_REPLACE))
#define SEARCH_AND_REPLACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SEARCH_AND_REPLACE, SearchAndReplaceClass))

typedef struct _SearchAndReplace SearchAndReplace;
typedef struct _SearchAndReplaceClass SearchAndReplaceClass;
typedef struct _SearchAndReplacePrivate SearchAndReplacePrivate;

#define SEARCH_AND_REPLACE_TYPE_MODE (search_and_replace_mode_get_type ())
typedef struct _Block29Data Block29Data;
typedef struct _Block30Data Block30Data;

#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 TYPE_SELECTION_TYPE (selection_type_get_type ())

struct _GotoLine {
	GtkGrid parent_instance;
	GotoLinePrivate * priv;
};

struct _GotoLineClass {
	GtkGridClass parent_class;
};

struct _GotoLinePrivate {
	MainWindow* main_window;
	ErrorEntry* entry;
};

struct _SearchAndReplace {
	GObject parent_instance;
	SearchAndReplacePrivate * priv;
};

struct _SearchAndReplaceClass {
	GObjectClass parent_class;
};

struct _SearchAndReplacePrivate {
	MainWindow* _main_window;
	Document* _working_document;
	GtkGrid* _main_grid;
	GtkGrid* _replace_grid;
	GtkButton* _button_arrow;
	GtkArrow* _arrow;
	ErrorEntry* _entry_find;
	GtkEntry* _entry_replace;
	GtkCheckMenuItem* _check_case_sensitive;
	GtkCheckMenuItem* _check_entire_word;
	gint min_nb_chars_for_inc_search;
};

typedef enum  {
	SEARCH_AND_REPLACE_MODE_SEARCH,
	SEARCH_AND_REPLACE_MODE_SEARCH_AND_REPLACE
} SearchAndReplaceMode;

struct _Block29Data {
	int _ref_count_;
	SearchAndReplace * self;
	GtkButton* button_clear_find;
	GtkButton* button_previous;
	GtkButton* button_next;
	GtkButton* button_clear_replace;
	GtkButton* button_replace;
	GtkButton* button_replace_all;
};

struct _Block30Data {
	int _ref_count_;
	SearchAndReplace * self;
	GtkMenu* menu;
};

typedef enum  {
	SELECTION_TYPE_NO_SELECTION,
	SELECTION_TYPE_ONE_LINE,
	SELECTION_TYPE_MULTIPLE_LINES
} SelectionType;


static gpointer goto_line_parent_class = NULL;
static gpointer search_and_replace_parent_class = NULL;

GType goto_line_get_type (void) G_GNUC_CONST;
GType main_window_get_type (void) G_GNUC_CONST;
GType error_entry_get_type (void) G_GNUC_CONST;
#define GOTO_LINE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_GOTO_LINE, GotoLinePrivate))
enum  {
	GOTO_LINE_DUMMY_PROPERTY
};
GotoLine* goto_line_new (MainWindow* main_window);
GotoLine* goto_line_construct (GType object_type, MainWindow* main_window);
static void __lambda94_ (GotoLine* self);
static void ___lambda94__gtk_button_clicked (GtkButton* _sender, gpointer self);
ErrorEntry* error_entry_new (void);
ErrorEntry* error_entry_construct (GType object_type);
static void __lambda95_ (GotoLine* self);
static void ___lambda95__gtk_entry_activate (GtkEntry* _sender, gpointer self);
static void __lambda96_ (GotoLine* self);
static void ___lambda96__gtk_entry_icon_press (GtkEntry* _sender, GtkEntryIconPosition p0, GdkEvent* p1, gpointer self);
static void goto_line_on_changed (GotoLine* self);
static void _goto_line_on_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self);
void goto_line_show (GotoLine* self);
void error_entry_set_error (ErrorEntry* self, gboolean value);
GType document_get_type (void) G_GNUC_CONST;
Document* main_window_get_active_document (MainWindow* self);
gboolean document_goto_line (Document* self, gint line);
GType document_view_get_type (void) G_GNUC_CONST;
DocumentView* main_window_get_active_view (MainWindow* self);
void document_view_scroll_to_cursor (DocumentView* self, gdouble margin);
static void goto_line_finalize (GObject* obj);
GType search_and_replace_get_type (void) G_GNUC_CONST;
#define SEARCH_AND_REPLACE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SEARCH_AND_REPLACE, SearchAndReplacePrivate))
enum  {
	SEARCH_AND_REPLACE_DUMMY_PROPERTY
};
static GType search_and_replace_mode_get_type (void) G_GNUC_UNUSED;
static SearchAndReplaceMode search_and_replace_get_mode (SearchAndReplace* self);
SearchAndReplace* search_and_replace_new (MainWindow* main_window);
SearchAndReplace* search_and_replace_construct (GType object_type, MainWindow* main_window);
static Block29Data* block29_data_ref (Block29Data* _data29_);
static void block29_data_unref (void * _userdata_);
static void search_and_replace_init_find_entry (SearchAndReplace* self);
static GtkButton* search_and_replace_get_button (SearchAndReplace* self, const gchar* stock_id);
static void __lambda98_ (SearchAndReplace* self);
static void ___lambda98__gtk_button_clicked (GtkButton* _sender, gpointer self);
void search_and_replace_hide (SearchAndReplace* self);
static void _search_and_replace_hide_gtk_button_clicked (GtkButton* _sender, gpointer self);
static void __lambda99_ (SearchAndReplace* self);
static void ___lambda99__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void __lambda100_ (SearchAndReplace* self);
static void ___lambda100__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void __lambda101_ (SearchAndReplace* self);
static void search_and_replace_set_search_text (SearchAndReplace* self, gboolean select);
void document_search_backward (Document* self);
static void ___lambda101__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void search_and_replace_search_forward (SearchAndReplace* self);
static void _search_and_replace_search_forward_gtk_button_clicked (GtkButton* _sender, gpointer self);
static void _search_and_replace_search_forward_gtk_entry_activate (GtkEntry* _sender, gpointer self);
static void __lambda102_ (Block29Data* _data29_);
static void search_and_replace_clear_search (SearchAndReplace* self);
static void ___lambda102__gtk_editable_changed (GtkEditable* _sender, gpointer self);
static void __lambda103_ (Block29Data* _data29_);
static void ___lambda103__gtk_editable_changed (GtkEditable* _sender, gpointer self);
static void __lambda104_ (SearchAndReplace* self);
static void ___lambda104__gtk_check_menu_item_toggled (GtkCheckMenuItem* _sender, gpointer self);
static void __lambda105_ (SearchAndReplace* self);
static void ___lambda105__gtk_check_menu_item_toggled (GtkCheckMenuItem* _sender, gpointer self);
static void search_and_replace_replace (SearchAndReplace* self);
static void _search_and_replace_replace_gtk_button_clicked (GtkButton* _sender, gpointer self);
static void _search_and_replace_replace_gtk_entry_activate (GtkEntry* _sender, gpointer self);
static void __lambda106_ (SearchAndReplace* self);
void document_replace_all (Document* self, const gchar* text);
static void ___lambda106__gtk_button_clicked (GtkButton* _sender, gpointer self);
static gboolean __lambda107_ (SearchAndReplace* self, GdkEventKey* event);
void search_and_replace_show_search_and_replace (SearchAndReplace* self);
static void search_and_replace_select_current_match (SearchAndReplace* self);
static gboolean ___lambda107__gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
static Block30Data* block30_data_ref (Block30Data* _data30_);
static void block30_data_unref (void * _userdata_);
static void __lambda97_ (Block30Data* _data30_, GtkEntryIconPosition icon_pos, GdkEvent* event);
static void ___lambda97__gtk_entry_icon_press (GtkEntry* _sender, GtkEntryIconPosition p0, GdkEvent* p1, gpointer self);
GtkWidget* search_and_replace_get_widget (SearchAndReplace* self);
void search_and_replace_show_search (SearchAndReplace* self);
static void search_and_replace_show (SearchAndReplace* self);
GType document_tab_get_type (void) G_GNUC_CONST;
DocumentTab* main_window_get_active_tab (MainWindow* self);
static void search_and_replace_set_replace_sensitivity (SearchAndReplace* self);
GType selection_type_get_type (void) G_GNUC_CONST;
SelectionType document_get_selection_type (Document* self);
static void _search_and_replace_set_replace_sensitivity_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
void document_set_search_text (Document* self, const gchar* text, gboolean case_sensitive, gboolean entire_word, guint* nb_matches, guint* num_match, gboolean select);
static gboolean search_and_replace_get_case_sensitive (SearchAndReplace* self);
static gboolean search_and_replace_get_entire_word (SearchAndReplace* self);
void document_select_current_match (Document* self);
void document_search_forward (Document* self);
void document_clear_search (Document* self, gboolean disconnect_signals);
gboolean document_get_readonly (Document* self);
void document_replace (Document* self, const gchar* text);
static void search_and_replace_finalize (GObject* obj);
static void _vala_search_and_replace_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);


static void __lambda94_ (GotoLine* self) {
	gtk_widget_hide ((GtkWidget*) self);
}


static void ___lambda94__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda94_ (self);
}


static void __lambda95_ (GotoLine* self) {
	gtk_widget_hide ((GtkWidget*) self);
}


static void ___lambda95__gtk_entry_activate (GtkEntry* _sender, gpointer self) {
	__lambda95_ (self);
}


static void __lambda96_ (GotoLine* self) {
	gtk_widget_hide ((GtkWidget*) self);
}


static void ___lambda96__gtk_entry_icon_press (GtkEntry* _sender, GtkEntryIconPosition p0, GdkEvent* p1, gpointer self) {
	__lambda96_ (self);
}


static void _goto_line_on_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self) {
	goto_line_on_changed (self);
}


GotoLine* goto_line_construct (GType object_type, MainWindow* main_window) {
	GotoLine * self = NULL;
	MainWindow* _tmp0_ = NULL;
	GtkButton* close_button = NULL;
	GtkButton* _tmp1_ = NULL;
	GtkImage* img = NULL;
	GtkImage* _tmp2_ = NULL;
	GtkLabel* label = NULL;
	const gchar* _tmp3_ = NULL;
	GtkLabel* _tmp4_ = NULL;
	ErrorEntry* _tmp5_ = NULL;
	ErrorEntry* _tmp6_ = NULL;
	GIcon* icon = NULL;
	GThemedIcon* _tmp7_ = NULL;
	ErrorEntry* _tmp8_ = NULL;
	ErrorEntry* _tmp9_ = NULL;
	ErrorEntry* _tmp10_ = NULL;
	const gchar* _tmp11_ = NULL;
	ErrorEntry* _tmp12_ = NULL;
	ErrorEntry* _tmp13_ = NULL;
	ErrorEntry* _tmp14_ = NULL;
	ErrorEntry* _tmp15_ = NULL;
	g_return_val_if_fail (main_window != NULL, NULL);
	self = (GotoLine*) g_object_new (object_type, NULL);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_HORIZONTAL);
	gtk_grid_set_column_spacing ((GtkGrid*) self, (guint) 3);
	_tmp0_ = main_window;
	self->priv->main_window = _tmp0_;
	_tmp1_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp1_);
	close_button = _tmp1_;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) close_button);
	gtk_button_set_relief (close_button, GTK_RELIEF_NONE);
	_tmp2_ = (GtkImage*) gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp2_);
	img = _tmp2_;
	gtk_container_add ((GtkContainer*) close_button, (GtkWidget*) img);
	g_signal_connect_object (close_button, "clicked", (GCallback) ___lambda94__gtk_button_clicked, self, 0);
	_tmp3_ = _ ("Go to Line:");
	_tmp4_ = (GtkLabel*) gtk_label_new (_tmp3_);
	g_object_ref_sink (_tmp4_);
	label = _tmp4_;
	gtk_widget_set_margin_left ((GtkWidget*) label, 2);
	gtk_widget_set_margin_right ((GtkWidget*) label, 2);
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) label);
	_tmp5_ = error_entry_new ();
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->entry);
	self->priv->entry = _tmp5_;
	_tmp6_ = self->priv->entry;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp6_);
	_tmp7_ = (GThemedIcon*) g_themed_icon_new_with_default_fallbacks ("go-jump-symbolic");
	icon = (GIcon*) _tmp7_;
	_tmp8_ = self->priv->entry;
	gtk_entry_set_icon_from_gicon ((GtkEntry*) _tmp8_, GTK_ENTRY_ICON_SECONDARY, icon);
	_tmp9_ = self->priv->entry;
	gtk_entry_set_icon_activatable ((GtkEntry*) _tmp9_, GTK_ENTRY_ICON_SECONDARY, TRUE);
	_tmp10_ = self->priv->entry;
	_tmp11_ = _ ("Line you want to move the cursor to");
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp10_, _tmp11_);
	_tmp12_ = self->priv->entry;
	gtk_widget_set_size_request ((GtkWidget*) _tmp12_, 100, -1);
	_tmp13_ = self->priv->entry;
	g_signal_connect_object ((GtkEntry*) _tmp13_, "activate", (GCallback) ___lambda95__gtk_entry_activate, self, 0);
	_tmp14_ = self->priv->entry;
	g_signal_connect_object ((GtkEntry*) _tmp14_, "icon-press", (GCallback) ___lambda96__gtk_entry_icon_press, self, 0);
	_tmp15_ = self->priv->entry;
	g_signal_connect_object ((GtkEditable*) _tmp15_, "changed", (GCallback) _goto_line_on_changed_gtk_editable_changed, self, 0);
	_g_object_unref0 (icon);
	_g_object_unref0 (label);
	_g_object_unref0 (img);
	_g_object_unref0 (close_button);
	return self;
}


GotoLine* goto_line_new (MainWindow* main_window) {
	return goto_line_construct (TYPE_GOTO_LINE, main_window);
}


void goto_line_show (GotoLine* self) {
	ErrorEntry* _tmp0_ = NULL;
	ErrorEntry* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entry;
	gtk_entry_set_text ((GtkEntry*) _tmp0_, "");
	gtk_widget_show_all ((GtkWidget*) self);
	_tmp1_ = self->priv->entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp1_);
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_ = 0L;
	gchar _tmp1_ = '\0';
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = index;
	_tmp1_ = ((gchar*) self)[_tmp0_];
	result = _tmp1_;
	return result;
}


static void goto_line_on_changed (GotoLine* self) {
	ErrorEntry* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	gchar* text = NULL;
	ErrorEntry* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	gchar* _tmp6_ = NULL;
	gint line = 0;
	const gchar* _tmp20_ = NULL;
	gint _tmp21_ = 0;
	ErrorEntry* _tmp22_ = NULL;
	MainWindow* _tmp23_ = NULL;
	Document* _tmp24_ = NULL;
	Document* _tmp25_ = NULL;
	gint _tmp26_ = 0;
	gint _tmp27_ = 0;
	gboolean _tmp28_ = FALSE;
	MainWindow* _tmp29_ = NULL;
	DocumentView* _tmp30_ = NULL;
	DocumentView* _tmp31_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->entry;
	_tmp1_ = gtk_entry_get_text_length ((GtkEntry*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == ((guint) 0)) {
		ErrorEntry* _tmp3_ = NULL;
		_tmp3_ = self->priv->entry;
		error_entry_set_error (_tmp3_, FALSE);
		return;
	}
	_tmp4_ = self->priv->entry;
	_tmp5_ = gtk_entry_get_text ((GtkEntry*) _tmp4_);
	_tmp6_ = g_strdup (_tmp5_);
	text = _tmp6_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp7_ = FALSE;
			_tmp7_ = TRUE;
			while (TRUE) {
				gboolean _tmp8_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_ = NULL;
				gint _tmp12_ = 0;
				gint _tmp13_ = 0;
				gunichar c = 0U;
				const gchar* _tmp14_ = NULL;
				gint _tmp15_ = 0;
				gchar _tmp16_ = '\0';
				gunichar _tmp17_ = 0U;
				gboolean _tmp18_ = FALSE;
				_tmp8_ = _tmp7_;
				if (!_tmp8_) {
					gint _tmp9_ = 0;
					_tmp9_ = i;
					i = _tmp9_ + 1;
				}
				_tmp7_ = FALSE;
				_tmp10_ = i;
				_tmp11_ = text;
				_tmp12_ = strlen (_tmp11_);
				_tmp13_ = _tmp12_;
				if (!(_tmp10_ < _tmp13_)) {
					break;
				}
				_tmp14_ = text;
				_tmp15_ = i;
				_tmp16_ = string_get (_tmp14_, (glong) _tmp15_);
				c = (gunichar) _tmp16_;
				_tmp17_ = c;
				_tmp18_ = g_unichar_isdigit (_tmp17_);
				if (!_tmp18_) {
					ErrorEntry* _tmp19_ = NULL;
					_tmp19_ = self->priv->entry;
					error_entry_set_error (_tmp19_, TRUE);
					_g_free0 (text);
					return;
				}
			}
		}
	}
	_tmp20_ = text;
	_tmp21_ = atoi (_tmp20_);
	line = _tmp21_;
	_tmp22_ = self->priv->entry;
	_tmp23_ = self->priv->main_window;
	_tmp24_ = main_window_get_active_document (_tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = line;
	line = _tmp26_ - 1;
	_tmp27_ = line;
	_tmp28_ = document_goto_line (_tmp25_, _tmp27_);
	error_entry_set_error (_tmp22_, !_tmp28_);
	_tmp29_ = self->priv->main_window;
	_tmp30_ = main_window_get_active_view (_tmp29_);
	_tmp31_ = _tmp30_;
	document_view_scroll_to_cursor (_tmp31_, 0.25);
	_g_free0 (text);
}


static void goto_line_class_init (GotoLineClass * klass) {
	goto_line_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GotoLinePrivate));
	G_OBJECT_CLASS (klass)->finalize = goto_line_finalize;
}


static void goto_line_instance_init (GotoLine * self) {
	self->priv = GOTO_LINE_GET_PRIVATE (self);
}


static void goto_line_finalize (GObject* obj) {
	GotoLine * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GOTO_LINE, GotoLine);
	_g_object_unref0 (self->priv->entry);
	G_OBJECT_CLASS (goto_line_parent_class)->finalize (obj);
}


GType goto_line_get_type (void) {
	static volatile gsize goto_line_type_id__volatile = 0;
	if (g_once_init_enter (&goto_line_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GotoLineClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) goto_line_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GotoLine), 0, (GInstanceInitFunc) goto_line_instance_init, NULL };
		GType goto_line_type_id;
		goto_line_type_id = g_type_register_static (GTK_TYPE_GRID, "GotoLine", &g_define_type_info, 0);
		g_once_init_leave (&goto_line_type_id__volatile, goto_line_type_id);
	}
	return goto_line_type_id__volatile;
}


static GType search_and_replace_mode_get_type (void) {
	static volatile gsize search_and_replace_mode_type_id__volatile = 0;
	if (g_once_init_enter (&search_and_replace_mode_type_id__volatile)) {
		static const GEnumValue values[] = {{SEARCH_AND_REPLACE_MODE_SEARCH, "SEARCH_AND_REPLACE_MODE_SEARCH", "search"}, {SEARCH_AND_REPLACE_MODE_SEARCH_AND_REPLACE, "SEARCH_AND_REPLACE_MODE_SEARCH_AND_REPLACE", "search-and-replace"}, {0, NULL, NULL}};
		GType search_and_replace_mode_type_id;
		search_and_replace_mode_type_id = g_enum_register_static ("SearchAndReplaceMode", values);
		g_once_init_leave (&search_and_replace_mode_type_id__volatile, search_and_replace_mode_type_id);
	}
	return search_and_replace_mode_type_id__volatile;
}


static SearchAndReplaceMode search_and_replace_get_mode (SearchAndReplace* self) {
	SearchAndReplaceMode result = 0;
	GtkArrow* _tmp0_ = NULL;
	GtkArrowType _tmp1_ = 0;
	GtkArrowType _tmp2_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_arrow;
	g_object_get (_tmp0_, "arrow-type", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == GTK_ARROW_UP) {
		result = SEARCH_AND_REPLACE_MODE_SEARCH_AND_REPLACE;
		return result;
	}
	result = SEARCH_AND_REPLACE_MODE_SEARCH;
	return result;
}


static Block29Data* block29_data_ref (Block29Data* _data29_) {
	g_atomic_int_inc (&_data29_->_ref_count_);
	return _data29_;
}


static void block29_data_unref (void * _userdata_) {
	Block29Data* _data29_;
	_data29_ = (Block29Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data29_->_ref_count_)) {
		SearchAndReplace * self;
		self = _data29_->self;
		_g_object_unref0 (_data29_->button_replace_all);
		_g_object_unref0 (_data29_->button_replace);
		_g_object_unref0 (_data29_->button_clear_replace);
		_g_object_unref0 (_data29_->button_next);
		_g_object_unref0 (_data29_->button_previous);
		_g_object_unref0 (_data29_->button_clear_find);
		_g_object_unref0 (self);
		g_slice_free (Block29Data, _data29_);
	}
}


static void __lambda98_ (SearchAndReplace* self) {
	SearchAndReplaceMode _tmp0_ = 0;
	_tmp0_ = search_and_replace_get_mode (self);
	if (_tmp0_ == SEARCH_AND_REPLACE_MODE_SEARCH_AND_REPLACE) {
		GtkArrow* _tmp1_ = NULL;
		GtkGrid* _tmp2_ = NULL;
		_tmp1_ = self->priv->_arrow;
		g_object_set (_tmp1_, "arrow-type", GTK_ARROW_DOWN, NULL);
		_tmp2_ = self->priv->_replace_grid;
		gtk_widget_hide ((GtkWidget*) _tmp2_);
	} else {
		GtkArrow* _tmp3_ = NULL;
		GtkGrid* _tmp4_ = NULL;
		_tmp3_ = self->priv->_arrow;
		g_object_set (_tmp3_, "arrow-type", GTK_ARROW_UP, NULL);
		_tmp4_ = self->priv->_replace_grid;
		gtk_widget_show ((GtkWidget*) _tmp4_);
	}
}


static void ___lambda98__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda98_ (self);
}


static void _search_and_replace_hide_gtk_button_clicked (GtkButton* _sender, gpointer self) {
	search_and_replace_hide (self);
}


static void __lambda99_ (SearchAndReplace* self) {
	ErrorEntry* _tmp0_ = NULL;
	_tmp0_ = self->priv->_entry_find;
	gtk_entry_set_text ((GtkEntry*) _tmp0_, "");
}


static void ___lambda99__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda99_ (self);
}


static void __lambda100_ (SearchAndReplace* self) {
	GtkEntry* _tmp0_ = NULL;
	_tmp0_ = self->priv->_entry_replace;
	gtk_entry_set_text (_tmp0_, "");
}


static void ___lambda100__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda100_ (self);
}


static void __lambda101_ (SearchAndReplace* self) {
	Document* _tmp0_ = NULL;
	Document* _tmp1_ = NULL;
	search_and_replace_set_search_text (self, FALSE);
	_tmp0_ = self->priv->_working_document;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_working_document;
	document_search_backward (_tmp1_);
}


static void ___lambda101__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda101_ (self);
}


static void _search_and_replace_search_forward_gtk_button_clicked (GtkButton* _sender, gpointer self) {
	search_and_replace_search_forward (self);
}


static void _search_and_replace_search_forward_gtk_entry_activate (GtkEntry* _sender, gpointer self) {
	search_and_replace_search_forward (self);
}


static void __lambda102_ (Block29Data* _data29_) {
	SearchAndReplace * self;
	gboolean sensitive = FALSE;
	ErrorEntry* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	ErrorEntry* _tmp8_ = NULL;
	guint _tmp9_ = 0U;
	guint _tmp10_ = 0U;
	self = _data29_->self;
	_tmp0_ = self->priv->_entry_find;
	_tmp1_ = gtk_entry_get_text_length ((GtkEntry*) _tmp0_);
	_tmp2_ = _tmp1_;
	sensitive = _tmp2_ > ((guint) 0);
	_tmp3_ = sensitive;
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_clear_find, _tmp3_);
	_tmp4_ = sensitive;
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_previous, _tmp4_);
	_tmp5_ = sensitive;
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_next, _tmp5_);
	_tmp6_ = sensitive;
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_replace, _tmp6_);
	_tmp7_ = sensitive;
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_replace_all, _tmp7_);
	_tmp8_ = self->priv->_entry_find;
	_tmp9_ = gtk_entry_get_text_length ((GtkEntry*) _tmp8_);
	_tmp10_ = _tmp9_;
	if (_tmp10_ == ((guint) 0)) {
		search_and_replace_clear_search (self);
	} else {
		ErrorEntry* _tmp11_ = NULL;
		guint _tmp12_ = 0U;
		guint _tmp13_ = 0U;
		gint _tmp14_ = 0;
		_tmp11_ = self->priv->_entry_find;
		_tmp12_ = gtk_entry_get_text_length ((GtkEntry*) _tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = self->priv->min_nb_chars_for_inc_search;
		if (_tmp13_ >= ((guint) _tmp14_)) {
			search_and_replace_set_search_text (self, TRUE);
		}
	}
}


static void ___lambda102__gtk_editable_changed (GtkEditable* _sender, gpointer self) {
	__lambda102_ (self);
}


static void __lambda103_ (Block29Data* _data29_) {
	SearchAndReplace * self;
	GtkEntry* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	self = _data29_->self;
	_tmp0_ = self->priv->_entry_replace;
	_tmp1_ = gtk_entry_get_text_length (_tmp0_);
	_tmp2_ = _tmp1_;
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_clear_replace, _tmp2_ > ((guint) 0));
}


static void ___lambda103__gtk_editable_changed (GtkEditable* _sender, gpointer self) {
	__lambda103_ (self);
}


static void __lambda104_ (SearchAndReplace* self) {
	search_and_replace_set_search_text (self, TRUE);
}


static void ___lambda104__gtk_check_menu_item_toggled (GtkCheckMenuItem* _sender, gpointer self) {
	__lambda104_ (self);
}


static void __lambda105_ (SearchAndReplace* self) {
	search_and_replace_set_search_text (self, TRUE);
}


static void ___lambda105__gtk_check_menu_item_toggled (GtkCheckMenuItem* _sender, gpointer self) {
	__lambda105_ (self);
}


static void _search_and_replace_replace_gtk_button_clicked (GtkButton* _sender, gpointer self) {
	search_and_replace_replace (self);
}


static void _search_and_replace_replace_gtk_entry_activate (GtkEntry* _sender, gpointer self) {
	search_and_replace_replace (self);
}


static void __lambda106_ (SearchAndReplace* self) {
	ErrorEntry* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	Document* _tmp3_ = NULL;
	GtkEntry* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	_tmp0_ = self->priv->_entry_find;
	_tmp1_ = gtk_entry_get_text_length ((GtkEntry*) _tmp0_);
	_tmp2_ = _tmp1_;
	g_return_if_fail (_tmp2_ != ((guint) 0));
	search_and_replace_set_search_text (self, TRUE);
	_tmp3_ = self->priv->_working_document;
	_tmp4_ = self->priv->_entry_replace;
	_tmp5_ = gtk_entry_get_text (_tmp4_);
	_tmp6_ = _tmp5_;
	document_replace_all (_tmp3_, _tmp6_);
}


static void ___lambda106__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda106_ (self);
}


static gboolean __lambda107_ (SearchAndReplace* self, GdkEventKey* event) {
	gboolean result = FALSE;
	GdkEventKey _tmp0_ = {0};
	guint _tmp1_ = 0U;
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = *event;
	_tmp1_ = _tmp0_.keyval;
	switch (_tmp1_) {
		case GDK_KEY_Tab:
		{
			GtkEntry* _tmp2_ = NULL;
			search_and_replace_show_search_and_replace (self);
			_tmp2_ = self->priv->_entry_replace;
			gtk_widget_grab_focus ((GtkWidget*) _tmp2_);
			result = TRUE;
			return result;
		}
		case GDK_KEY_Escape:
		{
			search_and_replace_select_current_match (self);
			search_and_replace_hide (self);
			result = TRUE;
			return result;
		}
		default:
		{
			result = FALSE;
			return result;
		}
	}
}


static gboolean ___lambda107__gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
	gboolean result;
	result = __lambda107_ (self, event);
	return result;
}


SearchAndReplace* search_and_replace_construct (GType object_type, MainWindow* main_window) {
	SearchAndReplace * self = NULL;
	Block29Data* _data29_;
	MainWindow* _tmp0_ = NULL;
	GtkGrid* _tmp1_ = NULL;
	GtkGrid* _tmp2_ = NULL;
	GtkGrid* _tmp3_ = NULL;
	GtkButton* _tmp4_ = NULL;
	GtkArrow* _tmp5_ = NULL;
	GtkButton* _tmp6_ = NULL;
	GtkArrow* _tmp7_ = NULL;
	GtkGrid* _tmp8_ = NULL;
	GtkButton* _tmp9_ = NULL;
	GtkGrid* find_grid = NULL;
	GtkGrid* _tmp10_ = NULL;
	GtkGrid* _tmp11_ = NULL;
	ErrorEntry* _tmp12_ = NULL;
	GtkButton* _tmp13_ = NULL;
	GtkButton* _tmp14_ = NULL;
	GtkButton* _tmp15_ = NULL;
	GtkButton* button_close = NULL;
	GtkButton* _tmp16_ = NULL;
	GtkGrid* _tmp17_ = NULL;
	GtkGrid* _tmp18_ = NULL;
	GtkGrid* _tmp19_ = NULL;
	GtkGrid* _tmp20_ = NULL;
	GtkGrid* _tmp21_ = NULL;
	GtkEntry* _tmp22_ = NULL;
	GtkEntry* _tmp23_ = NULL;
	const gchar* _tmp24_ = NULL;
	GtkEntry* _tmp25_ = NULL;
	GtkEntry* _tmp26_ = NULL;
	GtkGrid* _tmp27_ = NULL;
	GtkEntry* _tmp28_ = NULL;
	GtkButton* _tmp29_ = NULL;
	GtkButton* _tmp30_ = NULL;
	GtkButton* _tmp31_ = NULL;
	GtkGrid* replace_all_grid = NULL;
	GtkGrid* _tmp32_ = NULL;
	GtkImage* image = NULL;
	GtkImage* _tmp33_ = NULL;
	GtkLabel* label = NULL;
	const gchar* _tmp34_ = NULL;
	GtkLabel* _tmp35_ = NULL;
	GtkGrid* _tmp36_ = NULL;
	GtkGrid* _tmp37_ = NULL;
	GtkGrid* _tmp38_ = NULL;
	GtkButton* _tmp39_ = NULL;
	ErrorEntry* _tmp40_ = NULL;
	ErrorEntry* _tmp41_ = NULL;
	GtkEntry* _tmp42_ = NULL;
	GtkCheckMenuItem* _tmp43_ = NULL;
	GtkCheckMenuItem* _tmp44_ = NULL;
	GtkEntry* _tmp45_ = NULL;
	ErrorEntry* _tmp46_ = NULL;
	GtkGrid* _tmp47_ = NULL;
	g_return_val_if_fail (main_window != NULL, NULL);
	_data29_ = g_slice_new0 (Block29Data);
	_data29_->_ref_count_ = 1;
	self = (SearchAndReplace*) g_object_new (object_type, NULL);
	_data29_->self = g_object_ref (self);
	_tmp0_ = main_window;
	self->priv->_main_window = _tmp0_;
	_tmp1_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->_main_grid);
	self->priv->_main_grid = _tmp1_;
	_tmp2_ = self->priv->_main_grid;
	gtk_grid_set_column_spacing (_tmp2_, (guint) 3);
	_tmp3_ = self->priv->_main_grid;
	gtk_grid_set_row_spacing (_tmp3_, (guint) 3);
	_tmp4_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->_button_arrow);
	self->priv->_button_arrow = _tmp4_;
	_tmp5_ = (GtkArrow*) gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->_arrow);
	self->priv->_arrow = _tmp5_;
	_tmp6_ = self->priv->_button_arrow;
	_tmp7_ = self->priv->_arrow;
	gtk_container_add ((GtkContainer*) _tmp6_, (GtkWidget*) _tmp7_);
	_tmp8_ = self->priv->_main_grid;
	_tmp9_ = self->priv->_button_arrow;
	gtk_grid_attach (_tmp8_, (GtkWidget*) _tmp9_, 0, 0, 1, 1);
	_tmp10_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp10_);
	find_grid = _tmp10_;
	gtk_orientable_set_orientation ((GtkOrientable*) find_grid, GTK_ORIENTATION_HORIZONTAL);
	gtk_grid_set_column_spacing (find_grid, (guint) 2);
	_tmp11_ = self->priv->_main_grid;
	gtk_grid_attach (_tmp11_, (GtkWidget*) find_grid, 1, 0, 1, 1);
	search_and_replace_init_find_entry (self);
	_tmp12_ = self->priv->_entry_find;
	gtk_container_add ((GtkContainer*) find_grid, (GtkWidget*) _tmp12_);
	_tmp13_ = search_and_replace_get_button (self, GTK_STOCK_CLEAR);
	_data29_->button_clear_find = _tmp13_;
	_tmp14_ = search_and_replace_get_button (self, GTK_STOCK_GO_UP);
	_data29_->button_previous = _tmp14_;
	_tmp15_ = search_and_replace_get_button (self, GTK_STOCK_GO_DOWN);
	_data29_->button_next = _tmp15_;
	_tmp16_ = search_and_replace_get_button (self, GTK_STOCK_CLOSE);
	button_close = _tmp16_;
	gtk_container_add ((GtkContainer*) find_grid, (GtkWidget*) _data29_->button_clear_find);
	gtk_container_add ((GtkContainer*) find_grid, (GtkWidget*) _data29_->button_previous);
	gtk_container_add ((GtkContainer*) find_grid, (GtkWidget*) _data29_->button_next);
	gtk_container_add ((GtkContainer*) find_grid, (GtkWidget*) button_close);
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_clear_find, FALSE);
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_previous, FALSE);
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_next, FALSE);
	_tmp17_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp17_);
	_g_object_unref0 (self->priv->_replace_grid);
	self->priv->_replace_grid = _tmp17_;
	_tmp18_ = self->priv->_replace_grid;
	gtk_orientable_set_orientation ((GtkOrientable*) _tmp18_, GTK_ORIENTATION_HORIZONTAL);
	_tmp19_ = self->priv->_replace_grid;
	gtk_grid_set_column_spacing (_tmp19_, (guint) 2);
	_tmp20_ = self->priv->_main_grid;
	_tmp21_ = self->priv->_replace_grid;
	gtk_grid_attach (_tmp20_, (GtkWidget*) _tmp21_, 1, 1, 1, 1);
	_tmp22_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp22_);
	_g_object_unref0 (self->priv->_entry_replace);
	self->priv->_entry_replace = _tmp22_;
	_tmp23_ = self->priv->_entry_replace;
	_tmp24_ = _ ("Replace with");
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp23_, _tmp24_);
	_tmp25_ = self->priv->_entry_replace;
	g_object_set ((GtkWidget*) _tmp25_, "can-focus", TRUE, NULL);
	_tmp26_ = self->priv->_entry_replace;
	gtk_entry_set_width_chars (_tmp26_, 25);
	_tmp27_ = self->priv->_replace_grid;
	_tmp28_ = self->priv->_entry_replace;
	gtk_container_add ((GtkContainer*) _tmp27_, (GtkWidget*) _tmp28_);
	_tmp29_ = search_and_replace_get_button (self, GTK_STOCK_CLEAR);
	_data29_->button_clear_replace = _tmp29_;
	_tmp30_ = search_and_replace_get_button (self, GTK_STOCK_FIND_AND_REPLACE);
	_data29_->button_replace = _tmp30_;
	_tmp31_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp31_);
	_data29_->button_replace_all = _tmp31_;
	gtk_button_set_relief (_data29_->button_replace_all, GTK_RELIEF_NONE);
	_tmp32_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp32_);
	replace_all_grid = _tmp32_;
	gtk_orientable_set_orientation ((GtkOrientable*) replace_all_grid, GTK_ORIENTATION_HORIZONTAL);
	gtk_grid_set_column_spacing (replace_all_grid, (guint) 8);
	_tmp33_ = (GtkImage*) gtk_image_new_from_stock (GTK_STOCK_FIND_AND_REPLACE, GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp33_);
	image = _tmp33_;
	gtk_container_add ((GtkContainer*) replace_all_grid, (GtkWidget*) image);
	_tmp34_ = _ ("All");
	_tmp35_ = (GtkLabel*) gtk_label_new (_tmp34_);
	g_object_ref_sink (_tmp35_);
	label = _tmp35_;
	gtk_container_add ((GtkContainer*) replace_all_grid, (GtkWidget*) label);
	gtk_container_add ((GtkContainer*) _data29_->button_replace_all, (GtkWidget*) replace_all_grid);
	_tmp36_ = self->priv->_replace_grid;
	gtk_container_add ((GtkContainer*) _tmp36_, (GtkWidget*) _data29_->button_clear_replace);
	_tmp37_ = self->priv->_replace_grid;
	gtk_container_add ((GtkContainer*) _tmp37_, (GtkWidget*) _data29_->button_replace);
	_tmp38_ = self->priv->_replace_grid;
	gtk_container_add ((GtkContainer*) _tmp38_, (GtkWidget*) _data29_->button_replace_all);
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_clear_replace, FALSE);
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_replace, FALSE);
	gtk_widget_set_sensitive ((GtkWidget*) _data29_->button_replace_all, FALSE);
	_tmp39_ = self->priv->_button_arrow;
	g_signal_connect_object (_tmp39_, "clicked", (GCallback) ___lambda98__gtk_button_clicked, self, 0);
	g_signal_connect_object (button_close, "clicked", (GCallback) _search_and_replace_hide_gtk_button_clicked, self, 0);
	g_signal_connect_object (_data29_->button_clear_find, "clicked", (GCallback) ___lambda99__gtk_button_clicked, self, 0);
	g_signal_connect_object (_data29_->button_clear_replace, "clicked", (GCallback) ___lambda100__gtk_button_clicked, self, 0);
	g_signal_connect_object (_data29_->button_previous, "clicked", (GCallback) ___lambda101__gtk_button_clicked, self, 0);
	g_signal_connect_object (_data29_->button_next, "clicked", (GCallback) _search_and_replace_search_forward_gtk_button_clicked, self, 0);
	_tmp40_ = self->priv->_entry_find;
	g_signal_connect_object ((GtkEntry*) _tmp40_, "activate", (GCallback) _search_and_replace_search_forward_gtk_entry_activate, self, 0);
	_tmp41_ = self->priv->_entry_find;
	g_signal_connect_data ((GtkEditable*) _tmp41_, "changed", (GCallback) ___lambda102__gtk_editable_changed, block29_data_ref (_data29_), (GClosureNotify) block29_data_unref, 0);
	_tmp42_ = self->priv->_entry_replace;
	g_signal_connect_data ((GtkEditable*) _tmp42_, "changed", (GCallback) ___lambda103__gtk_editable_changed, block29_data_ref (_data29_), (GClosureNotify) block29_data_unref, 0);
	_tmp43_ = self->priv->_check_case_sensitive;
	g_signal_connect_object (_tmp43_, "toggled", (GCallback) ___lambda104__gtk_check_menu_item_toggled, self, 0);
	_tmp44_ = self->priv->_check_entire_word;
	g_signal_connect_object (_tmp44_, "toggled", (GCallback) ___lambda105__gtk_check_menu_item_toggled, self, 0);
	g_signal_connect_object (_data29_->button_replace, "clicked", (GCallback) _search_and_replace_replace_gtk_button_clicked, self, 0);
	_tmp45_ = self->priv->_entry_replace;
	g_signal_connect_object (_tmp45_, "activate", (GCallback) _search_and_replace_replace_gtk_entry_activate, self, 0);
	g_signal_connect_object (_data29_->button_replace_all, "clicked", (GCallback) ___lambda106__gtk_button_clicked, self, 0);
	_tmp46_ = self->priv->_entry_find;
	g_signal_connect_object ((GtkWidget*) _tmp46_, "key-press-event", (GCallback) ___lambda107__gtk_widget_key_press_event, self, 0);
	_tmp47_ = self->priv->_main_grid;
	gtk_widget_hide ((GtkWidget*) _tmp47_);
	_g_object_unref0 (label);
	_g_object_unref0 (image);
	_g_object_unref0 (replace_all_grid);
	_g_object_unref0 (button_close);
	_g_object_unref0 (find_grid);
	block29_data_unref (_data29_);
	_data29_ = NULL;
	return self;
}


SearchAndReplace* search_and_replace_new (MainWindow* main_window) {
	return search_and_replace_construct (TYPE_SEARCH_AND_REPLACE, main_window);
}


static Block30Data* block30_data_ref (Block30Data* _data30_) {
	g_atomic_int_inc (&_data30_->_ref_count_);
	return _data30_;
}


static void block30_data_unref (void * _userdata_) {
	Block30Data* _data30_;
	_data30_ = (Block30Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data30_->_ref_count_)) {
		SearchAndReplace * self;
		self = _data30_->self;
		_g_object_unref0 (_data30_->menu);
		_g_object_unref0 (self);
		g_slice_free (Block30Data, _data30_);
	}
}


static void __lambda97_ (Block30Data* _data30_, GtkEntryIconPosition icon_pos, GdkEvent* event) {
	SearchAndReplace * self;
	GtkEntryIconPosition _tmp0_ = 0;
	self = _data30_->self;
	g_return_if_fail (event != NULL);
	_tmp0_ = icon_pos;
	if (_tmp0_ == GTK_ENTRY_ICON_PRIMARY) {
		GdkEvent* _tmp1_ = NULL;
		GdkEventButton _tmp2_ = {0};
		guint _tmp3_ = 0U;
		GdkEvent* _tmp4_ = NULL;
		GdkEventButton _tmp5_ = {0};
		guint32 _tmp6_ = 0U;
		_tmp1_ = event;
		_tmp2_ = _tmp1_->button;
		_tmp3_ = _tmp2_.button;
		_tmp4_ = event;
		_tmp5_ = _tmp4_->button;
		_tmp6_ = _tmp5_.time;
		gtk_menu_popup (_data30_->menu, NULL, NULL, NULL, NULL, _tmp3_, _tmp6_);
	}
}


static void ___lambda97__gtk_entry_icon_press (GtkEntry* _sender, GtkEntryIconPosition p0, GdkEvent* p1, gpointer self) {
	__lambda97_ (self, p0, p1);
}


static void search_and_replace_init_find_entry (SearchAndReplace* self) {
	Block30Data* _data30_;
	ErrorEntry* _tmp0_ = NULL;
	ErrorEntry* _tmp1_ = NULL;
	GThemedIcon* _tmp2_ = NULL;
	GThemedIcon* _tmp3_ = NULL;
	ErrorEntry* _tmp4_ = NULL;
	ErrorEntry* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	ErrorEntry* _tmp7_ = NULL;
	ErrorEntry* _tmp8_ = NULL;
	GtkMenu* _tmp9_ = NULL;
	const gchar* _tmp10_ = NULL;
	GtkCheckMenuItem* _tmp11_ = NULL;
	const gchar* _tmp12_ = NULL;
	GtkCheckMenuItem* _tmp13_ = NULL;
	GtkCheckMenuItem* _tmp14_ = NULL;
	GtkCheckMenuItem* _tmp15_ = NULL;
	ErrorEntry* _tmp16_ = NULL;
	g_return_if_fail (self != NULL);
	_data30_ = g_slice_new0 (Block30Data);
	_data30_->_ref_count_ = 1;
	_data30_->self = g_object_ref (self);
	_tmp0_ = error_entry_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->_entry_find);
	self->priv->_entry_find = _tmp0_;
	_tmp1_ = self->priv->_entry_find;
	_tmp2_ = (GThemedIcon*) g_themed_icon_new_with_default_fallbacks ("document-properties-symbolic");
	_tmp3_ = _tmp2_;
	g_object_set ((GtkEntry*) _tmp1_, "primary-icon-gicon", (GIcon*) _tmp3_, NULL);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = self->priv->_entry_find;
	g_object_set ((GtkEntry*) _tmp4_, "primary-icon-activatable", TRUE, NULL);
	_tmp5_ = self->priv->_entry_find;
	_tmp6_ = _ ("Search for");
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp5_, _tmp6_);
	_tmp7_ = self->priv->_entry_find;
	g_object_set ((GtkWidget*) _tmp7_, "can-focus", TRUE, NULL);
	_tmp8_ = self->priv->_entry_find;
	gtk_entry_set_width_chars ((GtkEntry*) _tmp8_, 25);
	_tmp9_ = (GtkMenu*) gtk_menu_new ();
	g_object_ref_sink (_tmp9_);
	_data30_->menu = _tmp9_;
	_tmp10_ = _ ("Case sensitive");
	_tmp11_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_label (_tmp10_);
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->_check_case_sensitive);
	self->priv->_check_case_sensitive = _tmp11_;
	_tmp12_ = _ ("Entire words only");
	_tmp13_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_label (_tmp12_);
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->_check_entire_word);
	self->priv->_check_entire_word = _tmp13_;
	_tmp14_ = self->priv->_check_case_sensitive;
	gtk_menu_shell_append ((GtkMenuShell*) _data30_->menu, (GtkWidget*) ((GtkMenuItem*) _tmp14_));
	_tmp15_ = self->priv->_check_entire_word;
	gtk_menu_shell_append ((GtkMenuShell*) _data30_->menu, (GtkWidget*) ((GtkMenuItem*) _tmp15_));
	gtk_widget_show_all ((GtkWidget*) _data30_->menu);
	_tmp16_ = self->priv->_entry_find;
	g_signal_connect_data ((GtkEntry*) _tmp16_, "icon-press", (GCallback) ___lambda97__gtk_entry_icon_press, block30_data_ref (_data30_), (GClosureNotify) block30_data_unref, 0);
	block30_data_unref (_data30_);
	_data30_ = NULL;
}


static GtkButton* search_and_replace_get_button (SearchAndReplace* self, const gchar* stock_id) {
	GtkButton* result = NULL;
	GtkButton* button = NULL;
	GtkButton* _tmp0_ = NULL;
	GtkImage* image = NULL;
	const gchar* _tmp1_ = NULL;
	GtkImage* _tmp2_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (stock_id != NULL, NULL);
	_tmp0_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp0_);
	button = _tmp0_;
	_tmp1_ = stock_id;
	_tmp2_ = (GtkImage*) gtk_image_new_from_stock (_tmp1_, GTK_ICON_SIZE_MENU);
	g_object_ref_sink (_tmp2_);
	image = _tmp2_;
	gtk_container_add ((GtkContainer*) button, (GtkWidget*) image);
	gtk_button_set_relief (button, GTK_RELIEF_NONE);
	result = button;
	_g_object_unref0 (image);
	return result;
}


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


GtkWidget* search_and_replace_get_widget (SearchAndReplace* self) {
	GtkWidget* result = NULL;
	GtkGrid* _tmp0_ = NULL;
	GtkWidget* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_main_grid;
	_tmp1_ = _g_object_ref0 ((GtkWidget*) _tmp0_);
	result = _tmp1_;
	return result;
}


void search_and_replace_show_search (SearchAndReplace* self) {
	GtkArrow* _tmp0_ = NULL;
	GtkGrid* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_arrow;
	g_object_set (_tmp0_, "arrow-type", GTK_ARROW_DOWN, NULL);
	search_and_replace_show (self);
	_tmp1_ = self->priv->_replace_grid;
	gtk_widget_hide ((GtkWidget*) _tmp1_);
}


void search_and_replace_show_search_and_replace (SearchAndReplace* self) {
	GtkArrow* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_arrow;
	g_object_set (_tmp0_, "arrow-type", GTK_ARROW_UP, NULL);
	search_and_replace_show (self);
}


static void _search_and_replace_set_replace_sensitivity_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	search_and_replace_set_replace_sensitivity (self);
}


static void search_and_replace_show (SearchAndReplace* self) {
	MainWindow* _tmp0_ = NULL;
	DocumentTab* _tmp1_ = NULL;
	DocumentTab* _tmp2_ = NULL;
	GtkGrid* _tmp3_ = NULL;
	ErrorEntry* _tmp4_ = NULL;
	Document* doc = NULL;
	MainWindow* _tmp5_ = NULL;
	Document* _tmp6_ = NULL;
	Document* _tmp7_ = NULL;
	Document* _tmp8_ = NULL;
	Document* _tmp9_ = NULL;
	SelectionType _tmp10_ = 0;
	MainWindow* _tmp20_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_main_window;
	_tmp1_ = main_window_get_active_tab (_tmp0_);
	_tmp2_ = _tmp1_;
	g_return_if_fail (_tmp2_ != NULL);
	_tmp3_ = self->priv->_main_grid;
	gtk_widget_show_all ((GtkWidget*) _tmp3_);
	_tmp4_ = self->priv->_entry_find;
	gtk_widget_grab_focus ((GtkWidget*) _tmp4_);
	search_and_replace_set_replace_sensitivity (self);
	_tmp5_ = self->priv->_main_window;
	_tmp6_ = main_window_get_active_document (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	doc = _tmp8_;
	_tmp9_ = doc;
	_tmp10_ = document_get_selection_type (_tmp9_);
	if (_tmp10_ == SELECTION_TYPE_ONE_LINE) {
		GtkTextIter start = {0};
		GtkTextIter end = {0};
		Document* _tmp11_ = NULL;
		GtkTextIter _tmp12_ = {0};
		GtkTextIter _tmp13_ = {0};
		ErrorEntry* _tmp14_ = NULL;
		Document* _tmp15_ = NULL;
		GtkTextIter _tmp16_ = {0};
		GtkTextIter _tmp17_ = {0};
		gchar* _tmp18_ = NULL;
		gchar* _tmp19_ = NULL;
		_tmp11_ = doc;
		gtk_text_buffer_get_selection_bounds ((GtkTextBuffer*) _tmp11_, &_tmp12_, &_tmp13_);
		start = _tmp12_;
		end = _tmp13_;
		_tmp14_ = self->priv->_entry_find;
		_tmp15_ = doc;
		_tmp16_ = start;
		_tmp17_ = end;
		_tmp18_ = gtk_text_buffer_get_text ((GtkTextBuffer*) _tmp15_, &_tmp16_, &_tmp17_, FALSE);
		_tmp19_ = _tmp18_;
		gtk_entry_set_text ((GtkEntry*) _tmp14_, _tmp19_);
		_g_free0 (_tmp19_);
	}
	_tmp20_ = self->priv->_main_window;
	g_signal_connect_object ((GObject*) _tmp20_, "notify::active-document", (GCallback) _search_and_replace_set_replace_sensitivity_g_object_notify, self, 0);
	_g_object_unref0 (doc);
}


void search_and_replace_hide (SearchAndReplace* self) {
	GtkGrid* _tmp0_ = NULL;
	Document* _tmp1_ = NULL;
	MainWindow* _tmp2_ = NULL;
	DocumentView* _tmp3_ = NULL;
	DocumentView* _tmp4_ = NULL;
	MainWindow* _tmp8_ = NULL;
	guint _tmp9_ = 0U;
	GQuark _tmp10_ = 0U;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_main_grid;
	gtk_widget_hide ((GtkWidget*) _tmp0_);
	_tmp1_ = self->priv->_working_document;
	if (_tmp1_ != NULL) {
		search_and_replace_clear_search (self);
	}
	_tmp2_ = self->priv->_main_window;
	_tmp3_ = main_window_get_active_view (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ != NULL) {
		MainWindow* _tmp5_ = NULL;
		DocumentView* _tmp6_ = NULL;
		DocumentView* _tmp7_ = NULL;
		_tmp5_ = self->priv->_main_window;
		_tmp6_ = main_window_get_active_view (_tmp5_);
		_tmp7_ = _tmp6_;
		gtk_widget_grab_focus ((GtkWidget*) _tmp7_);
	}
	_tmp8_ = self->priv->_main_window;
	g_signal_parse_name ("notify::active-document", G_TYPE_OBJECT, &_tmp9_, &_tmp10_, TRUE);
	g_signal_handlers_disconnect_matched ((GObject*) _tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, _tmp10_, NULL, (GCallback) _search_and_replace_set_replace_sensitivity_g_object_notify, self);
}


static void search_and_replace_set_search_text (SearchAndReplace* self, gboolean select) {
	MainWindow* _tmp0_ = NULL;
	Document* _tmp1_ = NULL;
	Document* _tmp2_ = NULL;
	ErrorEntry* _tmp3_ = NULL;
	guint _tmp4_ = 0U;
	guint _tmp5_ = 0U;
	MainWindow* _tmp6_ = NULL;
	Document* _tmp7_ = NULL;
	Document* _tmp8_ = NULL;
	Document* _tmp9_ = NULL;
	guint nb_matches = 0U;
	Document* _tmp15_ = NULL;
	ErrorEntry* _tmp16_ = NULL;
	const gchar* _tmp17_ = NULL;
	const gchar* _tmp18_ = NULL;
	gboolean _tmp19_ = FALSE;
	gboolean _tmp20_ = FALSE;
	gboolean _tmp21_ = FALSE;
	gboolean _tmp22_ = FALSE;
	gboolean _tmp23_ = FALSE;
	guint _tmp24_ = 0U;
	ErrorEntry* _tmp25_ = NULL;
	guint _tmp26_ = 0U;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_main_window;
	_tmp1_ = main_window_get_active_document (_tmp0_);
	_tmp2_ = _tmp1_;
	g_return_if_fail (_tmp2_ != NULL);
	_tmp3_ = self->priv->_entry_find;
	_tmp4_ = gtk_entry_get_text_length ((GtkEntry*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == ((guint) 0)) {
		return;
	}
	_tmp6_ = self->priv->_main_window;
	_tmp7_ = main_window_get_active_document (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->_working_document;
	if (_tmp8_ != _tmp9_) {
		Document* _tmp10_ = NULL;
		MainWindow* _tmp11_ = NULL;
		Document* _tmp12_ = NULL;
		Document* _tmp13_ = NULL;
		Document* _tmp14_ = NULL;
		_tmp10_ = self->priv->_working_document;
		if (_tmp10_ != NULL) {
			search_and_replace_clear_search (self);
		}
		_tmp11_ = self->priv->_main_window;
		_tmp12_ = main_window_get_active_document (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = _g_object_ref0 (_tmp13_);
		_g_object_unref0 (self->priv->_working_document);
		self->priv->_working_document = _tmp14_;
	}
	_tmp15_ = self->priv->_working_document;
	_tmp16_ = self->priv->_entry_find;
	_tmp17_ = gtk_entry_get_text ((GtkEntry*) _tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = search_and_replace_get_case_sensitive (self);
	_tmp20_ = _tmp19_;
	_tmp21_ = search_and_replace_get_entire_word (self);
	_tmp22_ = _tmp21_;
	_tmp23_ = select;
	document_set_search_text (_tmp15_, _tmp18_, _tmp20_, _tmp22_, &_tmp24_, NULL, _tmp23_);
	nb_matches = _tmp24_;
	_tmp25_ = self->priv->_entry_find;
	_tmp26_ = nb_matches;
	error_entry_set_error (_tmp25_, _tmp26_ == ((guint) 0));
}


static void search_and_replace_select_current_match (SearchAndReplace* self) {
	MainWindow* _tmp0_ = NULL;
	Document* _tmp1_ = NULL;
	Document* _tmp2_ = NULL;
	Document* _tmp3_ = NULL;
	Document* _tmp4_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_main_window;
	_tmp1_ = main_window_get_active_document (_tmp0_);
	_tmp2_ = _tmp1_;
	g_return_if_fail (_tmp2_ != NULL);
	_tmp3_ = self->priv->_working_document;
	if (_tmp3_ != NULL) {
	}
	_tmp4_ = self->priv->_working_document;
	document_select_current_match (_tmp4_);
}


static void search_and_replace_search_forward (SearchAndReplace* self) {
	Document* _tmp0_ = NULL;
	Document* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	search_and_replace_set_search_text (self, FALSE);
	_tmp0_ = self->priv->_working_document;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = self->priv->_working_document;
	document_search_forward (_tmp1_);
}


static void search_and_replace_clear_search (SearchAndReplace* self) {
	Document* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_working_document;
	if (_tmp0_ != NULL) {
		Document* _tmp1_ = NULL;
		_tmp1_ = self->priv->_working_document;
		document_clear_search (_tmp1_, TRUE);
		_g_object_unref0 (self->priv->_working_document);
		self->priv->_working_document = NULL;
	}
}


static void search_and_replace_set_replace_sensitivity (SearchAndReplace* self) {
	gboolean readonly = FALSE;
	MainWindow* _tmp0_ = NULL;
	Document* _tmp1_ = NULL;
	Document* _tmp2_ = NULL;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	GtkGrid* _tmp5_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_main_window;
	_tmp1_ = main_window_get_active_document (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = document_get_readonly (_tmp2_);
	_tmp4_ = _tmp3_;
	readonly = _tmp4_;
	_tmp5_ = self->priv->_replace_grid;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp5_, !readonly);
}


static void search_and_replace_replace (SearchAndReplace* self) {
	ErrorEntry* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	Document* _tmp3_ = NULL;
	GtkEntry* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_entry_find;
	_tmp1_ = gtk_entry_get_text_length ((GtkEntry*) _tmp0_);
	_tmp2_ = _tmp1_;
	g_return_if_fail (_tmp2_ != ((guint) 0));
	search_and_replace_set_search_text (self, TRUE);
	_tmp3_ = self->priv->_working_document;
	_tmp4_ = self->priv->_entry_replace;
	_tmp5_ = gtk_entry_get_text (_tmp4_);
	_tmp6_ = _tmp5_;
	document_replace (_tmp3_, _tmp6_);
}


static gboolean search_and_replace_get_case_sensitive (SearchAndReplace* self) {
	gboolean result;
	GtkCheckMenuItem* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_check_case_sensitive;
	_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
	result = _tmp1_;
	return result;
}


static gboolean search_and_replace_get_entire_word (SearchAndReplace* self) {
	gboolean result;
	GtkCheckMenuItem* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_check_entire_word;
	_tmp1_ = gtk_check_menu_item_get_active (_tmp0_);
	result = _tmp1_;
	return result;
}


static void search_and_replace_class_init (SearchAndReplaceClass * klass) {
	search_and_replace_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (SearchAndReplacePrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_search_and_replace_get_property;
	G_OBJECT_CLASS (klass)->finalize = search_and_replace_finalize;
}


static void search_and_replace_instance_init (SearchAndReplace * self) {
	self->priv = SEARCH_AND_REPLACE_GET_PRIVATE (self);
	self->priv->min_nb_chars_for_inc_search = 3;
}


static void search_and_replace_finalize (GObject* obj) {
	SearchAndReplace * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SEARCH_AND_REPLACE, SearchAndReplace);
	_g_object_unref0 (self->priv->_working_document);
	_g_object_unref0 (self->priv->_main_grid);
	_g_object_unref0 (self->priv->_replace_grid);
	_g_object_unref0 (self->priv->_button_arrow);
	_g_object_unref0 (self->priv->_arrow);
	_g_object_unref0 (self->priv->_entry_find);
	_g_object_unref0 (self->priv->_entry_replace);
	_g_object_unref0 (self->priv->_check_case_sensitive);
	_g_object_unref0 (self->priv->_check_entire_word);
	G_OBJECT_CLASS (search_and_replace_parent_class)->finalize (obj);
}


GType search_and_replace_get_type (void) {
	static volatile gsize search_and_replace_type_id__volatile = 0;
	if (g_once_init_enter (&search_and_replace_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SearchAndReplaceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) search_and_replace_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SearchAndReplace), 0, (GInstanceInitFunc) search_and_replace_instance_init, NULL };
		GType search_and_replace_type_id;
		search_and_replace_type_id = g_type_register_static (G_TYPE_OBJECT, "SearchAndReplace", &g_define_type_info, 0);
		g_once_init_leave (&search_and_replace_type_id__volatile, search_and_replace_type_id);
	}
	return search_and_replace_type_id__volatile;
}


static void _vala_search_and_replace_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	SearchAndReplace * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_SEARCH_AND_REPLACE, SearchAndReplace);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



