[SCM] Development for GoFind! branch, master, updated. e0c489266de6174fc51844848941a7475bd6394a

Miriam Ruiz miriam at debian.org
Sat May 2 03:04:48 UTC 2009


The following commit has been merged in the master branch:
commit c1e6054f9e3f5075de86c419cd558131e5c8be88
Author: Miriam Ruiz <miriam at debian.org>
Date:   Sat May 2 05:07:23 2009 +0200

    Added better structured i18n support throught gettext

diff --git a/Makefile b/Makefile
index 1dd99e4..186d58a 100644
--- a/Makefile
+++ b/Makefile
@@ -31,11 +31,11 @@ LIBS= -lept -lept-core -lapt-pkg -lxapian -ldl `pkg-config $(PKGCONFIG_FILES) --
 
 OBJS= Engine.o Environment.o filter.o field.o gofind.o \
 	taghandler.o cfgmanager.o boolparser.o \
-	utf8.o dll.o guiplugin.o pkgdata.o slre.o
+	utf8.o dll.o guiplugin.o pkgdata.o slre.o i18n.o
 
 LIB_OBJS= Engine.o Environment.o filter.o field.o \
 	taghandler.o cfgmanager.o boolparser.o \
-	utf8.o dll.o guiplugin.o pkgdata.o slre.o
+	utf8.o dll.o guiplugin.o pkgdata.o slre.o i18n.o
 
 HEADERS=$(shell find . -name "*.h")
 
diff --git a/common.h b/common.h
index 7194480..30e42cf 100644
--- a/common.h
+++ b/common.h
@@ -40,13 +40,6 @@ extern "C" {
 #include "CuTest.h"
 #endif
 
-#ifdef USE_GETTEXT
-#include <libintl.h>
-#define _(String) gettext (String)
-#else
-#define _(String) String
-#endif
-
 #ifndef DATADIR
 #define DATADIR "/usr/share/goplay"
 #endif
diff --git a/fltk/aux.cpp b/fltk/aux.cpp
index a7beb1a..045c2e0 100644
--- a/fltk/aux.cpp
+++ b/fltk/aux.cpp
@@ -17,7 +17,7 @@
  */
 
 #include "aux.h"
-#include "../common.h"
+#include "common.h"
 
 #include <stdio.h>
 #include <string.h>
diff --git a/cfgmanager.cpp b/fltk/common.h
similarity index 62%
copy from cfgmanager.cpp
copy to fltk/common.h
index e88b595..e7df37b 100644
--- a/cfgmanager.cpp
+++ b/fltk/common.h
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2008  Miriam Ruiz <little_miry at yahoo.es>
+ * Copyright (C) 2007  Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2007, 2008  Miriam Ruiz <little_miry at yahoo.es>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,19 +17,19 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "common.h"
-#include "cfgmanager.h"
+#ifndef _GOFIND_FLTK_COMMON_H
+#define _GOFIND_FLTK_COMMON_H
 
-ConfigManager::ConfigManager()
-{
-}
+#include "../common.h"
 
-ConfigManager::~ConfigManager()
-{
-}
-
-#ifdef UNIT_TEST
-TEST_FUNCTION TestCuConfigManager(CuTest* tc)
-{
-}
+#ifdef USE_GETTEXT
+#include <libintl.h>
+#include <locale.h>
+#define _(String) gettext (String)
+#else
+// Work-around until goplay is actually gettextised
+#define gettext(String) (String)
+#define _(String) (String)
 #endif
+
+#endif // _GOFIND_FLTK_COMMON_H
diff --git a/fltk/pkgbrowser.cpp b/fltk/pkgbrowser.cpp
index 7070628..9f6d5a9 100644
--- a/fltk/pkgbrowser.cpp
+++ b/fltk/pkgbrowser.cpp
@@ -31,7 +31,7 @@
 #include "pkgbrowser.h"
 #include "ui.h"
 #include "aux.h"
-#include "../common.h"
+#include "common.h"
 #include "../pkgdata.h"
 
 #include <stdio.h>
@@ -50,14 +50,6 @@
 #include <set>
 #include <vector>
 
-#ifdef USE_GETTEXT
-#include <libintl.h>
-#include <locale.h>
-#else
-// Work-around until goplay is actually gettextised
-#define gettext(a) (a)
-#endif
-
 #include <FL/Fl_PNG_Image.H>
 #include <FL/Fl_JPEG_Image.H>
 #include <FL/Fl_BMP_Image.H>
diff --git a/fltk/ui.cpp b/fltk/ui.cpp
index 2449732..46234ce 100644
--- a/fltk/ui.cpp
+++ b/fltk/ui.cpp
@@ -1,6 +1,6 @@
 // generated by Fast Light User Interface Designer (fluid) version 1.0109
 
-#include "../common.h"
+#include "common.h"
 #include "ui.h"
 
 Fl_Menu_Item GamesUI::menu_TypeSelection[] = {
diff --git a/fltk/ui.fld b/fltk/ui.fld
index 77b7b1d..117dbf5 100644
--- a/fltk/ui.fld
+++ b/fltk/ui.fld
@@ -1,11 +1,11 @@
 # data file for the Fltk User Interface Designer (fluid)
 version 1.0109 
 i18n_type 1 
-i18n_include "../common.h" 
+i18n_include "common.h" 
 i18n_function _ 
 header_name {.h} 
 code_name {.cpp}
-decl {\#include "../common.h"} {public
+decl {\#include "common.h"} {public
 } 
 
 decl {\#include "aux.h"} {public
@@ -31,7 +31,7 @@ class GamesUI {open
     delete i;
   }} {}
   }
-  Function {Resize(int w, int h)} {open return_type void
+  Function {Resize(int w, int h)} {open selected return_type void
   } {
     code {static const int border = 6;
 static const int vgap = 4;
@@ -119,7 +119,7 @@ if (DebTagsBrowser)
         }
       }
       Fl_Button ScreenshotWidget {
-        callback {ResultsBrowser->ExternalBrowserScreenshot();} selected
+        callback {ResultsBrowser->ExternalBrowserScreenshot();}
         xywh {385 15 320 240} box FLAT_BOX color 32 selection_color 32
       }
       Fl_Browser ResultsBrowser {
@@ -142,7 +142,7 @@ if (DebTagsBrowser)
   Function {CreateAboutWindow()} {open
   } {
     Fl_Window AboutWindow {open
-      xywh {601 507 520 430} type Double visible
+      xywh {601 318 520 430} type Double visible
     } {
       Fl_Help_View AboutView {
         xywh {5 75 510 350}
diff --git a/fltk/ui.h b/fltk/ui.h
index 2f4bf8e..a0021ed 100644
--- a/fltk/ui.h
+++ b/fltk/ui.h
@@ -3,7 +3,7 @@
 #ifndef ui_h
 #define ui_h
 #include <FL/Fl.H>
-#include "../common.h"
+#include "common.h"
 #include "aux.h"
 #include "pkgbrowser.h"
 #include "windows.h"
diff --git a/gofind.cpp b/gofind.cpp
index a25ec7b..089de8e 100644
--- a/gofind.cpp
+++ b/gofind.cpp
@@ -19,6 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "i18n.h"
 #include "common.h"
 #include "guiplugin.h"
 
@@ -37,14 +38,6 @@
 #include <basedir.h>
 #include <basedir_fs.h>
 
-#ifdef USE_GETTEXT
-#include <libintl.h>
-#include <locale.h>
-#else
-// Work-around until goplay is actually gettextised
-#define gettext(a) (a)
-#endif
-
 #include <string.h>
 
 namespace std {
@@ -85,14 +78,6 @@ using namespace ept::textsearch;
 #ifndef UNIT_TEST
 int main(int argc, const char* argv[])
 {
-#ifdef USE_GETTEXT
-	setlocale (LC_MESSAGES, "");
-	setlocale (LC_CTYPE, "");
-	setlocale (LC_COLLATE, "");
-	textdomain ("gofind");
-	bindtextdomain ("gofind", NULL);
-#endif
-
 	wibble::commandline::GamesOptions opts;
 
 	try {
diff --git a/gui_cli.cpp b/gui_cli.cpp
index 2b75bf9..555fa55 100644
--- a/gui_cli.cpp
+++ b/gui_cli.cpp
@@ -42,9 +42,11 @@
 #ifdef USE_GETTEXT
 #include <libintl.h>
 #include <locale.h>
+#define _(String) gettext (String)
 #else
 // Work-around until goplay is actually gettextised
-#define gettext(a) (a)
+#define gettext(String) (String)
+#define _(String) (String)
 #endif
 
 using namespace std;
diff --git a/gui_fltk.cpp b/gui_fltk.cpp
index 36dc006..7e62412 100644
--- a/gui_fltk.cpp
+++ b/gui_fltk.cpp
@@ -30,9 +30,11 @@
 #ifdef USE_GETTEXT
 #include <libintl.h>
 #include <locale.h>
+#define _(String) gettext (String)
 #else
 // Work-around until goplay is actually gettextised
-#define gettext(a) (a)
+#define gettext(String) (String)
+#define _(String) (String)
 #endif
 
 #include <vector>
diff --git a/gui_lua.cpp b/gui_lua.cpp
index 8793e8a..6f91216 100644
--- a/gui_lua.cpp
+++ b/gui_lua.cpp
@@ -41,9 +41,11 @@
 #ifdef USE_GETTEXT
 #include <libintl.h>
 #include <locale.h>
+#define _(String) gettext (String)
 #else
 // Work-around until goplay is actually gettextised
-#define gettext(a) (a)
+#define gettext(String) (String)
+#define _(String) (String)
 #endif
 
 using namespace std;
diff --git a/guiplugin.cpp b/guiplugin.cpp
index f9424f8..28cf0b7 100644
--- a/guiplugin.cpp
+++ b/guiplugin.cpp
@@ -19,6 +19,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "i18n.h"
+
 #include "common.h"
 #include "guiplugin.h"
 
diff --git a/cfgmanager.cpp b/i18n.cpp
similarity index 64%
copy from cfgmanager.cpp
copy to i18n.cpp
index e88b595..03bea2c 100644
--- a/cfgmanager.cpp
+++ b/i18n.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008  Miriam Ruiz <little_miry at yahoo.es>
+ * Copyright (C) 2005  Miriam Ruiz <little_miry at yahoo.es>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,19 +16,26 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "common.h"
-#include "cfgmanager.h"
+#include "i18n.h"
 
-ConfigManager::ConfigManager()
-{
-}
+#ifdef USE_GETTEXT
 
-ConfigManager::~ConfigManager()
-{
-}
+#include <libintl.h>
+#include <locale.h>
 
-#ifdef UNIT_TEST
-TEST_FUNCTION TestCuConfigManager(CuTest* tc)
+GettextInit::GettextInit()
 {
+	if  (!IsInit)
+	{
+		IsInit = true;
+		setlocale (LC_MESSAGES, "");
+		setlocale (LC_CTYPE, "");
+		setlocale (LC_COLLATE, "");
+		textdomain ("gofind");
+		bindtextdomain ("gofind", NULL);
+	}
 }
-#endif
+
+bool GettextInit::IsInit = false;
+
+#endif // USE_GETTEXT
diff --git a/cfgmanager.cpp b/i18n.h
similarity index 62%
copy from cfgmanager.cpp
copy to i18n.h
index e88b595..65de43f 100644
--- a/cfgmanager.cpp
+++ b/i18n.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008  Miriam Ruiz <little_miry at yahoo.es>
+ * Copyright (C) 2005  Miriam Ruiz <little_miry at yahoo.es>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,19 +16,29 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "common.h"
-#include "cfgmanager.h"
+#ifndef _games_i18n_h
+#define _games_i18n_h
 
-ConfigManager::ConfigManager()
-{
-}
+#ifdef USE_GETTEXT
+#include <libintl.h>
+#include <locale.h>
+#else
+// Work-around until goplay is actually gettextised
+#define gettext(a) (a)
+#endif
 
-ConfigManager::~ConfigManager()
-{
-}
+#define _(String) gettext (String)
 
-#ifdef UNIT_TEST
-TEST_FUNCTION TestCuConfigManager(CuTest* tc)
+#ifdef USE_GETTEXT
+class GettextInit
 {
-}
+	protected:
+		static bool IsInit;
+	public:
+		GettextInit();
+};
+
+static GettextInit gettext_init;
 #endif
+
+#endif // _games_i18n_h
diff --git a/pkgdata.cpp b/pkgdata.cpp
index 26e451d..037b024 100644
--- a/pkgdata.cpp
+++ b/pkgdata.cpp
@@ -18,6 +18,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include "i18n.h"
+
 #include "pkgdata.h"
 #include "common.h"
 
@@ -34,14 +36,6 @@
 #include <cmath>
 #include <vector>
 
-#ifdef USE_GETTEXT
-#include <libintl.h>
-#include <locale.h>
-#else
-// Work-around until goplay is actually gettextised
-#define gettext(a) (a)
-#endif
-
 #include <string.h>
 
 PackageData::PackageData()

-- 
Development for GoFind!



More information about the Pkg-games-commits mailing list