[glom] Updated German translation



commit 97854999c5e71edbf301b75a55eef4eab003e281
Author: Mario Blättermann <mariobl gnome org>
Date:   Mon Mar 29 22:00:03 2010 +0200

    Updated German translation

 ChangeLog                                   |   16 +++
 Makefile_tests.am                           |   13 ++-
 glom/glom.glade                             |    4 +-
 glom/glom_developer.glade                   |   29 ++++---
 tests/glade_toplevels_instantiation.cc      |  138 +++++++++++++++++++++++++++
 tests/test_glade_toplevels_instantiation.sh |    7 ++
 6 files changed, 188 insertions(+), 19 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 11c08d4..1d42446 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-03-30  Murray Cumming  <murrayc murrayc com>
+
+    Add a test to check instantiation of glade widgets.
+
+    * Makefile_tests.am
+	* tests/glade_toplevels_instantiation.cc: Added this code for an
+    executable that will try to instantiate all GtkWindow and GtkDialog
+    objects in a specified .glade file. It also checks that they are not
+    visible by default.
+	* tests/test_glade_toplevels_instantiation.sh: Added a tests script,
+    run during make check, to run this executable on all our .glade files.
+
+    * glom/glom.glade, glom_developer.glom: Fix small problems found by the
+    test, removing an empty textbuffer top-level object and making all
+    top-level objects non-visible by default.
+
 2010-03-29  Daniel Borgmann  <danielb openismus com>
 
 	Relationships Overview dialog adjustments.
diff --git a/Makefile_tests.am b/Makefile_tests.am
index b9e9e92..549dc36 100644
--- a/Makefile_tests.am
+++ b/Makefile_tests.am
@@ -29,12 +29,14 @@ check_PROGRAMS =						\
 	tests/test_python_execute_func_date \
 	tests/test_python_execute_script \
 	tests/import/test_parsing \
-	tests/import/test_signals
+	tests/import/test_signals \
+	tests/glade_toplevels_instantiation
 
 TESTS =	tests/test_parsing_time	\
 	tests/test_signal_reemit \
-  tests/test_dtd_file_validation.sh \
-  tests/test_glade_file_validation.sh \
+	tests/test_dtd_file_validation.sh \
+	tests/test_glade_file_validation.sh \
+	tests/test_glade_toplevels_instantiation.sh \
 	tests/test_load_python_library \
 	tests/test_python_module \
 	tests/test_python_execute_func \
@@ -47,7 +49,8 @@ TESTS =	tests/test_parsing_time	\
 # We also set this in Makefile.am, with +=,
 # but this is the first use, where we must use =
 dist_noinst_SCRIPTS = tests/test_dtd_file_validation.sh \
-	tests/test_glade_file_validation.sh
+	tests/test_glade_file_validation.sh \
+	tests/test_glade_toplevels_instantiation.sh
 
 #TESTS_ENVIRONMENT=which valgrind && valgrind --tool=memcheck --leak-check=full --leak-resolution=high --trace-children=yes --num-callers=30
 
@@ -107,6 +110,8 @@ glom_utility_widgets_test_flowtable_LDADD = $(GLOM_LIBS)
 #	glom/utility_widgets/placeholder-glom.cc \
 #	glom/utility_widgets/test_flowtable_dnd.cc
 
+tests_glade_toplevels_instantiation_SOURCES = tests/glade_toplevels_instantiation.cc
+tests_glade_toplevels_instantiation_LDADD = $(tests_ldadd) $(LIBGLOM_LIBS) $(GLOM_LIBS)
 
 
 glom_test_pyembed_LDADD = $(LIBGLOM_LIBS) $(PYTHON_LIBS)
diff --git a/glom/glom.glade b/glom/glom.glade
index 59c517b..748a281 100644
--- a/glom/glom.glade
+++ b/glom/glom.glade
@@ -460,7 +460,7 @@
     </action-widgets>
   </object>
   <object class="GtkWindow" id="window_progress">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">Processing</property>
     <child>
       <object class="GtkVBox" id="vbox84">
@@ -1316,7 +1316,6 @@ The data in the field was not recognized. Please try to correct the data or reve
                     <property name="can_focus">True</property>
                     <property name="editable">False</property>
                     <property name="wrap_mode">word-char</property>
