Re: Adding support for OnlyShowIn

On Wed, 2006-04-05 at 17:24 -0500, Federico Mena Quintero wrote:
> Hi,
> I want to add support for the "OnlyShowIn" key in .desktop files, so
> that Nautilus will not show desktop items which have "OnlyShowIn=KDE",
> for example.
> I started with the attached patch, but it doesn't work.  Some advice
> would be appreciated :)
> Basically, my is_foreign_desktop_file() gets called with a URI that is
> incorrect.  Say I'm viewing /home/federico and I double-click on the
> icon for /home/federico/Desktop.  In it I have a test.desktop, which has
> "OnlyShowIn=KDE".
> My is_foreign_desktop_file() function gets called with a URI of
> "file:///home/federico/test.desktop", instead of
> "file:///home/federico/Desktop/test.desktop".
> Why does the async machinery (i.e. mime_list_one() and friends) get
> callbacks for URIs that are *not* direct children of the current
> directory?  I.e. a directory /home/federico will ask to read the MIME
> types of /home/federico/Desktop/*, and then I can't know what the
> original request was.

First of all, i'm not sure magically hiding completely normal files like
this is a good idea. I mean, when you're doing menus and stuff, yes, but
files? You'll think a directory is empty, but it really has a desktop
file in it...

Secondly, the implementation uses synchronous i/o, which is forbidden in
Nautilus. It also reads every desktop file in the directory you're
looking at and all subdirectories which is gonna be pretty damn slow, as
desktop files can be pretty big. The reason its called for
subdirectories (which is what is causing you problems) is because
should_skip_file() is called when counting the number of items in
subdirectories (hidden files shouldn't be counted).

Also, the modern API to read desktop files is GKeyFile.

 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a jaded Republican firefighter from a doomed world. She's a tortured 
bisexual opera singer from the wrong side of the tracks. They fight crime! 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]