mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
inspection: Find Ubuntu logo from an alternate location (RHBZ#1352761).
The current location doesn't exist unless you've installed GNOME,
which is not so common on Ubuntu. Unfortunately I couldn't find any
other location containing a clean, high quality logo.
This adds another low quality icon source, and also prevents any icon
being returned if the highquality flag was set (note this prevents
virt-manager from displaying an icon, but there's nothing we can do
about that, and it's no worse than the current situation).
Updates commit 1d0683964f.
Thanks: Xiaoyun Hu
This commit is contained in:
@@ -141,7 +141,8 @@ guestfs_impl_inspect_get_icon (guestfs_h *g, const char *root, size_t *size_r,
|
||||
break;
|
||||
|
||||
case OS_DISTRO_UBUNTU:
|
||||
r = icon_ubuntu (g, fs, &size);
|
||||
if (!highquality)
|
||||
r = icon_ubuntu (g, fs, &size);
|
||||
break;
|
||||
|
||||
case OS_DISTRO_MAGEIA:
|
||||
@@ -349,12 +350,29 @@ icon_debian (guestfs_h *g, struct inspect_fs *fs, size_t *size_r)
|
||||
return get_png (g, fs, DEBIAN_ICON, size_r, 2048);
|
||||
}
|
||||
|
||||
#define UBUNTU_ICON "/usr/share/icons/gnome/24x24/places/ubuntu-logo.png"
|
||||
|
||||
static char *
|
||||
icon_ubuntu (guestfs_h *g, struct inspect_fs *fs, size_t *size_r)
|
||||
{
|
||||
return get_png (g, fs, UBUNTU_ICON, size_r, 2048);
|
||||
const char *icons[] = {
|
||||
"/usr/share/icons/gnome/24x24/places/ubuntu-logo.png",
|
||||
|
||||
/* Very low quality and only present when ubuntu-desktop packages
|
||||
* have been installed.
|
||||
*/
|
||||
"/usr/share/help/C/ubuntu-help/figures/ubuntu-logo.png",
|
||||
NULL
|
||||
};
|
||||
size_t i;
|
||||
char *ret;
|
||||
|
||||
for (i = 0; icons[i] != NULL; ++i) {
|
||||
ret = get_png (g, fs, icons[i], size_r, 2048);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
if (ret != NOT_FOUND)
|
||||
return ret;
|
||||
}
|
||||
return NOT_FOUND;
|
||||
}
|
||||
|
||||
#define MAGEIA_ICON "/usr/share/icons/mageia.png"
|
||||
|
||||
Reference in New Issue
Block a user