/* dialog.c generated by valac 0.40.2, 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;
enum {
GEDIT_FIND_IN_FILES_PLUGIN_FIND_DIALOG_0_PROPERTY,
GEDIT_FIND_IN_FILES_PLUGIN_FIND_DIALOG_NUM_PROPERTIES
};
static GParamSpec* gedit_find_in_files_plugin_find_dialog_properties[GEDIT_FIND_IN_FILES_PLUGIN_FIND_DIALOG_NUM_PROPERTIES];
#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;
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_;
GtkEntry* _tmp1_;
const gchar* _tmp2_;
const gchar* _tmp3_;
_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;
GtkSettings* _tmp3_;
gboolean _tmp4_;
gboolean _tmp5_;
GtkEntry* _tmp10_;
GError * _inner_error_ = NULL;
self = (GeditFindInFilesPluginFindDialog*) g_object_new (object_type, NULL);
if (root != NULL) {
{
GtkFileChooserButton* _tmp0_;
_tmp0_ = self->sel_folder;
gtk_file_chooser_set_current_folder_file ((GtkFileChooser*) _tmp0_, root, &_inner_error_);
if (G_UNLIKELY (_inner_error_ != NULL)) {
goto __catch0_g_error;
}
}
goto __finally0;
__catch0_g_error:
{
GError* err = NULL;
GError* _tmp1_;
const gchar* _tmp2_;
err = _inner_error_;
_inner_error_ = NULL;
_tmp1_ = err;
_tmp2_ = _tmp1_->message;
g_warning ("dialog.vala:43: %s", _tmp2_);
_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);
_tmp3_ = gtk_settings_get_default ();
g_object_get (_tmp3_, "gtk-dialogs-use-header", &_tmp4_, NULL);
_tmp5_ = _tmp4_;
if (_tmp5_) {
GtkHeaderBar* header_bar = NULL;
GtkHeaderBar* _tmp6_;
GtkHeaderBar* _tmp7_;
GtkHeaderBar* _tmp8_;
GtkHeaderBar* _tmp9_;
_tmp6_ = (GtkHeaderBar*) gtk_header_bar_new ();
g_object_ref_sink (_tmp6_);
header_bar = _tmp6_;
_tmp7_ = header_bar;
gtk_header_bar_set_title (_tmp7_, _ ("Find in Files"));
_tmp8_ = header_bar;
gtk_header_bar_set_show_close_button (_tmp8_, TRUE);
_tmp9_ = header_bar;
gtk_window_set_titlebar ((GtkWindow*) self, (GtkWidget*) _tmp9_);
_g_object_unref0 (header_bar);
} else {
gtk_dialog_add_button ((GtkDialog*) self, _ ("_Close"), (gint) GTK_RESPONSE_CLOSE);
}
_tmp10_ = self->search_entry;
g_signal_connect_object ((GtkEditable*) _tmp10_, "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;
}