[Libosinfo] [[PATCHv2] 4/7] media: Add variant info API/XML

Christophe Fergeau cfergeau at redhat.com
Thu Nov 28 08:24:42 UTC 2013


On Thu, Nov 28, 2013 at 01:07:14AM +0000, Zeeshan Ali (Khattak) wrote:
> Add:
> 
> * ability to associate media to one or more variants of the OS in the
>   'media' XML node. For example:
> 
>   <os id="http://microsoft.com/win/7">
>     <short-id>win7</short-id>
>     <name>Microsoft Windows 7</name>
>     ..
> 
>     <variant id="starter">
>       <name>Microsoft Windows 7 Starter</name>
>     </variant>
>     <variant id="home-basic">
>       <name>Microsoft Windows 7 Home Basic</name>
>     </variant>
>     <variant id="home-premium">
>       <name>Microsoft Windows 7 Home Premium</name>
>     </variant>
>     ..

I'd tend to drop that part as this is not support for this that this commit
adds
> diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
> index 118ff8b..0d6b96a 100644
> --- a/osinfo/osinfo_media.c
> +++ b/osinfo/osinfo_media.c
> @@ -1136,6 +1136,45 @@ void osinfo_media_set_os(OsinfoMedia *media, OsinfoOs *os)
>  }
>  
>  /**
> + * osinfo_media_get_os_variants:
> + * @media: an #OsinfoMedia instance
> + *
> + * Gets the variants of the associated operating system.
> + *
> + * Returns: (transfer full): the operating system variant, or NULL
> + */
> +OsinfoOsVariantList *osinfo_media_get_os_variants(OsinfoMedia *media)
> +{
> +    OsinfoOs *os;
> +    OsinfoOsVariantList *os_variants;
> +    OsinfoOsVariantList *media_variants;
> +    GList *ids, *node;
> +    OsinfoFilter *filter;
> +
> +    g_return_val_if_fail(OSINFO_IS_MEDIA(media), NULL);
> +    os = g_weak_ref_get(&media->priv->os);
> +    os_variants = osinfo_os_get_variant_list(os);
> +    g_object_unref (os);
> +
> +    ids = osinfo_entity_get_param_value_list(OSINFO_ENTITY(media),
> +                                             OSINFO_MEDIA_PROP_VARIANT);
> +    filter = osinfo_filter_new();
> +    media_variants = osinfo_os_variantlist_new();
> +    for (node = ids; node != NULL; node = node->next) {
> +        osinfo_filter_clear_constraints(filter);
> +        osinfo_filter_add_constraint(filter,
> +                                     OSINFO_ENTITY_PROP_ID,
> +                                     (const char *) node->data);
> +        osinfo_list_add_filtered(OSINFO_LIST(media_variants),
> +                                 OSINFO_LIST(os_variants),
> +                                 filter);
> +    }
> +    g_object_unref (os_variants);

Spacing is off here (space before '(' )

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20131128/864ea28b/attachment.sig>


More information about the Libosinfo mailing list