[glom] Avoid repetitive Application::get_current_locale() calls.



commit 6ed44d073ecd62fbdc2e2e573aad53dd9105244f
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Jan 16 12:59:08 2012 +0100

    Avoid repetitive Application::get_current_locale() calls.
    
    * glom/application.[h|cc]: Added item_get_title() and item_get_title_or_name()
    outside of the class.
    * glom/libglom/data_structure/translatable_item.h: Removed unused
    glom_get_sharedptr_title_or_name().
    * glom/: Many files: Use the new functions to make the code slighly shorter.

 ChangeLog                                          |   10 ++++++++
 glom/application.cc                                |   24 +++++++++++++++++--
 glom/application.h                                 |    4 +++
 glom/box_reports.cc                                |    2 +-
 glom/libglom/data_structure/translatable_item.h    |    9 -------
 glom/mode_data/box_data_calendar_related.cc        |    2 +-
 glom/mode_data/box_data_list_related.cc            |    2 +-
 glom/mode_data/datawidget/cellcreation.cc          |    4 +-
 .../datawidget/combochoiceswithtreemodel.cc        |    2 +-
 glom/mode_data/datawidget/datawidget.cc            |    2 +-
 glom/mode_data/db_adddel/db_adddel.cc              |    2 +-
 glom/mode_data/flowtablewithfields.cc              |   14 +++++-----
 glom/mode_design/box_db_table_relationships.cc     |    2 +-
 glom/mode_design/fields/box_db_table_definition.cc |    2 +-
 glom/mode_design/fields/dialog_fielddefinition.cc  |    2 +-
 glom/mode_design/layout/combobox_fields.cc         |    2 +-
 glom/mode_design/layout/combobox_relationship.cc   |    6 ++--
 glom/mode_design/layout/dialog_choose_field.cc     |    4 +-
 .../layout/dialog_choose_relationship.cc           |    2 +-
 glom/mode_design/layout/dialog_layout_details.cc   |    2 +-
 .../layout_item_dialogs/dialog_buttonscript.cc     |    2 +-
 .../layout_item_dialogs/dialog_field_layout.cc     |    2 +-
 .../layout_item_dialogs/dialog_imageobject.cc      |    2 +-
 .../layout/layout_item_dialogs/dialog_notebook.cc  |    2 +-
 .../layout_item_dialogs/dialog_textobject.cc       |    2 +-
 .../mode_design/print_layouts/box_print_layouts.cc |    2 +-
 .../print_layouts/window_print_layout_edit.cc      |    2 +-
 .../relationships_overview/canvas_group_dbtable.cc |    4 +-
 .../dialog_relationships_overview.cc               |    4 +-
 .../report_layout/dialog_layout_report.cc          |    2 +-
 glom/mode_design/users/dialog_groups_list.cc       |    2 +-
 glom/navigation/box_tables.cc                      |    8 +++---
 glom/print_layout/print_layout_utils.cc            |    4 +-
 glom/utility_widgets/dialog_flowtable.cc           |    2 +-
 glom/utility_widgets/notebooklabelglom.cc          |    2 +-
 glom/utils_ui.cc                                   |    2 +-
 36 files changed, 83 insertions(+), 60 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 49c8a85..fa9c98c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2012-01-16  Murray Cumming  <murrayc murrayc com>
 
+	Avoid repetitive Application::get_current_locale() calls.
+
+	* glom/application.[h|cc]: Added item_get_title() and item_get_title_or_name()
+	outside of the class.
+	* glom/libglom/data_structure/translatable_item.h: Removed unused 
+	glom_get_sharedptr_title_or_name().
+	* glom/: Many files: Use the new functions to make the code slighly shorter.
+
+2012-01-16  Murray Cumming  <murrayc murrayc com>
+
 	TranslatableItems: Make less methods virtual.
 
 	* glom/libglom/data_structure/translatable_item.[h|cc]:
diff --git a/glom/application.cc b/glom/application.cc
index c0820e3..dd478bc 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -2009,7 +2009,7 @@ void Application::fill_menu_tables()
 
       ui_description += "<menuitem action='" + action_name + "' />";
 
-      Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create(action_name, Utils::string_escape_underscores(table_info->get_title_or_name(Application::get_current_locale())));
+      Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create(action_name, Utils::string_escape_underscores(item_get_title_or_name(table_info)));
       m_refNavTablesActionGroup->add(refAction,
         sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_box_tables_selected), table_info->get_name()) );
 
@@ -2078,7 +2078,7 @@ void Application::fill_menu_reports(const Glib::ustring& table_name)
 
         ui_description += "<menuitem action='" + action_name + "' />";
 
