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

[Libguestfs] [PATCH 1/2] 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 1d0683964f996b24b8fcf5bce7611a98443344f3.

Thanks: Xiaoyun Hu
---
 src/inspect-icon.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/inspect-icon.c b/src/inspect-icon.c
index c298dd7..3893fba 100644
--- a/src/inspect-icon.c
+++ b/src/inspect-icon.c
@@ -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"
-- 
2.7.4


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