[telepathy-account-widgets] builder: use the correct translation domain



commit fc5e5715096bc50fea89717b07806e5364e0228d
Author: Marco Barisione <marco barisione collabora co uk>
Date:   Tue Sep 3 15:46:06 2013 +0100

    builder: use the correct translation domain
    
    tpaw_builder_get_*() functions always used GETTEXT_PACKAGE as
    translation domain, but that always meant the tpaw one so it broke
    empathy's translations.
    
    This commit adds tpaw_builder_get_*_with_domain() functions and replace
    the previous functions with macros that use the GETTEXT_PACKAGE defined
    in the .c file that includes tpaw-builder.h.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707208

 tp-account-widgets/tpaw-builder.c |   15 ++++++++++-----
 tp-account-widgets/tpaw-builder.h |   14 ++++++++++++--
 2 files changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/tp-account-widgets/tpaw-builder.c b/tp-account-widgets/tpaw-builder.c
index 98b1dbe..cd5a3ea 100644
--- a/tp-account-widgets/tpaw-builder.c
+++ b/tp-account-widgets/tpaw-builder.c
@@ -38,6 +38,7 @@ enum _BuilderSource
 static GtkBuilder *
 builder_get_valist (const gchar *sourcename,
     enum _BuilderSource source,
+    const gchar *translation_domain,
     const gchar *first_object,
     va_list args)
 {
@@ -50,7 +51,7 @@ builder_get_valist (const gchar *sourcename,
   DEBUG ("Loading %s '%s'", source == BUILDER_SOURCE_FILE ? "file" : "resource", sourcename);
 
   gui = gtk_builder_new ();
-  gtk_builder_set_translation_domain (gui, GETTEXT_PACKAGE);
+  gtk_builder_set_translation_domain (gui, translation_domain);
 
   switch (source)
     {
@@ -100,7 +101,8 @@ builder_get_valist (const gchar *sourcename,
 }
 
 GtkBuilder *
-tpaw_builder_get_file (const gchar *filename,
+tpaw_builder_get_file_with_domain (const gchar *filename,
+    const gchar *translation_domain,
     const gchar *first_object,
     ...)
 {
@@ -108,14 +110,16 @@ tpaw_builder_get_file (const gchar *filename,
   va_list args;
 
   va_start (args, first_object);
-  gui = builder_get_valist (filename, BUILDER_SOURCE_FILE, first_object, args);
+  gui = builder_get_valist (filename, BUILDER_SOURCE_FILE,
+      translation_domain, first_object, args);
   va_end (args);
 
   return gui;
 }
 
 GtkBuilder *
-tpaw_builder_get_resource (const gchar *resourcename,
+tpaw_builder_get_resource_with_domain (const gchar *resourcename,
+    const gchar *translation_domain,
     const gchar *first_object,
     ...)
 {
@@ -123,7 +127,8 @@ tpaw_builder_get_resource (const gchar *resourcename,
   va_list args;
 
   va_start (args, first_object);
-  gui = builder_get_valist (resourcename, BUILDER_SOURCE_RESOURCE, first_object, args);
+  gui = builder_get_valist (resourcename, BUILDER_SOURCE_RESOURCE,
+      translation_domain, first_object, args);
   va_end (args);
 
   return gui;
diff --git a/tp-account-widgets/tpaw-builder.h b/tp-account-widgets/tpaw-builder.h
index 57134ce..4dc35bd 100644
--- a/tp-account-widgets/tpaw-builder.h
+++ b/tp-account-widgets/tpaw-builder.h
@@ -31,10 +31,20 @@
 
 G_BEGIN_DECLS
 
-GtkBuilder * tpaw_builder_get_file (const gchar *filename,
+#define tpaw_builder_get_file(filename, ...) \
+    tpaw_builder_get_file_with_domain (filename, GETTEXT_PACKAGE, \
+            __VA_ARGS__)
+
+#define tpaw_builder_get_resource(resourcename, ...) \
+    tpaw_builder_get_resource_with_domain (resourcename, GETTEXT_PACKAGE, \
+            __VA_ARGS__)
+
+GtkBuilder * tpaw_builder_get_file_with_domain (const gchar *filename,
+    const gchar *translation_domain,
     const gchar *first_object,
     ...);
-GtkBuilder * tpaw_builder_get_resource (const gchar *resourcename,
+GtkBuilder * tpaw_builder_get_resource_with_domain (const gchar *resourcename,
+    const gchar *translation_domain,
     const gchar *first_object,
     ...);
 void tpaw_builder_connect (GtkBuilder *gui,


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