[virt-tools-list] [libosinfo v2] API to query required user avatar format
Christophe Fergeau
cfergeau at redhat.com
Wed Nov 21 09:53:11 UTC 2012
Is it expressive enough to describe Fedora avatars? I really think not
having a list of mime types is a mistake API-wise.
Christophe
On Wed, Nov 21, 2012 at 05:33:48AM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
>
> Add a new API for apps to be able to query in which format do the user
> avatar file need to be in.
>
> Based on a patch from Fabiano Fidêncio <fabiano at fidencio.org>.
> ---
> data/install-scripts/windows-cmd.xml | 6 +
> data/schemas/libosinfo.rng | 30 +++++
> osinfo/Makefile.am | 2 +
> osinfo/libosinfo.syms | 8 +-
> osinfo/osinfo.h | 1 +
> osinfo/osinfo_avatar_format.c | 248 +++++++++++++++++++++++++++++++++++
> osinfo/osinfo_avatar_format.h | 95 ++++++++++++++
> osinfo/osinfo_install_script.c | 53 ++++++++
> osinfo/osinfo_install_script.h | 6 +
> osinfo/osinfo_loader.c | 44 +++++++
> po/POTFILES.in | 1 +
> 11 files changed, 493 insertions(+), 1 deletion(-)
> create mode 100644 osinfo/osinfo_avatar_format.c
> create mode 100644 osinfo/osinfo_avatar_format.h
>
> diff --git a/data/install-scripts/windows-cmd.xml b/data/install-scripts/windows-cmd.xml
> index 020a493..4ab48da 100644
> --- a/data/install-scripts/windows-cmd.xml
> +++ b/data/install-scripts/windows-cmd.xml
> @@ -12,6 +12,12 @@
> <param name="target-disk" policy="optional"/>
> <param name="script-disk" policy="optional"/>
> </config>
> + <avatar-format>
> + <mime-type>image/bmp</mime-type>
> + <width>48</width>
> + <height>48</height>
> + <alpha>false</alpha>
> + </avatar-format>
> <template>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
> index 3c57c36..c27c680 100644
> --- a/data/schemas/libosinfo.rng
> +++ b/data/schemas/libosinfo.rng
> @@ -478,6 +478,9 @@
> </element>
> </optional>
> <optional>
> + <ref name='avatar-format'/>
> + </optional>
> + <optional>
> <element name='config'>
> <oneOrMore>
> <element name='param'>
> @@ -509,6 +512,33 @@
> </element>
> </define>
>
> + <define name='avatar-format'>
> + <element name='avatar-format'>
> + <interleave>
> + <optional>
> + <element name="mime-type">
> + <text/>
> + </element>
> + </optional>
> + <optional>
> + <element name="width">
> + <ref name='num'/>
> + </element>
> + </optional>
> + <optional>
> + <element name="height">
> + <ref name='num'/>
> + </element>
> + </optional>
> + <optional>
> + <element name="depth">
> + <ref name='num'/>
> + </element>
> + </optional>
> + </interleave>
> + </element>
> + </define>
> +
> <define name="customElement">
> <element>
> <anyName/>
> diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
> index abaa78c..e85adb7 100644
> --- a/osinfo/Makefile.am
> +++ b/osinfo/Makefile.am
> @@ -55,6 +55,7 @@ libosinfo_1_0_includedir = $(includedir)/libosinfo-1.0/osinfo
>
> libosinfo_1_0_include_HEADERS = \
> osinfo.h \
> + osinfo_avatar_format.h \
> osinfo_db.h \
> osinfo_loader.h \
> osinfo_device.h \
> @@ -88,6 +89,7 @@ libosinfo_1_0_include_HEADERS = \
> $(NULL)
>
> libosinfo_1_0_la_SOURCES = \
> + osinfo_avatar_format.c \
> osinfo_entity.c \
> osinfo_enum_types.c \
> osinfo_filter.c \
> diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
> index de33a70..2b0aaae 100644
> --- a/osinfo/libosinfo.syms
> +++ b/osinfo/libosinfo.syms
> @@ -317,6 +317,12 @@ LIBOSINFO_0.2.1 {
>
> LIBOSINFO_0.2.2 {
> global:
> + osinfo_avatar_format_get_type;
> + osinfo_avatar_format_get_mime_type;
> + osinfo_avatar_format_get_width;
> + osinfo_avatar_format_get_height;
> + osinfo_avatar_format_get_alpha;
> +
> osinfo_install_config_param_policy_get_type;
> osinfo_media_error_get_type;
> osinfo_product_relationship_get_type;
> @@ -336,10 +342,10 @@ LIBOSINFO_0.2.2 {
> osinfo_install_config_get_script_disk;
> osinfo_install_config_set_script_disk;
>
> + osinfo_install_script_get_avatar_format;
> osinfo_install_script_get_path_format;
> } LIBOSINFO_0.2.1;
>
> -
> /* Symbols in next release...
>
> LIBOSINFO_0.0.2 {
> diff --git a/osinfo/osinfo.h b/osinfo/osinfo.h
> index 81ed1cc..559eaa8 100644
> --- a/osinfo/osinfo.h
> +++ b/osinfo/osinfo.h
> @@ -39,6 +39,7 @@
> #include <osinfo/osinfo_install_config.h>
> #include <osinfo/osinfo_install_config_param.h>
> #include <osinfo/osinfo_install_script.h>
> +#include <osinfo/osinfo_avatar_format.h>
> #include <osinfo/osinfo_install_scriptlist.h>
> #include <osinfo/osinfo_productlist.h>
> #include <osinfo/osinfo_product.h>
> diff --git a/osinfo/osinfo_avatar_format.c b/osinfo/osinfo_avatar_format.c
> new file mode 100644
> index 0000000..17c3391
> --- /dev/null
> +++ b/osinfo/osinfo_avatar_format.c
> @@ -0,0 +1,248 @@
> +/*
> + * libosinfo:
> + *
> + * Copyright (C) 2009-2012 Red Hat, Inc.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + *
> + * Authors:
> + * Fabiano Fidêncio <fabiano at fidencio.org>
> + * Zeeshan Ali (Khattak) <zeeshanak at gnome.org>
> + */
> +
> +#include <config.h>
> +
> +#include <osinfo/osinfo.h>
> +#include <glib/gi18n-lib.h>
> +
> +G_DEFINE_TYPE (OsinfoAvatarFormat, osinfo_avatar_format, OSINFO_TYPE_ENTITY);
> +
> +#define OSINFO_AVATAR_FORMAT_GET_PRIVATE(obj) \
> + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
> + OSINFO_TYPE_AVATAR_FORMAT, \
> + OsinfoAvatarFormatPrivate))
> +
> +#define DEFAULT_MIME_TYPE "image/png"
> +
> +/**
> + * SECTION: osinfo_avatar_format
> + * @short_description: The required format of avatar for an install script
> + * @see_also: #OsinfoInstallScript
> + */
> +
> +enum {
> + PROP_0,
> +
> + PROP_MIME_TYPE,
> + PROP_WIDTH,
> + PROP_HEIGHT,
> + PROP_ALPHA,
> +};
> +
> +static void
> +osinfo_avatar_format_get_property(GObject *object,
> + guint property_id,
> + GValue *value,
> + GParamSpec *pspec)
> +{
> + OsinfoAvatarFormat *avatar = OSINFO_AVATAR_FORMAT (object);
> +
> + switch (property_id)
> + {
> + case PROP_MIME_TYPE:
> + {
> + const gchar *mime_type;
> +
> + mime_type = osinfo_avatar_format_get_mime_type(avatar);
> + g_value_set_string(value, mime_type);
> + break;
> + }
> + case PROP_WIDTH:
> + g_value_set_int(value,
> + osinfo_avatar_format_get_width(avatar));
> + break;
> + case PROP_HEIGHT:
> + g_value_set_int(value,
> + osinfo_avatar_format_get_height(avatar));
> + break;
> + case PROP_ALPHA:
> + g_value_set_boolean(value,
> + osinfo_avatar_format_get_alpha(avatar));
> + break;
> + default:
> + /* We don't have any other property... */
> + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
> + break;
> + }
> +}
> +
> +/* Init functions */
> +static void
> +osinfo_avatar_format_class_init (OsinfoAvatarFormatClass *klass)
> +{
> + GObjectClass *g_klass = G_OBJECT_CLASS (klass);
> + GParamSpec *pspec;
> +
> + g_klass->get_property = osinfo_avatar_format_get_property;
> +
> + /**
> + * OsinfoAvatarFormat:mime-type:
> + *
> + * The required mime-type of the avatar.
> + **/
> + pspec = g_param_spec_string("mime-type",
> + "MIME Type",
> + _("The required mime-type of the avatar"),
> + DEFAULT_MIME_TYPE,
> + G_PARAM_READABLE |
> + G_PARAM_STATIC_STRINGS);
> + g_object_class_install_property(g_klass,
> + PROP_MIME_TYPE,
> + pspec);
> +
> + /**
> + * OsinfoAvatarFormat:width:
> + *
> + * The required width (in pixels) of the avatar.
> + **/
> + pspec = g_param_spec_int("width",
> + "Width",
> + _("The required width (in pixels) of the avatar"),
> + -1,
> + G_MAXINT,
> + -1,
> + G_PARAM_READABLE |
> + G_PARAM_STATIC_STRINGS);
> + g_object_class_install_property(g_klass,
> + PROP_WIDTH,
> + pspec);
> +
> + /**
> + * OsinfoAvatarFormat:height:
> + *
> + * The required height (in pixels) of the avatar.
> + **/
> + pspec = g_param_spec_int("height",
> + "Height",
> + _("The required height (in pixels) of the avatar."),
> + -1,
> + G_MAXINT,
> + -1,
> + G_PARAM_READABLE |
> + G_PARAM_STATIC_STRINGS);
> + g_object_class_install_property(g_klass,
> + PROP_HEIGHT,
> + pspec);
> +
> + /**
> + * OsinfoAvatarFormat:alpha:
> + *
> + * Whether alpha channel is supported in the avatar.
> + **/
> + pspec = g_param_spec_boolean("alpha",
> + "Alpha",
> + _("Whether alpha channel is supported in the avatar."),
> + TRUE,
> + G_PARAM_READABLE |
> + G_PARAM_STATIC_STRINGS);
> + g_object_class_install_property(g_klass,
> + PROP_ALPHA,
> + pspec);
> +}
> +
> +static void
> +osinfo_avatar_format_init (OsinfoAvatarFormat *avatar)
> +{
> +}
> +
> +/**
> + * osinfo_avatar_format_new:
> + *
> + * Construct a new user avatar file to a #OsinfoInstallScript.
> + *
> + * Returns: (transfer full): the necessary information to create an avatar for
> + * an user
> + */
> +OsinfoAvatarFormat *
> +osinfo_avatar_format_new(void)
> +{
> + return g_object_new(OSINFO_TYPE_AVATAR_FORMAT, NULL);
> +}
> +
> +/**
> + * osinfo_avatar_format_get_mime_type:
> + * @avatar: the avatar info
> + *
> + * Returns: the required mime-type of the avatar.
> + */
> +const gchar *
> +osinfo_avatar_format_get_mime_type(OsinfoAvatarFormat *avatar)
> +{
> + const gchar *mime_type;
> +
> + mime_type = osinfo_entity_get_param_value(OSINFO_ENTITY(avatar),
> + OSINFO_AVATAR_FORMAT_PROP_MIME_TYPE);
> + if (mime_type == NULL)
> + return DEFAULT_MIME_TYPE;
> +
> + return mime_type;
> +}
> +
> +/**
> + * osinfo_avatar_format_get_width:
> + * @avatar: the avatar info
> + *
> + * Returns: the required width (in pixels) of the avatar, or -1.
> + */
> +gint
> +osinfo_avatar_format_get_width(OsinfoAvatarFormat *avatar)
> +{
> + return osinfo_entity_get_param_value_int64(OSINFO_ENTITY(avatar),
> + OSINFO_AVATAR_FORMAT_PROP_WIDTH);
> +}
> +
> +/**
> + * osinfo_avatar_format_get_height:
> + * @avatar: the avatar info
> + *
> + * Returns: the required height (in pixels) of the avatar, or -1.
> + */
> +gint
> +osinfo_avatar_format_get_height(OsinfoAvatarFormat *avatar)
> +{
> + return osinfo_entity_get_param_value_int64(OSINFO_ENTITY(avatar),
> + OSINFO_AVATAR_FORMAT_PROP_HEIGHT);
> +}
> +
> +/**
> + * osinfo_avatar_format_get_alpha:
> + * @avatar: the avatar info
> + *
> + * Returns: Whether alpha channel is supported in the avatar.
> + */
> +gboolean
> +osinfo_avatar_format_get_alpha(OsinfoAvatarFormat *avatar)
> +{
> + return osinfo_entity_get_param_value_boolean_with_default
> + (OSINFO_ENTITY(avatar), OSINFO_AVATAR_FORMAT_PROP_ALPHA, TRUE);
> +}
> +
> +/*
> + * Local variables:
> + * indent-tabs-mode: nil
> + * c-indent-level: 4
> + * c-basic-offset: 4
> + * End:
> + */
> diff --git a/osinfo/osinfo_avatar_format.h b/osinfo/osinfo_avatar_format.h
> new file mode 100644
> index 0000000..c375548
> --- /dev/null
> +++ b/osinfo/osinfo_avatar_format.h
> @@ -0,0 +1,95 @@
> +/*
> + * libosinfo: OS installation avatar information
> + *
> + * Copyright (C) 2009-2012 Red Hat, Inc.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + *
> + * Authors:
> + * Fabiano Fidêncio <fabiano at fidencio.org>
> + * Zeeshan Ali (Khattak) <zeeshanak at gnome.org>
> + */
> +
> +#include <glib-object.h>
> +
> +#ifndef __OSINFO_AVATAR_FORMAT_H__
> +#define __OSINFO_AVATAR_FORMAT_H__
> +
> +/*
> + * Type macros.
> + */
> +#define OSINFO_TYPE_AVATAR_FORMAT \
> + (osinfo_avatar_format_get_type ())
> +
> +#define OSINFO_AVATAR_FORMAT(obj) \
> + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
> + OSINFO_TYPE_AVATAR_FORMAT, \
> + OsinfoAvatarFormat))
> +
> +#define OSINFO_IS_AVATAR_FORMAT(obj) \
> + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
> + OSINFO_TYPE_AVATAR_FORMAT))
> +
> +#define OSINFO_AVATAR_FORMAT_CLASS(klass) \
> + (G_TYPE_CHECK_CLASS_CAST ((klass), \
> + OSINFO_TYPE_AVATAR_FORMAT, \
> + OsinfoAvatarFormatClass))
> +
> +#define OSINFO_IS_AVATAR_FORMAT_CLASS(klass) \
> + (G_TYPE_CHECK_CLASS_TYPE ((klass), \
> + OSINFO_TYPE_AVATAR_FORMAT))
> +
> +#define OSINFO_AVATAR_FORMAT_GET_CLASS(obj) \
> + (G_TYPE_INSTANCE_GET_CLASS ((obj), \
> + OSINFO_TYPE_AVATAR_FORMAT, \
> + OsinfoAvatarFormatClass))
> +
> +typedef struct _OsinfoAvatarFormat OsinfoAvatarFormat;
> +typedef struct _OsinfoAvatarFormatClass OsinfoAvatarFormatClass;
> +
> +#define OSINFO_AVATAR_FORMAT_PROP_MIME_TYPE "mime-type"
> +#define OSINFO_AVATAR_FORMAT_PROP_WIDTH "width"
> +#define OSINFO_AVATAR_FORMAT_PROP_HEIGHT "height"
> +#define OSINFO_AVATAR_FORMAT_PROP_ALPHA "alpha"
> +
> +/* object */
> +struct _OsinfoAvatarFormat
> +{
> + OsinfoEntity parent_instance;
> +};
> +
> +/* class */
> +struct _OsinfoAvatarFormatClass
> +{
> + OsinfoEntityClass parent_class;
> +};
> +
> +GType osinfo_avatar_format_get_type(void);
> +
> +OsinfoAvatarFormat *osinfo_avatar_format_new(void);
> +
> +const gchar *osinfo_avatar_format_get_mime_type(OsinfoAvatarFormat *avatar);
> +gint osinfo_avatar_format_get_width(OsinfoAvatarFormat *avatar);
> +gint osinfo_avatar_format_get_height(OsinfoAvatarFormat *avatar);
> +gboolean osinfo_avatar_format_get_alpha(OsinfoAvatarFormat *avatar);
> +
> +#endif /* __OSINFO_AVATAR_FORMAT_H__ */
> +/*
> + * Local variables:
> + * indent-tabs-mode: nil
> + * c-indent-level: 4
> + * c-basic-offset: 4
> + * End:
> + */
> diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
> index 54dae64..75d8f4a 100644
> --- a/osinfo/osinfo_install_script.c
> +++ b/osinfo/osinfo_install_script.c
> @@ -50,6 +50,7 @@ struct _OsinfoInstallScriptPrivate
> gchar *output_prefix;
> gchar *output_filename;
> GList *config_param_list;
> + OsinfoAvatarFormat *avatar;
> };
>
> enum {
> @@ -60,6 +61,7 @@ enum {
> PROP_PROFILE,
> PROP_PRODUCT_KEY_FORMAT,
> PROP_PATH_FORMAT,
> + PROP_AVATAR_FORMAT,
> };
>
> typedef struct _OsinfoInstallScriptGenerateData OsinfoInstallScriptGenerateData;
> @@ -142,6 +144,11 @@ osinfo_os_get_property(GObject *object,
> osinfo_install_script_get_path_format(script));
> break;
>
> + case PROP_AVATAR_FORMAT:
> + g_value_take_object(value,
> + osinfo_install_script_get_avatar_format(script));
> + break;
> +
> default:
> /* We don't have any other property... */
> G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
> @@ -157,6 +164,8 @@ osinfo_install_script_finalize (GObject *object)
> g_free(script->priv->output_prefix);
> g_free(script->priv->output_filename);
> g_list_free_full(script->priv->config_param_list, g_object_unref);
> + if (script->priv->avatar != NULL)
> + g_object_unref(script->priv->avatar);
>
> /* Chain up to the parent class */
> G_OBJECT_CLASS (osinfo_install_script_parent_class)->finalize (object);
> @@ -240,6 +249,18 @@ osinfo_install_script_class_init (OsinfoInstallScriptClass *klass)
> PROP_PATH_FORMAT,
> pspec);
>
> + pspec = g_param_spec_object("avatar-format",
> + "Avatar Format",
> + _("Expected avatar format"),
> + OSINFO_TYPE_AVATAR_FORMAT,
> + G_PARAM_READABLE |
> + G_PARAM_STATIC_NAME |
> + G_PARAM_STATIC_NICK |
> + G_PARAM_STATIC_BLURB);
> + g_object_class_install_property(g_klass,
> + PROP_AVATAR_FORMAT,
> + pspec);
> +
> g_type_class_add_private (klass, sizeof (OsinfoInstallScriptPrivate));
> }
>
> @@ -464,6 +485,38 @@ const gchar *osinfo_install_script_get_output_filename(OsinfoInstallScript *scri
> return script->priv->output_filename;
> }
>
> +void
> +osinfo_install_script_set_avatar_format(OsinfoInstallScript *script,
> + OsinfoAvatarFormat *avatar)
> +{
> + g_return_if_fail(OSINFO_IS_INSTALL_SCRIPT(script));
> + g_return_if_fail(OSINFO_IS_AVATAR_FORMAT(avatar));
> +
> + if (script->priv->avatar != NULL)
> + g_object_unref(script->priv->avatar);
> + script->priv->avatar = g_object_ref(avatar);
> +}
> +
> +/**
> + * osinfo_install_script_get_avatar_format
> + *
> + * Some install scripts have restrictions on the format of the user avatar. Use
> + * this method to retrieve those restrictions in the form of an
> + * #OsinfoAvatarFormat instance.
> + *
> + * Returns: (transfer full): The avatar format, or NULL if there is no restrictions on the
> + * format of avatar
> + */
> +OsinfoAvatarFormat *osinfo_install_script_get_avatar_format(OsinfoInstallScript *script)
> +{
> + g_return_val_if_fail(OSINFO_IS_INSTALL_SCRIPT(script), NULL);
> +
> + if (script->priv->avatar == NULL)
> + return NULL;
> +
> + return g_object_ref(script->priv->avatar);
> +}
> +
> struct _OsinfoInstallScriptGenerateData {
> GSimpleAsyncResult *res;
> OsinfoOs *os;
> diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
> index 036b572..c6bc2df 100644
> --- a/osinfo/osinfo_install_script.h
> +++ b/osinfo/osinfo_install_script.h
> @@ -24,6 +24,7 @@
> #include <glib-object.h>
> #include <gio/gio.h>
> #include <osinfo/osinfo_install_config_param.h>
> +#include <osinfo/osinfo_avatar_format.h>
>
> #ifndef __OSINFO_INSTALL_SCRIPT_H__
> #define __OSINFO_INSTALL_SCRIPT_H__
> @@ -106,6 +107,11 @@ const gchar *osinfo_install_script_get_output_filename(OsinfoInstallScript *scri
>
> const gchar *osinfo_install_script_get_expected_filename(OsinfoInstallScript *script);
>
> +void osinfo_install_script_set_avatar_format(OsinfoInstallScript *script,
> + OsinfoAvatarFormat *avatar);
> +
> +OsinfoAvatarFormat *osinfo_install_script_get_avatar_format(OsinfoInstallScript *script);
> +
> void osinfo_install_script_generate_async(OsinfoInstallScript *script,
> OsinfoOs *os,
> OsinfoInstallConfig *config,
> diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
> index 4736189..7527530 100644
> --- a/osinfo/osinfo_loader.c
> +++ b/osinfo/osinfo_loader.c
> @@ -596,7 +596,31 @@ static void osinfo_loader_install_config_params(OsinfoLoader *loader,
> g_free(nodes);
> }
>
> +static OsinfoAvatarFormat *osinfo_loader_avatar_format(OsinfoLoader *loader,
> + xmlXPathContextPtr ctxt,
> + xmlNodePtr root,
> + GError **err)
> +{
> + OsinfoAvatarFormat *avatar_format;
> + const gchar *const keys[] = {
> + OSINFO_AVATAR_FORMAT_PROP_MIME_TYPE,
> + OSINFO_AVATAR_FORMAT_PROP_WIDTH,
> + OSINFO_AVATAR_FORMAT_PROP_HEIGHT,
> + OSINFO_AVATAR_FORMAT_PROP_ALPHA,
> + NULL
> + };
> +
> + avatar_format = osinfo_avatar_format_new();
> +
> + osinfo_loader_entity(loader, OSINFO_ENTITY(avatar_format), keys, ctxt, root, err);
> + if (error_is_set(err)) {
> + g_object_unref (avatar_format);
>
> + return NULL;
> + }
> +
> + return avatar_format;
> +}
>
> static void osinfo_loader_install_script(OsinfoLoader *loader,
> xmlXPathContextPtr ctxt,
> @@ -612,6 +636,8 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
> NULL
> };
> gchar *value = NULL;
> + xmlNodePtr *nodes = NULL;
> + int nnodes;
>
> if (!id) {
> OSINFO_ERROR(err, _("Missing install script id property"));
> @@ -651,6 +677,24 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
> root,
> err);
>
> + nnodes = osinfo_loader_nodeset("./avatar-format", ctxt, &nodes, err);
> + if (error_is_set(err))
> + goto error;
> +
> + if (nnodes > 0) {
> + OsinfoAvatarFormat *avatar_format;
> +
> + xmlNodePtr saved = ctxt->node;
> + ctxt->node = nodes[0];
> + avatar_format = osinfo_loader_avatar_format(loader, ctxt, root, err);
> + ctxt->node = saved;
> + if (error_is_set(err))
> + goto error;
> +
> + osinfo_install_script_set_avatar_format(installScript, avatar_format);
> + }
> + g_free(nodes);
> +
> osinfo_db_add_install_script(loader->priv->db, installScript);
>
> return;
> diff --git a/po/POTFILES.in b/po/POTFILES.in
> index 513958c..1a209bb 100644
> --- a/po/POTFILES.in
> +++ b/po/POTFILES.in
> @@ -23,6 +23,7 @@ data/devices/virtio-pci.xml.in
> data/devices/qemu-usb.xml.in
> data/hypervisors/rhel-xen.xml.in
> data/hypervisors/xen.xml.in
> +osinfo/osinfo_avatar_format.c
> osinfo/osinfo_deployment.c
> osinfo/osinfo_devicelink.c
> osinfo/osinfo_devicelinkfilter.c
> --
> 1.8.0
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- 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/virt-tools-list/attachments/20121121/4e679757/attachment.sig>
More information about the virt-tools-list
mailing list