Re: Operation options (filtering, sorting and more)
- From: "Juan A." Suárez Romero <jasuarez igalia com>
- To: grilo-list gnome org
- Subject: Re: Operation options (filtering, sorting and more)
- Date: Mon, 14 Mar 2011 17:17:04 +0100
On Mon, 2011-03-14 at 09:45 +0100, Iago Toral Quiroga wrote:
>
> grl_operation_options_new_for_source (source) and then the setters
> return TRUE (if the option is supported) or FALSE otherwise.
>
> the code would look like this:
>
> options = grl_operation_options_new_for_source (source);
> if (grl_operation_options_set_frobuz (options, frobuz) &&
> grl_operation_options_add_gharbles (options, gharble1)) {
> grl_operation_options_add_gharbles (options, gharble2);
> grl_media_source_browse (source, container, keys, skip, count,
> flags, options, callback, data);
> }
>
> On the plugin side this would mean implementing a virtual function
> with
> this signature:
>
> gboolean grl_my_source_add_option (options, option_name,
> option_value);
>
> a GrlOperation object would always call this method on the target
> source
> to return TRUE or FALSE on any of its setters.
>
> I am not sure if the operation options should also consider the
> operation type (browse, query, etc), right now I don't see a good
> reason
> for this, but maybe there is one.
>
Roughly speaking, this is the approach I was following in filtering so
far:
GrlOperationOptions contains both the options the source supports and
the options the user demands.
When creating a GrlOperationOptions, you can invoke
grl_media_source_setup_options(source, options) so the options are setup
with what the source supports. For instance, the source adds the list of
keys that it is able to filter (let's say album and artist, for
instance).
Then, the application can set up the options it wants (for instance, get
only videos with artist as 'Madonna').
Note that any moment, the user can check which options are supported.
GrlOperationOption can check if the options user demands can be
satisfied by options supported by source and if needed, get rid of those
options the plugin doesn't support.
I didn't consider adding the flags in the GrlOperationOptions, but
instead adding skip & count there. Two reasons for it: first, IIRC that
is how GData does. Second, as GrlOperationOptions makes sense when the
operation is able to return several elements, that is where skip & count
makes also sense.
J.A.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]