[Xfce4-commits] <postler:master> Make get_folder_iter recursive

Christian Dywan noreply at xfce.org
Sun Jan 30 09:48:01 CET 2011


Updating branch refs/heads/master
         to 0c16898998cbd74ab6cab6428c2d1eddab8dbeec (commit)
       from 963dad0b06291cf89668b37f6fe0d2dadc603c35 (commit)

commit 0c16898998cbd74ab6cab6428c2d1eddab8dbeec
Author: Sergio Spinatelli <spinatelli.sergio at gmail.com>
Date:   Sun Jan 30 09:43:01 2011 +0100

    Make get_folder_iter recursive

 postler/postler-folders.vala |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index 111d313..cc99362 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -156,22 +156,29 @@ public class Postler.Folders : Gtk.TreeView {
         return populate_accounts (account_infos);
     }
 
-    bool get_folder_iter (string location, Gtk.TreeIter account_iter,
+    bool get_folder_iter (string location, Gtk.TreeIter parent_iter,
         out Gtk.TreeIter iter) {
 
+        string existing_location;
+        store.get (parent_iter, Columns.LOCATION, out existing_location);
+
+        if (existing_location == location) {
+            if (&iter != null)
+                iter = parent_iter;
+            return true;
+        }
+
         Gtk.TreeIter folder_iter;
-        if (!store.iter_children (out folder_iter, account_iter))
+        if (!store.iter_children (out folder_iter, parent_iter))
             return false;
+
+        bool found = false;
         do {
-            string existing_location;
-            store.get (folder_iter, Columns.LOCATION, out existing_location);
-            if (existing_location == location) {
-                if (&iter != null)
-                    iter = folder_iter;
-                return true;
-            }
-        } while (store.iter_next (ref folder_iter));
-        return false;
+            found = get_folder_iter (location,folder_iter, out iter);
+
+        } while (!found && store.iter_next (ref folder_iter));
+
+        return found;
     }
 
     public static string decode_foldername (string name) {



More information about the Xfce4-commits mailing list