[libdazzle] suggestion: allow wrapping when no selection is active
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] suggestion: allow wrapping when no selection is active
- Date: Mon, 21 Jan 2019 18:49:13 +0000 (UTC)
commit 31af551e97fcb7e248e7740d7c7e1d59ae9807cb
Author: Christian Hergert <chergert redhat com>
Date: Mon Jan 21 10:48:49 2019 -0800
suggestion: allow wrapping when no selection is active
Pressing Up while no selection is active will jump to the last row.
src/suggestions/dzl-suggestion-popover.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/suggestions/dzl-suggestion-popover.c b/src/suggestions/dzl-suggestion-popover.c
index 06f259e..a2b92f2 100644
--- a/src/suggestions/dzl-suggestion-popover.c
+++ b/src/suggestions/dzl-suggestion-popover.c
@@ -949,11 +949,19 @@ dzl_suggestion_popover_move_by (DzlSuggestionPopover *self,
g_return_if_fail (DZL_IS_SUGGESTION_POPOVER (self));
- if (NULL == (row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->list_box), 0)))
+ if (!(row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->list_box), 0)))
return;
- if (NULL == gtk_list_box_get_selected_row (GTK_LIST_BOX (self->list_box)))
+ if (!gtk_list_box_get_selected_row (GTK_LIST_BOX (self->list_box)))
{
+ if (amount < 0)
+ {
+ guint n_items = g_list_model_get_n_items (self->model);
+
+ if (n_items > 0)
+ row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->list_box), n_items - 1);
+ }
+
dzl_suggestion_popover_select_row (self, row);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]