gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: support translation of cont


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: support translation of continents (#6749)
Date: Mon, 05 Apr 2021 19:29:27 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository anastasis-gtk.

The following commit(s) were added to refs/heads/master by this push:
     new 1abfcc6  support translation of continents (#6749)
1abfcc6 is described below

commit 1abfcc6a8ccf774a316866a52ebc055e1daaeae6
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Apr 5 19:29:25 2021 +0200

    support translation of continents (#6749)
---
 contrib/anastasis_gtk_main_window.glade |  4 ++-
 src/anastasis/anastasis-gtk_action.c    | 46 ++++++++++++++++++++++++++++++---
 src/anastasis/anastasis-gtk_helper.h    |  7 ++++-
 3 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/contrib/anastasis_gtk_main_window.glade 
b/contrib/anastasis_gtk_main_window.glade
index 0b95296..ff10b2c 100644
--- a/contrib/anastasis_gtk_main_window.glade
+++ b/contrib/anastasis_gtk_main_window.glade
@@ -97,6 +97,8 @@ Author: Christian Grothoff, Dennis Neufeld
     <columns>
       <!-- column-name continent_name -->
       <column type="gchararray"/>
+      <!-- column-name continent_i18n_name -->
+      <column type="gchararray"/>
     </columns>
   </object>
   <object class="GtkListStore" id="country_liststore">
@@ -432,7 +434,7 @@ Author: Christian Grothoff, Dennis Neufeld
                                                     <child>
                                                       <object 
class="GtkCellRendererText" id="continent_name_cell_renderer"/>
                                                       <attributes>
-                                                        <attribute 
name="text">0</attribute>
+                                                        <attribute 
name="text">1</attribute>
                                                       </attributes>
                                                     </child>
                                                   </object>
diff --git a/src/anastasis/anastasis-gtk_action.c 
b/src/anastasis/anastasis-gtk_action.c
index f286128..f0aa2c8 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -68,12 +68,34 @@ action_continent_selecting (void)
                           index,
                           continent)
       {
+        const char *name;
+        const char *name_i18n;
+        struct GNUNET_JSON_Specification spec[] = {
+          GNUNET_JSON_spec_string ("name",
+                                   &name),
+          TALER_JSON_spec_i18n_str ("name",
+                                    &name_i18n),
+          GNUNET_JSON_spec_end ()
+        };
+
+        if (GNUNET_OK !=
+            GNUNET_JSON_parse (continent,
+                               spec,
+                               NULL, NULL))
+        {
+          GNUNET_break (0);
+          continue;
+        }
+
         gtk_list_store_insert_with_values (continent_liststore,
                                            NULL,
                                            -1,
                                            AG_CMC_CONTINENT_NAME,
-                                           json_string_value (continent),
+                                           name,
+                                           AG_CMC_CONTINENT_NAME_I18N,
+                                           name_i18n,
                                            -1);
+        GNUNET_JSON_parse_free (spec);
       }
     }
   }
@@ -115,15 +137,30 @@ action_country_selecting (void)
     {
       GtkTreeIter iter;
       const char *code;
+      const char *name;
+      struct GNUNET_JSON_Specification spec[] = {
+        GNUNET_JSON_spec_string ("code",
+                                 &code),
+        TALER_JSON_spec_i18n_str ("name",
+                                  &name),
+        GNUNET_JSON_spec_end ()
+      };
+
+      if (GNUNET_OK !=
+          GNUNET_JSON_parse (country,
+                             spec,
+                             NULL, NULL))
+      {
+        GNUNET_break (0);
+        continue;
+      }
 
-      code = json_string_value (json_object_get (country,
-                                                 "code"));
       gtk_list_store_insert_with_values (
         country_liststore,
         &iter,
         -1,
         AG_CCMC_COUNTRY_NAME,
-        json_string_value (json_object_get (country, "name")),
+        name,
         AG_CCMC_COUNTRY_CODE,
         code,
         -1);
@@ -141,6 +178,7 @@ action_country_selecting (void)
         gtk_tree_selection_select_iter (sel,
                                         &iter);
       }
+      GNUNET_JSON_parse_free (spec);
     }
   }
 
diff --git a/src/anastasis/anastasis-gtk_helper.h 
b/src/anastasis/anastasis-gtk_helper.h
index 8da17f5..54d041a 100644
--- a/src/anastasis/anastasis-gtk_helper.h
+++ b/src/anastasis/anastasis-gtk_helper.h
@@ -41,7 +41,12 @@ enum AG_ContinentsModelColumns
   /**
    * A gchararray.
    */
-  AG_CMC_CONTINENT_NAME = 0
+  AG_CMC_CONTINENT_NAME = 0,
+
+  /**
+   * A gchararray.
+   */
+  AG_CMC_CONTINENT_NAME_I18N = 1
 };
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]