-        Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create( action_name, Utils::string_escape_underscores(report->get_title_or_name(Application::get_current_locale())));
+        Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create( action_name, Utils::string_escape_underscores(item_get_title_or_name(report)) );
         m_refNavReportsActionGroup->add(refAction,
           sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_report_selected), report->get_name()) );
 
@@ -2159,7 +2159,7 @@ void Application::fill_menu_print_layouts(const Glib::ustring& table_name)
 
         ui_description += "<menuitem action='" + action_name + "' />";
 
-        Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create( action_name, Utils::string_escape_underscores(print_layout->get_title_or_name(Application::get_current_locale())));
+        Glib::RefPtr<Gtk::Action> refAction = Gtk::Action::create( action_name, Utils::string_escape_underscores(item_get_title(print_layout)) );
         m_refNavPrintLayoutsActionGroup->add(refAction,
           sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_print_layout_selected), print_layout->get_name()) );
 
@@ -2904,4 +2904,22 @@ Glib::ustring Application::get_current_locale()
     return "C";
 }
 
+Glib::ustring item_get_title(const sharedptr<const TranslatableItem>& item)
+{
+  if(!item)
+    return Glib::ustring();
+
+  return item->get_title(Application::get_current_locale());
+}
+
+Glib::ustring item_get_title_or_name(const sharedptr<const TranslatableItem>& item)
+{
+  if(!item)
+    return Glib::ustring();
+
+  return item->get_title_or_name(Application::get_current_locale());
+}
+
+
+
 } //namespace Glom
diff --git a/glom/application.h b/glom/application.h
index 7fae93d..e25a251 100644
--- a/glom/application.h
+++ b/glom/application.h
@@ -296,6 +296,10 @@ private:
   static Glib::ustring m_current_locale, m_original_locale;
 };
 
+Glib::ustring item_get_title(const sharedptr<const TranslatableItem>& item);
+
+Glib::ustring item_get_title_or_name(const sharedptr<const TranslatableItem>& item);
+
 } //namespace Glom
 
 #endif // GLOM_APPLICATION_H
diff --git a/glom/box_reports.cc b/glom/box_reports.cc
index 3a820f0..c13ab52 100644
--- a/glom/box_reports.cc
+++ b/glom/box_reports.cc
@@ -65,7 +65,7 @@ void Box_Reports::fill_row(const Gtk::TreeModel::iterator& iter, const sharedptr
     const Glib::ustring report_name = report->get_name();
     m_AddDel.set_value_key(iter, report_name);
     m_AddDel.set_value(iter, m_colReportName, report_name);
-    m_AddDel.set_value(iter, m_colTitle, report->get_title(Application::get_current_locale()));
+    m_AddDel.set_value(iter, m_colTitle, item_get_title(report));
   }
 }
 
diff --git a/glom/libglom/data_structure/translatable_item.h b/glom/libglom/data_structure/translatable_item.h
index dcfe849..99758bf 100644
--- a/glom/libglom/data_structure/translatable_item.h
+++ b/glom/libglom/data_structure/translatable_item.h
@@ -153,15 +153,6 @@ Glib::ustring glom_get_sharedptr_name(const sharedptr<T_object>& item)
     return Glib::ustring();
 }
 
