   #---------------------------------------------
   close_all: ->
     $rootScope.current_open_folder = null
-    $rootScope.$apply()
-    # close all folders
-    for f in $rootScope.folders
-      $("#feeds-#{f.id}").collapse 'hide'
+    $rootScope.$apply() if $rootScope.$$phase != '$apply' && $rootScope.$$phase != '$digest'
+    $timeout ->
+      # close all folders
+      for f in $rootScope.folders
+        $("#feeds-#{f.id}").removeClass("in").addClass("collapse")
+    , 250
 
   #---------------------------------------------
   # Return the folder object which is currently open

########################################################

angular.module('feedbunch').service 'openFolderSvc',
['$rootScope', ($rootScope)->

  #---------------------------------------------
  # Set the currently open folder in the root scope.

  #---------------------------------------------
  open: (folder)->
    $rootScope.current_open_folder = folder
    $rootScope.$apply() if $rootScope.$$phase != '$apply' && $rootScope.$$phase != '$digest'
    $timeout ->
      # open the passed folder
      $("#feeds-#{folder.id}").addClass("in").removeClass("collapse")
    , 250
    $timeout ->
      # close all other folders
      for f in $rootScope.folders
        $("#feeds-#{f.id}").removeClass("in").addClass("collapse") if f != folder
    , 350

  #---------------------------------------------
  # Unset the currently open folder in the root scope, and also
