[glom] Field::set_field_info(): Slight code improvement.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Field::set_field_info(): Slight code improvement.
- Date: Mon, 28 Nov 2011 20:05:31 +0000 (UTC)
commit 247a4ac29e79944adff9fbaf8a476181b9429c5f
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Nov 28 21:05:25 2011 +0100
Field::set_field_info(): Slight code improvement.
* glom/libglom/data_structure/field.cc: Move some duplicated code into
a static helper function.
ChangeLog | 7 +++++++
glom/libglom/data_structure/field.cc | 21 +++++++++++----------
2 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9d291da..7b06363 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-11-28 Murray Cumming <murrayc murrayc comb>
+
+ Field::set_field_info(): Slight code improvement.
+
+ * glom/libglom/data_structure/field.cc: Move some duplicated code into
+ a static helper function.
+
2011-11-28 Murray Cumming <murrayc murrayc com>
Added an extra test for the Document class.
diff --git a/glom/libglom/data_structure/field.cc b/glom/libglom/data_structure/field.cc
index ce01995..8c453e7 100644
--- a/glom/libglom/data_structure/field.cc
+++ b/glom/libglom/data_structure/field.cc
@@ -135,6 +135,15 @@ Glib::RefPtr<const Gnome::Gda::Column> Field::get_field_info() const
return m_field_info;
}
+static const FieldTypes* get_field_types()
+{
+ ConnectionPool* connection_pool = ConnectionPool::get_instance();
+ if(!connection_pool)
+ return 0;
+
+ return connection_pool->get_field_types();
+}
+
void Field::set_field_info(const Glib::RefPtr<Gnome::Gda::Column>& fieldinfo)
{
m_field_info = fieldinfo;
@@ -148,11 +157,7 @@ void Field::set_field_info(const Glib::RefPtr<Gnome::Gda::Column>& fieldinfo)
{
cur_type = get_gda_type_for_glom_type(get_glom_type());
- const FieldTypes* pFieldTypes = 0;
-
- ConnectionPool* pConnectionPool = ConnectionPool::get_instance();
- if(pConnectionPool)
- pFieldTypes = pConnectionPool->get_field_types();
+ const FieldTypes* pFieldTypes = get_field_types();
if(pFieldTypes)
{
@@ -171,11 +176,7 @@ void Field::set_field_info(const Glib::RefPtr<Gnome::Gda::Column>& fieldinfo)
// TODO: Basically copied from set_default_value(). Maybe this check should
// be moved into an extra function.
GType cur_type = get_gda_type_for_glom_type(get_glom_type());
- const FieldTypes* pFieldTypes = 0;
-
- ConnectionPool* pConnectionPool = ConnectionPool::get_instance();
- if(pConnectionPool)
- pFieldTypes = pConnectionPool->get_field_types();
+ const FieldTypes* pFieldTypes = get_field_types();
// Take into account that value might be one of the fallback types
if(pFieldTypes)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]