Re: content type guessing



On Tue, 2008-07-08 at 01:02 -0400, Matthias Clasen wrote:
> Here is a patch that I'm going to commit to glib over the next few
> days. It moves the content type guessing
> functionality for mounts out of nautilus and makes it generally available as
> 
> char **    g_content_type_guess_for_tree    (GFile *root);
> 
> void         g_mount_guess_content_type        (GMount              *mount,
> 
>           gboolean             force_rescan,
> 
>           GCancellable        *cancellable,
> 
>           GAsyncReadyCallback  callback,
> 
>           gpointer             user_data);
> 
> gchar **  g_mount_guess_content_type_finish (GMount              *mount,
> 
>                GAsyncResult        *result,
> 
>                GError             **error)

API looks good to me - unfortunately gio is, as a whole, is somewhat
inconsistent with whether it uses

 g_foo_frobnicate()         /* sync version! */
 g_foo_frobnicate_async()
 g_foo_frobnicate_finish()

or just

 g_bar_frobnicate()         /* async version! */
 g_bar_frobnicate_finish()
 g_bar_frobnicate_sync()

Note that in the latter case no _sync() functions actually exist at this
moment. But I remember at least the GStreamer guys asked for a
synchronous mount() method which, if we implement it, would probably be
called g_mount_sync(). We'll see.

Anyway, at the end of the day I'm not sure all this matter much - if
anything it's just an eyesore and bad for muscle memory. At least this
API you suggest is consistent with the class it belongs to.

> I'm mentioning it here since the implementation of the
> guess_content_type vfunc will live in Davids
> new out-of-process HalVolumeMonitor. Right, David ?

That's correct. And we will also need to teach the daemon volume monitor
about it (the gphoto backend for example needs to implement this). But
more about that later when your API is available in gio.

> The patch depends on an update to the shared-mime-info spec and the
> update-desktop-database
> utility that I also hope to land in the next few days.

Cool.

Cheers,
David




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