[Libguestfs] [PATCH 3/3] inspect: revamp icon extraction for *SUSE guests

Richard W.M. Jones rjones at redhat.com
Wed Feb 6 16:04:34 UTC 2019


On Wed, Feb 06, 2019 at 03:26:46PM +0100, Pino Toscano wrote:
> Newer versions do not have the 24px distributor.png icon; OTOH they have
> the 48px version, so look for that one before the 24px one.
> 
> Also, bump the size limit to 10K, as newer versions of the icon are
> bigger than 3K.
> ---
>  lib/inspect-icon.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/inspect-icon.c b/lib/inspect-icon.c
> index 0cc8e92ad..623591aa6 100644
> --- a/lib/inspect-icon.c
> +++ b/lib/inspect-icon.c
> @@ -354,12 +354,16 @@ icon_mageia (guestfs_h *g, size_t *size_r)
>    return get_png (g, MAGEIA_ICON, size_r, 10240);
>  }
>  
> -#define OPENSUSE_ICON "/usr/share/icons/hicolor/24x24/apps/distributor.png"
> -
>  static char *
>  icon_opensuse (guestfs_h *g, size_t *size_r)
>  {
> -  return get_png (g, OPENSUSE_ICON, size_r, 2048);
> +  const char *icons[] = {
> +    "/usr/share/icons/hicolor/48x48/apps/distributor.png",
> +    "/usr/share/icons/hicolor/24x24/apps/distributor.png",
> +    NULL
> +  };
> +
> +  return find_png (g, icons, size_r, 10240);
>  }
>  
>  #if CAN_DO_CIRROS

ACK series, thanks.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list