mirror of https://github.com/xemu-project/xemu.git
ui: relocate paths to icons and translations
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a9eacf8b4d
commit
77d910fb6a
10
ui/gtk.c
10
ui/gtk.c
|
@ -51,6 +51,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
#include "qemu/cutils.h"
|
||||||
#include "ui/input.h"
|
#include "ui/input.h"
|
||||||
#include "sysemu/runstate.h"
|
#include "sysemu/runstate.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
|
@ -2202,6 +2203,7 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
GtkDisplayState *s = g_malloc0(sizeof(*s));
|
GtkDisplayState *s = g_malloc0(sizeof(*s));
|
||||||
GdkDisplay *window_display;
|
GdkDisplay *window_display;
|
||||||
GtkIconTheme *theme;
|
GtkIconTheme *theme;
|
||||||
|
char *dir;
|
||||||
|
|
||||||
if (!gtkinit) {
|
if (!gtkinit) {
|
||||||
fprintf(stderr, "gtk initialization failed\n");
|
fprintf(stderr, "gtk initialization failed\n");
|
||||||
|
@ -2211,7 +2213,9 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
s->opts = opts;
|
s->opts = opts;
|
||||||
|
|
||||||
theme = gtk_icon_theme_get_default();
|
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");
|
g_set_prgname("qemu");
|
||||||
|
|
||||||
s->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
s->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
@ -2227,7 +2231,9 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
|
||||||
* sure that we don't accidentally break implicit assumptions. */
|
* sure that we don't accidentally break implicit assumptions. */
|
||||||
setlocale(LC_MESSAGES, "");
|
setlocale(LC_MESSAGES, "");
|
||||||
setlocale(LC_CTYPE, "C.UTF-8");
|
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");
|
bind_textdomain_codeset("qemu", "UTF-8");
|
||||||
textdomain("qemu");
|
textdomain("qemu");
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
#include "qemu/cutils.h"
|
||||||
#include "ui/console.h"
|
#include "ui/console.h"
|
||||||
#include "ui/input.h"
|
#include "ui/input.h"
|
||||||
#include "ui/sdl2.h"
|
#include "ui/sdl2.h"
|
||||||
|
@ -795,6 +796,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
|
||||||
int i;
|
int i;
|
||||||
SDL_SysWMinfo info;
|
SDL_SysWMinfo info;
|
||||||
SDL_Surface *icon = NULL;
|
SDL_Surface *icon = NULL;
|
||||||
|
char *dir;
|
||||||
|
|
||||||
assert(o->type == DISPLAY_TYPE_SDL);
|
assert(o->type == DISPLAY_TYPE_SDL);
|
||||||
|
|
||||||
|
@ -868,15 +870,18 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SDL_IMAGE
|
#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
|
#else
|
||||||
/* Load a 32x32x4 image. White pixels are transparent. */
|
/* 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) {
|
if (icon) {
|
||||||
uint32_t colorkey = SDL_MapRGB(icon->format, 255, 255, 255);
|
uint32_t colorkey = SDL_MapRGB(icon->format, 255, 255, 255);
|
||||||
SDL_SetColorKey(icon, SDL_TRUE, colorkey);
|
SDL_SetColorKey(icon, SDL_TRUE, colorkey);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
g_free(dir);
|
||||||
if (icon) {
|
if (icon) {
|
||||||
SDL_SetWindowIcon(sdl2_console[0].real_window, icon);
|
SDL_SetWindowIcon(sdl2_console[0].real_window, icon);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue