Re: automounting / autorunning



On Thu, 2008-01-17 at 23:54 -0500, David Zeuthen wrote:
> On Thu, 2008-01-17 at 14:28 +0100, Alexander Larsson wrote:
> > > This fixes a bug where the returned GIcon isn't reffed.
> > 
> > It shouldn't ref it. (See previous discussion on gtk-devel-list on
> > getters vs refing for details.)
> 
> Oh, ok. A bit confusing. Anyway, if we don't do this we need to remove
> the g_object_unref(icon) call in src/nautilus-x-content-bar.c around
> line 116.

It is a bit confusing. There was some discussion on how getters should
act in general for glib/gtk, and the result was that we don't have a
standard way for this, but you need to read the docs for each call.
However, if possible we don't ref/copy/dup in getters. 

For the GAppInfo object we just return the constant icon object that is
stored in the appinfo. Refing it wouldn't really be a problem, except it
would be inconsistant with what the string getters do in that class, and
if we strdup in them thats a waste in most cases.

However, for GMount, these are live object that change over time (has a
change signal even), so we need to ref them. In particular, the API need
to be threadsafe to work with the async I/O stuff, so the getters really
*have* to copy or the caller might end up with an object that doesn't
live anymore.

> > Also, the way you detect content types is not really nice. You're doing
> > sync I/O to find things like the enclosing volume, etc, which is a major
> > no-no in Nautilus. And having a separated out call for getting some
> > information about files instead of using the Nautilus i/o machinery is
> > also pretty weird. I'll try to fix this up.
> 
> Yeah, sorry about that. The Nautilus code base is huge and it's hard to
> find my way around it. Is there anything I can do to help / you need me
> to do?

I'll work on it some more today and let you know the results.

> The reason I brought it was because I couldn't easily figure out how to
> get the GMount for a file in computer:///. E.g. in libnautilus-private/
> nautilus-autorun.c:nautilus_autorun_get_x_content_types_for_file()
> there's this TODO:

Well, many mountable objects may have no mount. For instance when
enumerating the shares on a smb server (smb://server/) and the shares
are not mounted. However, if they are we should be able to find them by
looking up the "standard::target-uri" attribute against the volume
monitor.

> Also, there's a few TODO's left in my (now committed) patches to only to
> do this local mounts. How do I find out if this is the case?

What do you mean by local? Its a very vague word, which could for
instance refer to a gphoto:// mount, or it could mean only file: mounts,
etc.




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