-template <class T_object>
-Glib::ustring glom_get_sharedptr_title_or_name(const sharedptr<T_object>& item, const Glib::ustring& locale)
-{
-  if(item)
-    return item->get_title_or_name(locale);
-  else
-    return Glib::ustring();
-}
-
 } //namespace Glom
 
 #endif //GLOM_DATASTRUCTURE_TRANSLATABLE_ITEM_H
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index 197e554..63f2be5 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -92,7 +92,7 @@ bool Box_Data_Calendar_Related::init_db_details(const Glib::ustring& parent_tabl
   {
     Glib::ustring title;
     if(m_portal)
-      title = m_portal->get_title(Application::get_current_locale());
+      title = item_get_title(m_portal);
 
     m_Label.set_markup(Utils::bold_message(title));
     m_Label.show();
diff --git a/glom/mode_data/box_data_list_related.cc b/glom/mode_data/box_data_list_related.cc
index 7106867..2a55b2e 100644
--- a/glom/mode_data/box_data_list_related.cc
+++ b/glom/mode_data/box_data_list_related.cc
@@ -88,7 +88,7 @@ bool Box_Data_List_Related::init_db_details(const Glib::ustring& parent_table, b
   {
     Glib::ustring title;
     if(m_portal)
-      title = m_portal->get_title(Application::get_current_locale());
+      title = item_get_title(m_portal);
 
     m_Label.set_markup(Utils::bold_message(title));
     m_Label.show();
diff --git a/glom/mode_data/datawidget/cellcreation.cc b/glom/mode_data/datawidget/cellcreation.cc
index b38af98..fb64cec 100644
--- a/glom/mode_data/datawidget/cellcreation.cc
+++ b/glom/mode_data/datawidget/cellcreation.cc
@@ -141,7 +141,7 @@ Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, c
       if(item_text)
       {
         Gtk::CellRendererText* pCellText = Gtk::manage( new Gtk::CellRendererText() );
-        pCellText->set_property("text", item_text->get_text(Application::get_current_locale()));
+        pCellText->set_property("text", item_get_title(item_text));
 
         cell = pCellText;
       }
@@ -151,7 +151,7 @@ Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, c
         if(item_button)
         {
           GlomCellRenderer_ButtonText* pCellButton = Gtk::manage( new GlomCellRenderer_ButtonText() );
-          pCellButton->set_property("text", item_button->get_title_or_name(Application::get_current_locale()));
+          pCellButton->set_property("text", item_get_title_or_name(item_button));
           //pCellButton->set_fixed_width(50); //Otherwise it doesn't show up. TODO: Discover the width of the contents.
 
           cell = pCellButton;
diff --git a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
index 1571ac9..7701ef8 100644
--- a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
+++ b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
@@ -239,7 +239,7 @@ void ComboChoicesWithTreeModel::set_choices_fixed(const FieldFormatting::type_li
     {
       //Show the translated text of the value:
       //This will never be stored in the database:
-      text = choicevalue->get_title(Application::get_current_locale());
+      text = item_get_title(choicevalue);
     }
     else
     {
diff --git a/glom/mode_data/datawidget/datawidget.cc b/glom/mode_data/datawidget/datawidget.cc
index cdc1627..ef0d098 100644
--- a/glom/mode_data/datawidget/datawidget.cc
+++ b/glom/mode_data/datawidget/datawidget.cc
@@ -71,7 +71,7 @@ DataWidget::DataWidget(const sharedptr<LayoutItem_Field>& field, const Glib::ust
   
   //The GNOME HIG says that labels should have ":" at the end:
   //http://library.gnome.org/devel/hig-book/stable/design-text-labels.html.en
-  const Glib::ustring title = Glib::ustring::compose(_("%1:"), field->get_title_or_name(Application::get_current_locale()));
+  const Glib::ustring title = Glib::ustring::compose(_("%1:"), item_get_title_or_name(field));
 
   m_child = 0;
   LayoutWidgetField* pFieldWidget = 0;  
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index 6a788bf..eff8b17 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -728,7 +728,7 @@ void DbAddDel::construct_specified_columns()
     {
       no_columns_used = false;
 
-      const Glib::ustring column_name = layout_item->get_title_or_name(Application::get_current_locale());
+      const Glib::ustring column_name = item_get_title_or_name(layout_item);
       const Glib::ustring column_id = layout_item->get_name();
 
       // Whenever we are dealing with real database fields,
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 0d25eae..91e4a6d 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -161,7 +161,7 @@ void FlowTableWithFields::add_layout_group(const sharedptr<LayoutGroup>& group,
   {
     Gtk::Frame* frame = Gtk::manage( new Gtk::Frame ); //TODO_leak: This is possibly leaked, according to valgrind.
 
-    const Glib::ustring group_title = group->get_title(Application::get_current_locale());
+    const Glib::ustring group_title = item_get_title(group);
     if(!group_title.empty())
     {
       Gtk::Label* label = Gtk::manage( new Gtk::Label ); //TODO: This is maybe leaked, according to valgrind, though it should be managed by GtkFrame.
@@ -369,7 +369,7 @@ void FlowTableWithFields::add_layout_notebook(const sharedptr<LayoutItem_Noteboo
       tab_label->show();
 #endif
 
-      tab_label->set_label(group->get_title_or_name(Application::get_current_locale()));
+      tab_label->set_label(item_get_title_or_name(group));
 
       sharedptr<LayoutItem_Portal> portal = sharedptr<LayoutItem_Portal>::cast_dynamic(group);
       if(portal)
@@ -564,7 +564,7 @@ void FlowTableWithFields::add_button(const sharedptr<LayoutItem_Button>& layouti
 {
   //Add the widget
   ButtonGlom* button = Gtk::manage(new ButtonGlom());
-  button->set_label(layoutitem_button->get_title_or_name(Application::get_current_locale()));
+  button->set_label(item_get_title_or_name(layoutitem_button));
   button->set_layout_item(layoutitem_button, table_name);
   button->signal_clicked().connect(
     sigc::bind(
@@ -622,7 +622,7 @@ void FlowTableWithFields::add_textobject(const sharedptr<LayoutItem_Text>& layou
 
   add_layoutwidgetbase(label);
 
-  const Glib::ustring title = layoutitem_text->get_title(Application::get_current_locale());
+  const Glib::ustring title = item_get_title(layoutitem_text);
   if(title.empty())
   {
     add(*alignment_label, true /* expand */);
@@ -656,7 +656,7 @@ void FlowTableWithFields::add_imageobject(const sharedptr<LayoutItem_Image>& lay
   add_layoutwidgetbase(image);
   //add_view(button); //So it can get the document.
 
-  const Glib::ustring title = layoutitem_image->get_title(Application::get_current_locale());
+  const Glib::ustring title = item_get_title(layoutitem_image);
   if(title.empty())
   {
     add(*image, true /* expand */);
@@ -1386,11 +1386,11 @@ void FlowTableWithFields::on_menu_properties_activate()
 void FlowTableWithFields::on_menu_delete_activate()
 {
   Glib::ustring message;
-  if(!get_layout_item()->get_title(Application::get_current_locale()).empty())
+  if(!item_get_title(get_layout_item()).empty())
   {
     //TODO: Use a real English sentence here?
     message = Glib::ustring::compose(_("Delete whole group \"%1\"?"),
-                                      get_layout_item()->get_title(Application::get_current_locale()));
+                                      item_get_title(get_layout_item()));
   }
   else
   {
diff --git a/glom/mode_design/box_db_table_relationships.cc b/glom/mode_design/box_db_table_relationships.cc
index f1228fd..0e0f1c1 100644
--- a/glom/mode_design/box_db_table_relationships.cc
+++ b/glom/mode_design/box_db_table_relationships.cc
@@ -112,7 +112,7 @@ bool Box_DB_Table_Relationships::fill_from_database()
         m_AddDel.set_value(iterTree, m_colName, relationship->get_name());
 
         //Title:
-        m_AddDel.set_value(iterTree, m_colTitle, relationship->get_title(Application::get_current_locale()));
+        m_AddDel.set_value(iterTree, m_colTitle, item_get_title(relationship));
         m_AddDel.set_value(iterTree, m_colTitleSingular, relationship->get_title_singular(Application::get_current_locale()));
 
         //From Field:
diff --git a/glom/mode_design/fields/box_db_table_definition.cc b/glom/mode_design/fields/box_db_table_definition.cc
index 20d2098..d3597d0 100644
--- a/glom/mode_design/fields/box_db_table_definition.cc
+++ b/glom/mode_design/fields/box_db_table_definition.cc
@@ -100,7 +100,7 @@ void Box_DB_Table_Definition::fill_field_row(const Gtk::TreeModel::iterator& ite
 
   m_AddDel.set_value(iter, m_colName, field->get_name());
 
-  const Glib::ustring title = field->get_title(Application::get_current_locale());
+  const Glib::ustring title = item_get_title(field);
   m_AddDel.set_value(iter, m_colTitle, title);
 
   //Type:
diff --git a/glom/mode_design/fields/dialog_fielddefinition.cc b/glom/mode_design/fields/dialog_fielddefinition.cc
index fb82582..c341f67 100644
--- a/glom/mode_design/fields/dialog_fielddefinition.cc
+++ b/glom/mode_design/fields/dialog_fielddefinition.cc
@@ -211,7 +211,7 @@ void Dialog_FieldDefinition::set_field(const sharedptr<const Field>& field, cons
   m_pTextView_Calculation->get_buffer()->set_text(calculation);
   //std::cout << "  debug: dialog_fielddefinition.c:: after get_buffer()" << std::endl;
 
-  m_pEntry_Title->set_text(field->get_title(Application::get_current_locale()));
+  m_pEntry_Title->set_text(item_get_title(field));
 
   //Formatting:
   m_box_formatting->set_formatting_for_field(field->m_default_formatting, m_table_name, field);
diff --git a/glom/mode_design/layout/combobox_fields.cc b/glom/mode_design/layout/combobox_fields.cc
index 2ae9c60..30ebb18 100644
--- a/glom/mode_design/layout/combobox_fields.cc
+++ b/glom/mode_design/layout/combobox_fields.cc
@@ -202,7 +202,7 @@ void ComboBox_Fields::on_cell_data_title(const Gtk::TreeModel::const_iterator& i
   sharedptr<Field> field = row[m_model_columns.m_field];
   if(field)
   {
-    m_renderer_title->set_property("text", field->get_title_or_name(Application::get_current_locale()));
+    m_renderer_title->set_property("text", item_get_title_or_name(field));
   }
   else
   {
diff --git a/glom/mode_design/layout/combobox_relationship.cc b/glom/mode_design/layout/combobox_relationship.cc
index 3648aa3..3c37f63 100644
--- a/glom/mode_design/layout/combobox_relationship.cc
+++ b/glom/mode_design/layout/combobox_relationship.cc
@@ -232,10 +232,10 @@ void ComboBox_Relationship::on_cell_data_title(const Gtk::TreeModel::const_itera
       //related relationship:
       sharedptr<Relationship> parent_relationship = (*iterParent)[m_model_columns.m_relationship];
       if(relationship)
-        m_renderer_title->set_property("text", parent_relationship->get_title_or_name(Application::get_current_locale()) + "::" + relationship->get_title_or_name(Application::get_current_locale()));
+        m_renderer_title->set_property("text", item_get_title_or_name(parent_relationship) + "::" + item_get_title_or_name(relationship));
     }
     else
-      m_renderer_title->set_property("text", relationship->get_title_or_name(Application::get_current_locale()));
+      m_renderer_title->set_property("text", item_get_title_or_name(relationship));
   }
   else if(get_has_parent_table())
   {
@@ -265,7 +265,7 @@ void ComboBox_Relationship::on_cell_data_fromfield(const Gtk::TreeModel::const_i
     {
       sharedptr<Relationship> parent_relationship = (*iterParent)[m_model_columns.m_relationship];
       if(parent_relationship)
-        m_renderer_fromfield->set_property("text", Glib::ustring::compose(_(" Via: %1::%2"), parent_relationship->get_title(Application::get_current_locale()), relationship->get_from_field()));
+        m_renderer_fromfield->set_property("text", Glib::ustring::compose(_(" Via: %1::%2"), item_get_title(parent_relationship), relationship->get_from_field()));
     }
     else
     {
diff --git a/glom/mode_design/layout/dialog_choose_field.cc b/glom/mode_design/layout/dialog_choose_field.cc
index 5ff0adc..f06278f 100644
--- a/glom/mode_design/layout/dialog_choose_field.cc
+++ b/glom/mode_design/layout/dialog_choose_field.cc
@@ -168,7 +168,7 @@ void Dialog_ChooseField::set_document(Document* document, const Glib::ustring& t
 
       sharedptr<Field> field = *iter;
       row[m_ColumnsFields.m_col_name] = field->get_name();
-      row[m_ColumnsFields.m_col_title] = field->get_title(Application::get_current_locale());
+      row[m_ColumnsFields.m_col_title] = item_get_title(field);
       row[m_ColumnsFields.m_col_field] = field;
     }
   }
@@ -327,7 +327,7 @@ void Dialog_ChooseField::on_combo_relationship_changed()
 
       sharedptr<Field> field = *iter;
       row[m_ColumnsFields.m_col_name] = field->get_name();
-      row[m_ColumnsFields.m_col_title] = field->get_title(Application::get_current_locale());
+      row[m_ColumnsFields.m_col_title] = item_get_title(field);
       row[m_ColumnsFields.m_col_field] = field;
     }
 
diff --git a/glom/mode_design/layout/dialog_choose_relationship.cc b/glom/mode_design/layout/dialog_choose_relationship.cc
index e4064d2..042eac6 100644
--- a/glom/mode_design/layout/dialog_choose_relationship.cc
+++ b/glom/mode_design/layout/dialog_choose_relationship.cc
@@ -86,7 +86,7 @@ void Dialog_ChooseRelationship::set_document(Document* document, const Glib::ust
       if(relationship)
         row[m_ColumnsRelationships.m_col_name] = glom_get_sharedptr_name(relationship);
 
-      //row[m_ColumnsRelationships.m_col_title] = iter->get_title(Application::get_current_locale());
+      //row[m_ColumnsRelationships.m_col_title] = item_get_title(iter);
       row[m_ColumnsRelationships.m_col_relationship] = relationship;
     }
   }
diff --git a/glom/mode_design/layout/dialog_layout_details.cc b/glom/mode_design/layout/dialog_layout_details.cc
index 5483d60..edd6327 100644
--- a/glom/mode_design/layout/dialog_layout_details.cc
+++ b/glom/mode_design/layout/dialog_layout_details.cc
@@ -1199,7 +1199,7 @@ void Dialog_Layout_Details::on_cell_data_title(Gtk::CellRenderer* renderer, cons
       if(layout_notebook)
         renderer_text->property_text() = _("(Notebook)");
       else if(layout_item)
-        renderer_text->property_text() = layout_item->get_title(Application::get_current_locale());
+        renderer_text->property_text() = item_get_title(layout_item);
       else
         renderer_text->property_text() = Glib::ustring();
 
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc
index 570bea3..92bc4a4 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_buttonscript.cc
@@ -81,7 +81,7 @@ void Dialog_ButtonScript::set_script(const sharedptr<const LayoutItem_Button>& s
 
   m_text_view_script->get_buffer()->set_text( script->get_script() );
 
-  m_entry_title->set_text(script->get_title(Application::get_current_locale()));
+  m_entry_title->set_text(item_get_title(script));
   //set_blocked(false);
 
   //Dialog_Properties::set_modified(false);
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
index ce1d2b1..1ae4a04 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
@@ -90,7 +90,7 @@ void Dialog_FieldLayout::set_field(const sharedptr<const LayoutItem_Field>& fiel
   //Custom title:
   Glib::ustring title_custom;
   if(field->get_title_custom())
-    title_custom = field->get_title_custom()->get_title(Application::get_current_locale());
+    title_custom = item_get_title(field->get_title_custom());
 
   m_radiobutton_title_custom->set_active( field->get_title_custom() && field->get_title_custom()->get_use_custom_title() );
   m_entry_title_custom->set_text(title_custom);
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.cc
index 76c73d7..819687f 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_imageobject.cc
@@ -70,7 +70,7 @@ void Dialog_ImageObject::set_imageobject(const sharedptr<const LayoutItem_Image>
   m_imageobject = glom_sharedptr_clone(imageobject); //Remember it so we save any details that are not in our UI.
   m_table_name = table_name;  //Used for lookup combo boxes.
 
-  m_entry_title->set_text(imageobject->get_title(Application::get_current_locale()));
+  m_entry_title->set_text(item_get_title(imageobject));
   m_image->set_value( imageobject->get_image() );
 
   if(show_title)
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
index 0be402e..59d9ecf 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
@@ -102,7 +102,7 @@ void Dialog_Notebook::set_notebook(const sharedptr<const LayoutItem_Notebook>& s
 
       row[m_ColumnsTabs.m_col_item] = glom_sharedptr_clone(item);
       row[m_ColumnsTabs.m_col_name] = item->get_name();
-      row[m_ColumnsTabs.m_col_title] = item->get_title(Application::get_current_locale());
+      row[m_ColumnsTabs.m_col_title] = item_get_title(item);
       row[m_ColumnsTabs.m_col_sequence] = sequence;
       ++sequence;
   }
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.cc
index df06cab..99c057d 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_textobject.cc
@@ -60,7 +60,7 @@ void Dialog_TextObject::set_textobject(const sharedptr<const LayoutItem_Text>& t
   m_textobject = glom_sharedptr_clone(textobject); //Remember it so we save any details that are not in our UI.
   m_table_name = table_name;  //Used for lookup combo boxes.
 
-  m_entry_title->set_text(textobject->get_title(Application::get_current_locale()));
+  m_entry_title->set_text(item_get_title(textobject));
   m_text_view->get_buffer()->set_text( textobject->get_text(Application::get_current_locale()) );
 
   if(show_title)
diff --git a/glom/mode_design/print_layouts/box_print_layouts.cc b/glom/mode_design/print_layouts/box_print_layouts.cc
index 4416c95..e4a7701 100644
--- a/glom/mode_design/print_layouts/box_print_layouts.cc
+++ b/glom/mode_design/print_layouts/box_print_layouts.cc
@@ -65,7 +65,7 @@ void Box_Print_Layouts::fill_row(const Gtk::TreeModel::iterator& iter, const sha
     const Glib::ustring& name = item->get_name();
     m_AddDel.set_value_key(iter, name);
     m_AddDel.set_value(iter, m_colName, name);
-    m_AddDel.set_value(iter, m_colTitle, item->get_title(Application::get_current_locale()));
+    m_AddDel.set_value(iter, m_colTitle, item_get_title(item));
   }
 }
 
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index 67dc1ca..171ea05 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -682,7 +682,7 @@ void Window_PrintLayout_Edit::set_print_layout(const Glib::ustring& table_name,
   update_table_title();
 
   m_entry_name->set_text(print_layout->get_name()); 
-  m_entry_title->set_text(print_layout->get_title(Application::get_current_locale()));
+  m_entry_title->set_text(item_get_title(print_layout));
 
   set_ruler_sizes();
 
diff --git a/glom/mode_design/relationships_overview/canvas_group_dbtable.cc b/glom/mode_design/relationships_overview/canvas_group_dbtable.cc
index 1235e2a..c771a0e 100644
--- a/glom/mode_design/relationships_overview/canvas_group_dbtable.cc
+++ b/glom/mode_design/relationships_overview/canvas_group_dbtable.cc
@@ -87,9 +87,9 @@ CanvasGroupDbTable::CanvasGroupDbTable(const Glib::ustring& table_name, const Gl
     //Show the primary key as bold:
     Glib::ustring title;
     if(field->get_primary_key())
-      title = "<u>" + field->get_title_or_name(Application::get_current_locale()) + "</u>";
+      title = "<u>" + item_get_title_or_name(field) + "</u>";
     else
-      title = field->get_title_or_name(Application::get_current_locale());
+      title = item_get_title_or_name(field);
 
     Glib::RefPtr<CanvasTextMovable> text_item = CanvasTextMovable::create(title, 
       x + margin, y + margin + field_y, m_table_width - margin*2,
diff --git a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
index ad7ad4b..6319afc 100644
--- a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
+++ b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
@@ -195,7 +195,7 @@ void Dialog_RelationshipsOverview::draw_tables()
       Document::type_vec_fields fields = document->get_table_fields(table_name);
 
       Glib::RefPtr<CanvasGroupDbTable> table_group =
-        CanvasGroupDbTable::create(info->get_name(), info->get_title_or_name(Application::get_current_locale()), fields, table_x, table_y);
+        CanvasGroupDbTable::create(info->get_name(), item_get_title_or_name(info), fields, table_x, table_y);
       m_group_tables->add_child(table_group);
       m_canvas.associate_with_grid(table_group); //Make snapping work.
 
@@ -317,7 +317,7 @@ void Dialog_RelationshipsOverview::draw_lines()
 
           const double text_x = (from_field_x + to_field_x) / 2;
           const double text_y = ((from_field_y + to_field_y) / 2) + y_offset;
-          Glib::RefPtr<CanvasTextMovable> text = CanvasTextMovable::create(relationship->get_title_or_name(Application::get_current_locale()),
+          Glib::RefPtr<CanvasTextMovable> text = CanvasTextMovable::create(item_get_title_or_name(relationship),
             text_x, text_y, -1, //TODO: Calc a suitable width.
             Goocanvas::ANCHOR_CENTER);
           text->property_font() = "Sans 10";
diff --git a/glom/mode_design/report_layout/dialog_layout_report.cc b/glom/mode_design/report_layout/dialog_layout_report.cc
index f711069..c848685 100644
--- a/glom/mode_design/report_layout/dialog_layout_report.cc
+++ b/glom/mode_design/report_layout/dialog_layout_report.cc
@@ -351,7 +351,7 @@ void Dialog_Layout_Report::set_report(const Glib::ustring& table_name, const sha
   m_label_table_name->set_text(table_name);
 
   m_entry_name->set_text(report->get_name());
-  m_entry_title->set_text(report->get_title(Application::get_current_locale()));
+  m_entry_title->set_text(item_get_title(report));
   m_checkbutton_table_title->set_active(report->get_show_table_title());
 
   //Update the tree models from the document
diff --git a/glom/mode_design/users/dialog_groups_list.cc b/glom/mode_design/users/dialog_groups_list.cc
index 20667a1..a160ae1 100644
--- a/glom/mode_design/users/dialog_groups_list.cc
+++ b/glom/mode_design/users/dialog_groups_list.cc
@@ -416,7 +416,7 @@ void Dialog_GroupsList::fill_table_list(const Glib::ustring& group_name)
       const Glib::ustring table_name = (*iter)->get_name();
 
       row[m_model_columns_tables.m_col_name] = table_name;
-      row[m_model_columns_tables.m_col_title] = (*iter)->get_title_or_name(Application::get_current_locale());
+      row[m_model_columns_tables.m_col_title] = item_get_title_or_name(*iter);
 
       const Privileges privs = Privs::get_table_privileges(group_name, table_name);
       row[m_model_columns_tables.m_col_view] = privs.m_view;
diff --git a/glom/navigation/box_tables.cc b/glom/navigation/box_tables.cc
index 990da17..767ceab 100644
--- a/glom/navigation/box_tables.cc
+++ b/glom/navigation/box_tables.cc
@@ -90,13 +90,13 @@ void Box_Tables::fill_table_row(const Gtk::TreeModel::iterator& iter, const shar
     if(developer_mode)
     {
       //std::cout << "debug: " << G_STRFUNC << ": dev title=" << table_info->get_title(Application::get_current_locale()) << std::endl;
-      m_AddDel.set_value(iter, m_colTitle, table_info->get_title(Application::get_current_locale()));
+      m_AddDel.set_value(iter, m_colTitle, item_get_title(table_info));
       m_AddDel.set_value(iter, m_colTitleSingular, table_info->get_title_singular(Application::get_current_locale()));
     }
     else
     {
       //std::cout << "debug: " << G_STRFUNC << ": op get_title_or_name=" << table_info->get_title_or_name(Application::get_current_locale()) << std::endl;
-      m_AddDel.set_value(iter, m_colTitle, table_info->get_title_or_name(Application::get_current_locale()));
+      m_AddDel.set_value(iter, m_colTitle, item_get_title_or_name(table_info));
     }
 
     m_AddDel.set_value(iter, m_colDefault, table_info->m_default);
@@ -175,7 +175,7 @@ bool Box_Tables::fill_from_database()
       {
         table_info = *iterFind;
 
-        //std::cout << "debug: " << G_STRFUNC << ": name=" << (*iterFind)->get_name() << ", table_info->get_title(Application::get_current_locale())=" << (*iterFind)->get_title(Application::get_current_locale()) << std::endl;
+        //std::cout << "debug: " << G_STRFUNC << ": name=" << (*iterFind)->get_name() << ", item_get_title(table_info)=" << item_get_title(*iterFind) << std::endl;
       }
       else
       {
@@ -480,7 +480,7 @@ void Box_Tables::save_to_document()
           table_info->m_hidden = m_AddDel.get_value_as_bool(iter, m_colHidden);
           table_info->set_title( m_AddDel.get_value(iter, m_colTitle) , Application::get_current_locale()); //TODO_Translations: Store the TableInfo in the TreeView.
           table_info->set_title_singular( m_AddDel.get_value(iter, m_colTitleSingular), Application::get_current_locale()); //TODO_Translations: Store the TableInfo in the TreeView.
-          //std::cout << "debug: " << G_STRFUNC << ": title=" << table_info->get_title(Application::get_current_locale()) << std::endl;
+          //std::cout << "debug: " << G_STRFUNC << ": title=" << item_get_title(table_info) << std::endl;
           table_info->m_default = m_AddDel.get_value_as_bool(iter, m_colDefault);
 
           listTables.push_back(table_info);
diff --git a/glom/print_layout/print_layout_utils.cc b/glom/print_layout/print_layout_utils.cc
index fd0c317..335ae6f 100644
--- a/glom/print_layout/print_layout_utils.cc
+++ b/glom/print_layout/print_layout_utils.cc
@@ -184,7 +184,7 @@ static void create_standard(const sharedptr<const LayoutGroup>& layout_group, co
 
   //Show the group's title
   //(but do not fall back to the name, because unnamed groups are really wanted sometimes.)
-  const Glib::ustring title = layout_group->get_title(Application::get_current_locale());
+  const Glib::ustring title = item_get_title(layout_group);
   if(!title.empty())
   {
     sharedptr<LayoutItem_Text> text = sharedptr<LayoutItem_Text>::create();
@@ -248,7 +248,7 @@ static void create_standard(const sharedptr<const LayoutGroup>& layout_group, co
       if(field)
       {
         text_title = sharedptr<LayoutItem_Text>::create();
-        const Glib::ustring field_title = field->get_title_or_name(Application::get_current_locale());
+        const Glib::ustring field_title = item_get_title_or_name(field);
         text_title->set_text(field_title + ":", Application::get_current_locale());
         
         if(avoid_page_margins)
diff --git a/glom/utility_widgets/dialog_flowtable.cc b/glom/utility_widgets/dialog_flowtable.cc
index a6ce402..c884b87 100644
--- a/glom/utility_widgets/dialog_flowtable.cc
+++ b/glom/utility_widgets/dialog_flowtable.cc
@@ -57,7 +57,7 @@ void Dialog_FlowTable::set_flowtable(FlowTableWithFields* flowtable)
 {
   m_flowtable = flowtable;
   m_layoutgroup = sharedptr<LayoutGroup>::cast_dynamic(flowtable->get_layout_item());
-  m_entry_title->set_text(m_layoutgroup->get_title(Application::get_current_locale()));
+  m_entry_title->set_text(item_get_title(m_layoutgroup));
   m_spin_columns->set_value(m_layoutgroup->get_columns_count());
 }
 
diff --git a/glom/utility_widgets/notebooklabelglom.cc b/glom/utility_widgets/notebooklabelglom.cc
index 3c45ae4..bba6420 100644
--- a/glom/utility_widgets/notebooklabelglom.cc
+++ b/glom/utility_widgets/notebooklabelglom.cc
@@ -84,7 +84,7 @@ void NotebookLabel::on_menu_new_group_activate()
 void NotebookLabel::on_menu_delete_activate()
 {
   Glib::ustring message;
-  const Glib::ustring notebook_title = m_notebook->get_layout_item()->get_title(Application::get_current_locale());
+  const Glib::ustring notebook_title = item_get_title(m_notebook->get_layout_item());
   if(!notebook_title.empty())
   {
     message = Glib::ustring::compose (_("Delete whole notebook \"%1\"?"),
diff --git a/glom/utils_ui.cc b/glom/utils_ui.cc
index f9dae03..ed6adfd 100644
--- a/glom/utils_ui.cc
+++ b/glom/utils_ui.cc
@@ -365,7 +365,7 @@ int Utils::get_suitable_field_width_for_widget(Gtk::Widget& widget, const shared
   if(or_title)
   {
     //Make sure that there's enough space for the title too.
-    const int title_width = get_width_for_text(widget, field_layout->get_title(Application::get_current_locale()));
+    const int title_width = get_width_for_text(widget, item_get_title(field_layout));
     if(title_width > result)
       result = title_width;
   }



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