summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2016-08-17 16:09:17 +0100
committerFrediano Ziglio <fziglio@redhat.com>2016-08-19 10:32:32 +0100
commit1709425c16deb1bd3209224b4edf24e306b41adb (patch)
treea0733fe28de4f246ae06f778c7f47f34029deeaa
parentba031e37f24f305a2cacdd4c6147c13729e64077 (diff)
Initialise gettext library properly
This will allow internationalisation to work correctly. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Marc-André Lureau <mlureau@redhat.com>
-rw-r--r--src/Makefile.am3
-rw-r--r--src/channel-usbredir.c2
-rw-r--r--src/desktop-integration.c2
-rw-r--r--src/spice-channel.c2
-rw-r--r--src/spice-cmdline.c2
-rw-r--r--src/spice-glib-main.c52
-rw-r--r--src/spice-option.c2
-rw-r--r--src/usb-device-manager.c2
-rw-r--r--src/usb-device-widget.c2
-rw-r--r--src/usbutil.c2
10 files changed, 63 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a820259..fd90db3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -104,6 +104,7 @@ SPICE_COMMON_CPPFLAGS = \
$(NULL)
AM_CPPFLAGS = \
+ -DLOCALE_DIR=\""$(datadir)/locale"\" \
$(SPICE_COMMON_CPPFLAGS) \
$(SPICE_CFLAGS) \
$(NULL)
@@ -274,6 +275,8 @@ libspice_client_glib_2_0_la_SOURCES = \
\
client_sw_canvas.c \
client_sw_canvas.h \
+ \
+ spice-glib-main.c \
$(NULL)
nodist_libspice_client_glib_2_0_la_SOURCES = \
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 0e7a0b0..dd17e6c 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -22,7 +22,7 @@
#include "config.h"
#ifdef USE_USBREDIR
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <usbredirhost.h>
#ifdef USE_LZ4
#include <lz4.h>
diff --git a/src/desktop-integration.c b/src/desktop-integration.c
index 529fb05..8070a71 100644
--- a/src/desktop-integration.c
+++ b/src/desktop-integration.c
@@ -26,7 +26,7 @@
#include "spice-session-priv.h"
#include "desktop-integration.h"
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#define GNOME_SESSION_INHIBIT_AUTOMOUNT 16
diff --git a/src/spice-channel.c b/src/spice-channel.c
index 0eb0e61..4e792a2 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -25,7 +25,7 @@
#include "spice-marshal.h"
#include "bio-gio.h"
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <openssl/rsa.h>
#include <openssl/evp.h>
diff --git a/src/spice-cmdline.c b/src/spice-cmdline.c
index 8619b57..4b6f4c2 100644
--- a/src/spice-cmdline.c
+++ b/src/spice-cmdline.c
@@ -16,7 +16,7 @@
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include "spice-client.h"
#include "spice-common.h"
diff --git a/src/spice-glib-main.c b/src/spice-glib-main.c
new file mode 100644
index 0000000..c2bd7ca
--- /dev/null
+++ b/src/spice-glib-main.c
@@ -0,0 +1,52 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ Copyright (C) 2016 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <common/macros.h>
+
+#ifdef G_OS_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
+
+BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ if (fdwReason == DLL_PROCESS_ATTACH) {
+ char *basedir =
+ g_win32_get_package_installation_directory_of_module(hinstDLL);
+ char *localedir = g_build_filename(basedir, "share", "locale", NULL);
+ bindtextdomain(GETTEXT_PACKAGE, localedir);
+ g_free(localedir);
+ g_free(basedir);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ }
+ return TRUE;
+}
+
+#else
+
+SPICE_CONSTRUCTOR_FUNC(i18n_init)
+{
+ bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+}
+
+#endif
diff --git a/src/spice-option.c b/src/spice-option.c
index 4d5aab2..c04e978 100644
--- a/src/spice-option.c
+++ b/src/spice-option.c
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <glib-object.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include "spice-session.h"
#include "spice-util.h"
#include "spice-channel-priv.h"
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 53505fa..4f956fd 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -51,7 +51,7 @@
#include "spice-marshal.h"
#include "usb-device-manager-priv.h"
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#ifndef G_OS_WIN32 /* Linux -- device id is bus.addr */
#define DEV_ID_FMT "at %u.%u"
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index 05c7054..b394499 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -20,7 +20,7 @@
*/
#include "config.h"
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include "spice-client.h"
#include "spice-marshal.h"
#include "usb-device-widget.h"
diff --git a/src/usbutil.c b/src/usbutil.c
index 6dcb4de..7bfbe44 100644
--- a/src/usbutil.c
+++ b/src/usbutil.c
@@ -22,7 +22,7 @@
#include "config.h"
#include <glib-object.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <ctype.h>
#include <stdlib.h>