[glom] libglom: Remove use of GLOM_ENABLE_MAEMO because it is about UI.



commit 8343c4b44f4364af729c1cb0c99ee53cc544aa94
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Jul 4 23:25:19 2009 +0200

    libglom: Remove use of GLOM_ENABLE_MAEMO because it is about UI.
    
    * glom/libglom/utils.cc:
    * glom/libglom/connectionpool.cc: Remove use of GLOM_ENABLE_MAEMO so
    because there should be no UI-specific login in libglom.
    * glom/libglom/document/document.[h|cc]: Remove
    get_active_layout_platform() because we no longer use GLOM_ENABLE_MAEMO.
    * glom/base_db.[h|cc]: Add a get_active_layout_platform(document)
    here instead.
    * glom/libglom/libglom_config.h.in: Moved GLOM_ENABLE_MAEMO to
    config.h.in because it is now only used in the app, not in libglom.
    
    * glom/base_db_table_data.cc:
    * glom/frame_glom.cc:
    * glom/mode_data/box_data.cc:
    * glom/mode_data/box_data_details.cc:
    * glom/mode_data/notebook_data.cc:
    * glom/relationships_overview/dialog_relationships_overview.cc:
    * glom/utility_widgets/adddel/adddel.cc:
    * glom/utility_widgets/datawidget.cc:
    * glom/utility_widgets/dialog_choose_id.cc:
    * glom/utils_ui.h:
    * glom/xsl_utils.cc: Adapted, using config.h instead of libglom_config.h

 ChangeLog                                          |   26 ++++++++++++++++++++
 config.h.in                                        |    6 ++++
 glom/base_db.cc                                    |   19 +++++++++++++-
 glom/base_db.h                                     |    4 +++
 glom/base_db_table_data.cc                         |    1 +
 glom/frame_glom.cc                                 |    4 +-
 glom/libglom/connectionpool.cc                     |    2 +-
 glom/libglom/document/document.cc                  |   15 +----------
 glom/libglom/document/document.h                   |    2 -
 glom/libglom/libglom_config.h.in                   |    6 ----
 glom/libglom/utils.cc                              |    6 +----
 glom/mode_data/box_data.cc                         |    2 +-
 glom/mode_data/box_data_details.cc                 |    1 +
 glom/mode_data/notebook_data.cc                    |    4 +-
 .../dialog_relationships_overview.cc               |    1 +
 glom/utility_widgets/adddel/adddel.cc              |    2 +-
 glom/utility_widgets/datawidget.cc                 |    3 +-
 glom/utility_widgets/dialog_choose_id.cc           |    2 +-
 glom/utils_ui.h                                    |    1 +
 glom/xsl_utils.cc                                  |    2 +-
 20 files changed, 71 insertions(+), 38 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d069ee2..6d745a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
 2009-07-04  Murray Cumming  <murrayc murrayc-x61>
 
+	libglom: Remove use of GLOM_ENABLE_MAEMO because it is about UI.
+
+	* glom/libglom/utils.cc:
+	* glom/libglom/connectionpool.cc: Remove use of GLOM_ENABLE_MAEMO so 
+	because there should be no UI-specific login in libglom.
+	* glom/libglom/document/document.[h|cc]: Remove 
+	get_active_layout_platform() because we no longer use GLOM_ENABLE_MAEMO.
+	* glom/base_db.[h|cc]: Add a get_active_layout_platform(document) 
+	here instead.
+	* glom/libglom/libglom_config.h.in: Moved GLOM_ENABLE_MAEMO to 
+	config.h.in because it is now only used in the app, not in libglom.
+
+	* glom/base_db_table_data.cc:
+	* glom/frame_glom.cc:
+	* glom/mode_data/box_data.cc:
+	* glom/mode_data/box_data_details.cc:
+	* glom/mode_data/notebook_data.cc:
+	* glom/relationships_overview/dialog_relationships_overview.cc:
+	* glom/utility_widgets/adddel/adddel.cc:
+	* glom/utility_widgets/datawidget.cc:
+	* glom/utility_widgets/dialog_choose_id.cc:
+	* glom/utils_ui.h:
+	* glom/xsl_utils.cc: Adapted, using config.h instead of libglom_config.h
+
+2009-07-04  Murray Cumming  <murrayc murrayc-x61>
+
 	libglom: Always enable developer-mode (!client-only) API.
  
 	* glom/libglom/*.[h|cc]: Remove use of ENABLE_CLIENT_ONLY ifdefs, 
diff --git a/config.h.in b/config.h.in
index d765f7c..887b71a 100644
--- a/config.h.in
+++ b/config.h.in
@@ -8,6 +8,12 @@
 /* Whether to enable support for SQLite databases. */
 #undef GLOM_ENABLE_SQLITE
 
