[gedit] Documents panel misbehaves when adding new tabs.
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Documents panel misbehaves when adding new tabs.
- Date: Mon, 26 Dec 2011 15:17:23 +0000 (UTC)
commit 983d4c0cf22854d4144a64e995c1276ed5c1eb21
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Dec 26 16:19:14 2011 +0100
Documents panel misbehaves when adding new tabs.
Block the selection changed callback while refresing the list.
gedit/gedit-documents-panel.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gedit/gedit-documents-panel.c b/gedit/gedit-documents-panel.c
index a03af3d..a098892 100644
--- a/gedit/gedit-documents-panel.c
+++ b/gedit/gedit-documents-panel.c
@@ -53,6 +53,7 @@ struct _GeditDocumentsPanelPrivate
GtkWidget *treeview;
GtkTreeModel *model;
+ guint selection_changed_handler_id;
guint refresh_idle_id;
guint adding_tab : 1;
@@ -410,8 +411,13 @@ refresh_notebook_foreach (GeditNotebook *notebook,
static gboolean
refresh_list_idle (GeditDocumentsPanel *panel)
{
+ GtkTreeSelection *selection;
+
gedit_debug (DEBUG_PANEL);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->priv->treeview));
+ g_signal_handler_block (selection, panel->priv->selection_changed_handler_id);
+
gtk_tree_store_clear (GTK_TREE_STORE (panel->priv->model));
panel->priv->adding_tab = TRUE;
@@ -426,6 +432,8 @@ refresh_list_idle (GeditDocumentsPanel *panel)
panel->priv->refresh_idle_id = 0;
+ g_signal_handler_unblock (selection, panel->priv->selection_changed_handler_id);
+
return FALSE;
}
@@ -1162,10 +1170,10 @@ gedit_documents_panel_init (GeditDocumentsPanel *panel)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (panel->priv->treeview));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- g_signal_connect (selection,
- "changed",
- G_CALLBACK (treeview_selection_changed),
- panel);
+ panel->priv->selection_changed_handler_id = g_signal_connect (selection,
+ "changed",
+ G_CALLBACK (treeview_selection_changed),
+ panel);
g_signal_connect (panel->priv->treeview,
"button-press-event",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]