From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Subject: [PATCH 12/13] ui: relocate paths to icons and translations
Date: Tue, 1 Sep 2020 02:20:19 -0400 [thread overview]
Message-ID: <20200901062020.26660-13-pbonzini@redhat.com> (raw)
In-Reply-To: <20200901062020.26660-1-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
ui/gtk.c | 10 ++++++++--
ui/sdl2.c | 9 +++++++--
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index b0cc08ad6d..597f829ad9 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -51,6 +51,7 @@
#include <math.h>
#include "trace.h"
+#include "qemu/cutils.h"
#include "ui/input.h"
#include "sysemu/runstate.h"
#include "sysemu/sysemu.h"
@@ -2200,6 +2201,7 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
GtkDisplayState *s = g_malloc0(sizeof(*s));
GdkDisplay *window_display;
GtkIconTheme *theme;
+ char *dir;
if (!gtkinit) {
fprintf(stderr, "gtk initialization failed\n");
@@ -2209,7 +2211,9 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
s->opts = opts;
theme = gtk_icon_theme_get_default();
- gtk_icon_theme_prepend_search_path(theme, CONFIG_QEMU_ICONDIR);
+ dir = get_relocated_path(CONFIG_QEMU_ICONDIR);
+ gtk_icon_theme_prepend_search_path(theme, dir);
+ g_free(dir);
g_set_prgname("qemu");
s->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -2225,7 +2229,9 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
* sure that we don't accidentally break implicit assumptions. */
setlocale(LC_MESSAGES, "");
setlocale(LC_CTYPE, "C.UTF-8");
- bindtextdomain("qemu", CONFIG_QEMU_LOCALEDIR);
+ dir = get_relocated_path(CONFIG_QEMU_LOCALEDIR);
+ bindtextdomain("qemu", dir);
+ g_free(dir);
bind_textdomain_codeset("qemu", "UTF-8");
textdomain("qemu");
diff --git a/ui/sdl2.c b/ui/sdl2.c
index b23a8f0a8e..abad7f981e 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qemu/module.h"
+#include "qemu/cutils.h"
#include "ui/console.h"
#include "ui/input.h"
#include "ui/sdl2.h"
@@ -795,6 +796,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
int i;
SDL_SysWMinfo info;
SDL_Surface *icon = NULL;
+ char *dir;
assert(o->type == DISPLAY_TYPE_SDL);
@@ -868,15 +870,18 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
}
#ifdef CONFIG_SDL_IMAGE
- icon = IMG_Load(CONFIG_QEMU_ICONDIR "/hicolor/128x128/apps/qemu.png");
+ dir = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/128x128/apps/qemu.png");
+ icon = IMG_Load(dir);
#else
/* Load a 32x32x4 image. White pixels are transparent. */
- icon = SDL_LoadBMP(CONFIG_QEMU_ICONDIR "/hicolor/32x32/apps/qemu.bmp");
+ dir = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/32x32/apps/qemu.bmp");
+ icon = SDL_LoadBMP(dir);
if (icon) {
uint32_t colorkey = SDL_MapRGB(icon->format, 255, 255, 255);
SDL_SetColorKey(icon, SDL_TRUE, colorkey);
}
#endif
+ g_free(dir);
if (icon) {
SDL_SetWindowIcon(sdl2_console[0].real_window, icon);
}
--
2.26.2
next prev parent reply other threads:[~2020-09-01 6:23 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 6:20 [PATCH 00/13] Make QEMU installation relocatable Paolo Bonzini
2020-09-01 6:20 ` [PATCH 01/13] fuzz: use qemu_get_exec_dir Paolo Bonzini
2020-09-01 9:18 ` Thomas Huth
2020-09-01 14:36 ` Alexander Bulekov
2020-09-01 6:20 ` [PATCH 02/13] oslib: do not call g_strdup from qemu_get_exec_dir Paolo Bonzini
2020-09-02 10:30 ` Thomas Huth
2020-09-01 6:20 ` [PATCH 03/13] oslib-posix: default exec_dir to bindir Paolo Bonzini
2020-09-01 18:04 ` Richard Henderson
2020-09-01 18:40 ` Paolo Bonzini
2020-09-01 6:20 ` [PATCH 04/13] cutils: introduce get_relocated_path Paolo Bonzini
2020-09-01 6:20 ` [PATCH 05/13] oslib-posix: relocate path to /var Paolo Bonzini
2020-09-02 8:20 ` Philippe Mathieu-Daudé
2020-09-01 6:20 ` [PATCH 06/13] module: relocate path to modules Paolo Bonzini
2020-09-01 6:20 ` [PATCH 07/13] net: relocate paths to helpers and scripts Paolo Bonzini
2020-09-02 8:24 ` Philippe Mathieu-Daudé
2020-09-02 8:40 ` Paolo Bonzini
2020-09-01 6:20 ` [PATCH 08/13] vl: relocate paths to data directories Paolo Bonzini
2020-09-02 8:28 ` Philippe Mathieu-Daudé
2020-09-02 8:35 ` Paolo Bonzini
2020-09-02 8:41 ` Philippe Mathieu-Daudé
2020-09-01 6:20 ` [PATCH 09/13] vl: relocate path to configuration file Paolo Bonzini
2020-09-02 8:28 ` Philippe Mathieu-Daudé
2020-09-01 6:20 ` [PATCH 10/13] qemu-bridge-helper: relocate path to default ACL Paolo Bonzini
2020-09-01 6:20 ` [PATCH 11/13] qga: relocate path to default configuration and hook Paolo Bonzini
2020-09-01 6:20 ` Paolo Bonzini [this message]
2020-09-02 8:29 ` [PATCH 12/13] ui: relocate paths to icons and translations Philippe Mathieu-Daudé
2020-09-01 6:20 ` [PATCH 13/13] configure: use a platform-neutral prefix Paolo Bonzini
2020-09-01 21:14 ` [PATCH 00/13] Make QEMU installation relocatable Mark Cave-Ayland
2020-09-01 21:22 ` Paolo Bonzini
2020-09-02 6:09 ` Mark Cave-Ayland
2020-09-02 6:42 ` Paolo Bonzini
2020-09-02 11:42 ` Mark Cave-Ayland
2020-09-02 11:45 ` Mark Cave-Ayland
2020-09-02 12:16 ` Paolo Bonzini
2020-09-02 18:45 ` Mark Cave-Ayland
2020-09-02 20:20 ` Paolo Bonzini
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=20200901062020.26660-13-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--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).