xbmc/xbmc — pull request #1646 by Montellese (2012-10-19 10:01:44+00:00)
Title: media library: fix regressions due to advanced library filtering

In the current implementation, upon retrieving a list of items in CGUIMediaWindow::Update() we overwrite the path passed in as a parameter with the path assigned to the new CFileItemList instance (the real path) because we need the real path for the advanced library filtering. This results in loss of important information because the original path is used in many places (e.g. getting the right CGUIViewState implementation). But for advanced filtering to work we need to also be able to access the real path containing the active filter as a JSON representation in the "filter" URL parameter which allows to pass an active filter down to a sub-directory and also to return back to a filtered list from a sub-directory.
To avoid overwriting the original path used to retrieve the list of items we store the real path in a new member variable m_strRealPath instead and also store the real path of a list in the current path history to be able to return to the filtered list from a sub-directory.

The first commit is just an optimization and has nothing to do with the fix but I thought I'd clean it up while I'm in CDirectoryHistory anyway. The third commit is just for convenience because I was sick of writing the same code in different places (i.e. check if the path contains a "filter" parameter and remove it if present).
The last commit contains the main changes which solves the regressions currently present in mainline (e.g. http://trac.xbmc.org/ticket/13422) and partly reverts some of the fixes I committed in the last few days because they are not needed anymore. But it still needs a solution for the problem described (and solved) in #1631.