glom r1507 - in trunk: . glom glom/libglom/data_structure glom/libglom/python_embed glom/mode_data glom/utility_widgets/db_adddel



Author: murrayc
Date: Tue Apr  1 15:40:33 2008
New Revision: 1507
URL: http://svn.gnome.org/viewvc/glom?rev=1507&view=rev

Log:
2008-04-01  Murray Cumming  <murrayc murrayc com>

* glom/glom_privs.cc (Glom.get_database_users, Glom.get_current_privs):
* glom/mode_data/box_data.cc (Glom.record_new,
  Glom.get_related_record_exists): Added use of BusyCursor because these 
access the database.

Modified:
   trunk/ChangeLog
   trunk/glom/base_db.cc
   trunk/glom/filechooser_export.cc
   trunk/glom/glom_privs.cc
   trunk/glom/libglom/data_structure/translatable_item.cc
   trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc
   trunk/glom/mode_data/box_data.cc
   trunk/glom/mode_data/notebook_data.cc
   trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
   trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.h

Modified: trunk/glom/base_db.cc
==============================================================================
--- trunk/glom/base_db.cc	(original)
+++ trunk/glom/base_db.cc	Tue Apr  1 15:40:33 2008
@@ -285,9 +285,7 @@
 
   type_vecStrings tables = get_table_names_from_database();
   type_vecStrings::const_iterator iterFind = std::find(tables.begin(), tables.end(), table_name);
-  bool result = (iterFind != tables.end());
-
-  return result;
+  return (iterFind != tables.end());
 }
 
 Base_DB::type_vecStrings Base_DB::get_table_names_from_database(bool ignore_system_tables) const
