From: Andrej N. Gritsenko <andrej@re...> - 2012-11-16 18:15:03
Grzegorz Antoniak has written on Friday, 16 November, at 9:09:
>I'm wondering if there's a possibility to add a custom column to the Detailed view, but only when displaying a specified directory?
First of all, PCManFM development discussion has another mailing list
so, please, let don't fill lxde-list with it.
About your question: this possibility is currently unavailable but is
planned to be implemented in libfm-1.2.
>I've already figured out how to add a column without taking current directory into consideration, and figured how to display my text in this column. But I'd like to display these two columns only when, for example, current directory contains "foobar" string, so, for example:
>* /home/user - would display normal set of columns (Name, Description, Size, Modified),
>* /home/user/foobar (and every subdir) - would display Name, Description, MyColumn1, MyColumn2, MyColumn3 (without Size, Modified - also I'd provide by own text for these columns in the implementation of fm_folder_model_get_value()).
>Is this even possible without changing architecture of PCManFM?
Yes, this will be possible later. And there are plans to make a solid
API to make custom columns which you are asking for.
>I've tried to do some hooking inside _check_tree_columns_defaults(), and walk from FmStandardView, through FmFolder, to FmPath, but it appears that the current directory model is changed two times - one time to clear the contents, and the second one to fill the directory items up. The second model change doesn't have a valid FmPath, so I don't know how to query current directory name, to be able to choose which column set to apply. Does this approach make any sense? ;)
The model can be changed for the same FmFolderView (FmStandardView is
an implementation of it) many times and you should not hook onto this
check as its purpose is clearly to set defaults if they weren't set yet.
>It may be the case that I'm not supposed to query FmFolder's FmPath in the column creation logic, but in this case I'm not sure I even know how to make column creation dependent on current directory.
No, you should not do it, your column should get data inside of some
FmFolderModel API and create representation, so FmFolderView can use it.
And creation of view itself will be handled by FmFolderView without your
intervention with help of future code which is planned for 1.2 as I said
>Thanks for any info,