[gtk+] listbox: Fix shift-selection
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] listbox: Fix shift-selection
- Date: Sun, 26 Jul 2015 06:41:42 +0000 (UTC)
commit 58fa3d96a81e2849dba7d49e7cebf6544d192bc3
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jul 26 02:40:26 2015 -0400
listbox: Fix shift-selection
Selecting a range of rows with Shift-click was accidentally broken
in e6e511eb460d8fcd. Make it work again.
gtk/gtklistbox.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 2aa372b..8f3926d 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -1034,10 +1034,7 @@ gtk_list_box_set_selection_mode (GtkListBox *box,
if (mode == GTK_SELECTION_NONE ||
priv->selection_mode == GTK_SELECTION_MULTIPLE)
- {
- dirty = gtk_list_box_unselect_all_internal (box);
- priv->selected_row = NULL;
- }
+ dirty = gtk_list_box_unselect_all_internal (box);
priv->selection_mode = mode;
@@ -1649,15 +1646,20 @@ gtk_list_box_update_selection (GtkListBox *box,
{
if (extend)
{
+ GtkListBoxRow *selected_row;
+
+ selected_row = priv->selected_row;
+
gtk_list_box_unselect_all_internal (box);
- if (priv->selected_row == NULL)
+
+ if (selected_row == NULL)
{
gtk_list_box_row_set_selected (row, TRUE);
priv->selected_row = row;
g_signal_emit (box, signals[ROW_SELECTED], 0, row);
}
else
- gtk_list_box_select_all_between (box, priv->selected_row, row, FALSE);
+ gtk_list_box_select_all_between (box, selected_row, row, FALSE);
}
else
{
@@ -1904,7 +1906,6 @@ gtk_list_box_multipress_gesture_released (GtkGestureMultiPress *gesture,
gboolean extend;
get_current_selection_modifiers (GTK_WIDGET (box), &modify, &extend);
-
/* With touch, we default to modifying the selection.
* You can still clear the selection and start over
* by holding Ctrl.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]