On Sun, Sep 4, 2011 at 4:26 PM, Gustavo Sverzut Barbieri
<[email protected]> wrote:
> On Sun, Sep 4, 2011 at 9:14 AM, Cedric BAIL <[email protected]> wrote:
>> On Sat, Sep 3, 2011 at 6:04 AM, Gustavo Sverzut Barbieri
>> <[email protected]> wrote:
>>> So Cedric and I disagree on Emotion thing, what a thing :-) But I had
>>> an idea that could help make the application's developer lives easier.
>>
>> :-)
>>
>>> Basically what Cedric have in Emotion is:
>>> - on load, get xattr value
>>> - on position changed (smart callback), save xattr value
>>>
>>> IMO there is not much of work to do or replicate in applications in
>>> this regard, but there is few annoyances:
>>> - all operations are async, need proper cancel for load so the
>>> "get" return is not applied to another file if it changes
>>> - need to convert to/from string and numbers
>>
>> And need to agree on the xattr name.
>
> Yes and no. If there is a desktop-wide value, then yes (we can
> document this in FreeDesktop.Org or E.org). But if the application
> wants to save specific values, then no need for common name. (The one
> in emotion, I'd have as application value)
>
>>> That said, how about if we add few helpers in Eio:
>>> - synchronous xattr_get, as it shouldn't take long and you're
>>> likely to do it very rarely (correct would be to do a single one at
>>> time per application)
>>> - xattr_get variants (sync/async) with primitive types: double,
>>> int64, uint64, string (should cover all cases)
>>> - xattr_set variants (just async) with primitive types
>>
>> I like that idea, simple to implement and add. Easy to share with
>> application on top of it. There is just one issue, maybe we should add
>> the sync set/get a few layer under. If we plan to support
>> 'user.mime_type' in efreet (and we really should), we have two choice,
>> either we do xattr code directly in it or we share that code with eio
>> in the hope to make it easier to port on Windows later. Meaning two
>> more functions for eina. So what your opinion on adding xattr set/get
>> synchronous without helper function in eina and adding the more higher
>> level function in Eio with also the asynchronous version of them.
>
> Go with it. Actually I did think it was like that, then I've checked
> the code before sending this mail and realized it was not like that.
Good.
> BTW, things like Eet could have also a "serialize to xattr". I'd hold
> on a bit here, wait for use cases. But looks like will be useful in
> future.
Yeah, I was thinking the same. Ultra easy to do.
>>> If those were available the application would have to do:
>>>
>>> void play(const char *file) {
>>> double position;
>>>
>>> /* existing code */
>>> emotion_object_file_set(o, file);
>>>
>>> if (eio_file_xattr_sync_get(file, &position)) /* shouldn't block
>>> much, and at this point it shouldn't matter a lot anyway */
>>> emotion_object_position_set(o, position);
>>> }
>>
>> You forgot the name of the extended attribute :-)
>>
>>> void stop(void) {
>>> double position = emotion_object_position_get(o);
>>> const char *file = emotion_object_file_get(o);
>>> eio_file_xattr_double_set(file, "user.e.time_seek", position,
>>> EIO_XATTR_INSERT, NULL, NULL, NULL);
>>>
>>> /* existing code */
>>> emotion_object_play_set(o, 0);
>>> }
>>
>> The only reason I dislike this idea is that the extended attribute
>> name isn't shared across application. So you can't easily fix
>> application by just updating one library if we plan to support some
>> new naming scheme in the future (like an use.xdg.time_seek for
>> example).
>
> Of course you can. Create efreet_xattrs.h:
>
> EAPI const char *EFREET_XATTR_XDG_TIME_SEEK;
> EAPI const char *EFREET_XATTR_E_TIME_SEEK; ...
>
> If you change the value inside libefreet.so, every user will get new values.
You know what, I like that idea ! So will move to that scheme.
--
Cedric BAIL
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel