1 From: Krzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>
2 Date: Wed, 19 Jan 2011 22:12:49 +0000 (+0100)
3 Subject: gschem: fix refresh in component seleciton dialog
4 X-Git-Url: http://git.gpleda.org/?p=gaf.git;a=commitdiff_plain;h=334307f0c4f68f704eec422af077b9e32d37b177;hp=a30f00bbee18ad5140616ad6459365cb48b03ee7
6 gschem: fix refresh in component seleciton dialog
8 Block signal handler for GtkTreeSelection "updated" signal while the
9 refreshed GtkTreeModel is installed in the GtkTreeView widget.
11 This is necessary as x_compselect_callback_response cannot reliably
12 determine whether it has been triggered by update of "library" or "in
17 (cherry picked from commit 2e5decb6ff1601935cc1f005a312ca04b6d13dfb)
20 diff --git a/gschem/src/x_compselect.c b/gschem/src/x_compselect.c
21 index 13e93f4..0917b79 100644
22 --- a/gschem/src/x_compselect.c
23 +++ b/gschem/src/x_compselect.c
24 @@ -810,6 +810,7 @@ compselect_callback_refresh_library (GtkButton *button, gpointer user_data)
26 Compselect *compselect = COMPSELECT (user_data);
28 + GtkTreeSelection *selection;
30 /* Rescan the libraries for symbols */
32 @@ -826,11 +827,26 @@ compselect_callback_refresh_library (GtkButton *button, gpointer user_data)
36 + /* Block handling selection updated for duration of model changes */
37 + selection = gtk_tree_view_get_selection (compselect->libtreeview);
38 + g_signal_handlers_block_by_func (selection,
39 + compselect_callback_tree_selection_changed,
42 + /* Update the view model with signals blocked */
43 gtk_tree_view_set_model (compselect->libtreeview, model);
45 /* Refresh the "In Use" view */
46 model = create_inuse_tree_model (compselect);
48 + /* Here we can update the model without blocking signals
49 + * as this is the second (final) tree view we are updating */
50 gtk_tree_view_set_model (compselect->inusetreeview, model);
52 + /* Unblock & fire handler for libtreeview selection */
53 + g_signal_handlers_unblock_by_func (selection,
54 + compselect_callback_tree_selection_changed,
58 /*! \brief Creates the treeview for the "In Use" view. */