+/* Whether to disable support for self-hosting and developer mode */
+#undef GLOM_ENABLE_CLIENT_ONLY
+
+/* Whether to enable support for the maemo platform */
+#undef GLOM_ENABLE_MAEMO
+
 /* always defined to indicate that i18n is enabled */
 #undef ENABLE_NLS
 
diff --git a/glom/base_db.cc b/glom/base_db.cc
index c3bc8e0..7a9ad96 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -18,7 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <libglom/libglom_config.h> // For GLOM_ENABLE_CLIENT_ONLY
+#include "config.h" // For GLOM_ENABLE_CLIENT_ONLY
 
 #include "base_db.h"
 #include "application.h" //App_Glom.
@@ -3525,5 +3525,22 @@ bool Base_DB::disable_user(const Glib::ustring& user)
   return true;
 }
 
+Glib::ustring Base_DB::get_active_layout_platform(Document* document)
+{
+  Glib::ustring result;
+  if(document)
+    result = document->get_active_layout_platform();
+
+  if(result.empty())
+  {
+    //Make Glom use the special "maemo" layouts if they exist.
+    #ifdef GLOM_ENABLE_MAEMO
+    return "maemo"
+    #endif
+  }
+
+  return result;
+}
+
 
 } //namespace Glom
diff --git a/glom/base_db.h b/glom/base_db.h
index dfdb888..45906db 100644
--- a/glom/base_db.h
+++ b/glom/base_db.h
@@ -116,6 +116,10 @@ public:
 
   bool insert_example_data(const Glib::ustring& table_name) const;
 
+  //TODO: This is not a very good place for this function.
+  /// Get the active layout platform for the document, or get a suitable default.
+  static Glib::ustring get_active_layout_platform(Document* document);
+
   typedef std::vector< sharedptr<LayoutItem_Field> > type_vecLayoutFields;
   typedef std::vector< sharedptr<const LayoutItem_Field> > type_vecConstLayoutFields;
 
diff --git a/glom/base_db_table_data.cc b/glom/base_db_table_data.cc
index eb44a69..6628840 100644
--- a/glom/base_db_table_data.cc
+++ b/glom/base_db_table_data.cc
@@ -18,6 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
 #include "base_db_table_data.h"
 #include <libglom/data_structure/glomconversions.h>
 #include <glom/application.h>
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 293e5ec..fd71038 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -429,7 +429,7 @@ void Frame_Glom::show_table_allow_empty(const Glib::ustring& table_name, const G
     case(MODE_Find):
     {
       strMode = _("Find");
-      m_Notebook_Find.init_db_details(m_table_name, get_document()->get_active_layout_platform());
+      m_Notebook_Find.init_db_details(m_table_name, get_active_layout_platform(get_document()));
       set_mode_widget(m_Notebook_Find);
       break;
     }
@@ -568,7 +568,7 @@ void Frame_Glom::on_menu_file_export()
   if(!document)
     return;
 
-  Document::type_list_layout_groups mapGroupSequence = document->get_data_layout_groups_plus_new_fields("details", m_table_name, document->get_active_layout_platform());
+  Document::type_list_layout_groups mapGroupSequence = document->get_data_layout_groups_plus_new_fields("details", m_table_name, get_active_layout_platform(document));
 
   Gtk::Window* pWindowApp = get_app_window();
   g_assert(pWindowApp);
diff --git a/glom/libglom/connectionpool.cc b/glom/libglom/connectionpool.cc
index 2725df4..7c1aafa 100644
--- a/glom/libglom/connectionpool.cc
+++ b/glom/libglom/connectionpool.cc
@@ -18,7 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <libglom/libglom_config.h> // For GLOM_ENABLE_MAEMO
+#include <libglom/libglom_config.h>
  
 #include <libglom/connectionpool.h>
 #include <libglom/document/document.h>
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 513c4f9..0baba35 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -1722,22 +1722,9 @@ void Document::emit_userlevel_changed()
   m_signal_userlevel_changed.emit(m_app_state.get_userlevel());
 }
 
