qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@gmail.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Jason Wang" <jasowang@redhat.com>,
	qemu-devel@nongnu.org, Programmingkid <programmingkidx@gmail.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Akihiko Odaki" <akihiko.odaki@gmail.com>
Subject: [PATCH v6 6/7] ui/icons: Use bundle mechanism
Date: Thu, 16 Jun 2022 00:56:33 +0900	[thread overview]
Message-ID: <20220615155634.578-7-akihiko.odaki@gmail.com> (raw)
In-Reply-To: <20220615155634.578-1-akihiko.odaki@gmail.com>

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
---
 ui/cocoa.m           |  2 +-
 ui/gtk.c             |  2 +-
 ui/icons/meson.build | 32 ++++++++++++++++++++++++--------
 ui/sdl2.c            |  4 ++--
 4 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 84c84e98fc5..25584cc78ce 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1562,7 +1562,7 @@ - (BOOL)verifyQuit
 - (IBAction) do_about_menu_item: (id) sender
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    char *icon_path_c = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/512x512/apps/qemu.png");
+    char *icon_path_c = find_bundle(CONFIG_QEMU_ICONDIR "/hicolor/512x512/apps/qemu.png");
     NSString *icon_path = [NSString stringWithUTF8String:icon_path_c];
     g_free(icon_path_c);
     NSImage *icon = [[NSImage alloc] initWithContentsOfFile:icon_path];
diff --git a/ui/gtk.c b/ui/gtk.c
index 2a791dd2aa0..27d5a3407cf 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -2321,7 +2321,7 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
     s->opts = opts;
 
     theme = gtk_icon_theme_get_default();
-    dir = get_relocated_path(CONFIG_QEMU_ICONDIR);
+    dir = find_bundle(CONFIG_QEMU_ICONDIR);
     gtk_icon_theme_prepend_search_path(theme, dir);
     g_free(dir);
     g_set_prgname("qemu");
diff --git a/ui/icons/meson.build b/ui/icons/meson.build
index 12c52080ebd..1d99aff10ed 100644
--- a/ui/icons/meson.build
+++ b/ui/icons/meson.build
@@ -1,13 +1,29 @@
+icons = [
+  {
+    'source': 'qemu_32x32.bmp',
+    'install': 'hicolor' / '32x32' / 'apps' / 'qemu.bmp',
+  },
+  {
+    'source': 'qemu.svg',
+    'install': 'hicolor' / 'scalable' / 'apps' / 'qemu.svg',
+  },
+]
+
 foreach s: [16, 24, 32, 48, 64, 128, 256, 512]
   s = '@0@x@0@'.format(s.to_string())
-  install_data('qemu_@0@.png'.format(s),
-               rename: 'qemu.png',
-               install_dir: qemu_icondir / 'hicolor' / s / 'apps')
+  icons += {
+    'source': 'qemu_@0@.png'.format(s),
+    'install': 'hicolor' / s / 'apps' / 'qemu.png',
+  }
 endforeach
 
-install_data('qemu_32x32.bmp',
-             rename: 'qemu.bmp',
-             install_dir: qemu_icondir / 'hicolor' / '32x32' / 'apps')
+foreach icon: icons
+  source = icon.get('source')
+  install = icon.get('install')
+
+  install_data(source,
+               rename: fs.name(install),
+               install_dir: qemu_icondir / fs.parent(install))
 
-install_data('qemu.svg',
-             install_dir: qemu_icondir / 'hicolor' / 'scalable' / 'apps')
+  bundles += { qemu_bundledir / qemu_icondir / install: meson.current_source_dir() / source }
+endforeach
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 8cb77416af2..916815cc8a2 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -910,11 +910,11 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
     }
 
 #ifdef CONFIG_SDL_IMAGE
-    dir = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/128x128/apps/qemu.png");
+    dir = find_bundle(CONFIG_QEMU_ICONDIR "/hicolor/128x128/apps/qemu.png");
     icon = IMG_Load(dir);
 #else
     /* Load a 32x32x4 image. White pixels are transparent. */
-    dir = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/32x32/apps/qemu.bmp");
+    dir = find_bundle(CONFIG_QEMU_ICONDIR "/hicolor/32x32/apps/qemu.bmp");
     icon = SDL_LoadBMP(dir);
     if (icon) {
         uint32_t colorkey = SDL_MapRGB(icon->format, 255, 255, 255);
-- 
2.32.1 (Apple Git-133)



  parent reply	other threads:[~2022-06-15 16:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15 15:56 [PATCH v6 0/7] cutils: Introduce bundle mechanism Akihiko Odaki
2022-06-15 15:56 ` [PATCH v6 1/7] datadir: Simplify firmware directory search Akihiko Odaki
2022-06-15 16:52   ` Daniel P. Berrangé
2022-06-15 15:56 ` [PATCH v6 2/7] qga: Relocate a path emitted in the help text Akihiko Odaki
2022-06-15 15:56 ` [PATCH v6 3/7] Remove prefixes from path configuration macros Akihiko Odaki
2022-06-15 19:25   ` Paolo Bonzini
2022-06-15 15:56 ` [PATCH v6 4/7] cutils: Introduce bundle mechanism Akihiko Odaki
2022-06-15 19:26   ` Paolo Bonzini
2022-06-15 15:56 ` [PATCH v6 5/7] datadir: Use " Akihiko Odaki
2022-06-15 19:23   ` Paolo Bonzini
2022-06-15 15:56 ` Akihiko Odaki [this message]
2022-06-15 15:56 ` [PATCH v6 7/7] net: " Akihiko Odaki
2022-06-15 19:27 ` [PATCH v6 0/7] cutils: Introduce " Paolo Bonzini
2022-06-16  9:18   ` Paolo Bonzini
2022-06-24 16:33     ` Akihiko Odaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220615155634.578-7-akihiko.odaki@gmail.com \
    --to=akihiko.odaki@gmail.com \
    --cc=berrange@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).