[Xfce4-commits] <postler:master> Unset the message models while populating
Christian Dywan
noreply at xfce.org
Sat Jun 5 17:42:03 CEST 2010
Updating branch refs/heads/master
to 2430729a9ba6f2538c406918065fd598766de942 (commit)
from ff9645de581fef3510c51d09e241835e77552e9f (commit)
commit 2430729a9ba6f2538c406918065fd598766de942
Author: Christian Dywan <christian at twotoasts.de>
Date: Sat Jun 5 17:20:33 2010 +0200
Unset the message models while populating
postler/postler-messages.vala | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index c0e09e1..00a1182 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -245,9 +245,11 @@ public class Postler.Messages : Gtk.TreeView {
public bool populate (string? location, string filter="", string header="subject") {
clear ();
- sort.reset_default_sort_func ();
if (location == null)
return true;
+
+ model = sort = null;
+
if (filter != "")
last_filter = filter;
var now = GLib.Date ();
@@ -291,6 +293,7 @@ public class Postler.Messages : Gtk.TreeView {
GLib.FileInfo info;
folder = folder_dir.get_basename ();
+ bool folder_new = folder_dir.get_path ().has_suffix ("cur");
while ((info = folder_enumerator.next_file (null)) != null) {
Gtk.TreeIter account_iter;
string name = info.get_name ();
@@ -300,7 +303,7 @@ public class Postler.Messages : Gtk.TreeView {
string status = Gtk.STOCK_NEW;
int font_weight = Pango.Weight.BOLD;
string flagged = null;
- if (folder == "cur") {
+ if (!folder_new) {
status = parse_flags (name, out flagged, out font_weight);
if (hide_read && status != Gtk.STOCK_NEW && flagged == null)
continue;
@@ -382,7 +385,10 @@ public class Postler.Messages : Gtk.TreeView {
-1);
}
}
+
+ sort = new Gtk.TreeModelSort.with_model (store);
sort.set_sort_column_id (Columns.TIMESTAMP, Gtk.SortType.ASCENDING);
+ model = sort;
/* Scroll to the bottom */
int last_child = sort.iter_n_children (null) - 1;
@@ -392,11 +398,15 @@ public class Postler.Messages : Gtk.TreeView {
set_cursor (sort.get_path (sort_iter), null, false);
}
}
- last_location = location;
+
} catch (GLib.Error error) {
+ sort = new Gtk.TreeModelSort.with_model (store);
+ model = sort;
GLib.critical (_("Failed to read folder \"%s\": %s"),
location, error.message);
}
+
+ last_location = location;
return false;
}
More information about the Xfce4-commits
mailing list