[evolution/gnome-2-28] Bug #599615 - i18n support for emae and filter-bar when used as lib



commit 3d84a9bb7ded8e5a412d90df616a9d7bc61cd41c
Author: Yan Li <yanli infradead org>
Date:   Mon Dec 21 14:43:16 2009 +0800

    Bug #599615 - i18n support for emae and filter-bar when used as lib
    
    This bug is first reported at Moblin Bugzilla:
    http://bugzilla.moblin.org/show_bug.cgi?id=4895
    
    Evolution shares some functions to be used by client programs like
    Anjal, so we have to use gi18n-lib.h instead of gi18n.lib to get i18n
    support.

 e-util/e-config.c           |    8 ++++----
 mail/em-account-editor.c    |   30 ++++++++++++++++++------------
 mail/em-popup.c             |    4 +++-
 widgets/misc/Makefile.am    |    1 +
 widgets/misc/e-filter-bar.c |    7 ++++++-
 widgets/misc/e-search-bar.c |    4 +++-
 6 files changed, 35 insertions(+), 19 deletions(-)
---
diff --git a/e-util/e-config.c b/e-util/e-config.c
index b9a284b..31662d0 100644
--- a/e-util/e-config.c
+++ b/e-util/e-config.c
@@ -22,13 +22,15 @@
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
+#include <glib/gi18n-lib.h>
+#else
+#include <glib/gi18n.h>
 #endif
 
 #include <string.h>
 #include <stdlib.h>
 
 #include <gtk/gtk.h>
-#include <glib/gi18n.h>
 
 #include <libgnomeui/gnome-druid.h>
 #include <libgnomeui/gnome-druid-page-standard.h>
@@ -36,8 +38,6 @@
 
 #include "e-config.h"
 
-#include <glib/gi18n.h>
-
 #define d(x)
 
 struct _EConfigFactory {
@@ -429,7 +429,7 @@ ec_rebuild(EConfig *emp)
 		d(printf(" '%s'\n", item->path));
 
 		if (item->label != NULL)
-			translated_label = gettext (item->label);
+			translated_label = _(item->label);
 
 		/* If the last section doesn't contain anything, hide it */
 		if (sectionnode != NULL
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 195f36e..f7418dd 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -36,9 +37,11 @@
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
+#include <glib/gi18n-lib.h>
+#else
+#include <glib/gi18n.h>
 #endif
 
-#include <glib/gi18n.h>
 #include <glib/gstdio.h>
 
 #include <string.h>
@@ -234,6 +237,9 @@ emae_finalise (GObject *o)
 static void
 emae_class_init (GObjectClass *klass)
 {
+	bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
 	klass->finalize = emae_finalise;
 }
 
@@ -400,7 +406,7 @@ emae_display_license (EMAccountEditor *emae, CamelProvider *prov)
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "mail-dialogs.glade",
 				      NULL);
-	xml = glade_xml_new (gladefile, "license_dialog", NULL);
+	xml = glade_xml_new (gladefile, "license_dialog", GETTEXT_PACKAGE);
 	g_free (gladefile);
 
 	dialog = glade_xml_get_widget (xml, "license_dialog");
@@ -1828,7 +1834,7 @@ emae_identity_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "mail-config.glade",
 				      NULL);
-	xml = glade_xml_new (gladefile, item->label, NULL);
+	xml = glade_xml_new (gladefile, item->label, GETTEXT_PACKAGE);
 	g_free (gladefile);
 
 	/* Management & Identity fields, in the druid the management frame is relocated to the last page later on */
@@ -1864,7 +1870,7 @@ emae_identity_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
 		gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 					      "mail-config.glade",
 					      NULL);
-		druidxml = glade_xml_new (gladefile, "identity_page", NULL);
+		druidxml = glade_xml_new (gladefile, "identity_page", GETTEXT_PACKAGE);
 		g_free (gladefile);
 
 		page = glade_xml_get_widget (druidxml, "identity_page");
@@ -1899,7 +1905,7 @@ emae_receive_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "mail-config.glade",
 				      NULL);
-	xml = glade_xml_new (gladefile, item->label, NULL);
+	xml = glade_xml_new (gladefile, item->label, GETTEXT_PACKAGE);
 	g_free (gladefile);
 
 	gui->source.type = CAMEL_PROVIDER_STORE;
@@ -1915,7 +1921,7 @@ emae_receive_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
 		gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 					      "mail-config.glade",
 					      NULL);
-		druidxml = glade_xml_new (gladefile, "source_page", NULL);
+		druidxml = glade_xml_new (gladefile, "source_page", GETTEXT_PACKAGE);
 		g_free (gladefile);
 
 		page = glade_xml_get_widget (druidxml, "source_page");
