libgweather r471 - in trunk: . libgweather
- From: danw svn gnome org
- To: svn-commits-list gnome org
- Subject: libgweather r471 - in trunk: . libgweather
- Date: Mon, 29 Sep 2008 16:30:39 +0000 (UTC)
Author: danw
Date: Mon Sep 29 16:30:39 2008
New Revision: 471
URL: http://svn.gnome.org/viewvc/libgweather?rev=471&view=rev
Log:
* libgweather/weather.c (gweather_gettext): gettext wrapper that
ensures bindtextdomain() and bind_textdomain_codeset() have been
called for our GETTEXT_PACKAGE.
* libgweather/weather-priv.h: Prototype gweather_gettext, #define
_() in terms of it.
* libgweather/gweather-gconf.c:
* libgweather/gweather-prefs.c:
* libgweather/weather-iwin.c:
* libgweather/weather-metar.c:
* libgweather/weather-wx.c: Remove glib/gi18n-lib.h includes, add
weather-priv.h include, where needed
#535865, based on a patch from Minoru Hashima.
Modified:
trunk/ChangeLog
trunk/libgweather/gweather-gconf.c
trunk/libgweather/gweather-prefs.c
trunk/libgweather/weather-iwin.c
trunk/libgweather/weather-metar.c
trunk/libgweather/weather-priv.h
trunk/libgweather/weather-wx.c
trunk/libgweather/weather.c
Modified: trunk/libgweather/gweather-gconf.c
==============================================================================
--- trunk/libgweather/gweather-gconf.c (original)
+++ trunk/libgweather/gweather-gconf.c Mon Sep 29 16:30:39 2008
@@ -28,10 +28,10 @@
#endif
#include <string.h>
-#include <glib/gi18n-lib.h>
#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
#include "gweather-gconf.h"
+#include "weather-priv.h"
struct _GWeatherGConf
{
Modified: trunk/libgweather/gweather-prefs.c
==============================================================================
--- trunk/libgweather/gweather-prefs.c (original)
+++ trunk/libgweather/gweather-prefs.c Mon Sep 29 16:30:39 2008
@@ -24,11 +24,11 @@
#include <langinfo.h>
#endif
-#include <glib/gi18n-lib.h>
#include <gconf/gconf-client.h>
#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
#include "gweather-prefs.h"
+#include "weather-priv.h"
static GConfEnumStringPair temp_unit_enum_map [] = {
{ TEMP_UNIT_DEFAULT, N_("Default") },
Modified: trunk/libgweather/weather-iwin.c
==============================================================================
--- trunk/libgweather/weather-iwin.c (original)
+++ trunk/libgweather/weather-iwin.c Mon Sep 29 16:30:39 2008
@@ -23,7 +23,6 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
-#include <glib/gi18n-lib.h>
#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
#include "weather.h"
Modified: trunk/libgweather/weather-metar.c
==============================================================================
--- trunk/libgweather/weather-metar.c (original)
+++ trunk/libgweather/weather-metar.c Mon Sep 29 16:30:39 2008
@@ -24,7 +24,6 @@
#include <string.h>
#include <sys/types.h>
#include <regex.h>
-#include <glib/gi18n-lib.h>
#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
#include "weather.h"
Modified: trunk/libgweather/weather-priv.h
==============================================================================
--- trunk/libgweather/weather-priv.h (original)
+++ trunk/libgweather/weather-priv.h Mon Sep 29 16:30:39 2008
@@ -20,11 +20,17 @@
#define __WEATHER_PRIV_H_
#include <time.h>
+#include <libintl.h>
#include <libsoup/soup.h>
#include "weather.h"
#include "gweather-location.h"
+const char *gweather_gettext (const char *str) G_GNUC_FORMAT (1);
+#define _(str) (gweather_gettext (str))
+#define N_(str) (str)
+
+
#define WEATHER_LOCATION_CODE_LEN 4
WeatherLocation *gweather_location_to_weather_location (GWeatherLocation *gloc,
Modified: trunk/libgweather/weather-wx.c
==============================================================================
--- trunk/libgweather/weather-wx.c (original)
+++ trunk/libgweather/weather-wx.c Mon Sep 29 16:30:39 2008
@@ -20,8 +20,6 @@
#include <config.h>
#endif
-#include <glib/gi18n-lib.h>
-
#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
#include "weather.h"
#include "weather-priv.h"
Modified: trunk/libgweather/weather.c
==============================================================================
--- trunk/libgweather/weather.c (original)
+++ trunk/libgweather/weather.c Mon Sep 29 16:30:39 2008
@@ -34,7 +34,6 @@
#include <time.h>
#include <unistd.h>
-#include <glib/gi18n-lib.h>
#include <gtk/gtkicontheme.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
@@ -43,6 +42,22 @@
#include "weather.h"
#include "weather-priv.h"
+const char *
+gweather_gettext (const char *str)
+{
+ static gsize gweather_gettext_initialized = FALSE;
+
+ if (G_UNLIKELY (g_once_init_enter (&gweather_gettext_initialized))) {
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+ g_once_init_leave (&gweather_gettext_initialized, TRUE);
+ }
+
+ return dgettext (GETTEXT_PACKAGE, str);
+}
+
/*
* Convert string of the form "DD-MM-SSH" to radians
* DD:degrees (to 3 digits), MM:minutes, SS:seconds H:hemisphere (NESW)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]