[Xfce4-commits] <postler:master> Render errors with getting messages in the overview

Christian Dywan noreply at xfce.org
Fri May 27 20:32:10 CEST 2011


Updating branch refs/heads/master
         to 52cfae56a1a2fb01427ca9ec689bd0640b81be5f (commit)
       from cf13c0c80e7d55136edfee3485b216ff23a1700d (commit)

commit 52cfae56a1a2fb01427ca9ec689bd0640b81be5f
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri May 27 20:25:52 2011 +0200

    Render errors with getting messages in the overview

 postler/postler-client.vala   |    9 +++++++--
 postler/postler-message.vala  |    5 +++++
 postler/postler-messages.vala |    4 +---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/postler/postler-client.vala b/postler/postler-client.vala
index ef026f0..29181aa 100644
--- a/postler/postler-client.vala
+++ b/postler/postler-client.vala
@@ -56,8 +56,13 @@ namespace Postler {
             return yield client.unread_messages (uri);
         }
 
-        public async void get_message (Message message, Gtk.TreeRowReference row) throws GLib.Error {
-            message.from_hash_table (yield client.get_message (message.uri));
+        public async void get_message (Message message, Gtk.TreeRowReference row) {
+            try {
+                message.from_hash_table (yield client.get_message (message.uri));
+            } catch (GLib.Error error) {
+                message.from_error (error.message.replace (
+    "org.gtk.GDBus.UnmappedGError.Quark._g_2dfile_2derror_2dquark.Code24", "GLib.FileError"));
+            }
             Gtk.TreeIter iter;
             if (row.get_model ().get_iter (out iter, row.get_path ()))
                 row.get_model ().row_changed (row.get_path (), iter);
diff --git a/postler/postler-message.vala b/postler/postler-message.vala
index 22f29c0..d2387a4 100644
--- a/postler/postler-message.vala
+++ b/postler/postler-message.vala
@@ -61,6 +61,11 @@ namespace Postler {
             this.uri = uri;
         }
 
+        public void from_error (string error_message) {
+            this.uri = "error:";
+            this.subject = error_message;
+        }
+
         public void from_hash_table (GLib.HashTable<string,Variant> message_data) {
             this.subject = message_data.lookup ("subject").get_string ();
             this.sender = message_data.lookup ("sender").get_string ();
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index db2c459..eedde8b 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -514,10 +514,8 @@ public class Postler.Messages : Gtk.TreeView {
     public void display_error (string title, string text) {
         clear ();
         string markup = "<big><b>%s</b></big>\n\n%s".printf (title, text);
-        var message_data = new GLib.HashTable<string,Variant> (str_hash, str_equal);
-        message_data.insert ("subject", markup);
         var message = new Message.from_uri ("error:");
-        message.from_hash_table (message_data);
+        message.from_error (markup);
         store.insert_with_values (null, null, 0,
                                   Columns.MESSAGE, message);
     }



More information about the Xfce4-commits mailing list