@@ -1636,7 +1634,7 @@
   const Document_Glom* document = get_document();
   if(document)
   {
-    //TODO_Performance:
+    //TODO_Performance: Cache this result?
     Document_Glom::type_vecFields fields = document->get_table_fields(table_name);
     for(Document_Glom::type_vecFields::iterator iter = fields.begin(); iter != fields.end(); ++iter)
     {

Modified: trunk/glom/filechooser_export.cc
==============================================================================
--- trunk/glom/filechooser_export.cc	(original)
+++ trunk/glom/filechooser_export.cc	Tue Apr  1 15:40:33 2008
@@ -101,7 +101,7 @@
 
 void FileChooser_Export::get_layout_groups(Document_Glom::type_list_layout_groups& layout_groups) const
 {
-  layout_groups = m_layout_groups; //TODO_Performance: Avoid copying so much.
+  layout_groups = m_layout_groups;
 }
 
 } //namespace Glom

Modified: trunk/glom/glom_privs.cc
==============================================================================
--- trunk/glom/glom_privs.cc	(original)
+++ trunk/glom/glom_privs.cc	Tue Apr  1 15:40:33 2008
@@ -46,6 +46,8 @@
 
 Privs::type_vecStrings Privs::get_database_users(const Glib::ustring& group_name)
 {
+  Bakery::BusyCursor cursor(get_app_window());
+
   type_vecStrings result;
 
   if(group_name.empty())
@@ -89,7 +91,7 @@
           if(data_model)
           {
             const Gnome::Gda::Value value = data_model->get_value_at(0, 0); 
-           result.push_back(value.get_string());
+            result.push_back(value.get_string());
           }
         }
 
@@ -318,6 +320,8 @@
   //TODO_Performance: There's lots of database access here.
   //We could maybe replace some with the postgres has_table_* function().
 
+  Bakery::BusyCursor cursor(get_app_window());
+
   Privileges result;
 
   ConnectionPool* connection_pool = ConnectionPool::get_instance();

Modified: trunk/glom/libglom/data_structure/translatable_item.cc
==============================================================================
--- trunk/glom/libglom/data_structure/translatable_item.cc	(original)
+++ trunk/glom/libglom/data_structure/translatable_item.cc	Tue Apr  1 15:40:33 2008
@@ -120,7 +120,7 @@
       const Glib::ustring current_locale_language_id = Utils::locale_language_id(current_locale_id);
       for(type_map_locale_to_translations::const_iterator iter = m_map_translations.begin(); iter != m_map_translations.end(); ++iter)
       {
-        const Glib::ustring locale_id = iter->first;
+        const Glib::ustring& locale_id = iter->first;
         if(Utils::locale_language_id(locale_id) == current_locale_language_id)
         {
           if(!(iter->second.empty()))

Modified: trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc
==============================================================================
--- trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc	(original)
+++ trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc	Tue Apr  1 15:40:33 2008
@@ -186,7 +186,7 @@
 
         //Check whether the field exists in the table.
         //TODO_Performance: Do this without the useless Field information?
-        sharedptr<Field> field  = self_derived->m_document->get_field((*(self_derived->m_relationship))->get_to_table(), field_name);
+        sharedptr<Field> field = self_derived->m_document->get_field((*(self_derived->m_relationship))->get_to_table(), field_name);
         if(!field)
           g_warning("RelatedRecord_tp_as_mapping_getitem: field %s not found in table %s", field_name.c_str(), (*(self_derived->m_relationship))->get_to_table().c_str());
         else

Modified: trunk/glom/mode_data/box_data.cc
==============================================================================
--- trunk/glom/mode_data/box_data.cc	(original)
+++ trunk/glom/mode_data/box_data.cc	Tue Apr  1 15:40:33 2008
@@ -222,7 +222,7 @@
         }
 
         //Use default values (These are also specified in postgres as part of the field definition,
-        //so we could theoretically just not specify it here.
+        //so we could theoretically just not specify it here.)
         //TODO_Performance: Add has_default_value()?
         if(Conversions::value_is_empty(value))
         {
@@ -664,6 +664,8 @@
 
 bool Box_Data::get_related_record_exists(const sharedptr<const Relationship>& relationship, const sharedptr<const Field>& key_field, const Gnome::Gda::Value& key_value)
 {
+  Bakery::BusyCursor cursor(get_app_window());
+
   bool result = false;
 
   //TODO_Performance: It's very possible that this is slow.

Modified: trunk/glom/mode_data/notebook_data.cc
==============================================================================
--- trunk/glom/mode_data/notebook_data.cc	(original)
+++ trunk/glom/mode_data/notebook_data.cc	Tue Apr  1 15:40:33 2008
@@ -301,7 +301,6 @@
     //And refresh the list view whenever it is shown, to 
     //a) show any new records that were added via the details view, or via a related portal elsewhere.
     //b) show changed field contents, changed elsewhere.
-    //TODO_Performance: This causes double refreshes (with database retrieval) when doing finds. We probably want to distinguish between user page-switches and programmatic page-switches.
     if(box == &m_Box_List)
     {
       std::cout << "debug: switching to list" << std::endl;

Modified: trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc	(original)
+++ trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.cc	Tue Apr  1 15:40:33 2008
@@ -519,6 +519,9 @@
 
       m_gda_datamodel = m_connection->get_gda_connection()->execute_select_command(sql_query, params);
 
+      if(app && app->get_show_sql_debug())
+        std::cout << "  Debug: DbTreeModel::refresh_from_database(): The query execution has finished." << std::endl;
+
       //Examine the columns in the returned DataModel:
       /*
       for(int col = 0; col < m_gda_datamodel->get_n_columns(); ++col)
@@ -777,18 +780,6 @@
     //Store the row_index in the GtkTreeIter:
     //See also iter_next_vfunc()
 
-    //TODO_Performance
-    /*
-    type_datamodel_iter row_iter = m_rows.begin();
-    for(int i = 0; i < n; ++i)
-    {
-      if(row_iter == m_rows.end())
-        break;
-
-      ++row_iter;
-    }
-    */
-
     //TODO_Performance:
     //Get the nth unremoved row:
     type_datamodel_iter row_iter = 0;
@@ -828,15 +819,6 @@
   type_datamodel_iter row_iter = get_datamodel_row_iter_from_tree_row_iter(iter);
 
   //TODO_Performance:
-  /*
-  int index = 0;
-  for(type_datamodel_iter iter_count = m_rows.begin(); iter_count != row_iter; ++iter_count)
-  {
-    ++index;
-  }
-  */
-
-  //TODO_Performance:
   //Get the number of non-removed items before this iter, because the path index doesn't care about removed internal stuff.
   int path_index = -1 ;
   if(row_iter > 0) //A row inedx of 0 must mean a path index ir there are _any_ non-removed rows.

Modified: trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.h
==============================================================================
--- trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.h	(original)
+++ trunk/glom/utility_widgets/db_adddel/glom_db_treemodel.h	Tue Apr  1 15:40:33 2008
@@ -228,7 +228,7 @@
    //Data:
    sharedptr<SharedConnection> m_connection;
    Glib::RefPtr<Gnome::Gda::DataModel> m_gda_datamodel;
-   guint m_data_model_rows_count; //TODO: TODO_Performance: GdaDataModel probably needs an on-demand iterator. murrayc.
+   guint m_data_model_rows_count;
    guint m_data_model_columns_count; //1 less than m_columns_count, which also has a model column for the key.
 
    //TODO: Performance:



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