-                    <property name="buffer">textbuffer1</property>
                   </object>
                 </child>
               </object>
@@ -1375,7 +1374,6 @@ The data in the field was not recognized. Please try to correct the data or reve
       <action-widget response="-5">import_csv_progress_ok_button</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkTextBuffer" id="textbuffer1"/>
   <object class="GtkDialog" id="dialog_image_progress">
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Loading image</property>
diff --git a/glom/glom_developer.glade b/glom/glom_developer.glade
index 1cfdf95..865ecc6 100644
--- a/glom/glom_developer.glade
+++ b/glom/glom_developer.glade
@@ -2684,7 +2684,7 @@ Glom could not create the new database. Maybe you do not have the necessary acce
   </object>
   <object class="GtkDialog" id="window_groups">
     <property name="height_request">400</property>
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes">Groups</property>
     <property name="type_hint">dialog</property>
@@ -3001,7 +3001,7 @@ Glom could not create the new database. Maybe you do not have the necessary acce
     </action-widgets>
   </object>
   <object class="GtkDialog" id="window_users">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes">Users</property>
     <property name="default_width">400</property>
@@ -3258,7 +3258,7 @@ Glom could not create the new database. Maybe you do not have the necessary acce
     </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_user">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">User</property>
     <property name="type_hint">dialog</property>
     <property name="has_separator">False</property>
@@ -3495,7 +3495,7 @@ Glom could not create the new database. Maybe you do not have the necessary acce
     </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_new_group">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">Create Group</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
@@ -3698,7 +3698,7 @@ What name should this group have?</property>
     </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_choose_user">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">Choose User</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
@@ -4161,7 +4161,7 @@ Which user should be added to this group?</property>
     </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_database_preferences">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">Database Preferences</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
@@ -5835,7 +5835,7 @@ Which user should be added to this group?</property>
     </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_groupby_secondary_fields">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">Group By - Secondary Fields</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
@@ -6151,7 +6151,7 @@ Which user should be added to this group?</property>
     </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_groupby_sort_fields">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">Group By - Sort Fields</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
@@ -6418,7 +6418,7 @@ Which user should be added to this group?</property>
     </action-widgets>
   </object>
   <object class="GtkWindow" id="window_formatting">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">window1</property>
     <child>
       <object class="GtkVBox" id="box_formatting">
@@ -7015,7 +7015,12 @@ Which user should be added to this group?</property>
     </child>
   </object>
   <object class="GtkDialog" id="dialog_relationships_overview">
+<<<<<<< HEAD:glom/glom_developer.glade
     <property name="visible">True</property>
+=======
+    <property name="visible">False</property>
+    <property name="border_width">6</property>
+>>>>>>> Add a test to check instantiation of glade widgets.:glom/glom_developer.glade
     <property name="title" translatable="yes">Relationships Overview</property>
     <property name="default_width">400</property>
     <property name="default_height">400</property>
@@ -8044,7 +8049,7 @@ From what language would you like to copy the translations to use as the start o
     </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_choose_date">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">Choose Date</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
@@ -8672,7 +8677,7 @@ If a suitable related table already exists then you should instead cancel and ju
     </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_new_library_script">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">Create Group</property>
     <property name="default_width">311</property>
     <property name="default_height">179</property>
@@ -10099,7 +10104,7 @@ What name should this module have?</property>
     </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_notebook">
-    <property name="visible">True</property>
+    <property name="visible">False</property>
     <property name="title" translatable="yes">Notebook Tabs</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
