[gedit] spell plugin dialog: close the dialog with Escape
- From: Sebastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] spell plugin dialog: close the dialog with Escape
- Date: Fri, 19 Dec 2014 20:55:29 +0000 (UTC)
commit a33a02062d35985af643a6cfc101ded8c2388e0e
Author: Sebastien Lafargue <slafargue gnome org>
Date: Fri Dec 19 18:22:12 2014 +0100
spell plugin dialog: close the dialog with Escape
Add a binding on Escape to close the dialog
( it's a gtkwindow not a gtkdialog so we don't
have it by default )
We declare a "close" signal so the default behaviour
can be overwritten if needed.
plugins/spell/gedit-spell-checker-dialog.c | 23 +++++++++++++++++++++++
plugins/spell/gedit-spell-checker-dialog.h | 2 ++
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/plugins/spell/gedit-spell-checker-dialog.c b/plugins/spell/gedit-spell-checker-dialog.c
index c9a9bf9..dcc5b2d 100644
--- a/plugins/spell/gedit-spell-checker-dialog.c
+++ b/plugins/spell/gedit-spell-checker-dialog.c
@@ -62,6 +62,7 @@ enum
CHANGE,
CHANGE_ALL,
ADD_WORD_TO_PERSONAL,
+ CLOSE,
LAST_SIGNAL
};
@@ -127,13 +128,25 @@ gedit_spell_checker_dialog_finalize (GObject *object)
}
static void
+gedit_spell_checker_dialog_close (GeditSpellCheckerDialog *dlg)
+{
+ gtk_window_close (GTK_WINDOW (dlg));
+}
+
+static void
gedit_spell_checker_dialog_class_init (GeditSpellCheckerDialogClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkBindingSet *binding_set;
object_class->dispose = gedit_spell_checker_dialog_dispose;
object_class->finalize = gedit_spell_checker_dialog_finalize;
+ klass->close = gedit_spell_checker_dialog_close;
+
+ binding_set = gtk_binding_set_by_class (klass);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0);
+
signals[IGNORE] =
g_signal_new ("ignore",
G_OBJECT_CLASS_TYPE (object_class),
@@ -190,6 +203,16 @@ gedit_spell_checker_dialog_class_init (GeditSpellCheckerDialogClass * klass)
G_TYPE_NONE,
1,
G_TYPE_STRING);
+
+ signals[CLOSE] =
+ g_signal_new ("close",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GeditSpellCheckerDialogClass, close),
+ NULL, NULL,
+ gedit_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
}
static void
diff --git a/plugins/spell/gedit-spell-checker-dialog.h b/plugins/spell/gedit-spell-checker-dialog.h
index 39571ae..857591a 100644
--- a/plugins/spell/gedit-spell-checker-dialog.h
+++ b/plugins/spell/gedit-spell-checker-dialog.h
@@ -57,6 +57,8 @@ struct _GeditSpellCheckerDialogClass
void (*add_word_to_personal) (GeditSpellCheckerDialog *dlg,
const gchar *word);
+ /* Keybinding signal */
+ void (*close) (GeditSpellCheckerDialog *dlg);
};
GType gedit_spell_checker_dialog_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]