-Glib::ustring Document::get_default_layout_platform()
-{
-  //Make Glom use the special "maemo" layouts if they exist.
-  #ifdef GLOM_ENABLE_MAEMO
-  return "maemo"
-  #else
-  return Glib::ustring();
-  #endif
-}
-
 Glib::ustring Document::get_active_layout_platform() const
 {
-  if(m_active_layout_platform.empty())
-    return get_default_layout_platform();
-  else
-    return m_active_layout_platform;
+  return m_active_layout_platform;
 }
 
 void Document::set_active_layout_platform(const Glib::ustring& layout_platform)
diff --git a/glom/libglom/document/document.h b/glom/libglom/document/document.h
index a01c450..3187606 100644
--- a/glom/libglom/document/document.h
+++ b/glom/libglom/document/document.h
@@ -382,8 +382,6 @@ public:
   void emit_userlevel_changed();
 #endif //SWIG
 
-  static Glib::ustring get_default_layout_platform();
-
   /** This is transitory information, not saved to disk.
    */
   Glib::ustring get_active_layout_platform() const;
diff --git a/glom/libglom/libglom_config.h.in b/glom/libglom/libglom_config.h.in
index baf3a45..7a8d07c 100644
--- a/glom/libglom/libglom_config.h.in
+++ b/glom/libglom/libglom_config.h.in
@@ -5,10 +5,4 @@
 /* "definition of GLOM_DTD_INSTALL_DIR" */
 #undef GLOM_DTD_INSTALL_DIR
 
-/* Whether to disable support for self-hosting and developer mode */
-#undef GLOM_ENABLE_CLIENT_ONLY
-
-/* Whether to enable support for the maemo platform */
-#undef GLOM_ENABLE_MAEMO
-
 #endif /* GLOM_LIBGLOM_CONFIG_H */
diff --git a/glom/libglom/utils.cc b/glom/libglom/utils.cc
index 6ec0f6a..32e4bc6 100644
--- a/glom/libglom/utils.cc
+++ b/glom/libglom/utils.cc
@@ -18,7 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <libglom/libglom_config.h> // For GLOM_ENABLE_MAEMO
+#include <libglom/libglom_config.h>
 
 #include <libglom/utils.h>
 #include <libglom/connectionpool.h>
@@ -29,10 +29,6 @@
 
 #include <giomm.h>
 
-#ifdef GLOM_ENABLE_MAEMO
-#include <hildonmm/note.h>
-#endif
-
 #include <string.h> // for strchr
 #include <sstream> //For stringstream
 
diff --git a/glom/mode_data/box_data.cc b/glom/mode_data/box_data.cc
index bca2571..29a7932 100644
--- a/glom/mode_data/box_data.cc
+++ b/glom/mode_data/box_data.cc
@@ -18,7 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <libglom/libglom_config.h> // For GLOM_ENABLE_MAEMO
+#include "config.h" // For GLOM_ENABLE_MAEMO
 
 #include "box_data.h"
 #include <libglom/data_structure/glomconversions.h>
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index b7917e4..a12b01d 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -18,6 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
 #include <glom/mode_data/box_data_details.h>
 #include <glom/frame_glom.h> //For show_ok_dialog().
 #include <libglom/data_structure/field.h>
diff --git a/glom/mode_data/notebook_data.cc b/glom/mode_data/notebook_data.cc
index 0e76bbd..f9ee107 100644
--- a/glom/mode_data/notebook_data.cc
+++ b/glom/mode_data/notebook_data.cc
@@ -94,7 +94,7 @@ bool Notebook_Data::init_db_details(const FoundSet& found_set, const Gnome::Gda:
     // Ignore error, sharedconnection is not used directly within this function
 #endif
 
-    result = m_Box_List.init_db_details(found_set, get_document()->get_active_layout_platform()); //TODO: Select the last selected record.
+    result = m_Box_List.init_db_details(found_set, get_active_layout_platform(get_document())); //TODO: Select the last selected record.
 
     //Show the previously-shown record, if there is one, if this is not a new found-set (via a new where_clause)
     //so that returning to this table will return the user to the same record:
@@ -133,7 +133,7 @@ bool Notebook_Data::init_db_details(const FoundSet& found_set, const Gnome::Gda:
         }
       }
 
