aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-06-19 00:13:23 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-06-19 00:13:23 +0800
commit1a5163b53919385a751bdcfdbc20d63a9424f3d0 (patch)
tree85405c1e5b8d5988acacbe488f5e8047c749ff44 /widgets
parenta908563be0c1b07d978955d533bf4dd2a3521bef (diff)
downloadgsoc2013-evolution-1a5163b53919385a751bdcfdbc20d63a9424f3d0.tar
gsoc2013-evolution-1a5163b53919385a751bdcfdbc20d63a9424f3d0.tar.gz
gsoc2013-evolution-1a5163b53919385a751bdcfdbc20d63a9424f3d0.tar.bz2
gsoc2013-evolution-1a5163b53919385a751bdcfdbc20d63a9424f3d0.tar.lz
gsoc2013-evolution-1a5163b53919385a751bdcfdbc20d63a9424f3d0.tar.xz
gsoc2013-evolution-1a5163b53919385a751bdcfdbc20d63a9424f3d0.tar.zst
gsoc2013-evolution-1a5163b53919385a751bdcfdbc20d63a9424f3d0.zip
** Fix for bug #532597
2008-06-18 Milan Crha <mcrha@redhat.com> ** Fix for bug #532597 * e-selection-model-array.c: (e_selection_model_array_delete_rows): Do not leave selected more than one item if somebody else took care or reposition of the cursor row before the delete. svn path=/trunk/; revision=35647
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog8
-rw-r--r--widgets/misc/e-selection-model-array.c40
2 files changed, 38 insertions, 10 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index fa9ace0c85..85f63b4742 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-18 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #532597
+
+ * e-selection-model-array.c: (e_selection_model_array_delete_rows):
+ Do not leave selected more than one item if somebody else took care
+ or reposition of the cursor row before the delete.
+
2008-06-10 Milan Crha <mcrha@redhat.com>
** Fix for bug #340683
diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c
index 430caf4dd9..6dab753c70 100644
--- a/widgets/misc/e-selection-model-array.c
+++ b/widgets/misc/e-selection-model-array.c
@@ -77,18 +77,38 @@ e_selection_model_array_delete_rows(ESelectionModelArray *esma, int row, int cou
else
e_bit_array_delete(esma->eba, row, count);
- if (esma->cursor_row_sorted >= e_bit_array_bit_count (esma->eba)) {
- esma->cursor_row_sorted = e_bit_array_bit_count (esma->eba) - 1;
- esma->selection_start_row--;
- }
+ if (esma->cursor_row >= row && esma->cursor_row < row + count) {
+ /* we should move the cursor_row, because some lines before us are going to be removed */
+ if (esma->cursor_row_sorted >= e_bit_array_bit_count (esma->eba)) {
+ esma->cursor_row_sorted = e_bit_array_bit_count (esma->eba) - 1;
+ }
- if (esma->cursor_row_sorted >= 0) {
- esma->cursor_row = es_row_sorted_to_model (esma, esma->cursor_row_sorted);
- e_bit_array_change_one_row (esma->eba, esma->cursor_row, TRUE);
+ if (esma->cursor_row_sorted >= 0) {
+ esma->cursor_row = es_row_sorted_to_model (esma, esma->cursor_row_sorted);
+ esma->selection_start_row = 0;
+ e_bit_array_change_one_row (esma->eba, esma->cursor_row, TRUE);
+ } else {
+ esma->cursor_row = -1;
+ esma->cursor_row_sorted = -1;
+ esma->selection_start_row = 0;
+ }
} else {
- esma->cursor_row = -1;
- esma->cursor_row_sorted = -1;
- esma->selection_start_row = 0;
+ /* some code earlier changed the selected row, so just update the sorted one */
+ if (esma->cursor_row >= row)
+ esma->cursor_row = MAX (0, esma->cursor_row - count);
+
+ if (esma->cursor_row >= e_bit_array_bit_count (esma->eba))
+ esma->cursor_row = e_bit_array_bit_count (esma->eba) - 1;
+
+ if (esma->cursor_row >= 0) {
+ esma->cursor_row_sorted = es_row_model_to_sorted (esma, esma->cursor_row);
+ esma->selection_start_row = 0;
+ e_bit_array_change_one_row (esma->eba, esma->cursor_row, TRUE);
+ } else {
+ esma->cursor_row = -1;
+ esma->cursor_row_sorted = -1;
+ esma->selection_start_row = 0;
+ }
}
esma->selected_row = -1;