[gedit] HighLightMode dialog: fix
- From: Sebastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] HighLightMode dialog: fix
- Date: Wed, 5 Nov 2014 17:52:46 +0000 (UTC)
commit 1d88423668f829f6f28581232bf223f0525f3bc8
Author: Sebastien Lafargue <slafargue gnome org>
Date: Wed Nov 5 17:59:56 2014 +0100
HighLightMode dialog: fix
The selector is destroyed before we had time to activate the
selected language.
gedit/gedit-highlight-mode-dialog.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/gedit/gedit-highlight-mode-dialog.c b/gedit/gedit-highlight-mode-dialog.c
index 81ed4d5..bb5c75a 100644
--- a/gedit/gedit-highlight-mode-dialog.c
+++ b/gedit/gedit-highlight-mode-dialog.c
@@ -25,6 +25,7 @@
struct _GeditHighlightModeDialogPrivate
{
GeditHighlightModeSelector *selector;
+ gulong on_language_selected_id;
};
G_DEFINE_TYPE_WITH_PRIVATE (GeditHighlightModeDialog, gedit_highlight_mode_dialog, GTK_TYPE_DIALOG)
@@ -37,13 +38,12 @@ gedit_highlight_mode_dialog_response (GtkDialog *dialog,
if (response_id == GTK_RESPONSE_OK)
{
- /* The dialog will be destroyed if a language is selected */
+ g_signal_handler_block (priv->selector, priv->on_language_selected_id);
gedit_highlight_mode_selector_activate_selected_language (priv->selector);
+ g_signal_handler_unblock (priv->selector, priv->on_language_selected_id);
}
- else
- {
- gtk_widget_destroy (GTK_WIDGET (dialog));
- }
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
@@ -51,6 +51,12 @@ on_language_selected (GeditHighlightModeSelector *sel,
GtkSourceLanguage *language,
GtkDialog *dialog)
{
+ GeditHighlightModeDialogPrivate *priv = GEDIT_HIGHLIGHT_MODE_DIALOG (dialog)->priv;
+
+ g_signal_handler_block (priv->selector, priv->on_language_selected_id);
+ gedit_highlight_mode_selector_activate_selected_language (priv->selector);
+ g_signal_handler_unblock (priv->selector, priv->on_language_selected_id);
+
gtk_widget_destroy (GTK_WIDGET (dialog));
}
@@ -76,8 +82,8 @@ gedit_highlight_mode_dialog_init (GeditHighlightModeDialog *dlg)
gtk_widget_init_template (GTK_WIDGET (dlg));
gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK);
- g_signal_connect (dlg->priv->selector, "language-selected",
- G_CALLBACK (on_language_selected), dlg);
+ dlg->priv->on_language_selected_id = g_signal_connect (dlg->priv->selector, "language-selected",
+ G_CALLBACK (on_language_selected), dlg);
}
GtkWidget *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]