[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Sun, 20 Mar 2022 04:55:22 -0400 (EDT) |
branch: master
commit b4308708cbacd8bd37066e4497c3a3c4b7ee1191
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Mon Oct 21 12:41:59 2019 +0100
change selection mode to avoid gtk_tree_store_clear causing callbacks
---
js/infog/extension.c | 1 -
js/infog/main.c | 22 +++++++++++++++++++---
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/js/infog/extension.c b/js/infog/extension.c
index 712fb89ded..65b6996cc1 100644
--- a/js/infog/extension.c
+++ b/js/infog/extension.c
@@ -344,7 +344,6 @@ send_toc (WebKitDOMDocument *dom_document)
e = webkit_dom_element_get_next_element_sibling (e);
}
- g_print ("BUILT TOC %s\n", toc->str);
packetize ("toc", toc);
g_string_free (toc, TRUE);
}
diff --git a/js/infog/main.c b/js/infog/main.c
index 85f38226f8..c1ce13b78a 100644
--- a/js/infog/main.c
+++ b/js/infog/main.c
@@ -254,7 +254,7 @@ load_toc (char *p)
if (!q2)
break;
*q2++ = 0;
- debug (1, "add toc entry %s:%s\n", p, q);
+ debug (2, "add toc entry %s:%s\n", p, q);
gtk_tree_store_append (toc_store, &iter, NULL);
gtk_tree_store_set (toc_store, &iter,
@@ -272,9 +272,14 @@ toc_selected_cb (GtkTreeSelection *selection, gpointer
user_data)
GtkTreeModel *model;
char *url;
+ debug (1, "TOC ENTRY SELECTED\n");
+
success = gtk_tree_selection_get_selected (selection, &model, &iter);
if (!success)
- return;
+ {
+ debug (1, "NONE SELECTED\n");
+ return;
+ }
gtk_tree_model_get (model, &iter, 1, &url, -1);
@@ -339,7 +344,17 @@ socket_cb (GSocket *socket,
debug (1, "NEW MANUAL %s\n", p + 1);
clear_completions ();
if (toc_store)
- gtk_tree_store_clear (toc_store);
+ {
+ gtk_tree_selection_set_mode (toc_selection, GTK_SELECTION_NONE);
+ gtk_tree_store_clear (toc_store);
+ gtk_tree_selection_set_mode (toc_selection,
+ GTK_SELECTION_SINGLE);
+ /* If we do not change the selection mode, it appears that
+ gtk_tree_store_clear causes every row to be selected in turn,
+ so toc_selected_cb runs and loads all the nodes in the old
+ manual. */
+ }
+ debug (1, "CLEARED TOC %s\n", p + 1);
char *q = strchr (p + 1, '\n');
if (!q)
@@ -543,6 +558,7 @@ build_gui (void)
toc_pane = GTK_TREE_VIEW(gtk_tree_view_new ());
gtk_tree_view_set_headers_visible (toc_pane, FALSE);
toc_selection = gtk_tree_view_get_selection (toc_pane);
+ gtk_tree_selection_set_mode (toc_selection, GTK_SELECTION_SINGLE);
g_signal_connect (toc_selection, "changed",
G_CALLBACK(toc_selected_cb), NULL);
- [no subject], (continued)
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject],
Gavin D. Smith <=
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20