[Xfce4-commits] <postler:master> Retain selected message as long as it is in the list
Christian Dywan
noreply at xfce.org
Sun Jul 10 20:30:03 CEST 2011
Updating branch refs/heads/master
to 4cd6ae9d7e685e18ad6ccb5d4fc3f14f925cd805 (commit)
from 6883460388d165d1057830624ec03f1e18b0ff08 (commit)
commit 4cd6ae9d7e685e18ad6ccb5d4fc3f14f925cd805
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Jul 10 20:28:17 2011 +0200
Retain selected message as long as it is in the list
postler/postler-messages.vala | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index 061d424..4ac847b 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -314,6 +314,7 @@ public class Postler.Messages : Gtk.TreeView {
if (this.location == location)
return false;
+ var previously_selected_message = selected_message;
clear ();
selected_folder_type = folder_type;
var messages = new GLib.List<Message> ();
@@ -349,6 +350,14 @@ public class Postler.Messages : Gtk.TreeView {
}
this.location = location;
+ /* Retain selected message as long as it is in the list */
+ if (previously_selected_message != null) {
+ var iter = Gtk.TreeIter ();
+ if (get_message_iter (previously_selected_message, out iter)) {
+ set_cursor (model.get_path (iter), null, false);
+ content.display (previously_selected_message);
+ }
+ }
return false;
}
@@ -396,14 +405,14 @@ public class Postler.Messages : Gtk.TreeView {
return false;
}
- bool get_message_iter (string location, out Gtk.TreeIter iter) {
+ bool get_message_iter (Message message, out Gtk.TreeIter iter) {
Gtk.TreeIter message_iter;
if (!store.iter_children (out message_iter, null))
return false;
do {
Message existing_message;
store.get (message_iter, Columns.MESSAGE, out existing_message);
- if (existing_message.get_path () == location) {
+ if (existing_message.id == message.id) {
if (&iter != null)
iter = message_iter;
return true;
@@ -438,7 +447,7 @@ public class Postler.Messages : Gtk.TreeView {
}
void got_message (Message message, int64 position) {
- if (get_message_iter (message.get_path (), null))
+ if (get_message_iter (message, null))
return;
/* TODO: Honor folder and filter */
bool scroll = vadjustment.value == 0;
@@ -446,7 +455,7 @@ public class Postler.Messages : Gtk.TreeView {
Columns.MESSAGE, message);
if (scroll)
vadjustment.value = 0;
- /* if (get_message_iter (file.get_path (), out iter))
+ /* if (get_message_iter (message, out iter))
store.remove (iter); */
}
More information about the Xfce4-commits
mailing list