[hyena/gtk3] ListView: zero vadjustment values also when model.Count is zero
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena/gtk3] ListView: zero vadjustment values also when model.Count is zero
- Date: Fri, 6 Sep 2013 11:21:23 +0000 (UTC)
commit fa67b296a577d5ee3a555fc9396b142b85dc9e9a
Author: Andrés G. Aragoneses <knocte gmail com>
Date: Fri Sep 6 13:20:24 2013 +0200
ListView: zero vadjustment values also when model.Count is zero
One of the edge cases fixed by this recent commit [1] consisted of
zeroing all values of the vadjustment object when there were no rows
to show (model == null).
But, as evidenced when adding and subsequently removing tracks from
Banshee's PlayQueueSource as an example, there are obvious cases in
which model can be not null and still not hold anything to show in
the widget (model.Count == 0).
So the block where we zero all VAdjustment values (Upper, Lower,
PageSize, PageIncrement, StepIncrement, Value) needs to cover also
the case when model.Count == 0, otherwise there would be still some
rendering issues (SizeAllocated calls with negative coordinates).
We also add a TODO comment in this commit, to remind us in the future
that we could use Linq in the model to be a bit more efficient here.
[1] https://git.gnome.org/browse/hyena/commit/?h=gtk3&id=0745bfb75809886925dfa49a57c79e5f71565d08
.../ListView/ListView_Interaction.cs | 2 +-
Hyena/Hyena.Data/IListModel.cs | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
index 8368175..602b4c4 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
@@ -1025,7 +1025,7 @@ namespace Hyena.Data.Gui
if (vadjustment != null) {
- if (model != null) {
+ if (model != null && model.Count > 0) {
// FIXME: hard-coded grid logic
if (ViewLayout != null) {
vadjustment.Upper = ViewLayout.VirtualSize.Height;
diff --git a/Hyena/Hyena.Data/IListModel.cs b/Hyena/Hyena.Data/IListModel.cs
index 1d0a773..f3b8670 100644
--- a/Hyena/Hyena.Data/IListModel.cs
+++ b/Hyena/Hyena.Data/IListModel.cs
@@ -28,10 +28,9 @@
using System;
-using Hyena.Collections;
-
namespace Hyena.Data
{
+ //TODO: inherit from IEnumerable, so the .Any() Linq method can be used, which is more efficient than
comparing Count to 0
public interface IListModel : ISelectable
{
event EventHandler Cleared;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]