-      m_Box_Details.init_db_details(found_set, get_document()->get_active_layout_platform(), primary_key_for_details);
+      m_Box_Details.init_db_details(found_set, get_active_layout_platform(get_document()), primary_key_for_details);
     }
     else
       std::cerr << "Notebook_Data::init_db_details(): document is NULL" << std::endl;
diff --git a/glom/relationships_overview/dialog_relationships_overview.cc b/glom/relationships_overview/dialog_relationships_overview.cc
index 2846685..597e1fd 100644
--- a/glom/relationships_overview/dialog_relationships_overview.cc
+++ b/glom/relationships_overview/dialog_relationships_overview.cc
@@ -18,6 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
 #include "dialog_relationships_overview.h"
 #include "glom/utility_widgets/canvas/canvas_line_movable.h"
 #include "glom/utility_widgets/canvas/canvas_text_movable.h"
diff --git a/glom/utility_widgets/adddel/adddel.cc b/glom/utility_widgets/adddel/adddel.cc
index dc0a14f..7c8d842 100644
--- a/glom/utility_widgets/adddel/adddel.cc
+++ b/glom/utility_widgets/adddel/adddel.cc
@@ -18,7 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <libglom/libglom_config.h> // For GLOM_ENABLE_MAEMO
+#include "config.h" // For GLOM_ENABLE_MAEMO
 
 #include <glom/utility_widgets/adddel/adddel.h>
 #include <algorithm> //For std::find.
diff --git a/glom/utility_widgets/datawidget.cc b/glom/utility_widgets/datawidget.cc
index b37a798..a450cc8 100644
--- a/glom/utility_widgets/datawidget.cc
+++ b/glom/utility_widgets/datawidget.cc
@@ -18,6 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include "config.h"
 #include "datawidget.h"
 #include "entryglom.h"
 #include "checkglom.h"
@@ -887,7 +888,7 @@ bool DataWidget::offer_related_record_id_find(Gnome::Gda::Value& chosen_id)
     else
       g_warning("get_layout_item() was not a LayoutItem_Field");
 
-    dialog->init_db_details(related_table_name, get_document()->get_active_layout_platform());
+    dialog->init_db_details(related_table_name, Base_DB::get_active_layout_platform(get_document()));
 
 
     const int response = dialog->run();
diff --git a/glom/utility_widgets/dialog_choose_id.cc b/glom/utility_widgets/dialog_choose_id.cc
index 8cedf94..1f5be08 100644
--- a/glom/utility_widgets/dialog_choose_id.cc
+++ b/glom/utility_widgets/dialog_choose_id.cc
@@ -18,7 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <libglom/libglom_config.h> // For GLOM_ENABLE_MAEMO
+#include "config.h" // For GLOM_ENABLE_MAEMO
 
 #include "dialog_choose_id.h"
 #include <glom/utils_ui.h> //For bold_message()).
diff --git a/glom/utils_ui.h b/glom/utils_ui.h
index 5cca9e6..7eb9c6e 100644
--- a/glom/utils_ui.h
+++ b/glom/utils_ui.h
@@ -21,6 +21,7 @@
 #ifndef GLOM_UTILS_UI_H
 #define GLOM_UTILS_UI_H
 
+#include "config.h"
 #include <libglom/data_structure/field.h>
 #include <libglom/data_structure/numeric_format.h>
 
diff --git a/glom/xsl_utils.cc b/glom/xsl_utils.cc
index c00c708..fddcc2f 100644
--- a/glom/xsl_utils.cc
+++ b/glom/xsl_utils.cc
@@ -18,7 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <libglom/libglom_config.h> // For GLOM_ENABLE_MAEMO
+#include "config.h" // For GLOM_ENABLE_MAEMO
 
 #include "xsl_utils.h"
 #include <libglom/connectionpool.h>



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