[glom] libglom: Always enable developer-mode (!client-only) API.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Subject: [glom] libglom: Always enable developer-mode (!client-only) API.
- Date: Sat, 4 Jul 2009 16:46:57 +0000 (UTC)
commit f05fb43f33b589e3b8a26b6abeea492825035b8a
Author: Murray Cumming <murrayc murrayc com>
Date: Sat Jul 4 18:46:28 2009 +0200
libglom: Always enable developer-mode (!client-only) API.
* glom/libglom/*.[h|cc]: Remove use of ENABLE_CLIENT_ONLY ifdefs,
so we can allow parallel install of full and
client-only versions.
ChangeLog | 12 ++++++++-
glom/libglom/appstate.cc | 9 -------
glom/libglom/connectionpool.cc | 17 -------------
glom/libglom/connectionpool.h | 8 ------
glom/libglom/connectionpool_backends/backend.cc | 2 -
glom/libglom/connectionpool_backends/backend.h | 2 -
glom/libglom/connectionpool_backends/postgres.cc | 6 +---
glom/libglom/connectionpool_backends/postgres.h | 2 -
.../connectionpool_backends/postgres_central.cc | 2 -
.../connectionpool_backends/postgres_central.h | 2 -
.../connectionpool_backends/postgres_self.h | 2 -
glom/libglom/connectionpool_backends/sqlite.cc | 3 --
glom/libglom/connectionpool_backends/sqlite.h | 4 ---
glom/libglom/document/document.cc | 25 +------------------
glom/libglom/document/document.h | 17 +------------
15 files changed, 15 insertions(+), 98 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 77df73d..d069ee2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,16 @@
-2009-07-04 Murray Cumming <murrayc murrayc com>
+2009-07-04 Murray Cumming <murrayc murrayc-x61>
- Remove ifdefs from libglom to allow parallel install of full and
+ libglom: Always enable developer-mode (!client-only) API.
+
+ * glom/libglom/*.[h|cc]: Remove use of ENABLE_CLIENT_ONLY ifdefs,
+ so we can allow parallel install of full and
client-only versions.
+2009-07-04 Murray Cumming <murrayc murrayc com>
+
+ Remove ifdefs from libglom to allow parallel install of sqlite- and
+ PostgreSQL-using versions of Glom.
+
* glom/libglom/connectionpool_backends/postgres.h:
* glom/libglom/connectionpool_backends/postgres_central.h:
* glom/libglom/connectionpool_backends/sqlite.h:
diff --git a/glom/libglom/appstate.cc b/glom/libglom/appstate.cc
index 28e4f14..f0e4c0b 100644
--- a/glom/libglom/appstate.cc
+++ b/glom/libglom/appstate.cc
@@ -26,11 +26,7 @@ namespace Glom
{
AppState::AppState()
-#ifdef GLOM_ENABLE_CLIENT_ONLY
-: m_userlevel(USERLEVEL_OPERATOR)
-#else
: m_userlevel(USERLEVEL_DEVELOPER)
-#endif
{
}
@@ -46,11 +42,6 @@ AppState::userlevels AppState::get_userlevel() const
void AppState::set_userlevel(userlevels value)
{
- //Make sure that developer mode is never possible in client-only mode:
- #ifdef GLOM_ENABLE_CLIENT_ONLY
- value = USERLEVEL_OPERATOR;
- #endif //GLOM_ENABLE_CLIENT_ONLY
-
if(m_userlevel != value)
{
m_userlevel = value;
diff --git a/glom/libglom/connectionpool.cc b/glom/libglom/connectionpool.cc
index ae7a310..2725df4 100644
--- a/glom/libglom/connectionpool.cc
+++ b/glom/libglom/connectionpool.cc
@@ -40,11 +40,9 @@
#include <signal.h> //To catch segfaults
-#ifndef GLOM_ENABLE_CLIENT_ONLY
#ifndef G_OS_WIN32
static EpcProtocol publish_protocol = EPC_PROTOCOL_HTTPS;
#endif
-#endif
// Uncomment to see debug messages
//#define GLOM_CONNECTION_DEBUG
@@ -208,10 +206,8 @@ ConnectionPool* ConnectionPool::m_instance = 0;
ConnectionPool::ConnectionPool()
:
-#ifndef GLOM_ENABLE_CLIENT_ONLY
m_epc_publisher(0),
m_dialog_epc_progress(0),
-#endif // !GLOM_ENABLE_CLIENT_ONLY
m_backend(0),
m_sharedconnection_refcount(0),
m_ready_to_connect(false),
@@ -407,7 +403,6 @@ sharedptr<SharedConnection> ConnectionPool::connect(std::auto_ptr<ExceptionConne
if(!m_pFieldTypes)
m_pFieldTypes = new FieldTypes(m_refGdaConnection);
-#ifndef GLOM_ENABLE_CLIENT_ONLY
#ifndef G_OS_WIN32
//Let other clients discover this server via avahi:
//TODO: Only advertize if we are the first to open the document,
@@ -418,7 +413,6 @@ sharedptr<SharedConnection> ConnectionPool::connect(std::auto_ptr<ExceptionConne
if(document && document->get_network_shared())
avahi_start_publishing(); //Stopped in the signal_finished handler.
#endif // !G_OS_WIN32
-#endif // !GLOM_ENABLE_CLIENT_ONLY
#ifdef GLIBMM_EXCEPTIONS_ENABLED
return connect(); //Call this method recursively. This time m_refGdaConnection exists.
@@ -436,7 +430,6 @@ sharedptr<SharedConnection> ConnectionPool::connect(std::auto_ptr<ExceptionConne
return sharedptr<SharedConnection>(0);
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void ConnectionPool::create_database(const Glib::ustring& database_name)
#else
@@ -453,7 +446,6 @@ void ConnectionPool::create_database(const Glib::ustring& database_name, std::au
if(error.get()) throw *error;
#endif
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
void ConnectionPool::set_user(const Glib::ustring& value)
{
@@ -544,12 +536,10 @@ void ConnectionPool::on_sharedconnection_finished()
m_refGdaConnection.reset();
-#ifndef GLOM_ENABLE_CLIENT_ONLY
#ifndef G_OS_WIN32
//TODO: this should only even be started if we are the first to open the .glom file:
avahi_stop_publishing();
#endif
-#endif
//g_warning("ConnectionPool: connection closed");
}
@@ -682,7 +672,6 @@ bool ConnectionPool::set_network_shared(const SlotProgress& slot_progress, bool
return false;
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool ConnectionPool::add_column(const Glib::ustring& table_name, const sharedptr<const Field>& field)
#else
@@ -809,7 +798,6 @@ bool ConnectionPool::change_columns(const Glib::ustring& table_name, const type_
return result;
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
ConnectionPool::InitErrors ConnectionPool::initialize(const SlotProgress& slot_progress, bool network_shared)
{
@@ -819,7 +807,6 @@ ConnectionPool::InitErrors ConnectionPool::initialize(const SlotProgress& slot_p
return Backend::INITERROR_OTHER;
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
Document* ConnectionPool::get_document()
{
if(!m_slot_get_document)
@@ -830,9 +817,7 @@ Document* ConnectionPool::get_document()
return m_slot_get_document();
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-#ifndef GLOM_ENABLE_CLIENT_ONLY
#ifndef G_OS_WIN32
//static
EpcContents* ConnectionPool::on_publisher_document_requested(EpcPublisher* /* publisher */, const gchar* /* key */, gpointer user_data)
@@ -1002,7 +987,5 @@ void ConnectionPool::set_get_document_func(const SlotGetDocument& slot)
m_slot_get_document = slot;
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-
} //namespace Glom
diff --git a/glom/libglom/connectionpool.h b/glom/libglom/connectionpool.h
index ac2fc50..4af3563 100644
--- a/glom/libglom/connectionpool.h
+++ b/glom/libglom/connectionpool.h
@@ -208,7 +208,6 @@ public:
*/
virtual bool set_network_shared(const SlotProgress& slot_progress, bool network_shared = true);
-#ifndef GLOM_ENABLE_CLIENT_ONLY
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool add_column(const Glib::ustring& table_name, const sharedptr<const Field>& field);
#else
@@ -232,7 +231,6 @@ public:
#else
bool change_columns(const Glib::ustring& table_name, const type_vec_const_fields& old_fields, const type_vec_const_fields& fields, std::auto_ptr<Glib::Error>& error);
#endif
-#endif // !GLOM_ENABLE_CLIENT_ONLY
/** Specify a callback that the ConnectionPool can call to get a pointer to the document.
* This callback avoids Connection having to link to App_Glom,
@@ -261,7 +259,6 @@ private:
*/
void invalidate_connection();
-#ifndef GLOM_ENABLE_CLIENT_ONLY
/** Examine ports one by one, starting at @a starting_port, in increasing order,
* and return the first one that is available.
*/
@@ -275,14 +272,11 @@ private:
void avahi_start_publishing();
void avahi_stop_publishing();
#endif // !G_OS_WIN32
-#endif // !GLOM_ENABLE_CLIENT_ONLY
private:
-#ifndef GLOM_ENABLE_CLIENT_ONLY
EpcPublisher* m_epc_publisher;
Gtk::Dialog* m_dialog_epc_progress; //For progress while generating certificates.
-#endif // !GLOM_ENABLE_CLIENT_ONLY
std::auto_ptr<Backend> m_backend;
Glib::RefPtr<Gnome::Gda::Connection> m_refGdaConnection;
@@ -295,9 +289,7 @@ private:
private:
static ConnectionPool* m_instance;
-#ifndef GLOM_ENABLE_CLIENT_ONLY
SlotGetDocument m_slot_get_document;
-#endif
type_void_slot m_epc_slot_begin, m_epc_slot_progress, m_epc_slot_done;
};
diff --git a/glom/libglom/connectionpool_backends/backend.cc b/glom/libglom/connectionpool_backends/backend.cc
index 1c5b08b..dc350ba 100644
--- a/glom/libglom/connectionpool_backends/backend.cc
+++ b/glom/libglom/connectionpool_backends/backend.cc
@@ -189,7 +189,6 @@ bool Backend::query_execute(const Glib::RefPtr<Gnome::Gda::Connection>& connecti
#endif
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
bool Backend::add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const sharedptr<const Field>& field, std::auto_ptr<Glib::Error>& error)
{
Glib::RefPtr<Gnome::Gda::ServerProvider> provider = connection->get_provider();
@@ -293,7 +292,6 @@ bool Backend::change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connect
return true;
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
} // namespace ConnectionPoolBackends
diff --git a/glom/libglom/connectionpool_backends/backend.h b/glom/libglom/connectionpool_backends/backend.h
index 847f043..f731139 100644
--- a/glom/libglom/connectionpool_backends/backend.h
+++ b/glom/libglom/connectionpool_backends/backend.h
@@ -171,7 +171,6 @@ protected:
*/
virtual Glib::RefPtr<Gnome::Gda::Connection> connect(const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<ExceptionConnection>& error) = 0;
-#ifndef GLOM_ENABLE_CLIENT_ONLY
virtual bool add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const sharedptr<const Field>& field, std::auto_ptr<Glib::Error>& error);
virtual bool drop_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const Glib::ustring& field_name, std::auto_ptr<Glib::Error>& error);
@@ -181,7 +180,6 @@ protected:
/** This method is called to create a new database on the
* database server. */
virtual bool create_database(const Glib::ustring& database_name, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<Glib::Error>& error) = 0;
-#endif
};
} // namespace ConnectionPoolBackends
diff --git a/glom/libglom/connectionpool_backends/postgres.cc b/glom/libglom/connectionpool_backends/postgres.cc
index 619ecf3..86c105d 100644
--- a/glom/libglom/connectionpool_backends/postgres.cc
+++ b/glom/libglom/connectionpool_backends/postgres.cc
@@ -158,7 +158,6 @@ Glib::RefPtr<Gnome::Gda::Connection> Postgres::attempt_connect(const Glib::ustri
return connection;
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
bool Postgres::change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const type_vec_const_fields& old_fields, const type_vec_const_fields& new_fields, std::auto_ptr<Glib::Error>& error)
{
static const char* TRANSACTION_NAME = "glom_change_columns_transaction";
@@ -411,7 +410,7 @@ bool Postgres::attempt_create_database(const Glib::ustring& database_name, const
error.reset(new Glib::Error(ex));
return false;
}
-#else
+#else //GLIBMM_EXCEPTIONS_ENABLED
op->set_value_at("/SERVER_CNX_P/HOST", host, error);
op->set_value_at("/SERVER_CNX_P/PORT", port, error);
op->set_value_at("/SERVER_CNX_P/ADM_LOGIN", username, error);
@@ -421,11 +420,10 @@ bool Postgres::attempt_create_database(const Glib::ustring& database_name, const
op->perform_create_database("PostgreSQL");
else
return false;
-#endif
+#endif //GLIBMM_EXCEPTIONS_ENABLED
return true;
}
-#endif
bool Postgres::check_postgres_gda_client_is_available()
{
diff --git a/glom/libglom/connectionpool_backends/postgres.h b/glom/libglom/connectionpool_backends/postgres.h
index 30b1f02..5165454 100644
--- a/glom/libglom/connectionpool_backends/postgres.h
+++ b/glom/libglom/connectionpool_backends/postgres.h
@@ -58,12 +58,10 @@ private:
virtual Glib::ustring get_string_find_operator() const { return "ILIKE"; } // ILIKE is a postgres extension for locale-dependent case-insensitive matches.
virtual const char* get_public_schema_name() const { return "public"; }
-#ifndef GLOM_ENABLE_CLIENT_ONLY
virtual bool change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const type_vec_const_fields& old_fields, const type_vec_const_fields& new_fields, std::auto_ptr<Glib::Error>& error);
protected:
bool attempt_create_database(const Glib::ustring& database_name, const Glib::ustring& host, const Glib::ustring& port, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<Glib::Error>& error);
-#endif
protected:
Glib::RefPtr<Gnome::Gda::Connection> attempt_connect(const Glib::ustring& host, const Glib::ustring& port, const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<ExceptionConnection>& error);
diff --git a/glom/libglom/connectionpool_backends/postgres_central.cc b/glom/libglom/connectionpool_backends/postgres_central.cc
index dfa2f26..3d242f8 100644
--- a/glom/libglom/connectionpool_backends/postgres_central.cc
+++ b/glom/libglom/connectionpool_backends/postgres_central.cc
@@ -158,12 +158,10 @@ Glib::RefPtr<Gnome::Gda::Connection> PostgresCentralHosted::connect(const Glib::
return connection;
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
bool PostgresCentralHosted::create_database(const Glib::ustring& database_name, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<Glib::Error>& error)
{
return attempt_create_database(database_name, get_host(), port_as_string(m_port), username, password, error);
}
-#endif //GLOM_ENABLE_CLIENT_ONLY
}
diff --git a/glom/libglom/connectionpool_backends/postgres_central.h b/glom/libglom/connectionpool_backends/postgres_central.h
index 3858040..7858786 100644
--- a/glom/libglom/connectionpool_backends/postgres_central.h
+++ b/glom/libglom/connectionpool_backends/postgres_central.h
@@ -50,9 +50,7 @@ public:
private:
virtual Glib::RefPtr<Gnome::Gda::Connection> connect(const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<ExceptionConnection>& error);
-#ifndef GLOM_ENABLE_CLIENT_ONLY
virtual bool create_database(const Glib::ustring& database_name, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<Glib::Error>& error);
-#endif
private:
typedef std::list<Glib::ustring> type_list_ports;
diff --git a/glom/libglom/connectionpool_backends/postgres_self.h b/glom/libglom/connectionpool_backends/postgres_self.h
index da0bee0..027b1d8 100644
--- a/glom/libglom/connectionpool_backends/postgres_self.h
+++ b/glom/libglom/connectionpool_backends/postgres_self.h
@@ -70,9 +70,7 @@ private:
virtual Glib::RefPtr<Gnome::Gda::Connection> connect(const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<ExceptionConnection>& error);
-#ifndef GLOM_ENABLE_CLIENT_ONLY
virtual bool create_database(const Glib::ustring& database_name, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<Glib::Error>& error);
-#endif
private:
/** Examine ports one by one, starting at @a starting_port, in increasing
diff --git a/glom/libglom/connectionpool_backends/sqlite.cc b/glom/libglom/connectionpool_backends/sqlite.cc
index 59236c6..5df0ac3 100644
--- a/glom/libglom/connectionpool_backends/sqlite.cc
+++ b/glom/libglom/connectionpool_backends/sqlite.cc
@@ -91,7 +91,6 @@ Glib::RefPtr<Gnome::Gda::Connection> Sqlite::connect(const Glib::ustring& databa
return connection;
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
bool Sqlite::create_database(const Glib::ustring& database_name, const Glib::ustring& /* username */, const Glib::ustring& /* password */, std::auto_ptr<Glib::Error>& error)
{
Glib::RefPtr<Gio::File> file = Gio::File::create_for_uri(m_database_directory_uri);
@@ -120,7 +119,6 @@ bool Sqlite::create_database(const Glib::ustring& database_name, const Glib::ust
}
#endif
-#ifndef GLOM_ENABLE_CLIENT_ONLY
bool Sqlite::add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, GdaMetaTableColumn* column, unsigned int i, std::auto_ptr<Glib::Error>& error)
{
@@ -377,7 +375,6 @@ bool Sqlite::change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connecti
return recreate_table(connection, table_name, type_vec_strings(), type_vec_const_fields(), fields_changed, error);
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
} // namespace ConnectionPoolBackends
diff --git a/glom/libglom/connectionpool_backends/sqlite.h b/glom/libglom/connectionpool_backends/sqlite.h
index 07bad41..0b33931 100644
--- a/glom/libglom/connectionpool_backends/sqlite.h
+++ b/glom/libglom/connectionpool_backends/sqlite.h
@@ -46,7 +46,6 @@ private:
virtual Glib::ustring get_string_find_operator() const { return "LIKE"; }
virtual const char* get_public_schema_name() const { return "main"; }
-#ifndef GLOM_ENABLE_CLIENT_ONLY
bool add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, GdaMetaTableColumn* column, unsigned int i, std::auto_ptr<Glib::Error>& error);
bool add_column_to_server_operation(const Glib::RefPtr<Gnome::Gda::ServerOperation>& operation, const sharedptr<const Field>& column, unsigned int i, std::auto_ptr<Glib::Error>& error);
@@ -59,15 +58,12 @@ private:
virtual bool add_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const sharedptr<const Field>& field, std::auto_ptr<Glib::Error>& error);
virtual bool drop_column(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const Glib::ustring& field_name, std::auto_ptr<Glib::Error>& error);
virtual bool change_columns(const Glib::RefPtr<Gnome::Gda::Connection>& connection, const Glib::ustring& table_name, const type_vec_const_fields& old_fields, const type_vec_const_fields& new_fields, std::auto_ptr<Glib::Error>& error);
-#endif
virtual Glib::RefPtr<Gnome::Gda::Connection> connect(const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<ExceptionConnection>& error);
/** Creates a new database.
*/
-#ifndef GLOM_ENABLE_CLIENT_ONLY
virtual bool create_database(const Glib::ustring& database_name, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr<Glib::Error>& error);
-#endif
private:
std::string m_database_directory_uri;
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index d039b83..513c4f9 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -244,9 +244,7 @@ Document::Document()
m_connection_try_other_ports(false),
m_block_cache_update(false),
m_block_modified_set(false),
-#ifndef GLOM_ENABLE_CLIENT_ONLY
m_allow_auto_save(true), //Save all changes immediately, by default.
-#endif // !GLOM_ENABLE_CLIENT_ONLY
m_is_example(false),
m_opened_from_browse(false)
{
@@ -1112,7 +1110,6 @@ void Document::set_child_text_node(xmlpp::Element* node, const Glib::ustring& ch
text_child->set_content(text);
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
void Document::set_node_attribute_value_as_bool(xmlpp::Element* node, const Glib::ustring& strAttributeName, bool value, bool value_default)
{
if((value == value_default) && !node->get_attribute(strAttributeName))
@@ -1135,7 +1132,6 @@ void Document::set_node_attribute_value_as_decimal(xmlpp::Element* node, const G
set_node_attribute_value(node, strAttributeName, value_string);
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
void Document::set_node_attribute_value_as_decimal_double(xmlpp::Element* node, const Glib::ustring& strAttributeName, double value)
{
@@ -1185,7 +1181,6 @@ double Document::get_node_attribute_value_as_decimal_double(const xmlpp::Element
return result;
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
void Document::set_node_attribute_value_as_float(xmlpp::Element* node, const Glib::ustring& strAttributeName, float value)
{
if(value == std::numeric_limits<float>::infinity() && !node->get_attribute(strAttributeName))
@@ -1199,7 +1194,6 @@ void Document::set_node_attribute_value_as_float(xmlpp::Element* node, const Gli
set_node_attribute_value(node, strAttributeName, value_string);
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
float Document::get_node_attribute_value_as_float(const xmlpp::Element* node, const Glib::ustring& strAttributeName)
{
@@ -1218,23 +1212,19 @@ float Document::get_node_attribute_value_as_float(const xmlpp::Element* node, co
return result;
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
void Document::set_node_attribute_value_as_value(xmlpp::Element* node, const Glib::ustring& strAttributeName, const Gnome::Gda::Value& value, Field::glom_field_type field_type)
{
NumericFormat format_ignored; //Because we use ISO format.
const Glib::ustring value_as_text = Field::to_file_format(value, field_type);
set_node_attribute_value(node, strAttributeName, value_as_text);
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-#ifndef GLOM_ENABLE_CLIENT_ONLY
void Document::set_node_text_child_as_value(xmlpp::Element* node, const Gnome::Gda::Value& value, Field::glom_field_type field_type)
{
const Glib::ustring value_as_text = Field::to_file_format(value, field_type);
if(node)
node->set_child_text(value_as_text);
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
Gnome::Gda::Value Document::get_node_attribute_value_as_value(const xmlpp::Element* node, const Glib::ustring& strAttributeName, Field::glom_field_type field_type)
{
@@ -1685,12 +1675,7 @@ AppState::userlevels Document::get_userlevel(userLevelReason& reason) const
}
else if(m_file_uri.empty()) //If it has never been saved then this is a new default document, so the user created it, so the user can be a developer.
{
-#ifdef GLOM_ENABLE_CLIENT_ONLY
- // Client only mode doesn't support developer mode:
- return AppState::USERLEVEL_OPERATOR;
-#else
return AppState::USERLEVEL_DEVELOPER;
-#endif
}
else
{
@@ -1710,7 +1695,6 @@ void Document::on_app_state_userlevel_changed(AppState::userlevels userlevel)
bool Document::set_userlevel(AppState::userlevels userlevel)
{
-#ifndef GLOM_ENABLE_CLIENT_ONLY
//Prevent incorrect user level:
if((userlevel == AppState::USERLEVEL_DEVELOPER) && get_read_only())
{
@@ -1726,7 +1710,7 @@ bool Document::set_userlevel(AppState::userlevels userlevel)
m_app_state.set_userlevel(AppState::USERLEVEL_OPERATOR);
return false;
}
-#endif
+
{
m_app_state.set_userlevel(userlevel);
return true;
@@ -1788,7 +1772,6 @@ Glib::ustring Document::get_first_table() const
return iter->second.m_info->get_name();
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
void Document::set_allow_autosave(bool value)
{
if(m_allow_auto_save == value)
@@ -1861,7 +1844,6 @@ void Document::set_modified(bool value)
}
//}
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
void Document::load_after_layout_item_formatting(const xmlpp::Element* element, FieldFormatting& format, Field::glom_field_type field_type, const Glib::ustring& table_name, const Glib::ustring& field_name)
{
@@ -2408,13 +2390,12 @@ bool Document::load_after(int& failure_code)
}
}
-#ifdef GLOM_ENABLE_CLIENT_ONLY
if(mode == HOSTING_MODE_POSTGRES_SELF) //TODO: Define these enums always and show a dialog saying that the feature is not enabled.
{
std::cerr << "Document::load_after(): Loading failed because the document needs to be self-hosted, but self-hosting is not supported in client only mode" << std::endl;
return false; //TODO: Provide more information so the application (or Bakery) can say exactly why loading failed.
}
-#endif
+
m_hosting_mode = mode;
}
@@ -2847,7 +2828,6 @@ bool Document::load_after(int& failure_code)
return result;
}
-#ifndef GLOM_ENABLE_CLIENT_ONLY
void Document::save_before_layout_item_formatting(xmlpp::Element* nodeItem, const FieldFormatting& format, Field::glom_field_type field_type)
{
//Numeric format:
@@ -3564,7 +3544,6 @@ bool Document::save_before()
return GlomBakery::Document_XML::save_before();
}
-#endif // !GLOM_ENABLE_CLIENT_ONLY
Glib::ustring Document::get_database_title() const
{
diff --git a/glom/libglom/document/document.h b/glom/libglom/document/document.h
index ed6828e..a01c450 100644
--- a/glom/libglom/document/document.h
+++ b/glom/libglom/document/document.h
@@ -56,9 +56,7 @@ public:
Document();
virtual ~Document();
-#ifndef GLOM_ENABLE_CLIENT_ONLY
virtual void set_modified(bool value = true);
-#endif // !GLOM_ENABLE_CLIENT_ONLY
virtual void set_file_uri(const Glib::ustring& file_uri, bool bEnforceFileExtension = false);
@@ -75,13 +73,11 @@ public:
void set_opened_from_browse(bool val = true);
bool get_opened_from_browse() const;
-#ifndef GLOM_ENABLE_CLIENT_ONLY
/** The document usually saves itself when you call set_modified().
* Pass false to this function to prevent that temporarily.
* The document will be saved, if necessary, after you call this function with true.
*/
void set_allow_autosave(bool value = true);
-#endif // !GLOM_ENABLE_CLIENT_ONLY
bool get_is_example_file() const;
void set_is_example_file(bool value = true);
@@ -101,12 +97,8 @@ public:
enum HostingMode
{
HOSTING_MODE_POSTGRES_CENTRAL, /*!< The database is hosted on an external postgresql server. */
-
- //Only enabled if GLOM_ENABLE_CLIENT_ONLY is not defined:
HOSTING_MODE_POSTGRES_SELF, /*!< A new postgres database process is spawned that hosts the data. */
-
HOSTING_MODE_SQLITE, /*!< A sqlite database file is used. */
-
HOSTING_MODE_DEFAULT = HOSTING_MODE_POSTGRES_SELF /*!- Arbitrary default. */
};
@@ -411,10 +403,8 @@ protected:
//TODO: Remove this:
friend class ReportBuilder;
-#ifndef GLOM_ENABLE_CLIENT_ONLY
///If value is equal to the default then no attribute will be set, to save text space in the XML file.
static void set_node_attribute_value_as_decimal(xmlpp::Element* node, const Glib::ustring& strAttributeName, guint value, guint value_default = 0);
-#endif // !GLOM_ENABLE_CLIENT_ONLY
// This is required by the report builder, so it cannot be disabled
// in client only mode
@@ -439,7 +429,6 @@ public:
private:
//Overrides:
-#ifndef GLOM_ENABLE_CLIENT_ONLY
virtual bool save_before();
void save_before_layout_group(xmlpp::Element* node, const sharedptr<const LayoutGroup>& group, bool with_print_layout_positions = false);
void save_before_sort_by(xmlpp::Element* node, const LayoutItem_GroupBy::type_list_sort_fields& list_fields);
@@ -451,7 +440,6 @@ private:
void save_before_print_layout_position(xmlpp::Element* nodeItem, const sharedptr<const LayoutItem>& item);
void save_changes();
-#endif // !GLOM_ENABLE_CLIENT_ONLY
virtual bool load_after(int& failure_code);
void load_after_layout_group(const xmlpp::Element* node, const Glib::ustring& table_name, const sharedptr<LayoutGroup>& group, bool with_print_layout_positions = false);
@@ -474,12 +462,11 @@ private:
static double get_node_attribute_value_as_decimal_double(const xmlpp::Element* node, const Glib::ustring& strAttributeName);
static float get_node_attribute_value_as_float(const xmlpp::Element* node, const Glib::ustring& strAttributeName);
-#ifndef GLOM_ENABLE_CLIENT_ONLY
static void set_node_attribute_value_as_bool(xmlpp::Element* node, const Glib::ustring& strAttributeName, bool value = true, bool value_default = false);
static void set_node_attribute_value_as_float( xmlpp::Element* node, const Glib::ustring& strAttributeName, float value );
static void set_node_attribute_value_as_value(xmlpp::Element* node, const Glib::ustring& strAttributeName, const Gnome::Gda::Value& value, Field::glom_field_type field_type);
static void set_node_text_child_as_value(xmlpp::Element* node, const Gnome::Gda::Value& value, Field::glom_field_type field_type);
-#endif // !GLOM_ENABLE_CLIENT_ONLY
+
static Gnome::Gda::Value get_node_attribute_value_as_value(const xmlpp::Element* node, const Glib::ustring& strAttributeName, Field::glom_field_type field_type);
static Gnome::Gda::Value get_node_text_child_as_value(const xmlpp::Element* node, Field::glom_field_type field_type);
@@ -596,9 +583,7 @@ private:
bool m_block_cache_update; //For efficiency.
bool m_block_modified_set;
-#ifndef GLOM_ENABLE_CLIENT_ONLY
bool m_allow_auto_save;
-#endif // !GLOM_ENABLE_CLIENT_ONLY
bool m_is_example;
guint m_document_format_version;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]