/* dialog.c generated by valac 0.29.1, the Vala compiler
 * generated from dialog.vala, do not modify */

/*
* Copyright (C) 2015 The Lemon Man
*
* This program 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 2, or (at your option)
* any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

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


#define GEDIT_FIND_IN_FILES_PLUGIN_TYPE_FIND_DIALOG (gedit_find_in_files_plugin_find_dialog_get_type ())
#define GEDIT_FIND_IN_FILES_PLUGIN_FIND_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_FIND_DIALOG, GeditFindInFilesPluginFindDialog))
#define GEDIT_FIND_IN_FILES_PLUGIN_FIND_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_FIND_DIALOG, GeditFindInFilesPluginFindDialogClass))
#define GEDIT_FIND_IN_FILES_PLUGIN_IS_FIND_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_FIND_DIALOG))
#define GEDIT_FIND_IN_FILES_PLUGIN_IS_FIND_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_FIND_DIALOG))
#define GEDIT_FIND_IN_FILES_PLUGIN_FIND_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_FIND_IN_FILES_PLUGIN_TYPE_FIND_DIALOG, GeditFindInFilesPluginFindDialogClass))

typedef struct _GeditFindInFilesPluginFindDialog GeditFindInFilesPluginFindDialog;
typedef struct _GeditFindInFilesPluginFindDialogClass GeditFindInFilesPluginFindDialogClass;
typedef struct _GeditFindInFilesPluginFindDialogPrivate GeditFindInFilesPluginFindDialogPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _GeditFindInFilesPluginFindDialog {
	GtkDialog parent_instance;
	GeditFindInFilesPluginFindDialogPrivate * priv;
	GtkEntry* search_entry;
	GtkFileChooserButton* sel_folder;
	GtkCheckButton* match_case_checkbutton;
	GtkCheckButton* entire_word_checkbutton;
	GtkCheckButton* regex_checkbutton;
	GtkWidget* find_button;
};

struct _GeditFindInFilesPluginFindDialogClass {
	GtkDialogClass parent_class;
};


static gpointer gedit_find_in_files_plugin_find_dialog_parent_class = NULL;
static GType gedit_find_in_files_plugin_find_dialog_type_id = 0;

GType gedit_find_in_files_plugin_find_dialog_get_type (void) G_GNUC_CONST;
GType gedit_find_in_files_plugin_find_dialog_register_type (GTypeModule * module);
enum  {
	GEDIT_FIND_IN_FILES_PLUGIN_FIND_DIALOG_DUMMY_PROPERTY
};
GeditFindInFilesPluginFindDialog* gedit_find_in_files_plugin_find_dialog_new (GFile* root);
GeditFindInFilesPluginFindDialog* gedit_find_in_files_plugin_find_dialog_construct (GType object_type, GFile* root);
static void __lambda4_ (GeditFindInFilesPluginFindDialog* self);
static void ___lambda4__gtk_editable_changed (GtkEditable* _sender, gpointer self);
static void gedit_find_in_files_plugin_find_dialog_finalize (GObject* obj);


static void __lambda4_ (GeditFindInFilesPluginFindDialog* self) {
	GtkWidget* _tmp0_ = NULL;
	GtkEntry* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	_tmp0_ = self->find_button;
	_tmp1_ = self->search_entry;
	_tmp2_ = gtk_entry_get_text (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_widget_set_sensitive (_tmp0_, g_strcmp0 (_tmp3_, "") != 0);
}


static void ___lambda4__gtk_editable_changed (GtkEditable* _sender, gpointer self) {
	__lambda4_ ((GeditFindInFilesPluginFindDialog*) self);
}


GeditFindInFilesPluginFindDialog* gedit_find_in_files_plugin_find_dialog_construct (GType object_type, GFile* root) {
	GeditFindInFilesPluginFindDialog * self = NULL;
	GFile* _tmp0_ = NULL;
	GtkSettings* _tmp5_ = NULL;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	GtkEntry* _tmp14_ = NULL;
	GError * _inner_error_ = NULL;
	self = (GeditFindInFilesPluginFindDialog*) g_object_new (object_type, NULL);
	_tmp0_ = root;
	if (_tmp0_ != NULL) {
		{
			GtkFileChooserButton* _tmp1_ = NULL;
			GFile* _tmp2_ = NULL;
			_tmp1_ = self->sel_folder;
			_tmp2_ = root;
			gtk_file_chooser_set_current_folder_file ((GtkFileChooser*) _tmp1_, _tmp2_, &_inner_error_);
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* err = NULL;
			GError* _tmp3_ = NULL;
			const gchar* _tmp4_ = NULL;
			err = _inner_error_;
			_inner_error_ = NULL;
			_tmp3_ = err;
			_tmp4_ = _tmp3_->message;
			g_warning ("dialog.vala:43: %s", _tmp4_);
			_g_error_free0 (err);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
	}
	gtk_dialog_set_default_response ((GtkDialog*) self, (gint) GTK_RESPONSE_OK);
	gtk_dialog_set_response_sensitive ((GtkDialog*) self, (gint) GTK_RESPONSE_OK, FALSE);
	_tmp5_ = gtk_settings_get_default ();
	g_object_get (_tmp5_, "gtk-dialogs-use-header", &_tmp6_, NULL);
	_tmp7_ = _tmp6_;
	if (_tmp7_) {
		GtkHeaderBar* header_bar = NULL;
		GtkHeaderBar* _tmp8_ = NULL;
		GtkHeaderBar* _tmp9_ = NULL;
		const gchar* _tmp10_ = NULL;
		GtkHeaderBar* _tmp11_ = NULL;
		GtkHeaderBar* _tmp12_ = NULL;
		_tmp8_ = (GtkHeaderBar*) gtk_header_bar_new ();
		g_object_ref_sink (_tmp8_);
		header_bar = _tmp8_;
		_tmp9_ = header_bar;
		_tmp10_ = _ ("Find in Files");
		gtk_header_bar_set_title (_tmp9_, _tmp10_);
		_tmp11_ = header_bar;
		gtk_header_bar_set_show_close_button (_tmp11_, TRUE);
		_tmp12_ = header_bar;
		gtk_window_set_titlebar ((GtkWindow*) self, (GtkWidget*) _tmp12_);
		_g_object_unref0 (header_bar);
	} else {
		const gchar* _tmp13_ = NULL;
		_tmp13_ = _ ("_Close");
		gtk_dialog_add_button ((GtkDialog*) self, _tmp13_, (gint) GTK_RESPONSE_CLOSE);
	}
	_tmp14_ = self->search_entry;
	g_signal_connect_object ((GtkEditable*) _tmp14_, "changed", (GCallback) ___lambda4__gtk_editable_changed, self, 0);
	return self;
}


GeditFindInFilesPluginFindDialog* gedit_find_in_files_plugin_find_dialog_new (GFile* root) {
	return gedit_find_in_files_plugin_find_dialog_construct (GEDIT_FIND_IN_FILES_PLUGIN_TYPE_FIND_DIALOG, root);
}


static void gedit_find_in_files_plugin_find_dialog_class_init (GeditFindInFilesPluginFindDialogClass * klass) {
	gedit_find_in_files_plugin_find_dialog_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = gedit_find_in_files_plugin_find_dialog_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/gedit/plugins/findinfiles/ui/dialog.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "search_entry", FALSE, G_STRUCT_OFFSET (GeditFindInFilesPluginFindDialog, search_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "sel_folder", FALSE, G_STRUCT_OFFSET (GeditFindInFilesPluginFindDialog, sel_folder));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "match_case_checkbutton", FALSE, G_STRUCT_OFFSET (GeditFindInFilesPluginFindDialog, match_case_checkbutton));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "entire_word_checkbutton", FALSE, G_STRUCT_OFFSET (GeditFindInFilesPluginFindDialog, entire_word_checkbutton));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "regex_checkbutton", FALSE, G_STRUCT_OFFSET (GeditFindInFilesPluginFindDialog, regex_checkbutton));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "find_button", FALSE, G_STRUCT_OFFSET (GeditFindInFilesPluginFindDialog, find_button));
}


static void gedit_find_in_files_plugin_find_dialog_instance_init (GeditFindInFilesPluginFindDialog * self) {
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void gedit_find_in_files_plugin_find_dialog_finalize (GObject* obj) {
	GeditFindInFilesPluginFindDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEDIT_FIND_IN_FILES_PLUGIN_TYPE_FIND_DIALOG, GeditFindInFilesPluginFindDialog);
	_g_object_unref0 (self->search_entry);
	_g_object_unref0 (self->sel_folder);
	_g_object_unref0 (self->match_case_checkbutton);
	_g_object_unref0 (self->entire_word_checkbutton);
	_g_object_unref0 (self->regex_checkbutton);
	_g_object_unref0 (self->find_button);
	G_OBJECT_CLASS (gedit_find_in_files_plugin_find_dialog_parent_class)->finalize (obj);
}


GType gedit_find_in_files_plugin_find_dialog_get_type (void) {
	return gedit_find_in_files_plugin_find_dialog_type_id;
}


GType gedit_find_in_files_plugin_find_dialog_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GeditFindInFilesPluginFindDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gedit_find_in_files_plugin_find_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeditFindInFilesPluginFindDialog), 0, (GInstanceInitFunc) gedit_find_in_files_plugin_find_dialog_instance_init, NULL };
	gedit_find_in_files_plugin_find_dialog_type_id = g_type_module_register_type (module, gtk_dialog_get_type (), "GeditFindInFilesPluginFindDialog", &g_define_type_info, 0);
	return gedit_find_in_files_plugin_find_dialog_type_id;
}



