[blam] ItemList: don't switch to first unread if we're already in the channel
- From: Carlos MartÃn Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam] ItemList: don't switch to first unread if we're already in the channel
- Date: Fri, 15 Feb 2013 22:55:45 +0000 (UTC)
commit c90acc0a0708ad9f1b03a02552c420606d46597b
Author: Carlos MartÃn Nieto <cmn dwim me>
Date: Fri Feb 15 23:50:07 2013 +0100
ItemList: don't switch to first unread if we're already in the channel
We used to do advance to the next unread on any channel update,
including when we are already showing the channel, which advanced the
current item to the next unread on each refresh, losing the user's
position.
Recognise whether we're updating whilst inside the channel or not and
advance as appropriate.
src/Application.cs | 2 +-
src/ItemList.cs | 30 ++++++++++++++++--------------
2 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/src/Application.cs b/src/Application.cs
index 96f5042..66bca75 100644
--- a/src/Application.cs
+++ b/src/Application.cs
@@ -737,7 +737,7 @@ namespace Imendio.Blam {
UpdateTotalNumberOfUnread ();
if (channelList.GetSelected () == channel) {
- itemList.UpdateList ();
+ itemList.UpdateList(false);
}
}
diff --git a/src/ItemList.cs b/src/ItemList.cs
index 208716d..d95a32c 100644
--- a/src/ItemList.cs
+++ b/src/ItemList.cs
@@ -37,7 +37,7 @@ namespace Imendio.Blam {
set {
channel = value;
- UpdateList();
+ UpdateList(true);
}
}
@@ -126,7 +126,7 @@ namespace Imendio.Blam {
return false;
}
- public void UpdateList ()
+ public void UpdateList(bool changed)
{
if (channel == null)
return;
@@ -142,22 +142,24 @@ namespace Imendio.Blam {
list.AppendValues(store.Get(id));
}
- // Now we have the current list of items, go to the first unread or latest
- if (Next(true))
- return;
+ if (changed) {
+ // Now we have the current list of items, go to the first unread or latest
+ if (Next(true))
+ return;
- TreeIter iter;
- if (!Model.GetIterFirst(out iter))
- return;
+ TreeIter iter;
+ if (!Model.GetIterFirst(out iter))
+ return;
- list.Foreach((TreeModel model, TreePath path, TreeIter i) => {
- if (CompareFunc(Model, iter, i) < 0)
- iter = i;
+ list.Foreach((TreeModel model, TreePath path, TreeIter i) => {
+ if (CompareFunc(Model, iter, i) < 0)
+ iter = i;
- return false;
- });
+ return false;
+ });
- ScrollTo(iter);
+ ScrollTo(iter);
+ }
}
public void Update (Item item)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]