[Xfce4-commits] <postler:master> Recognise . as folder separator next to ~-

Christian Dywan noreply at xfce.org
Fri Nov 26 01:08:01 CET 2010


Updating branch refs/heads/master
         to 174b28381095781564372ccae19a594a8f958cbd (commit)
       from 921f249748d84767546c771746ebff993113ce59 (commit)

commit 174b28381095781564372ccae19a594a8f958cbd
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Nov 25 22:43:16 2010 +0100

    Recognise . as folder separator next to ~-

 postler/postler-folders.vala |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index 47c373c..fc095cf 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -193,25 +193,34 @@ public class Postler.Folders : Gtk.TreeView {
 
                     Gtk.TreeIter parent_iter = account_iter;
                     Gtk.TreeIter folder_iter;
-                    string folder_name = name;
-
-                    /* A ~- separates parent and subfolder */
-                    if ("~-" in name) {
-                        string[]? name_pieces = name.split ("~-");
+                    string folder_name = name.replace ("~~", "~");
+
+                    /* A . or ~- separates parent and subfolder */
+                    unowned string? separator = null;
+                    if ("~-" in name)
+                        separator = "~-";
+                    else if ("." in name)
+                        separator = ".";
+                    if (separator != null) {
                         string folder_dir_path = folder_dir.get_path ();
-                        if (get_folder_iter (folder_dir_path, account_iter, out folder_iter))
+                        string[] name_pieces = name.split (separator);
+                        string parent = name_pieces[name_pieces.length - 2];
+                        folder_name = name_pieces[name_pieces.length - 1];
+                        string parent_path = name.substring (0,
+                            name.length - folder_name.length - separator.length);
+                        if (get_folder_iter (account_info.path + "/" + parent_path,
+                            account_iter, out folder_iter))
                             parent_iter = folder_iter;
                         else {
                             store.insert_with_values (out parent_iter, account_iter, -1,
                                 Columns.ICON, Gtk.STOCK_DIRECTORY,
-                                Columns.NAME, name_pieces[0],
-                                Columns.LOCATION, folder_dir_path,
+                                Columns.NAME, parent,
+                                Columns.LOCATION, folder_dir_path + "/" + parent_path,
                                 Columns.INFO, account_info);
                         }
-                        folder_name = name_pieces[1];
-                    } else if ("~~" in name) {
-                        folder_name = folder_name.replace ("~~", "~");
-                    }
+                    } else if (get_folder_iter (account_info.path + "/" + name,
+                                                account_iter, null))
+                        continue;
 
                     if (name == "INBOX") {
                         var msg_dir = folder_dir.resolve_relative_path (



More information about the Xfce4-commits mailing list