diff --git a/tests/glade_toplevels_instantiation.cc b/tests/glade_toplevels_instantiation.cc
new file mode 100644
index 0000000..dc85455
--- /dev/null
+++ b/tests/glade_toplevels_instantiation.cc
@@ -0,0 +1,138 @@
+/* main.cc
+ *
+ * Copyright (C) 2010 The Glom development team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtkmm.h>
+#include <gtksourceviewmm/init.h>
+#include <libxml++/libxml++.h>
+
+#include <iostream>
+
+static bool attempt_instantiation(const std::string& filepath, const xmlpp::Element* child)
+{
+  const Glib::ustring id = child->get_attribute_value("id");
+  const Glib::ustring gclassname = child->get_attribute_value("class");
+
+  // Try to instantiate the object:
+  Glib::RefPtr<Gtk::Builder> builder;
+  try
+  {
+    builder = Gtk::Builder::create_from_file(filepath, id);
+  }
+  catch(const Glib::Error& ex)
+  {
+    std::cerr << "Exception from Gtk::Builder::create_from_file() with id=" << id << " from file " << filepath << std::endl;
+    std::cerr << "  Error: " << ex.what() << std::endl;
+    return -1;
+  }
+
+  // Try to get the widget, checking that it has the correct type:
+  Gtk::Widget* widget = 0;
+  if(gclassname == "GtkWindow")
+  {
+    Gtk::Window* window = 0;
+    builder->get_widget(id, window);
+    widget = window;
+  }
+  else if(gclassname == "GtkDialog")
+  {
+    Gtk::Dialog* dialog = 0;
+    builder->get_widget(id, dialog);
+    widget = dialog;
+  }
+  else
+  {
+    //We try to avoid using non-window top-level widgets in Glom.
+    std::cerr << "Non-window top-level object in Glade file (unexpected by Glom): id=" << id << " from file " << filepath << std::endl; 
+
+    //But let's try this anyway:
+    Glib::RefPtr<Glib::Object> object = builder->get_object(id);
+
+    return false;
+  }
+
+  if(!widget)
+  {
+    std::cerr << "Failed to instantiate object with id=" << id << " from file " << filepath << std::endl;
+    return false;
+  }
+
+  //Check that it is not visible by default, 
+  //because applications generally want to separate instantiation from showing.
+  if(widget->get_visible())
+  {
+     std::cerr << "Top-level window is visible by default (unwanted by Glom): id=" << id << " from file " << filepath << std::endl;
+     return false;
+  }
+
+  //std::cout << "Successful instantiation of object with id=" << id << " from file " << filepath << std::endl;
+
+  delete widget;
+  return true;
+}
+
+int main(int argc, char* argv[])
+{
+  Gtk::Main kit(argc, argv);
+  gtksourceview::init(); //Our .glade files contain gtksourceview widgets too.
+
+  std::string filepath;
+  if(argc > 1 )
+    filepath = argv[1]; //Allow the user to specify a different XML file to parse.
+  else
+  {
+    std::cerr << "Usage: glade_toplevels_instantiation filepath" << std::endl;
+    return -1;
+  }
+  
+  #ifdef LIBXMLCPP_EXCEPTIONS_ENABLED
+  try
+  {
+  #endif //LIBXMLCPP_EXCEPTIONS_ENABLED 
+    xmlpp::DomParser parser;
+    //parser.set_validate();
+    parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
+    parser.parse_file(filepath);
+    if(!parser)
+      return -1;
+    
+    const xmlpp::Node* root = parser.get_document()->get_root_node(); //deleted by DomParser.
+    if(!root)
+      return -1;
+
+    const xmlpp::Node::NodeList children = root->get_children("object");
+    for(xmlpp::Node::NodeList::const_iterator iter = children.begin(); iter != children.end(); ++iter)
+    {
+       const xmlpp::Element* child = dynamic_cast<const xmlpp::Element*>(*iter);
+
+       //Try to instante the object with Gtk::Builder:
+       if(child && !attempt_instantiation(filepath, child))
+         return -1;
+    }
+    
+  #ifdef LIBXMLCPP_EXCEPTIONS_ENABLED
+  }
+  catch(const std::exception& ex)
+  {
+    std::cout << "Exception caught: " << ex.what() << std::endl;
+  }
+  #endif //LIBXMLCPP_EXCEPTIONS_ENABLED 
+
+  return 0;
+}
+
diff --git a/tests/test_glade_toplevels_instantiation.sh b/tests/test_glade_toplevels_instantiation.sh
new file mode 100755
index 0000000..410a7bc
--- /dev/null
+++ b/tests/test_glade_toplevels_instantiation.sh
@@ -0,0 +1,7 @@
+#/bin/sh -e
+
+for x in $(find ${srcdir}/glom/ -name "*.glade")
+do
+  # echo glade_toplevels_instantiation $x
+  tests/glade_toplevels_instantiation $x
+done



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