[balsa] balsa-index: minor cleanup
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] balsa-index: minor cleanup
- Date: Thu, 9 Jan 2020 16:25:32 +0000 (UTC)
commit 83a023ce35a4533159aec15a89269e340589e185
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Jan 9 11:24:59 2020 -0500
balsa-index: minor cleanup
* src/balsa-index.c (bndx_scroll_on_open_idle): rename 'total'
to 'n_children', as in:
(balsa_index_ensure_visible): use
gtk_tree_path_new_from_indices() instead of
gtk_tree_model_iter_nth_child() and gtk_tree_model_get_path().
ChangeLog | 10 ++++++++++
src/balsa-index.c | 18 +++++++-----------
2 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fe737f2a1..b61ce6f11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-09 Peter Bloomfield <pbloomfield bellsouth net>
+
+ balsa-index: minor cleanup
+
+ * src/balsa-index.c (bndx_scroll_on_open_idle): rename 'total'
+ to 'n_children', as in:
+ (balsa_index_ensure_visible): use
+ gtk_tree_path_new_from_indices() instead of
+ gtk_tree_model_iter_nth_child() and gtk_tree_model_get_path().
+
2020-01-08 Peter Bloomfield <pbloomfield bellsouth net>
libbalsa/x509-cert-widget: keep scan-build happy
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 789c64493..673b51be7 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -839,11 +839,11 @@ bndx_scroll_on_open_idle(BalsaIndex *bindex)
alternative which is to scroll to the most recently
delivered does not feel natural when other sorting order is
used */
- int total = gtk_tree_model_iter_n_children
- (GTK_TREE_MODEL(mailbox), NULL);
- if(total == 0)
+ gint n_children =
+ gtk_tree_model_iter_n_children(GTK_TREE_MODEL(mailbox), NULL);
+ if (n_children == 0)
return FALSE;
- path = gtk_tree_path_new_from_indices(total - 1, -1);
+ path = gtk_tree_path_new_from_indices(n_children - 1, -1);
}
bndx_expand_to_row(bindex, path);
@@ -2752,16 +2752,12 @@ balsa_index_ensure_visible(BalsaIndex * index)
model = gtk_tree_view_get_model(tree_view);
n_children = gtk_tree_model_iter_n_children(model, NULL);
- if (n_children > 0) {
- GtkTreeIter iter;
- gtk_tree_model_iter_nth_child(model, &iter, NULL,
- --n_children);
- path = gtk_tree_model_get_path(model, &iter);
- }
+ if (n_children > 0)
+ path = gtk_tree_path_new_from_indices(n_children - 1, -1);
}
}
- if (path) {
+ if (path != NULL) {
gtk_tree_view_scroll_to_cell(tree_view, path, NULL, FALSE, 0, 0);
gtk_tree_path_free(path);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]