@@ -2390,7 +2396,7 @@ emae_send_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *ol
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "mail-config.glade",
 				      NULL);
-	xml = glade_xml_new (gladefile, item->label, NULL);
+	xml = glade_xml_new (gladefile, item->label, GETTEXT_PACKAGE);
 	g_free (gladefile);
 
 	/* Transport */
@@ -2407,7 +2413,7 @@ emae_send_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *ol
 		gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 					      "mail-config.glade",
 					      NULL);
-		druidxml = glade_xml_new (gladefile, "transport_page", NULL);
+		druidxml = glade_xml_new (gladefile, "transport_page", GETTEXT_PACKAGE);
 		g_free (gladefile);
 
 		page = glade_xml_get_widget (druidxml, "transport_page");
@@ -2442,7 +2448,7 @@ emae_defaults_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "mail-config.glade",
 				      NULL);
-	xml = glade_xml_new (gladefile, item->label, NULL);
+	xml = glade_xml_new (gladefile, item->label, GETTEXT_PACKAGE);
 	g_free (gladefile);
 
 	/* Special folders */
@@ -2502,7 +2508,7 @@ emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "mail-config.glade",
 				      NULL);
-	xml = glade_xml_new (gladefile, item->label, NULL);
+	xml = glade_xml_new (gladefile, item->label, GETTEXT_PACKAGE);
 	g_free (gladefile);
 
 	/* Security */
@@ -2616,7 +2622,7 @@ emae_management_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg
 		gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 					      "mail-config.glade",
 					      NULL);
-		druidxml = glade_xml_new (gladefile, "management_page", NULL);
+		druidxml = glade_xml_new (gladefile, "management_page", GETTEXT_PACKAGE);
 		g_free (gladefile);
 
 		page = glade_xml_get_widget (druidxml, "management_page");
@@ -2644,7 +2650,7 @@ emae_widget_druid_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkW
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "mail-config.glade",
 				      NULL);
-	druidxml = glade_xml_new (gladefile, item->label, NULL);
+	druidxml = glade_xml_new (gladefile, item->label, GETTEXT_PACKAGE);
 	g_free (gladefile);
 
 	w = glade_xml_get_widget (druidxml, item->label);
diff --git a/mail/em-popup.c b/mail/em-popup.c
index 4fc912b..674cb40 100644
--- a/mail/em-popup.c
+++ b/mail/em-popup.c
@@ -22,6 +22,9 @@
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
+#include <glib/gi18n-lib.h>
+#else
+#include <glib/gi18n.h>
 #endif
 
 #include <string.h>
@@ -29,7 +32,6 @@
 
 #include <gio/gio.h>
 #include <gtk/gtk.h>
-#include <glib/gi18n.h>
 
 #include "em-popup.h"
 #include "libedataserver/e-msgport.h"
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index d6689ef..56d0591 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -7,6 +7,7 @@ AM_CPPFLAGS =								\
 	-I$(top_srcdir)/a11y/widgets					\
 	-I$(top_srcdir)/widgets						\
 	-DEVOLUTION_IMAGES=\""$(imagesdir)"\"				\
+	-DEVOLUTION_LOCALEDIR=\""$(localedir)"\"			\
 	-DEVOLUTION_GLADEDIR=\""$(gladedir)"\"				\
 	-DG_LOG_DOMAIN=__FILE__						\
 	$(EVOLUTION_MAIL_CFLAGS)					\
diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c
index 5a86f6f..a145592 100644
--- a/widgets/misc/e-filter-bar.c
+++ b/widgets/misc/e-filter-bar.c
@@ -23,6 +23,9 @@
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
+#include <glib/gi18n-lib.h>
+#else
+#include <glib/gi18n.h>
 #endif
 
 #include <string.h>
@@ -30,7 +33,6 @@
 #include <libxml/tree.h>
 #include <libxml/parser.h>
 
-#include <glib/gi18n.h>
 
 #include "e-dropdown-button.h"
 #include "e-filter-bar.h"
@@ -911,6 +913,9 @@ class_init (EFilterBarClass *klass)
 
 	/*gtk_object_add_arg_type ("EFilterBar::query", G_TYPE_STRING, GTK_ARG_READABLE, ARG_QUERY);*/
 
+	bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
 #if 0
 	esb_signals [QUERY_CHANGED] =
 		g_signal_new ("query_changed",
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index 0a77853..a65517b 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -24,6 +24,9 @@
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
+#include <glib/gi18n-lib.h>
+#else
+#include <glib/gi18n.h>
 #endif
 
 #include <gdk/gdkkeysyms.h>
@@ -31,7 +34,6 @@
 #include <misc/e-unicode.h>
 #include <misc/e-gui-utils.h>
 
-#include <glib/gi18n.h>
 
 #include <bonobo/bonobo-ui-util.h>
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]