Re: GIcon thoughts



On Sun, 2008-01-13 at 22:13 -0500, Matthias Clasen wrote:

> gboolean
> gdk_pixbuf_save_to_stream    (GdkPixbuf      *pixbuf,
>                                          GOutputStream  *stream,
>                                          const char     *type,
>                                          GError        **error,
>                                          ...);
> 
> I wonder if these functions should take a GCancellable...

Yeah, everything that does i/o should ideally be cancellable. 
Also, both the load and the save calls close the stream. This is very
convenient in many cases, but it also means its not possible to e.g.
load multiple pixbufs from the same stream (if you for instance are
using it to serialize things or something like that). Not sure what the
best approach to that is...,


> The next patch adds a resurrect signal to GdkPixbuf that can be
> used to resurrect a pixbuf from dispose, by adding a reference in
> the signal handler.

Don't you need to use g_atomic_get_int to read the refcount?

> The third patch adds lookup-by-gicon and forced size support
> to GtkIconTheme. I ended up with a slightly different api than
> outlined before:
> 
>   GTK_ICON_LOOKUP_FORCE_SIZE       = 1 << 4
> 
> GtkIconInfo *
> gtk_icon_theme_lookup_by_gicon  (GtkIconTheme    *icon_theme,
>                                                     GIcon
>          *icon,
>                                                     gint
>           size,
>                                                     GtkIconLookupFlags
>           flags);
> 
> Does this look like it will still work ok for nautilus, Alex ?
> I haven't added the icon-info-from-pixbuf function yet, since it
> wasn't necessary. Should be trivial to add if nautilus needs it.

I believe it should work.

make sure you handle errors (file_info == NULL) from query_file_info,
also check for the content type != NULL. (Should be
application/octet-stream if otherwise unknown, but who knows what might
happen in some weird backend.) 

Nautilus would need the from_pixbuf version. Its used to make
asynchronously loaded thumbnails look like ordinary icons in the cache.




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