Re: [PATCHv4 08/11] Add osinfo_install_config_new_for_script

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

 



On Thu, Dec 20, 2012 at 6:45 PM, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote:
> In order to be able to automatically transform configuration parameters set
> on OsinfoInstallConfig instances (ie translate from generic value to
> OS-specific value), we need to have access to the
> OsinfoInstallConfigParamList for the current OsinfoInstallScript as
> this is where the OsinfoDatamaps needed to do the remapping are stored.
>
> After the previous commits we can now associate an
> OsinfoInstallConfigParamList with an OsinfoInstallConfig instance,
> and we can get the OsinfoInstallConfigParamList corresponding to
> an OsinfoInstallScript instance, so this commit just adds a new
> osinfo_install_config_new_for_script which will create a new
> OsinfoInstallConfig instance associated with the
> OsinfoInstallConfigParamList for a given installation script.
> ---
>  osinfo/libosinfo.syms          |  1 +
>  osinfo/osinfo_install_config.c | 36 +++++++++++++++++++++++++++++++++---
>  osinfo/osinfo_install_config.h |  4 ++++
>  3 files changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
> index a32a8b7..efea371 100644
> --- a/osinfo/libosinfo.syms
> +++ b/osinfo/libosinfo.syms
> @@ -388,6 +388,7 @@ LIBOSINFO_0.2.3 {
>         osinfo_db_get_datamap_list;
>         osinfo_db_identify_media;
>
> +       osinfo_install_config_new_for_script;
>         osinfo_install_config_get_config_params;
>
>         osinfo_install_config_paramlist_get_type;
> diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c
> index 4c42746..e61bfb6 100644
> --- a/osinfo/osinfo_install_config.c
> +++ b/osinfo/osinfo_install_config.c
> @@ -189,9 +189,39 @@ osinfo_install_config_init (OsinfoInstallConfig *config)
>   */
>  OsinfoInstallConfig *osinfo_install_config_new(const gchar *id)
>  {
> -    return g_object_new(OSINFO_TYPE_INSTALL_CONFIG,
> -                        "id", id,
> -                        NULL);
> +    return osinfo_install_config_new_for_script(id, NULL);
> +}
> +
> +
> +/**
> + * osinfo_install_config_new_for_script:
> + * @id: the unique identifier
> + * @script: the #OsinfoInstallScript we are creating the configuration for
> + *
> + * Construct a new install configuration associated with @script.
> + * OsinfoInstallConfig:config-params will contain the
> + * #OsinfoInstallConfigParamList describing the parameters that can be set
> + * on the config object when creating a configuration for @script. See
> + * osinfo_install_config_new() for a description of the default values that
> + * will be set on the newly created #OsinfoInstallConfig.
> + *
> + * Returns: (transfer full): an install configuration
> + */
> +OsinfoInstallConfig *osinfo_install_config_new_for_script(const gchar *id,
> +                                                          OsinfoInstallScript *script)
> +{
> +    OsinfoInstallConfigParamList *params = NULL;
> +    OsinfoInstallConfig *config;
> +
> +    if (script != NULL)
> +        params = osinfo_install_script_get_config_params(script);
> +

I don't think it makes sense to have script argument nullable here but
no strong feelings. If you disagree, you want to add gir annotation in
the doc comment. Either way, you can just change it before pushing.

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux