[libgd] gd-main-view: Make selection_mode_do_select_range handle any order
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd] gd-main-view: Make selection_mode_do_select_range handle any order
- Date: Thu, 11 Apr 2013 20:29:35 +0000 (UTC)
commit 70f3b79601d3c11839c134b1a959472a9d66fc23
Author: Alexander Larsson <alexl redhat com>
Date: Thu Apr 11 11:17:06 2013 +0200
gd-main-view: Make selection_mode_do_select_range handle any order
This makes the function work no matter what order the two iters
are in the model, where previously it would break unless first_element
was before last_element.
https://bugzilla.gnome.org/show_bug.cgi?id=697645
libgd/gd-main-view.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/libgd/gd-main-view.c b/libgd/gd-main-view.c
index 97136d3..8b54ca3 100644
--- a/libgd/gd-main-view.c
+++ b/libgd/gd-main-view.c
@@ -327,8 +327,19 @@ selection_mode_do_select_range (GdMainView *self,
GtkTreePath *path, *last_path;
gboolean equal;
+ path = gtk_tree_model_get_path (self->priv->model, first_element);
last_path = gtk_tree_model_get_path (self->priv->model, last_element);
- iter = *first_element;
+ if (gtk_tree_path_compare (path, last_path) > 0)
+ {
+ gtk_tree_path_free (last_path);
+ last_path = path;
+ iter = *last_element;
+ }
+ else
+ {
+ gtk_tree_path_free (path);
+ iter = *first_element;
+ }
do
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]