[glom] Fix the UI part to build on maemo platform
- From: Johannes Schmid <jhs src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom] Fix the UI part to build on maemo platform
- Date: Fri, 31 Jul 2009 09:33:59 +0000 (UTC)
commit c30f4c7cf438935f4cddddebd8129dca1f471262
Author: Johannes Schmid <jhs gnome org>
Date: Fri Jul 31 11:31:49 2009 +0200
Fix the UI part to build on maemo platform
ChangeLog | 48 +++++
configure.ac | 2 +-
glom/application.cc | 11 +-
glom/bakery/app_withdoc.cc | 3 +-
glom/bakery/app_withdoc_gtk.cc | 4 +-
glom/base_db.cc | 209 +++++++++++++++-----
glom/base_db_table_data.cc | 6 +
glom/dialog_existing_or_new.cc | 124 +++++++++++-
glom/dialog_import_csv.cc | 80 ++++++++
glom/dialog_import_csv_progress.cc | 4 +
glom/dialog_invalid_data.cc | 10 -
glom/filechooser_export.cc | 6 -
glom/glade_utils.cc | 8 +-
glom/glade_utils.h | 14 +-
glom/glom_privs.cc | 37 ++++-
glom/main.cc | 22 +-
glom/mode_data/box_data_calendar_related.cc | 14 ++-
glom/mode_data/box_data_details.cc | 14 ++
glom/mode_data/box_data_portal.cc | 6 +-
glom/mode_data/flowtablewithfields.h | 2 +-
glom/mode_data/notebook_data.cc | 2 +
glom/notebook_glom.cc | 8 +
glom/reports/report_builder.cc | 17 ++-
glom/utility_widgets/adddel/adddel.cc | 2 +
glom/utility_widgets/canvas/canvas_group_grid.cc | 19 ++-
.../canvas/canvas_group_resizable.cc | 87 ++++++++-
.../utility_widgets/canvas/canvas_image_movable.cc | 39 ++++-
glom/utility_widgets/canvas/canvas_line_movable.cc | 20 ++
glom/utility_widgets/canvas/canvas_rect_movable.cc | 38 ++++-
.../utility_widgets/canvas/canvas_table_movable.cc | 21 ++-
glom/utility_widgets/canvas/canvas_text_movable.cc | 41 ++++-
glom/utility_widgets/datawidget.cc | 24 +--
glom/utility_widgets/db_adddel/db_adddel.cc | 18 ++-
.../utility_widgets/db_adddel/glom_db_treemodel.cc | 22 ++-
glom/utility_widgets/dialog_image_progress.cc | 67 +++++++
glom/utility_widgets/entryglom.cc | 2 +
glom/utility_widgets/flowtable.cc | 3 +
glom/utility_widgets/imageglom.cc | 2 +
glom/utility_widgets/placeholder-glom.cc | 22 +-
glom/utility_widgets/placeholder-glom.h | 2 -
glom/utils_ui.cc | 5 +-
glom/xsl_utils.cc | 13 +-
42 files changed, 917 insertions(+), 181 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 466492f..f80e014 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+2009-07-31 Johannes Schmid <jschmid openismus com>
+
+ * configure.ac: Add dependency on hildon-fmmm
+
+ * glom/application.cc:
+ * glom/utils_ui.cc: Comment out most hildon stuff for now
+
+ * glom/bakery/app_withdoc.cc:
+ * glom/bakery/app_withdoc_gtk.cc:
+ * glom/xsl_utils.cc:
+ Fix Gio exception handling
+
+ * glom/base_db.cc:
+ * glom/base_db_table_data.cc:
+ * glom/dialog_existing_or_new.cc:
+ * glom/dialog_import_csv.cc:
+ * glom/dialog_invalid_data.cc:
+ * glom/filechooser_export:
+ * glom/glom_privs.cc:
+ * glom/mode_data/box_data_calendar_related.cc:
+ * glom/mode_data/box_data_details.cc:
+ * glom/mode_data/box_data_portal.cc:
+ * glom/mode_data/notebook_data.cc:
+ * glom/reports/report_builder.cc:
+ Fixed Gda exception handling, most notable and often get_value_at()
+
+ * glom/glade_utils.h
+ * glom/glade_utils.cc: Fixed GtkBuilder usage (though this seems to be a bug
+ in Gtkmm)
+
+ * glom/mode_data/flowtablewithfields.h:
+ * glom/notebook_glom.cc:
+ * glom/utility_widgets/flowtable.cc:
+ * glom/utility_widgets/entryglom.cc:
+ * glom/utility_widgets/imageglom.cc:
+ * glom/utility_widgets/placeholder-glom.cc:
+ * glom/utility_widgets/placeholder-glom.h:
+ * glom/utility_widgets/dialog_image_progress.cc:
+ Use signals instead of virtual methods, disable accesibility on maemo
+
+ * glom/utility_widgets/canvas/*.cc: Use get/set_property() instead of the
+ direct property access when properties are disabled
+
+ * glom/utility_widgets/adddel/adddel.cc:
+ * glom/utility_widgets/datawidget.cc
+ * glom/utiltiy_widgets/db_adddel/db_adddel.cc:
+ * glom/utility_widgets/db_adddel/glom_db_treemodel.cc
+
2009-07-30 Johannes Schmid <jschmid openismus com>
* autogen.sh: Use automake-1.10 explicitly
diff --git a/configure.ac b/configure.ac
index c7a6a2a..b28c468 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,7 +150,7 @@ AS_IF([test "x$glom_enable_client_only" != xyes],
AS_IF([test "x$glom_enable_sqlite" = xyes],
[REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS libgda-sqlite-4.0"])
AS_IF([test "x$glom_enable_maemo" = xyes],
- [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS hildonmm"])
+ [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS hildonmm hildon-fmmm"])
AS_IF([test "x$glom_maemo_launcher" = xyes],
[REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS maemo-launcher-app"])
diff --git a/glom/application.cc b/glom/application.cc
index 0b99269..88671bc 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -43,6 +43,7 @@
#ifdef GLOM_ENABLE_MAEMO
#include <hildon/hildon-window.h>
+#include <hildon-fmmm.h>
#endif // GLOM_ENABLE_MAEMO
#ifndef G_OS_WIN32
@@ -108,7 +109,7 @@ App_Glom::App_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& bu
m_show_sql_debug(false)
{
// TODO: Wrap missing method in gtkmm
- gtk_window_set_icon_name(gobj(), "glom");
+ gtk_window_set_icon_name(GTK_WINDOW(gobj()), "glom");
//Load widgets from glade file:
builder->get_widget("bakery_vbox", m_pBoxTop);
@@ -226,6 +227,7 @@ void App_Glom::init_layout()
//Add menu bar at the top:
//These were defined in init_uimanager().
+#undef GLOM_ENABLE_MAEMO // TODO: Fix menu!
#ifdef GLOM_ENABLE_MAEMO
Gtk::Menu* pMenu = static_cast<Gtk::Menu*>(m_refUIManager->get_widget("/Bakery_MainMenu"));
set_menu(*pMenu);
@@ -1256,15 +1258,8 @@ Glib::RefPtr<Gtk::UIManager> App_Glom::get_ui_manager()
bool App_Glom::offer_new_or_existing()
{
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
//Offer to load an existing document, or start a new one.
Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), "dialog_existing_or_new");
-#else
- std::auto_ptr<Glib::Error> error;
- Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), "dialog_existing_or_new", "", error);
- if(error.get())
- return false;
-#endif
Dialog_ExistingOrNew* dialog_raw = 0;
refXml->get_widget_derived("dialog_existing_or_new", dialog_raw);
diff --git a/glom/bakery/app_withdoc.cc b/glom/bakery/app_withdoc.cc
index 46ac9ed..0930bbc 100644
--- a/glom/bakery/app_withdoc.cc
+++ b/glom/bakery/app_withdoc.cc
@@ -198,8 +198,7 @@ bool App_WithDoc::file_exists(const Glib::ustring& uri)
return false; //Something went wrong. It does not exist.
}
#else
- std::auto_ptr<Gio::Error> error;
- retrun file->query_exists(error);
+ return file->query_exists();
#endif
}
}
diff --git a/glom/bakery/app_withdoc_gtk.cc b/glom/bakery/app_withdoc_gtk.cc
index d75dd1c..1c76164 100644
--- a/glom/bakery/app_withdoc_gtk.cc
+++ b/glom/bakery/app_withdoc_gtk.cc
@@ -35,6 +35,8 @@
//#include <gtk/gtkfilesel.h>
+#undef GLOM_ENABLE_MAEMO
+
namespace GlomBakery
{
@@ -555,7 +557,7 @@ static bool uri_is_writable(const Glib::RefPtr<const Gio::File>& uri)
return false;
}
#else
- std::auto_ptr<Gio::Error> error;
+ std::auto_ptr<Glib::Error> error;
file_info = uri->query_info(G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, Gio::FILE_QUERY_INFO_NONE, error);
if(error.get())
return false;
diff --git a/glom/base_db.cc b/glom/base_db.cc
index 76f54ec..6b23b2d 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -200,10 +200,10 @@ Glib::RefPtr<Gnome::Gda::DataModel> Base_DB::query_execute_select(const Glib::us
std::cout << "debug: Base_DB::query_execute_select(): SqlParserError: exception from parse_string(): " << ex.what() << std::endl;
}
#else
- std::auto_ptr<Glib::Error> error;
- stmt = parser->parse_string(strQuery, error);
- if(error)
- std::cout << "debug: Base_DB::query_execute_select(): SqlParserError: exception from parse_string(): " << error.what() << std::endl;
+ std::auto_ptr<Glib::Error> ex;
+ stmt = parser->parse_string(strQuery, ex);
+ if(error.get())
+ std::cout << "debug: Base_DB::query_execute_select(): SqlParserError: exception from parse_string(): " << error->what() << std::endl;
#endif //GLIBMM_EXCEPTIONS_ENABLED
@@ -214,16 +214,19 @@ Glib::RefPtr<Gnome::Gda::DataModel> Base_DB::query_execute_select(const Glib::us
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
-#endif
const Glib::ustring full_query = stmt->to_sql(params);
std::cout << "Debug: Base_DB::query_execute_select(): " << full_query << std::endl;
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(const Glib::Exception& ex)
{
std::cout << "Debug: query string could not be converted to std::cout: " << ex.what() << std::endl;
}
+#else
+ const Glib::ustring full_query = stmt->to_sql(params, ex);
+ std::cout << "Debug: Base_DB::query_execute_select(): " << full_query << std::endl;
+ if (ex.get())
+ std::cout << "Debug: query string could not be converted to std::cout: " << ex->what() << std::endl;
+
#endif
}
@@ -247,10 +250,9 @@ Glib::RefPtr<Gnome::Gda::DataModel> Base_DB::query_execute_select(const Glib::us
}
#else
- std::auto_ptr<Glib::Error> error;
- result = gda_connection->statement_execute_select(stmt, params, error);
- if(error)
- std::cout << "debug: Base_DB::query_execute_select(): Glib::Error from statement_execute_select(): " << error->what() << std::endl;
+ result = gda_connection->statement_execute_select(stmt, params, ex);
+ if(ex.get())
+ std::cout << "debug: Base_DB::query_execute_select(): Glib::Error from statement_execute_select(): " << ex->what() << std::endl;
#endif //GLIBMM_EXCEPTIONS_ENABLED
if(!result)
@@ -300,9 +302,9 @@ bool Base_DB::query_execute(const Glib::ustring& strQuery,
#else
std::auto_ptr<Glib::Error> sql_error;
stmt = parser->parse_string(strQuery, sql_error);
- if(sql_error)
+ if(sql_error.get())
{
- std::cerr << "DEBUG: BaseDB::query_execute: SqlParserError:" << error.what() << std::endl;
+ std::cerr << "DEBUG: BaseDB::query_execute: SqlParserError:" << sql_error->what() << std::endl;
return false;
}
#endif
@@ -315,17 +317,20 @@ bool Base_DB::query_execute(const Glib::ustring& strQuery,
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
-#endif
//TODO: full_query still seems to contain ## parameter names,
//though it works for our SELECT queries in query_execute_select():
const Glib::ustring full_query = stmt->to_sql(params);
std::cerr << "Debug: Base_DB::query_execute(): " << full_query << std::endl;
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(const Glib::Exception& ex)
{
std::cerr << "Debug: query string could not be converted to std::cout: " << ex.what() << std::endl;
}
+#else
+ const Glib::ustring full_query = stmt->to_sql(params, sql_error);
+ std::cerr << "Debug: Base_DB::query_execute(): " << full_query << std::endl;
+ if (sql_error.get())
+ std::cerr << "Debug: query string could not be converted to std::cout: " << sql_error->what() << std::endl;
#endif
}
@@ -344,12 +349,12 @@ bool Base_DB::query_execute(const Glib::ustring& strQuery,
return false;
}
#else
- std_autoptr<Glib::Error> exec_error;
+ std::auto_ptr<Glib::Error> exec_error;
exec_retval = gda_connection->statement_execute_non_select (stmt, params, exec_error);
- if(exec_error)
+ if(exec_error.get())
{
- std::cerr << "BaseDB::query_execute: ConnectionError: " << error.what() << std::endl;
- const Glib::ustring full_query = stmt->to_sql(params);
+ std::cerr << "BaseDB::query_execute: ConnectionError: " << exec_error->what() << std::endl;
+ const Glib::ustring full_query = stmt->to_sql(params, exec_error);
std::cerr << " full_query: " << full_query << std::endl;
return false;
}
@@ -448,7 +453,7 @@ Base_DB::type_vec_strings Base_DB::get_table_names_from_database(bool ignore_sys
}
#else
std::auto_ptr<Glib::Error> error;
- Glib::RefPtr<Gnome::Gda::DataModel> data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES, error);
+ data_model_tables = gda_connection->get_meta_store_data(Gnome::Gda::CONNECTION_META_TABLES, error);
// Ignore error, data_model_tables presence is checked below
#endif
@@ -462,8 +467,11 @@ Base_DB::type_vec_strings Base_DB::get_table_names_from_database(bool ignore_sys
const int rows = data_model_tables->get_n_rows();
for(int i = 0; i < rows; ++i)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
const Gnome::Gda::Value value = data_model_tables->get_value_at(0, i);
-
+#else
+ const Gnome::Gda::Value value = data_model_tables->get_value_at(0, i, error);
+#endif
//Get the table name:
Glib::ustring table_name;
if(G_VALUE_TYPE(value.gobj()) == G_TYPE_STRING)
@@ -638,13 +646,15 @@ Base_DB::type_vec_fields Base_DB::get_fields_for_table_from_database(const Glib:
Glib::RefPtr<Gnome::Gda::Connection> connection = sharedconnection->get_gda_connection();
Glib::RefPtr<Gnome::Gda::Holder> holder_table_name = Gnome::Gda::Holder::create(G_TYPE_STRING, "name");
- gchar* quoted_table_name_c = gda_meta_store_sql_identifier_quote(table_name.c_str(), connection->gobj());
+#ifndef GLOM_ENABLE_MAEMO // TODO: Requires libgda(mm) trunk
+ gchar* quoted_table_name_c = gda_meta_store_sql_identifier_quote(table_name.c_str(), connection->gobj());
g_assert(quoted_table_name_c);
Glib::ustring quoted_table_name(quoted_table_name_c);
g_free (quoted_table_name_c);
quoted_table_name_c = 0;
holder_table_name->set_value(quoted_table_name);
+#endif
std::list< Glib::RefPtr<Gnome::Gda::Holder> > holder_list;
holder_list.push_back(holder_table_name);
@@ -690,13 +700,13 @@ Base_DB::type_vec_fields Base_DB::get_fields_for_table_from_database(const Glib:
Glib::RefPtr<Gnome::Gda::MetaStore> store = connection->get_meta_store();
Glib::RefPtr<Gnome::Gda::MetaStruct> metastruct =
Gnome::Gda::MetaStruct::create(store, Gnome::Gda::META_STRUCT_FEATURE_NONE);
-
+#ifndef GLOM_ENABLE_MAEMO
GdaMetaDbObject* meta_dbobject = metastruct->complement(Gnome::Gda::META_DB_TABLE,
Gnome::Gda::Value(), /* catalog */
Gnome::Gda::Value(), /* schema */
Gnome::Gda::Value(quoted_table_name)); //It's a static instance inside the MetaStore.
GdaMetaTable* meta_table = GDA_META_TABLE(meta_dbobject);
-
+#endif
//Examine each field:
guint row = 0;
@@ -706,7 +716,12 @@ Base_DB::type_vec_fields Base_DB::get_fields_for_table_from_database(const Glib:
Glib::RefPtr<Gnome::Gda::Column> field_info = Gnome::Gda::Column::create();
//Get the field name:
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
Gnome::Gda::Value value_name = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_NAME, row);
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ Gnome::Gda::Value value_name = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_NAME, row, value_error);
+#endif
if(value_name.get_value_type() == G_TYPE_STRING)
{
if(value_name.get_string().empty())
@@ -718,7 +733,11 @@ Base_DB::type_vec_fields Base_DB::get_fields_for_table_from_database(const Glib:
}
//Get the field type:
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
Gnome::Gda::Value value_fieldtype = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_GTYPE, row);
+#else
+ Gnome::Gda::Value value_fieldtype = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_GTYPE, row, value_error);
+#endif
if(value_fieldtype.get_value_type() == G_TYPE_STRING)
{
const Glib::ustring type_string = value_fieldtype.get_string();
@@ -735,7 +754,11 @@ Base_DB::type_vec_fields Base_DB::get_fields_for_table_from_database(const Glib:
*/
//Get whether it can be null:
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
Gnome::Gda::Value value_notnull = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_NOTNULL, row);
+#else
+ Gnome::Gda::Value value_notnull = data_model_fields->get_value_at(DATAMODEL_FIELDS_COL_NOTNULL, row, value_error);
+#endif
if(value_notnull.get_value_type() == G_TYPE_BOOLEAN)
field_info->set_allow_null(value_notnull.get_boolean());
@@ -745,8 +768,10 @@ Base_DB::type_vec_fields Base_DB::get_fields_for_table_from_database(const Glib:
//Get whether it is a primary key:
+#ifndef GLOM_ENABLE_MAEMO // TODO
field->set_primary_key(
meta_table_column_is_primary_key(meta_table, field_info->get_name()) );
+#endif
#if 0 // This was with libgda-3.0:
@@ -893,8 +918,12 @@ Gnome::Gda::Value Base_DB::auto_increment_insert_first_if_necessary(const Glib::
else
{
//Return the value so that a calling function does not need to do a second SELECT.
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
const Gnome::Gda::Value actual_value = datamodel->get_value_at(0, 0);
-
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ const Gnome::Gda::Value actual_value = datamodel->get_value_at(0, 0, value_error);
+#endif
//But the caller wants a numeric value not a text value
//(our system_autoincrements table has it as text, for future flexibility):
const std::string actual_value_text = actual_value.get_string();
@@ -917,7 +946,12 @@ void Base_DB::recalculate_next_auto_increment_value(const Glib::ustring& table_n
if(datamodel && datamodel->get_n_rows() && datamodel->get_n_columns())
{
//Increment it:
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
const Gnome::Gda::Value value_max = datamodel->get_value_at(0, 0); // A GdaNumeric.
+#else
+ std::auto_ptr<Glib::Error> error;
+ const Gnome::Gda::Value value_max = datamodel->get_value_at(0, 0, error); // A GdaNumeric.
+#endif
double num_max = Conversions::get_double_for_gda_value_numeric(value_max);
++num_max;
@@ -993,11 +1027,10 @@ SystemPrefs Base_DB::get_database_preferences() const
bool succeeded = true;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
- #endif
{
Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute_select(sql_query);
if(datamodel && (datamodel->get_n_rows() != 0))
- {
+ {
result.m_name = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(0, 0));
result.m_org_name = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(1, 0));
result.m_org_address_street = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(2, 0));
@@ -1008,13 +1041,12 @@ SystemPrefs Base_DB::get_database_preferences() const
result.m_org_address_postcode = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(7, 0));
//We need to be more clever about these column indexes if we add more new fields:
- if(optional_org_logo)
+ if(optional_org_logo)
result.m_org_logo = datamodel->get_value_at(8, 0);
}
else
succeeded = false;
}
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
catch(const Glib::Exception& ex)
{
std::cerr << "Base_DB::get_database_preferences(): exception: " << ex.what() << std::endl;
@@ -1025,8 +1057,33 @@ SystemPrefs Base_DB::get_database_preferences() const
std::cerr << "Base_DB::get_database_preferences(): exception: " << ex.what() << std::endl;
succeeded = false;
}
- #endif // GLIBMM_EXCEPTIONS_ENABLED
-
+ #else // GLIBMM_EXCEPTIONS_ENABLED
+ std::auto_ptr<Glib::Error> error;
+ Glib::RefPtr<Gnome::Gda::DataModel> datamodel = query_execute_select(sql_query);
+ if(datamodel && (datamodel->get_n_rows() != 0))
+ {
+ result.m_name = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(0, 0, error));
+ result.m_org_name = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(1, 0, error));
+ result.m_org_address_street = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(2, 0, error));
+ result.m_org_address_street2 = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(3, 0, error));
+ result.m_org_address_town = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(4, 0, error));
+ result.m_org_address_county = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(5, 0, error));
+ result.m_org_address_country = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(6, 0, error));
+ result.m_org_address_postcode = Conversions::get_text_for_gda_value(Field::TYPE_TEXT, datamodel->get_value_at(7, 0, error));
+
+ //We need to be more clever about these column indexes if we add more new fields:
+ if(optional_org_logo)
+ result.m_org_logo = datamodel->get_value_at(8, 0, error);
+ }
+ else
+ succeeded = false;
+
+ if (error.get())
+ {
+ std::cerr << "Error: " << error->what() << std::endl;
+ succeeded = false;
+ }
+ #endif
//Return the result, or try again:
if(succeeded)
return result;
@@ -1716,7 +1773,12 @@ bool Base_DB::insert_example_data(const Glib::ustring& table_name) const
generator.get_next_name(id));
holder->set_not_null(false);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
holder->set_value_as_value(value);
+#else
+ std::auto_ptr<Glib::Error> holder_error;
+ holder->set_value_as_value(value, holder_error);
+#endif
params->add_holder(holder);
strVals += "##" + generator.get_name_from_id(id) + "::" + vec_fields[i]->get_gda_type_name();
@@ -1761,13 +1823,7 @@ sharedptr<LayoutItem_Field> Base_DB::offer_field_list_select_one_field(const sha
return result;
}
#else
- std::auto_ptr<Gtk::BuilderError> error;
- refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "dialog_choose_field", "", error);
- if(error.get())
- {
- std::cerr << error->what() << std::endl;
- return result;
- }
+ refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "dialog_choose_field");
#endif
Dialog_ChooseField* dialog = 0;
@@ -1811,13 +1867,7 @@ Base_DB::type_list_field_items Base_DB::offer_field_list(const Glib::ustring& ta
return result;
}
#else
- std::auto_ptr<Gtk::BuilderError> error;
- refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "dialog_choose_field", "", error);
- if(error.get())
- {
- std::cerr << error->what() << std::endl;
- return result;
- }
+ refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "dialog_choose_field");
#endif
Dialog_ChooseField* dialog = 0;
@@ -2356,7 +2406,13 @@ void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, co
const int rows_count = data_model->get_n_rows();
for(int row = 0; row < rows_count; ++row)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
const Gnome::Gda::Value primary_key_value = data_model->get_value_at(0, row);
+#else
+ std::auto_ptr<Glib::Error> error;
+ const Gnome::Gda::Value primary_key_value = data_model->get_value_at(0, row, error);
+#endif
+
if(!Conversions::value_is_empty(primary_key_value))
{
field_in_record.m_key_value = primary_key_value;
@@ -2525,6 +2581,7 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
const Glib::ustring query = Utils::build_sql_select_with_key(table_name, fieldsToGet, primary_key, primary_key_value);
Glib::RefPtr<Gnome::Gda::DataModel> data_model;
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
data_model = query_execute_select(query);
@@ -2535,7 +2592,16 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
handle_error(ex);
return field_values;
}
-
+#else
+ //TODO: Seems there is no error handling in query_execute_select() without exceptions
+ std::auto_ptr<Glib::Error> error;
+ data_model = query_execute_select(query);
+ if (error.get())
+ {
+ std::cerr << "Base_DB::get_record_field_values_for_calculation(): Exception while executing SQL: " << query << std::endl;
+ return field_values;
+ }
+#endif
if(data_model && data_model->get_n_rows())
{
int col_index = 0;
@@ -2543,9 +2609,11 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
{
//There should be only 1 row. Well, there could be more but we will ignore them.
sharedptr<const Field> field = *iter;
-
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
Gnome::Gda::Value value = data_model->get_value_at(col_index, 0);
-
+#else
+ Gnome::Gda::Value value = data_model->get_value_at(col_index, 0, error);
+#endif
//Never give a NULL-type value to the python calculation for types that don't use them:
//to prevent errors:
if(value.is_null())
@@ -2699,7 +2767,12 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const LayoutFieldInRecord
{
if(data_model->get_n_rows())
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
result = data_model->get_value_at(0, 0);
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ result = data_model->get_value_at(0, 0, value_error);
+#endif
}
}
else
@@ -2743,7 +2816,12 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const sharedptr<Field>& f
{
if(data_model->get_n_rows())
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
result = data_model->get_value_at(0, 0);
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ result = data_model->get_value_at(0, 0, value_error);
+#endif
}
}
else
@@ -3013,7 +3091,12 @@ Gnome::Gda::Value Base_DB::get_lookup_value(const Glib::ustring& /* table_name *
if(data_model && data_model->get_n_rows())
{
//There should be only 1 row. Well, there could be more but we will ignore them.
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
result = data_model->get_value_at(0, 0);
+#else
+ std::auto_ptr<Glib::Error> error;
+ result = data_model->get_value_at(0, 0, error);
+#endif
}
else
{
@@ -3263,14 +3346,16 @@ int Base_DB::count_rows_returned_by(const Glib::ustring& sql_query)
const App_Glom* app = App_Glom::get_application();
if(app && app->get_show_sql_debug())
- {
+ {
try
{
std::cout << "Debug: count_rows_returned_by(): " << query_count << std::endl;
}
catch(const Glib::Exception& ex)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
std::cout << "Debug: query string could not be converted to std::cout: " << ex.what() << std::endl;
+#endif
}
}
@@ -3292,17 +3377,22 @@ int Base_DB::count_rows_returned_by(const Glib::ustring& sql_query)
{
Glib::RefPtr<Gnome::Gda::DataModel> datamodel = sharedconnection->get_gda_connection()->statement_execute_select(query_count);
#else
- std::auto_ptr<Glib::Error> error;
- Glib::RefPtr<Gnome::Gda::DataModel> datamodel = sharedconnection->get_gda_connection()->statement_execute_select(query_count, error);
- if(error)
+ std::auto_ptr<Glib::Error> model_error;
+ Glib::RefPtr<Gnome::Gda::DataModel> datamodel = sharedconnection->get_gda_connection()->statement_execute_select(query_count, Gnome::Gda::STATEMENT_MODEL_RANDOM_ACCESS, model_error);
+ if(model_error.get())
{
- std::cerr << "count_rows_returned_by(): exception caught: " << ex.what() << std::endl;
+ std::cerr << "count_rows_returned_by(): exception caught: " << model_error->what() << std::endl;
return result;
}
#endif
if(datamodel && datamodel->get_n_rows() && datamodel->get_n_columns())
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
Gnome::Gda::Value value = datamodel->get_value_at(0, 0);
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ Gnome::Gda::Value value = datamodel->get_value_at(0, 0, value_error);
+#endif
//This showed me that this contains a gint64: std::cerr << "DEBUG: value type=" << G_VALUE_TYPE_NAME(value.gobj()) << std::endl;
//For sqlite, this is an integer
if(value.get_value_type() == G_TYPE_INT64)
@@ -3382,7 +3472,12 @@ void Base_DB::set_found_set_where_clause_for_portal(FoundSet& found_set, const s
void Base_DB::update_gda_metastore_for_table(const Glib::ustring& table_name) const
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
sharedptr<SharedConnection> sharedconnection = connect_to_server(App_Glom::get_application());
+#else
+ std::auto_ptr<Glom::ExceptionConnection> ex;
+ sharedptr<SharedConnection> sharedconnection = connect_to_server(App_Glom::get_application(), ex);
+#endif
if(!sharedconnection)
{
std::cerr << "Base_DB::update_gda_metastore_for_table(): No connection." << std::endl;
@@ -3404,7 +3499,13 @@ void Base_DB::update_gda_metastore_for_table(const Glib::ustring& table_name) co
std::cout << "DEBUG: Base_DB::update_gda_metastore_for_table(): Calling Gda::Connection::update_meta_store_table() ..." << std::endl;
//TODO: This doesn't seem to quite work yet:
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
gda_connection->update_meta_store_table(table_name);
+#else
+ std::auto_ptr<Glib::Error> update_error;
+ gda_connection->update_meta_store_table(table_name, Glib::ustring(), update_error);
+#endif
+
//This does work, though it takes ages: gda_connection->update_meta_store();
std::cout << "DEBUG: Base_DB::update_gda_metastore_for_table(): ... Finished calling Gda::Connection::update_meta_store_table()" << std::endl;
}
@@ -3549,7 +3650,7 @@ Glib::ustring Base_DB::get_active_layout_platform(Document* document)
{
//Make Glom use the special "maemo" layouts if they exist.
#ifdef GLOM_ENABLE_MAEMO
- return "maemo"
+ return "maemo";
#endif
}
diff --git a/glom/base_db_table_data.cc b/glom/base_db_table_data.cc
index 6628840..de37ab1 100644
--- a/glom/base_db_table_data.cc
+++ b/glom/base_db_table_data.cc
@@ -307,6 +307,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const sharedptr<const Layo
//Warn the user:
//TODO: Make the field insensitive until it can receive data, so people never see this dialog.
const Glib::ustring message = _("Data may not be entered into this related field, because the related record does not yet exist, and the relationship does not allow automatic creation of new related records.");
+#undef GLOM_ENABLE_MAEMO
#ifdef GLOM_ENABLE_MAEMO
Hildon::Note dialog(Hildon::NOTE_TYPE_INFORMATION, *App_Glom::get_application(), message);
#else
@@ -511,7 +512,12 @@ void Base_DB_Table_Data::refresh_related_fields(const LayoutFieldInRecord& field
for(guint uiCol = 0; uiCol < cols_count; uiCol++)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
const Gnome::Gda::Value value = result->get_value_at(uiCol, 0 /* row */);
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ const Gnome::Gda::Value value = result->get_value_at(uiCol, 0 /* row */, value_error);
+#endif
sharedptr<LayoutItem_Field> layout_item = *iterFields;
if(!layout_item)
std::cerr << "Base_DB_Table_Data::refresh_related_fields(): The layout_item was null." << std::endl;
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index 079c854..94f314c 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -100,13 +100,17 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
builder->get_widget("existing_or_new_existing_treeview", m_existing_view);
builder->get_widget("existing_or_new_new_treeview", m_new_view);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(!m_existing_view || !m_new_view)
throw std::runtime_error("Glade file does not contain treeviews for ExistingOrNew dialog.");
+#endif
builder->get_widget("existing_or_new_notebook", m_notebook);
builder->get_widget("existing_or_new_button_select", m_select_button);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(!m_notebook || !m_select_button)
throw std::runtime_error("Glade file does not contain the notebook or the select button for ExistingOrNew dialog.");
+#endif
m_existing_model = Gtk::TreeStore::create(m_existing_columns);
m_existing_model->set_sort_column(m_existing_columns.m_col_time, Gtk::SORT_DESCENDING);
@@ -360,7 +364,9 @@ Glib::ustring Dialog_ExistingOrNew::get_uri() const
}
else
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
throw std::logic_error("Dialog_ExistingOrNew::get_uri: action is neither NEW_FROM_TEMPLATE nor OPEN_URI");
+#endif
}
}
@@ -372,8 +378,10 @@ EpcServiceInfo* Dialog_ExistingOrNew::get_service_info() const
if(action == OPEN_REMOTE)
return (*iter)[m_existing_columns.m_col_service_info];
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
else
throw std::logic_error("Dialog_ExistingOrNew::get_service_info: action is not OPEN_REMOTE");
+#endif
}
Glib::ustring Dialog_ExistingOrNew::get_service_name() const
@@ -383,8 +391,10 @@ Glib::ustring Dialog_ExistingOrNew::get_service_name() const
if(action == OPEN_REMOTE)
return (*iter)[m_existing_columns.m_col_service_name];
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
else
throw std::logic_error("Dialog_ExistingOrNew::get_service_name: action is not OPEN_REMOTE");
+#endif
}
#endif
@@ -404,9 +414,15 @@ std::auto_ptr<Gtk::TreeModel::iterator> Dialog_ExistingOrNew::create_dummy_item_
void Dialog_ExistingOrNew::existing_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
- Gtk::CellRendererPixbuf* pixbuf_renderer = dynamic_cast<Gtk::CellRendererPixbuf*>(renderer);
- if(!pixbuf_renderer) throw std::logic_error("Renderer not a pixbuf renderer in existing_icon_data_func");
+ Gtk::CellRendererPixbuf* pixbuf_renderer = dynamic_cast<Gtk::CellRendererPixbuf*>(renderer);
+ if(!pixbuf_renderer)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ throw std::logic_error("Renderer not a pixbuf renderer in existing_icon_data_func");
+#else
+ return;
+#endif
+#ifdef GLIBMM_PROPERTIES_ENABKED
pixbuf_renderer->property_stock_size() = Gtk::ICON_SIZE_BUTTON;
pixbuf_renderer->property_stock_id() = "";
pixbuf_renderer->property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>();
@@ -425,6 +441,29 @@ void Dialog_ExistingOrNew::existing_icon_data_func(Gtk::CellRenderer* renderer,
else if(m_iter_existing_network_dummy.get() != NULL && iter == *m_iter_existing_network_dummy)
pixbuf_renderer->property_stock_id() = Gtk::Stock::DIALOG_ERROR.id; // TODO: Use Stock::STOP instead?
#endif
+
+#else // Properties enabled
+
+ pixbuf_renderer->set_property("stock-size", Gtk::ICON_SIZE_BUTTON);
+ pixbuf_renderer->set_property("stock-id", std::string());
+ pixbuf_renderer->set_property("pixbuf", Glib::RefPtr<Gdk::Pixbuf>());
+
+ if(iter == m_iter_existing_recent)
+ pixbuf_renderer->set_property("stock-id", Gtk::Stock::INDEX.id);
+#ifndef G_OS_WIN32
+ else if(iter == m_iter_existing_network)
+ pixbuf_renderer->set_property("stock-id", Gtk::Stock::NETWORK.id);
+#endif
+ else if(iter == m_iter_existing_other)
+ pixbuf_renderer->set_property("stock-id", Gtk::Stock::OPEN.id);
+ else if(m_iter_existing_recent_dummy.get() != NULL && iter == *m_iter_existing_recent_dummy)
+ pixbuf_renderer->set_property("stock-id", Gtk::Stock::DIALOG_ERROR.id); // TODO: Use Stock::STOP instead?
+#ifndef G_OS_WIN32
+ else if(m_iter_existing_network_dummy.get() != NULL && iter == *m_iter_existing_network_dummy)
+ pixbuf_renderer->set_property("stock-id", Gtk::Stock::DIALOG_ERROR.id); // TODO: Use Stock::STOP instead?
+#endif
+
+#endif // Properties enabled
else
{
if(m_existing_model->is_ancestor(m_iter_existing_recent, iter))
@@ -442,7 +481,9 @@ void Dialog_ExistingOrNew::existing_icon_data_func(Gtk::CellRenderer* renderer,
#endif
else
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
throw std::logic_error("Unexpected iterator in existing_icon_data_func");
+#endif
}
}
}
@@ -450,8 +491,14 @@ void Dialog_ExistingOrNew::existing_icon_data_func(Gtk::CellRenderer* renderer,
void Dialog_ExistingOrNew::existing_title_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
Gtk::CellRendererText* text_renderer = dynamic_cast<Gtk::CellRendererText*>(renderer);
- if(!text_renderer) throw std::logic_error("Renderer not a text renderer in existing_title_data_func");
+ if(!text_renderer)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ throw std::logic_error("Renderer not a text renderer in existing_title_data_func");
+#else
+ return;
+#endif
+#ifdef GLIBMM_PROPERTIES_ENABLED
text_renderer->property_text() = (*iter)[m_existing_columns.m_col_title];
// Default: Use default color
@@ -466,13 +513,35 @@ void Dialog_ExistingOrNew::existing_title_data_func(Gtk::CellRenderer* renderer,
{
text_renderer->property_foreground() = "grey";
}
+#else // PROPERTIES_ENABLED
+ Glib::ustring text = (*iter)[m_existing_columns.m_col_title];
+ text_renderer->set_property("text", text);
+ // Default: Use default color
+ text_renderer->set_property("foreground-set", false);
+ // Use grey if parent item has no children
+#ifndef G_OS_WIN32
+ if( (iter == m_iter_existing_network && m_iter_existing_network_dummy.get()) ||
+ (iter == m_iter_existing_recent && m_iter_existing_recent_dummy.get()))
+#else
+ if(iter == m_iter_existing_recent && m_iter_existing_recent_dummy.get())
+#endif
+ {
+ text_renderer->set_property("foreground", std::string("grey"));
+ }
+#endif // PROPERTIES_ENABLED
}
void Dialog_ExistingOrNew::new_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
Gtk::CellRendererPixbuf* pixbuf_renderer = dynamic_cast<Gtk::CellRendererPixbuf*>(renderer);
- if(!pixbuf_renderer) throw std::logic_error("Renderer not a pixbuf renderer in new_icon_data_func");
+ if(!pixbuf_renderer)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ throw std::logic_error("Renderer not a pixbuf renderer in new_icon_data_func");
+#else
+ return;
+#endif
+#ifdef GLIBMM_PROPERTIES_ENABLED
pixbuf_renderer->property_stock_size() = Gtk::ICON_SIZE_BUTTON;
pixbuf_renderer->property_stock_id() = "";
pixbuf_renderer->property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>();
@@ -491,16 +560,49 @@ void Dialog_ExistingOrNew::new_icon_data_func(Gtk::CellRenderer* renderer, const
}
else
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
throw std::logic_error("Unexpected iterator in new_icon_data_func");
+#endif
}
}
+#else
+ pixbuf_renderer->set_property("stock-size", Gtk::ICON_SIZE_BUTTON);
+ pixbuf_renderer->set_property("stock-id", Glib::ustring());
+ pixbuf_renderer->set_property("pixbuf", Glib::RefPtr<Gdk::Pixbuf>());
+
+ if(iter == m_iter_new_empty)
+ pixbuf_renderer->set_property("stock-id", Gtk::Stock::NEW.id);
+ else if(iter == m_iter_new_template)
+ pixbuf_renderer->set_property("stock-id", Gtk::Stock::EDIT.id); // TODO: More meaningful icon?
+ else if(m_iter_new_template_dummy.get() != NULL && iter == *m_iter_new_template_dummy)
+ pixbuf_renderer->set_property("stock-id", Gtk::Stock::DIALOG_ERROR.id); // TODO: Use Stock::STOP instead?
+ else
+ {
+ if(m_new_model->is_ancestor(m_iter_new_template, iter))
+ {
+ pixbuf_renderer->set_property("icon-name", Glib::ustring("glom"));
+ }
+ else
+ {
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ throw std::logic_error("Unexpected iterator in new_icon_data_func");
+#endif
+ }
+ }
+#endif
}
void Dialog_ExistingOrNew::new_title_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
Gtk::CellRendererText* text_renderer = dynamic_cast<Gtk::CellRendererText*>(renderer);
- if(!text_renderer) throw std::logic_error("Renderer not a text renderer in new_title_data_func");
+ if(!text_renderer)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ throw std::logic_error("Renderer not a text renderer in new_title_data_func");
+#else
+ return;
+#endif
+#ifdef GLIBMM_PROPERTIES_ENABLED
text_renderer->property_text() = (*iter)[m_new_columns.m_col_title];
// Default: Use default color
@@ -510,6 +612,18 @@ void Dialog_ExistingOrNew::new_title_data_func(Gtk::CellRenderer* renderer, cons
{
text_renderer->property_foreground() = "grey";
}
+#else
+ Glib::ustring text = (*iter)[m_new_columns.m_col_title];
+ text_renderer->set_property("text", text);
+
+ // Default: Use default color
+ text_renderer->set_property("foreground-set", false);
+ // Use grey if parent item has no children
+ if( (iter == m_iter_new_template && m_iter_new_template_dummy.get()))
+ {
+ text_renderer->set_property("foreground", Glib::ustring("grey"));
+ }
+#endif
}
void Dialog_ExistingOrNew::on_switch_page(GtkNotebookPage* /* page */, guint /* page_num */)
diff --git a/glom/dialog_import_csv.cc b/glom/dialog_import_csv.cc
index 61ccd66..e53f2df 100644
--- a/glom/dialog_import_csv.cc
+++ b/glom/dialog_import_csv.cc
@@ -202,8 +202,10 @@ Dialog_Import_CSV::Dialog_Import_CSV(BaseObjectType* cobject, const Glib::RefPtr
builder->get_widget("import_csv_sample_rows", m_sample_rows);
builder->get_widget("import_csv_advice_label", m_advice_label);
builder->get_widget("import_csv_error_label", m_error_label);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(!m_sample_view || !m_encoding_combo || !m_target_table || !m_encoding_info || !m_first_line_as_title || !m_sample_rows || !m_error_label)
throw std::runtime_error("Missing widgets from glade file for Dialog_Import_CSV");
+#endif
m_encoding_model = Gtk::ListStore::create(m_encoding_columns);
@@ -390,6 +392,7 @@ bool Dialog_Import_CSV::row_separator_func(const Glib::RefPtr<Gtk::TreeModel>& /
void Dialog_Import_CSV::on_query_info(const Glib::RefPtr<Gio::AsyncResult>& result)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
Glib::RefPtr<Gio::FileInfo> info = m_file->query_info_finish(result);
@@ -400,10 +403,22 @@ void Dialog_Import_CSV::on_query_info(const Glib::RefPtr<Gio::AsyncResult>& resu
{
std::cerr << "Failed to fetch display name of uri " << m_file->get_uri() << ": " << ex.what() << std::endl;
}
+#else
+ std::auto_ptr<Glib::Error> error;
+ Glib::RefPtr<Gio::FileInfo> info = m_file->query_info_finish(result, error);
+ if (!error.get())
+ {
+ m_filename = info->get_display_name();
+ set_title(m_filename + _(" - Import From CSV File"));
+ }
+ else
+ std::cerr << "Failed to fetch display name of uri " << m_file->get_uri() << ": " << error->what() << std::endl;
+#endif
}
void Dialog_Import_CSV::on_file_read(const Glib::RefPtr<Gio::AsyncResult>& result)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
m_stream = m_file->read_finish(result);
@@ -417,10 +432,25 @@ void Dialog_Import_CSV::on_file_read(const Glib::RefPtr<Gio::AsyncResult>& resul
clear();
// TODO: Response?
}
+#else
+ std::auto_ptr<Glib::Error> error;
+ m_stream = m_file->read_finish(result, error);
+ if (!error.get())
+ {
+ m_buffer.reset(new Buffer);
+ m_stream->read_async(m_buffer->buf, sizeof(m_buffer->buf), sigc::mem_fun(*this, &Dialog_Import_CSV::on_stream_read));
+ }
+ else
+ {
+ show_error_dialog(_("Could Not Open file"), Glib::ustring::compose(_("The file at \"%1\" could not be opened: %2"), m_file->get_uri(), error->what()));
+ clear();
+ }
+#endif
}
void Dialog_Import_CSV::on_stream_read(const Glib::RefPtr<Gio::AsyncResult>& result)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
const gssize size = m_stream->read_finish(result);
@@ -459,6 +489,46 @@ void Dialog_Import_CSV::on_stream_read(const Glib::RefPtr<Gio::AsyncResult>& res
clear();
// TODO: Response?
}
+#else
+ std::auto_ptr<Glib::Error> error;
+ const gssize size = m_stream->read_finish(result, error);
+ if (!error.get())
+ {
+ m_raw.insert(m_raw.end(), m_buffer->buf, m_buffer->buf + size);
+
+ // If the parser already exists, but it is currently not parsing because it waits
+ // for new input, then continue parsing.
+ if(m_parser.get() && !m_parser->idle_connection.connected())
+ {
+ m_parser->idle_connection = Glib::signal_idle().connect(sigc::mem_fun(*this, &Dialog_Import_CSV::on_idle_parse));
+ }
+ // If the parser does not exist yet, then create a new parser, except when the
+ // current encoding does not work for the file ,in which case the user must first
+ // choose another encoding.
+ else if(!m_parser.get() && m_state != ENCODING_ERROR)
+ {
+ begin_parse();
+ }
+
+ if(size > 0)
+ {
+ // Read the next few bytes
+ m_stream->read_async(m_buffer->buf, sizeof(m_buffer->buf), sigc::mem_fun(*this, &Dialog_Import_CSV::on_stream_read));
+ }
+ else
+ {
+ // Finished reading
+ m_buffer.reset(NULL);
+ m_stream.reset();
+ m_file.reset();
+ }
+ }
+ if (error.get())
+ {
+ show_error_dialog(_("Could Not Read File"), Glib::ustring::compose(_("The file at \"%1\" could not be read: %2"), m_file->get_uri(), error->what()));
+ clear();
+ }
+#endif
}
void Dialog_Import_CSV::on_encoding_changed()
@@ -847,9 +917,15 @@ void Dialog_Import_CSV::handle_line(const Glib::ustring& line, guint line_number
col->pack_start(*cell, true);
col->set_cell_data_func(*cell, sigc::bind(sigc::mem_fun(*this, &Dialog_Import_CSV::field_data_func), i));
col->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
+#ifdef GLIBMM_PROPERTIES_ENABLED
cell->property_model() = m_field_model_sorted;
cell->property_text_column() = 0;
cell->property_has_entry() = false;
+#else
+ cell->set_property("model", m_field_model_sorted);
+ cell->set_property("text-column", 0);
+ cell->set_property("has_entry", false);
+#endif
cell->signal_edited().connect(sigc::bind(sigc::mem_fun(*this, &Dialog_Import_CSV::on_field_edited), i));
m_sample_view->append_column(*col);
}
@@ -879,8 +955,10 @@ void Dialog_Import_CSV::line_data_func(Gtk::CellRenderer* renderer, const Gtk::T
{
const int row = (*iter)[m_sample_columns.m_col_row];
Gtk::CellRendererText* renderer_text = dynamic_cast<Gtk::CellRendererText*>(renderer);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(!renderer_text)
throw std::logic_error("CellRenderer is not a CellRendererText in line_data_func");
+#endif
if(row == -1)
renderer_text->set_property("text", Glib::ustring(_("Target Field")));
@@ -892,7 +970,9 @@ void Dialog_Import_CSV::field_data_func(Gtk::CellRenderer* renderer, const Gtk::
{
const int row = (*iter)[m_sample_columns.m_col_row];
Gtk::CellRendererCombo* renderer_combo = dynamic_cast<Gtk::CellRendererCombo*>(renderer);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(!renderer_combo) throw std::logic_error("CellRenderer is not a CellRendererCombo in field_data_func");
+#endif
Glib::ustring text;
bool editable = false;
diff --git a/glom/dialog_import_csv_progress.cc b/glom/dialog_import_csv_progress.cc
index 65af812..16dffee 100644
--- a/glom/dialog_import_csv_progress.cc
+++ b/glom/dialog_import_csv_progress.cc
@@ -35,8 +35,10 @@ Dialog_Import_CSV_Progress::Dialog_Import_CSV_Progress(BaseObjectType* cobject,
builder->get_widget("import_csv_progress_progress_bar", m_progress_bar);
builder->get_widget("import_csv_progress_textview", m_text_view);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(!m_progress_bar || !m_text_view)
throw std::runtime_error("Missing widgets from glade file for Dialog_Import_CSV_Progress");
+#endif
}
bool Dialog_Import_CSV_Progress::init_db_details(const Glib::ustring& table_name)
@@ -259,7 +261,9 @@ void Dialog_Import_CSV_Progress::set_primary_key_value(const Gtk::TreeModel::ite
Gnome::Gda::Value Dialog_Import_CSV_Progress::get_primary_key_value(const Gtk::TreeModel::iterator& /* row */) const
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
throw std::logic_error("Dialog_Import_CSV_Progress::get_primary_key_value() called");
+#endif
}
} //namespace Glom
diff --git a/glom/dialog_invalid_data.cc b/glom/dialog_invalid_data.cc
index 6100f1b..6673ee5 100644
--- a/glom/dialog_invalid_data.cc
+++ b/glom/dialog_invalid_data.cc
@@ -32,17 +32,7 @@ namespace Glom
bool glom_show_dialog_invalid_data(Field::glom_field_type glom_type)
{
//TODO: Share a global instance, to make this quicker?
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), "dialog_data_invalid_format");
-#else
- std::auto_ptr<Glib::Error> error;
- Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), "dialog_data_invalid_format", "", error);
- if(error.get())
- {
- std::cerr << "glom_show_dialog_invalid_data() failed: " << error->what() << std::endl;
- return false;
- }
-#endif
Dialog_InvalidData* dialog = 0;
refXml->get_widget_derived("dialog_data_invalid_format", dialog);
diff --git a/glom/filechooser_export.cc b/glom/filechooser_export.cc
index 3379a72..0e5250f 100644
--- a/glom/filechooser_export.cc
+++ b/glom/filechooser_export.cc
@@ -47,13 +47,7 @@ FileChooser_Export::FileChooser_Export()
m_extra_widget.show();
//TODO: Use a generic layout dialog?
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "window_data_layout_export");
-#else
- std::auto_ptr<Gtk::BuilderError> error;
- Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "window_data_layout_export", "", error);
- // Ignore error, refXml is checked below
-#endif
if(refXml)
{
diff --git a/glom/glade_utils.cc b/glom/glade_utils.cc
index 6bb1891..176286b 100644
--- a/glom/glade_utils.cc
+++ b/glom/glade_utils.cc
@@ -33,14 +33,8 @@ Dialog_ProgressCreating* get_and_show_pulse_dialog(const Glib::ustring& message,
if(!parent_window)
std::cerr << "debug: Glom: get_and_show_pulse_dialog(): parent_window is NULL" << std::endl;
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), "window_progress");
-#else
- std::auto_ptr<Glib::Error> error;
- Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), "window_progress", "", error);
- if(error.get())
- return 0;
-#endif
+
if(refXml)
{
diff --git a/glom/glade_utils.h b/glom/glade_utils.h
index 84afbe6..2e126f5 100644
--- a/glom/glade_utils.h
+++ b/glom/glade_utils.h
@@ -58,10 +58,7 @@ void get_glade_widget_derived_with_warning(const Glib::ustring& id, T_Widget*& w
std::cerr << ex.what() << std::endl;
}
#else
- error.reset(0);
- refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), id, "", error);
- if(error.get())
- std::cerr << error->what() << std::endl;
+ refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), id);
#endif
if(refXml)
@@ -85,9 +82,7 @@ void get_glade_developer_widget_derived_with_warning(const Glib::ustring& id, T_
std::cerr << ex.what() << std::endl;
}
#else
- error.reset(NULL);
- refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), id, "", error);
- if(error.get()) std::cerr << error->what() << std::endl;
+ refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), id);
#endif
if(refXml)
@@ -111,10 +106,7 @@ void get_glade_widget_with_warning(const Glib::ustring& id, T_Widget*& widget)
std::cerr << ex.what() << std::endl;
}
#else
- error.reset(0);
- refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), id, "", error);
- if(error.get())
- std::cerr << error->what() << std::endl;
+ refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), id);
#endif
if(refXml)
diff --git a/glom/glom_privs.cc b/glom/glom_privs.cc
index eb9918e..c63374e 100644
--- a/glom/glom_privs.cc
+++ b/glom/glom_privs.cc
@@ -40,7 +40,12 @@ Privs::type_vec_strings Privs::get_database_groups()
const int rows_count = data_model->get_n_rows();
for(int row = 0; row < rows_count; ++row)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
const Gnome::Gda::Value value = data_model->get_value_at(0, row);
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ const Gnome::Gda::Value value = data_model->get_value_at(0, row, value_error);
+#endif
const Glib::ustring name = value.get_string();
result.push_back(name);
}
@@ -103,8 +108,13 @@ Privs::type_vec_strings Privs::get_database_users(const Glib::ustring& group_nam
const int rows_count = data_model->get_n_rows();
for(int row = 0; row < rows_count; ++row)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
const Gnome::Gda::Value value = data_model->get_value_at(0, row);
- const Glib::ustring name = value.get_string();
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ const Gnome::Gda::Value value = data_model->get_value_at(0, row, value_error);
+#endif
+ const Glib::ustring name = value.get_string();
result.push_back(name);
}
}
@@ -118,7 +128,12 @@ Privs::type_vec_strings Privs::get_database_users(const Glib::ustring& group_nam
const int rows_count = data_model->get_n_rows();
for(int row = 0; row < rows_count; ++row)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
const Gnome::Gda::Value value = data_model->get_value_at(1, row); //Column 1 is the /* the user list.
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ const Gnome::Gda::Value value = data_model->get_value_at(1, row, value_error); //Column 1 is the /* the user list.
+#endif
//pg_group is a string, formatted, bizarrely, like so: "{100, 101}".
Glib::ustring group_list;
@@ -133,7 +148,12 @@ Privs::type_vec_strings Privs::get_database_users(const Glib::ustring& group_nam
Glib::RefPtr<Gnome::Gda::DataModel> data_model = query_execute_select(strQuery);
if(data_model)
{
- const Gnome::Gda::Value value = data_model->get_value_at(0, 0);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ const Gnome::Gda::Value value = data_model->get_value_at(0, 0);
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ const Gnome::Gda::Value value = data_model->get_value_at(0, 0, value_error);
+#endif
result.push_back(value.get_string());
}
}
@@ -179,6 +199,7 @@ void Privs::set_table_privileges(const Glib::ustring& group_name, const Glib::us
if(privs.m_create)
{
if(!strPrivilege.empty())
+
strPrivilege += ", ";
strPrivilege += "INSERT";
@@ -236,7 +257,13 @@ Privileges Privs::get_table_privileges(const Glib::ustring& group_name, const Gl
Glib::RefPtr<Gnome::Gda::DataModel> data_model = query_execute_select(strQuery);
if(data_model && data_model->get_n_rows())
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
const Gnome::Gda::Value value = data_model->get_value_at(0, 0);
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ const Gnome::Gda::Value value = data_model->get_value_at(0, 0, value_error);
+#endif
+
Glib::ustring access_details;
if(!value.is_null())
access_details = value.get_string();
@@ -408,8 +435,12 @@ Privileges Privs::get_current_privs(const Glib::ustring& table_name)
result.m_developer = true;
}
*/
-
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
sharedptr<SharedConnection> sharedconnection = connection_pool->connect();
+#else
+ std::auto_ptr<ExceptionConnection> ex;
+ sharedptr<SharedConnection> sharedconnection = connection_pool->connect(ex);
+#endif
if(sharedconnection && sharedconnection->get_gda_connection()->supports_feature(Gnome::Gda::CONNECTION_FEATURE_USERS))
{
//Get the "true" rights for any groups that the user is in:
diff --git a/glom/main.cc b/glom/main.cc
index 1773972..b1a46da 100644
--- a/glom/main.cc
+++ b/glom/main.cc
@@ -326,15 +326,25 @@ main(int argc, char* argv[])
PySys_SetArgv(argc, argv);
std::auto_ptr<Gtk::Main> mainInstance;
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
+#endif
{
mainInstance = std::auto_ptr<Gtk::Main>( new Gtk::Main(argc, argv, context) );
}
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
catch(const Glib::Error& ex)
{
std::cerr << "Glom: Error while initializing gtkmm: " << ex.what() << std::endl;
return 0;
}
+#else
+ if (!mainInstance.get())
+ {
+ std::cerr << "Glom: Error while initializing gtkmm" << std::endl;
+ return 0;
+ }
+#endif
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
@@ -469,19 +479,9 @@ main(int argc, char* argv[])
if(group.m_arg_debug_date_check)
return 0; //This command-line option is documented as stopping afterwards.
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
// Main app
Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Glom::Utils::get_glade_file_path("glom.glade"), "window_main");
-#else
- std::auto_ptr<Glib::Error> error;
- Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Glom::Utils::get_glade_file_path("glom.glade"), "window_main", "", error);
- if(error.get())
- {
- std::cerr << "Glom: exception: \n " << error->what() << std::endl;
- return -1;
- }
-#endif
+
Glom::App_Glom* pApp_Glom = 0;
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index c5e795f..a71233b 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -202,14 +202,26 @@ bool Box_Data_Calendar_Related::fill_from_database()
continue;
//Get the date value for this row:
- Gnome::Gda::Value value_date = datamodel->get_value_at(m_query_column_date_field, row_index);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ Gnome::Gda::Value value_date = datamodel->get_value_at(m_query_column_date_field, row_index);
+#else
+ std::auto_ptr<Glib::Error> error;
+ Gnome::Gda::Value value_date = datamodel->get_value_at(m_query_column_date_field, row_index, error);
+#endif
const Glib::Date date = value_date.get_date();
//Get all the values for this row:
type_vector_values* pVector = new type_vector_values(m_FieldsShown.size());
for(int column_index = 0; column_index < columns_count; ++column_index)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
(*pVector)[column_index] = datamodel->get_value_at(column_index, row_index);
+#else
+ std::auto_ptr<Glib::Error> error;
+ (*pVector)[column_index] = datamodel->get_value_at(column_index, row_index, error);
+ if (error.get())
+ break;
+#endif
}
m_map_values[date].push_back(pVector);
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index a12b01d..c744c4b 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -355,7 +355,14 @@ bool Box_Data_Details::fill_from_database()
{
if(index_primary_key < cols_count)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
m_primary_key_value = result->get_value_at(index_primary_key, row_number);
+#else
+ {
+ std::auto_ptr<Glib::Error> value_error;
+ m_primary_key_value = result->get_value_at(index_primary_key, row_number, value_error);
+ }
+#endif
set_found_set_from_primary_key_value();
}
}
@@ -369,7 +376,14 @@ bool Box_Data_Details::fill_from_database()
Gnome::Gda::Value value;
if(!primary_key_is_empty)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
value = result->get_value_at(i, row_number);
+#else
+ {
+ std::auto_ptr<Glib::Error> value_error;
+ value = result->get_value_at(i, row_number, value_error);
+ }
+#endif
else
{
value = Conversions::get_empty_value(layout_item->get_glom_type());
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index 6885a29..03d2f75 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -313,8 +313,12 @@ void Box_Data_Portal::get_suitable_record_to_view_details(const Gnome::Gda::Valu
{
//Set the output parameters:
table_name = navigation_table_name;
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
table_primary_key_value = data_model->get_value_at(0, 0);
-
+#else
+ std::auto_ptr<Glib::Error> error;
+ table_primary_key_value = data_model->get_value_at(0, 0, error);
+#endif
//std::cout << "Box_Data_Portal::get_suitable_record_to_view_details(): table_primary_key_value=" << table_primary_key_value.to_string() << std::endl;
//The value is empty when there there is no record to match the key in the related table:
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index 0d85a79..5083b5e 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -254,8 +254,8 @@ private:
#ifndef GLOM_ENABLE_CLIENT_ONLY
virtual void on_menu_properties_activate();
virtual void on_menu_delete_activate(); // override this to add a dialog box
- virtual bool on_button_press_event(GdkEventButton *event);
#endif // !GLOM_ENABLE_CLIENT_ONLY
+ virtual bool on_button_press_event(GdkEventButton *event);
};
} //namespace Glom
diff --git a/glom/mode_data/notebook_data.cc b/glom/mode_data/notebook_data.cc
index f9ee107..c97652b 100644
--- a/glom/mode_data/notebook_data.cc
+++ b/glom/mode_data/notebook_data.cc
@@ -35,7 +35,9 @@ Notebook_Data::Notebook_Data()
m_iPage_Details = 1;
// Set accessible name for the notebook, to be able to access it via LDTP
+#ifndef GLOM_ENABLE_MAEMO
get_accessible()->set_name(_("List Or Details View"));
+#endif
//Connect signals:
diff --git a/glom/notebook_glom.cc b/glom/notebook_glom.cc
index 74c33c2..e7162cf 100644
--- a/glom/notebook_glom.cc
+++ b/glom/notebook_glom.cc
@@ -35,6 +35,12 @@ Notebook_Glom::Notebook_Glom()
//signal_leave_page().connect(sigc::mem_fun(*this, &Notebook_Glom::on_leave_page));
m_destructor_in_progress = false;
+
+#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
+ signal_show().connect(sigc::mem_fun(*this, &Notebook_Glom::on_show));
+#endif
+
+
}
Notebook_Glom::~Notebook_Glom()
@@ -43,7 +49,9 @@ Notebook_Glom::~Notebook_Glom()
void Notebook_Glom::on_show()
{
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
Gtk::Notebook::on_show();
+#endif
//We do this only in on_show() because otherwise GtkNotebook emits the signal (and we catch it) during show:
if(!m_connection_switch_page)
diff --git a/glom/reports/report_builder.cc b/glom/reports/report_builder.cc
index a6da425..3621f9e 100644
--- a/glom/reports/report_builder.cc
+++ b/glom/reports/report_builder.cc
@@ -190,7 +190,13 @@ void ReportBuilder::report_build_groupby(const FoundSet& found_set_parent, xmlpp
guint rows_count = datamodel->get_n_rows();
for(guint row = 0; row < rows_count; ++row)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
const Gnome::Gda::Value group_value = datamodel->get_value_at(0 /* col*/, row);
+#else
+ std::auto_ptr<Glib::Error> error;
+ const Gnome::Gda::Value group_value = datamodel->get_value_at(0 /* col*/, row, error);
+#endif
+
//Add XML node:
xmlpp::Element* nodeGroupBy = parent_node.add_child(group_by->get_report_part_id());
@@ -385,14 +391,23 @@ void ReportBuilder::report_build_records_field(const FoundSet& found_set, xmlpp:
if(!datamodel)
return;
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
value = datamodel->get_value_at(colField, row);
-
+#else
+ std::auto_ptr<Glib::Error> error;
+ value = datamodel->get_value_at(colField, row, error);
+#endif
colField = 0;
row = 0;
}
else
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
value = datamodel->get_value_at(colField, row);
+#else
+ std::auto_ptr<Glib::Error> error;
+ value = datamodel->get_value_at(colField, row, error);
+#endif
}
nodeField->set_attribute("title", field->get_title_or_name()); //Not always used, but useful.
diff --git a/glom/utility_widgets/adddel/adddel.cc b/glom/utility_widgets/adddel/adddel.cc
index 7c8d842..5facedb 100644
--- a/glom/utility_widgets/adddel/adddel.cc
+++ b/glom/utility_widgets/adddel/adddel.cc
@@ -146,7 +146,9 @@ AddDel::~AddDel()
void AddDel::set_treeview_accessible_name(const Glib::ustring& name)
{
+#ifndef GLOM_ENABLE_MAEMO
m_TreeView.get_accessible()->set_name(name);
+#endif
}
void AddDel::warn_about_duplicate()
diff --git a/glom/utility_widgets/canvas/canvas_group_grid.cc b/glom/utility_widgets/canvas/canvas_group_grid.cc
index 269c252..09052e5 100644
--- a/glom/utility_widgets/canvas/canvas_group_grid.cc
+++ b/glom/utility_widgets/canvas/canvas_group_grid.cc
@@ -169,13 +169,23 @@ void CanvasGroupGrid::snap_position(double& x, double& y) const
Glib::RefPtr<Goocanvas::Polyline> CanvasGroupGrid::create_grid_or_rule_line(double x1, double y1, double x2, double y2, bool is_rule)
{
Glib::RefPtr<Goocanvas::Polyline> line = Goocanvas::Polyline::create(x1, y1, x2, y2);
+#ifdef GLIBMM_PROPERTIES_ENABLED
line->property_line_width() = 1.0f;
+#else
+ line->set_property("line-width", 1.0f);
+#endif
+#ifdef GLIBMM_PROPERTIES_ENABLED
if(is_rule)
line->property_stroke_color() = "green";
else
line->property_stroke_color() = "gray";
-
+#else
+ if(is_rule)
+ line->set_property("stroke-color", Glib::ustring("green"));
+ else
+ line->set_property("stroke-color", Glib::ustring("gray"));
+#endif
return line;
}
@@ -228,10 +238,17 @@ void CanvasGroupGrid::create_lines()
if(m_grid_gap > 0) //0 steps cause a crash in older versions of goocanvas.
{
m_grid_lines = Goocanvas::Grid::create(0, 0, width, height, m_grid_gap, m_grid_gap);
+#ifdef GLIBMM_PROPERTIES_ENABLED
m_grid_lines->property_horz_grid_line_width() = 1.0f;
m_grid_lines->property_vert_grid_line_width() = 1.0f;
m_grid_lines->property_horz_grid_line_color() = "gray";
m_grid_lines->property_vert_grid_line_color() = "gray";
+#else
+ m_grid_lines->set_property("horz-grid-line-width", 1.0f);
+ m_grid_lines->set_property("vert-grid-line-width", 1.0f);
+ m_grid_lines->set_property("horz-grid-line-color", Glib::ustring("gray"));
+ m_grid_lines->set_property("vert-grid-line-color", Glib::ustring("gray"));
+#endif
add_child(m_grid_lines);
}
diff --git a/glom/utility_widgets/canvas/canvas_group_resizable.cc b/glom/utility_widgets/canvas/canvas_group_resizable.cc
index f6cc815..a7258f1 100644
--- a/glom/utility_widgets/canvas/canvas_group_resizable.cc
+++ b/glom/utility_widgets/canvas/canvas_group_resizable.cc
@@ -63,8 +63,13 @@ void CanvasGroupResizable::create_manipulators()
void CanvasGroupResizable::create_rect_manipulators()
{
m_rect = Goocanvas::Rect::create(0, 0, 0, 0);
+#ifdef GLIBMM_PROPERTIES_ENABLED
m_rect->property_line_width() = 0;
m_rect->property_fill_color() = "white";
+#else
+ m_rect->set_property("line-width", 0);
+ m_rect->set_property("fill-color", Glib::ustring("white"));
+#endif
add_child(m_rect);
//Allow dragging of the rect to move everything:
@@ -191,11 +196,19 @@ void CanvasGroupResizable::position_rect_manipulators()
//Show the size of this item (not always the same as the child size):
+#ifdef GLIBMM_PROPERTIES_ENABLED
m_rect->property_x() = child_x;
m_rect->property_y() = child_y;
m_rect->property_width() = child_width;
m_rect->property_height() = child_height;
m_rect->property_fill_color() = "white";
+#else
+ m_rect->set_property("x", child_x);
+ m_rect->set_property("y", child_y);
+ m_rect->set_property("width", child_width);
+ m_rect->set_property("height",child_height);
+ m_rect->set_property("fill_color", Glib::ustring("white"));
+#endif
const double x2 = child_x + child_width;
const double y2 = child_y + child_height;
@@ -230,7 +243,12 @@ void CanvasGroupResizable::position_line_manipulators()
if(!line)
return;
+#ifdef GLIBMM_PROPERTIES_ENABLED
const Goocanvas::Points points = line->property_points();
+#else
+ Goocanvas::Points points;
+ line->get_property("points", points);
+#endif
if(points.get_num_points() < 2)
return;
@@ -423,13 +441,23 @@ void CanvasGroupResizable::on_manipulator_corner_moved(Manipulators manipulator_
switch(manipulator_id)
{
+#ifndef GLIBMM_PROPERTIES_ENABLED
+ // The compiler probably already does exactly this...
+ int x, y;
+ manipulator->get_property("x", x);
+ manipulator->get_property("y", y);
+#endif
case(MANIPULATOR_CORNER_TOP_LEFT):
{
const double new_x = std::min(manipulator_x, child_x + child_width);
const double new_y = std::min(manipulator_y, child_y + child_height);
+#ifdef GLIBMM_PROPERTIES_ENABLED
const double new_height = std::max(child_y + child_height - manipulator->property_y(), 0.0);
const double new_width = std::max(child_x + child_width - manipulator->property_x(), 0.0);
-
+#else
+ const double new_height = std::max(child_y + child_height - y, 0.0);
+ const double new_width = std::max(child_x + child_width - x, 0.0);
+#endif
set_xy(new_x, new_y);
set_width_height(new_width, new_height);
@@ -438,8 +466,13 @@ void CanvasGroupResizable::on_manipulator_corner_moved(Manipulators manipulator_
case(MANIPULATOR_CORNER_TOP_RIGHT):
{
const double new_y = std::min(manipulator_y, child_y + child_height);
+#ifdef GLIBMM_PROPERTIES_ENABLED
const double new_height = std::max(child_y + child_height - manipulator->property_y(), 0.0);
const double new_width = std::max(manipulator->property_x() + manipulator_corner_size - child_x, 0.0);
+#else
+ const double new_height = std::max(child_y + child_height - y, 0.0);
+ const double new_width = std::max(x + manipulator_corner_size - child_x, 0.0);
+#endif
set_xy(child_x, new_y);
set_width_height(new_width, new_height);
@@ -449,9 +482,13 @@ void CanvasGroupResizable::on_manipulator_corner_moved(Manipulators manipulator_
case(MANIPULATOR_CORNER_BOTTOM_LEFT):
{
const double new_x = std::min(manipulator_x, child_x + child_width);
+#ifdef GLIBMM_PROPERTIES_ENABLED
const double new_height = std::max(manipulator->property_y() + manipulator_corner_size - child_y, 0.0);
const double new_width = std::max(child_x + child_width - manipulator->property_x(), 0.0);
-
+#else
+ const double new_height = std::max(y + manipulator_corner_size - child_y, 0.0);
+ const double new_width = std::max(child_x + child_width - x, 0.0);
+#endif
set_xy(new_x, child_y);
set_width_height(new_width, new_height);
@@ -459,9 +496,13 @@ void CanvasGroupResizable::on_manipulator_corner_moved(Manipulators manipulator_
}
case(MANIPULATOR_CORNER_BOTTOM_RIGHT):
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
const double new_height = std::max(manipulator->property_y() + manipulator_corner_size - child_y, 0.0);
const double new_width = std::max(manipulator->property_x() + manipulator_corner_size - child_x, 0.0);
-
+#else
+ const double new_height = std::max(y + manipulator_corner_size - child_y, 0.0);
+ const double new_width = std::max(x + manipulator_corner_size - child_x, 0.0);
+#endif
set_width_height(new_width, new_height);
break;
@@ -497,14 +538,24 @@ void CanvasGroupResizable::on_manipulator_line_end_moved(Manipulators manipulato
double manipulator_y = 0;
manipulator->get_xy(manipulator_x, manipulator_y);
+#ifdef GLIBMM_PROPERTIES_ENABLED
Goocanvas::Points points = line->property_points();
+#else
+ Goocanvas::Points points;
+ line->get_property("points", points);
+#endif
+
if(points.get_num_points() < 2)
return;
const int point_index = (manipulator_id == MANIPULATOR_START) ? 0 : 1;
const double half_size = manipulator_corner_size / 2;
points.set_coordinate(point_index, manipulator_x + half_size, manipulator_y + half_size);
+#ifdef GLIBMM_PROPERTIES_ENABLED
line->property_points() = points; //TODO: Add a way to do this without getting and setting the points property.
+#else
+ line->set_property("points", points); //TODO: Add a way to do this without getting and setting the points property.
+#endif
position_manipulators();
}
@@ -534,7 +585,12 @@ void CanvasGroupResizable::on_manipulator_edge_moved(Manipulators manipulator_id
//std::cout << "CanvasGroupResizable::on_manipulator_edge_moved(): manipulator=" << manipulator_id << std::endl;
+#ifdef GLIBMM_PROPERTIES_ENABLED
Goocanvas::Points points = manipulator->property_points();
+#else
+ Goocanvas::Points points;
+ manipulator->get_property("points", points);
+#endif
double x1 = 0;
double y1 = 0;
points.get_coordinate(0, x1, y1);
@@ -644,8 +700,11 @@ void CanvasGroupResizable::set_manipulators_visibility(Goocanvas::ItemVisibility
return;
//For testing: visibility = Goocanvas::ITEM_VISIBLE;
-
+#ifdef GLIBMM_PROPERTIES_ENABLED
m_group_manipulators->property_visibility() = visibility;
+#else
+ m_group_manipulators->set_property("visibility", visibility);
+#endif
}
bool CanvasGroupResizable::on_rect_enter_notify_event(const Glib::RefPtr<Goocanvas::Item>& /* target */, GdkEventCrossing* /* event */)
@@ -695,22 +754,34 @@ bool CanvasGroupResizable::on_resizer_leave_notify_event(const Glib::RefPtr<Gooc
Glib::RefPtr<CanvasRectMovable> CanvasGroupResizable::create_corner_manipulator()
{
Glib::RefPtr<CanvasRectMovable> result = CanvasRectMovable::create();
+#ifdef GLIBMM_PROPERTIES_ENABLED
result->property_fill_color() = manipulator_corner_fill_color; //This makes the whole area clickable, not just the outline stroke:
result->property_line_width() = manipulator_stroke_width;
result->property_stroke_color() = manipulator_stroke_color;
result->property_height() = manipulator_corner_size;
result->property_width() = manipulator_corner_size;
-
+#else
+ result->set_property("fill-color", manipulator_corner_fill_color); //This makes the whole area clickable, not just the outline stroke:
+ result->set_property("line-width", manipulator_stroke_width);
+ result->set_property("stroke_color", manipulator_stroke_color);
+
+ result->set_property("height", manipulator_corner_size);
+ result->set_property("width", manipulator_corner_size);
+#endif
return result;
}
Glib::RefPtr<CanvasLineMovable> CanvasGroupResizable::create_edge_manipulator()
{
Glib::RefPtr<Glom::CanvasLineMovable> line = Glom::CanvasLineMovable::create();
+#ifdef GLIBMM_PROPERTIES_ENABLED
line->property_line_width() = manipulator_stroke_width;
line->property_stroke_color() = manipulator_stroke_color;
-
+#else
+ line->set_property("line-width", manipulator_stroke_width);
+ line->set_property("stroke-color", manipulator_stroke_color);
+#endif
return line;
}
@@ -718,7 +789,11 @@ void CanvasGroupResizable::set_edge_points(const Glib::RefPtr<Glom::CanvasLineMo
{
double points_coordinates[] = {x1, y1, x2, y2};
Goocanvas::Points points(2, points_coordinates);
+#ifdef GLIBMM_PROPERTIES_ENABLED
line->property_points() = points;
+#else
+ line->set_property("points", points);
+#endif
}
void CanvasGroupResizable::get_xy(double& x, double& y) const
diff --git a/glom/utility_widgets/canvas/canvas_image_movable.cc b/glom/utility_widgets/canvas/canvas_image_movable.cc
index 8b78c41..a7c5883 100644
--- a/glom/utility_widgets/canvas/canvas_image_movable.cc
+++ b/glom/utility_widgets/canvas/canvas_image_movable.cc
@@ -70,14 +70,24 @@ Glib::RefPtr<CanvasImageMovable> CanvasImageMovable::create(double x, double y)
void CanvasImageMovable::get_xy(double& x, double& y) const
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
x = property_x();
y = property_y();
+#else
+ get_property("x", x);
+ get_property("y", y);
+#endif
}
void CanvasImageMovable::set_xy(double x, double y)
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_x() = x;
property_y() = y;
+#else
+ set_property("x", x);
+ set_property("y", y);
+#endif
}
void CanvasImageMovable::get_width_height(double& width, double& height) const
@@ -85,14 +95,24 @@ void CanvasImageMovable::get_width_height(double& width, double& height) const
//TODO: This only works when it is on a canvas already,
//and this is apparently incorrect when the "coordinate space" of the item changes, whatever that means. murrayc.
+#ifdef GLIBMM_PROPERTIES_ENABLED
width = property_width();
height = property_height();
+#else
+ get_property("width", width);
+ get_property("height", height);
+#endif
}
void CanvasImageMovable::set_width_height(double width, double height)
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_width() = width;
property_height() = height;
+#else
+ set_property("width", width);
+ set_property("height", height);
+#endif
}
void CanvasImageMovable::snap_position(double& x, double& y) const
@@ -111,7 +131,11 @@ void CanvasImageMovable::snap_position(double& x, double& y) const
corner_y_offset = 0;
break;
case CORNER_TOP_RIGHT:
+#ifdef GLIBMM_PROPERTIES_ENABLED
corner_x_offset = property_width();
+#else
+ get_property("width", corner_x_offset);
+#endif
corner_y_offset = 0;
break;
case CORNER_BOTTOM_LEFT:
@@ -154,7 +178,11 @@ void CanvasImageMovable::set_snap_corner(Corners corner)
void CanvasImageMovable::set_image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, bool scale)
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_pixbuf() = pixbuf;
+#else
+ set_property("pixbuf", pixbuf);
+#endif
m_pixbuf = pixbuf;
if(scale)
@@ -176,7 +204,11 @@ void CanvasImageMovable::scale_to_size()
if(width && height)
{
Glib::RefPtr<Gdk::Pixbuf> pixbuf = ImageGlom::scale_keeping_ratio(m_pixbuf, (int)height, (int)width);
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_pixbuf() = pixbuf;
+#else
+ set_property("pixbuf", pixbuf);
+#endif
}
//Make sure that the size stays the same even if the scaling wasn't exact:
@@ -196,8 +228,11 @@ void CanvasImageMovable::set_image_empty()
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
if(widget)
pixbuf = widget->render_icon(Gtk::Stock::MISSING_IMAGE, Gtk::ICON_SIZE_DIALOG);
-
- property_pixbuf() = pixbuf;
+#ifdef GLIBMM_PROPERTIES_ENABLED
+ property_pixbuf() = pixbuf;
+#else
+ set_property("pixbuf", pixbuf);
+#endif
}
bool CanvasImageMovable::get_image_empty() const
diff --git a/glom/utility_widgets/canvas/canvas_line_movable.cc b/glom/utility_widgets/canvas/canvas_line_movable.cc
index 4add442..eac00cd 100644
--- a/glom/utility_widgets/canvas/canvas_line_movable.cc
+++ b/glom/utility_widgets/canvas/canvas_line_movable.cc
@@ -50,28 +50,48 @@ Glib::RefPtr<CanvasLineMovable> CanvasLineMovable::create()
void CanvasLineMovable::get_xy(double& x, double& y) const
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
x = property_x();
y = property_y();
+#else
+ get_property("x", x);
+ get_property("y", y);
+#endif
}
void CanvasLineMovable::set_xy(double x, double y)
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_x() = x;
property_y() = y;
+#else
+ set_property("x", x);
+ set_property("y", y);
+#endif
}
void CanvasLineMovable::get_width_height(double& width, double& height) const
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
width = property_width();
height = property_height();
+#else
+ get_property("width", width);
+ get_property("height", height);
+#endif
//std::cout << "CanvasLineMovable::get_width_height(): width=" << width << std::endl;
}
void CanvasLineMovable::set_width_height(double width, double height)
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_width() = width;
property_height() = height;
+#else
+ set_property("width", width);
+ set_property("height", height);
+#endif
//std::cout << "CanvasLineMovable::set_width_height(): end x=" << x1+width << std::endl;
}
diff --git a/glom/utility_widgets/canvas/canvas_rect_movable.cc b/glom/utility_widgets/canvas/canvas_rect_movable.cc
index bf1c665..a0afc54 100644
--- a/glom/utility_widgets/canvas/canvas_rect_movable.cc
+++ b/glom/utility_widgets/canvas/canvas_rect_movable.cc
@@ -68,26 +68,46 @@ Glib::RefPtr<CanvasRectMovable> CanvasRectMovable::create(double x, double y, do
void CanvasRectMovable::get_xy(double& x, double& y) const
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
x = property_x();
y = property_y();
+#else
+ get_property("x", x);
+ get_property("y", y);
+#endif
}
void CanvasRectMovable::set_xy(double x, double y)
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_x() = x;
property_y() = y;
+#else
+ set_property("x", x);
+ set_property("y", y);
+#endif
}
void CanvasRectMovable::get_width_height(double& width, double& height) const
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
width = property_width();
height = property_height();
+#else
+ get_property("width", width);
+ get_property("height", height);
+#endif
}
void CanvasRectMovable::set_width_height(double width, double height)
{
- property_height() = height;
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_width() = width;
+ property_height() = height;
+#else
+ set_property("width", width);
+ set_property("height", height);
+#endif
}
void CanvasRectMovable::snap_position_one_corner(Corners corner, double& x, double& y) const
@@ -102,16 +122,32 @@ void CanvasRectMovable::snap_position_one_corner(Corners corner, double& x, doub
corner_y_offset = 0;
break;
case CORNER_TOP_RIGHT:
+#ifdef GLIBMM_PROPERTIES_ENABLED
corner_x_offset = property_width();
+#else
+ get_property("width", corner_x_offset);
+#endif
corner_y_offset = 0;
break;
case CORNER_BOTTOM_LEFT:
corner_x_offset = 0;
+#ifdef GLIBMM_PROPERTIES_ENABLED
corner_y_offset = property_height();
+#else
+ get_property("height", corner_y_offset);
+#endif
break;
case CORNER_BOTTOM_RIGHT:
+#ifdef GLIBMM_PROPERTIES_ENABLED
corner_x_offset = property_width();
+#else
+ get_property("width", corner_x_offset);
+#endif
+#ifdef GLIBMM_PROPERTIES_ENABLED
corner_y_offset = property_height();
+#else
+ get_property("height", corner_y_offset);
+#endif
break;
default:
break;
diff --git a/glom/utility_widgets/canvas/canvas_table_movable.cc b/glom/utility_widgets/canvas/canvas_table_movable.cc
index 0943e75..7ab61dc 100644
--- a/glom/utility_widgets/canvas/canvas_table_movable.cc
+++ b/glom/utility_widgets/canvas/canvas_table_movable.cc
@@ -48,20 +48,35 @@ Glib::RefPtr<CanvasTableMovable> CanvasTableMovable::create()
void CanvasTableMovable::get_xy(double& x, double& y) const
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
x = property_x();
y = property_y();
+#else
+ get_property("x", x);
+ get_property("y", y);
+#endif
}
void CanvasTableMovable::set_xy(double x, double y)
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_x() = x;
property_y() = y;
+#else
+ set_property("x", x);
+ set_property("y", y);
+#endif
}
void CanvasTableMovable::get_width_height(double& width, double& height) const
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
width = property_width();
height = property_height();
+#else
+ get_property("width", width);
+ get_property("height", height);
+#endif
if(width == -1) //Means "default width" - presumably the width demanded by the children. But we don't use that.
width = 0;
@@ -76,9 +91,13 @@ void CanvasTableMovable::set_width_height(double width, double height)
{
std::cout << "CanvasTableMovable::set_width_height(): width is -1" << std::endl;
}
-
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_width() = width;
property_height() = height;
+#else
+ set_property("width", width);
+ set_property("height", height);
+#endif
}
void CanvasTableMovable::set_grid(const Glib::RefPtr<const CanvasGroupGrid>& grid)
diff --git a/glom/utility_widgets/canvas/canvas_text_movable.cc b/glom/utility_widgets/canvas/canvas_text_movable.cc
index abb098f..f8a9ad7 100644
--- a/glom/utility_widgets/canvas/canvas_text_movable.cc
+++ b/glom/utility_widgets/canvas/canvas_text_movable.cc
@@ -55,14 +55,24 @@ Glib::RefPtr<CanvasTextMovable> CanvasTextMovable::create(const Glib::ustring& s
void CanvasTextMovable::get_xy(double& x, double& y) const
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
x = property_x();
y = property_y();
+#else
+ get_property("x", x);
+ get_property("y", y);
+#endif
}
void CanvasTextMovable::set_xy(double x, double y)
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_x() = x;
property_y() = y;
+#else
+ set_property("x", x);
+ set_property("y", y);
+#endif
}
void CanvasTextMovable::get_width_height(double& width, double& height) const
@@ -70,14 +80,24 @@ void CanvasTextMovable::get_width_height(double& width, double& height) const
//TODO: This only works when it is on a canvas already,
//and this is apparently incorrect when the "coordinate space" of the item changes, whatever that means. murrayc.
+#ifdef GLIBMM_PROPERTIES_ENABLED
width = property_width();
height = property_height();
+#else
+ get_property("width", width);
+ get_property("height", height);
+#endif
}
void CanvasTextMovable::set_width_height(double width, double height)
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_width() = width;
property_height() = height;
+#else
+ set_property("width", width);
+ set_property("height", height);
+#endif
}
void CanvasTextMovable::snap_position(double& x, double& y) const
@@ -96,7 +116,11 @@ void CanvasTextMovable::snap_position(double& x, double& y) const
corner_y_offset = 0;
break;
case CORNER_TOP_RIGHT:
+#ifdef GLIBMM_PROPERTIES_ENABLED
corner_x_offset = property_width();
+#else
+ get_property("width", corner_x_offset);
+#endif
corner_y_offset = 0;
break;
case CORNER_BOTTOM_LEFT:
@@ -169,7 +193,11 @@ void CanvasTextMovable::reconstruct_markup()
{
if(m_font.empty())
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_text() = m_text;
+#else
+ set_property("text", m_text);
+#endif
return;
}
@@ -184,18 +212,29 @@ void CanvasTextMovable::reconstruct_markup()
markup = g_strdup_printf("<span font_desc=\"%s\">%s</span>", m_font.c_str(), m_text.c_str());
//std::cout << "DEBUG: markup=" << markup << std::endl;
}
-
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_use_markup() = true;
+#else
+ set_property("markup", true);
+#endif
if(markup)
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_text() = Glib::ustring(markup); //TODO: Inefficient.
+#else
+ set_property("text", Glib::ustring(markup));
+#endif
g_free(markup);
}
else
{
+#ifdef GLIBMM_PROPERTIES_ENABLED
property_text() = Glib::ustring();
+#else
+ set_property("text", Glib::ustring());
+#endif
}
}
diff --git a/glom/utility_widgets/datawidget.cc b/glom/utility_widgets/datawidget.cc
index a450cc8..2ba8e96 100644
--- a/glom/utility_widgets/datawidget.cc
+++ b/glom/utility_widgets/datawidget.cc
@@ -619,13 +619,7 @@ sharedptr<LayoutItem_Field> DataWidget::offer_field_list(const Glib::ustring& ta
return result;
}
#else
- std::auto_ptr<Gtk::BuilderError> error;
- refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "dialog_choose_field", "", error);
- if(error.get())
- {
- std::cerr << error->what() << std::endl;
- return result;
- }
+ refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "dialog_choose_field");
#endif
Dialog_ChooseField* dialog = 0;
@@ -801,13 +795,7 @@ void DataWidget::on_button_choose_date()
return;
}
#else
- std::auto_ptr<Gtk::BuilderError> error;
- refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "dialog_choose_date", "", error);
- if(error.get())
- {
- std::cerr << error->what() << std::endl;
- return;
- }
+ refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "dialog_choose_date");
#endif
Dialog_ChooseDate* dialog = 0;
@@ -858,13 +846,7 @@ bool DataWidget::offer_related_record_id_find(Gnome::Gda::Value& chosen_id)
return result;
}
#else
- std::auto_ptr<Glib::Error> error;
- refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), "dialog_find_id", "", error);
- if(error.get())
- {
- std::cerr << error->what() << std::endl;
- return result;
- }
+ refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom.glade"), "dialog_find_id");
#endif
Dialog_ChooseID* dialog = 0;
diff --git a/glom/utility_widgets/db_adddel/db_adddel.cc b/glom/utility_widgets/db_adddel/db_adddel.cc
index 6de206e..281c9e8 100644
--- a/glom/utility_widgets/db_adddel/db_adddel.cc
+++ b/glom/utility_widgets/db_adddel/db_adddel.cc
@@ -93,7 +93,9 @@ DbAddDel::DbAddDel()
// Give the TreeView an accessible name, to access it in LDTP
// TODO: Maybe this should be a constructor parameter, so that multiple
// DbAddDels in a single Window can be addressed separately.
+#ifndef GLOM_ENABLE_MAEMO
m_TreeView.get_accessible()->set_name(_("Table Content"));
+#endif
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
m_ScrolledWindow.add(m_TreeView);
@@ -813,15 +815,27 @@ void DbAddDel::apply_formatting(Gtk::CellRenderer* renderer, const FieldFormatti
//Use the text formatting:
const Glib::ustring font_desc = formatting.get_text_format_font();
if(!font_desc.empty())
+#ifdef GLIBMM_PROPERTIES_ENABLED
text_renderer->property_font() = font_desc;
+#else
+ text_renderer->set_property("font", font_desc);
+#endif
const Glib::ustring fg = formatting.get_text_format_color_foreground();
if(!fg.empty())
+#ifdef GLIBMM_PROPERTIES_ENABLED
text_renderer->property_foreground() = fg;
-
+#else
+ text_renderer->set_property("foreground", fg);
+#endif
+
const Glib::ustring bg = formatting.get_text_format_color_background();
if(!bg.empty())
+#ifdef GLIBMM_PROPERTIES_ENABLED
text_renderer->property_background() = bg;
+#else
+ text_renderer->set_property("background", bg);
+#endif
}
void DbAddDel::construct_specified_columns()
@@ -2368,7 +2382,7 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
sharedptr<SharedConnection> sharedconnection = connect_to_server(get_application()); //Keep it alive while we need the data_model.
#else
std::auto_ptr<ExceptionConnection> error;
- sharedptr<SharedConnection> sharedconnection = connect_to_server(get_app_window(), error); //Keep it alive while we need the data_model.
+ sharedptr<SharedConnection> sharedconnection = connect_to_server(get_application(), error); //Keep it alive while we need the data_model.
// Ignore error - sharedconnection is checked for NULL instead:
#endif
if(sharedconnection)
diff --git a/glom/utility_widgets/db_adddel/glom_db_treemodel.cc b/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
index 8f04ced..cc40f01 100644
--- a/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
+++ b/glom/utility_widgets/db_adddel/glom_db_treemodel.cc
@@ -242,7 +242,12 @@ bool DbTreeModel::refresh_from_database(const FoundSet& found_set)
}
//Add at least an initial row:
- m_gda_datamodel->append_row(); //TODO: Handle adding.
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ m_gda_datamodel->append_row(); //TODO: Handle adding.
+#else
+ std::auto_ptr<Glib::Error> error;
+ m_gda_datamodel->append_row(error); //TODO: Handle adding.
+#endif
return true;
}
@@ -286,10 +291,10 @@ bool DbTreeModel::refresh_from_database(const FoundSet& found_set)
}
Glib::RefPtr<Gnome::Gda::SqlParser> parser = m_connection->get_gda_connection()->create_parser();
- Glib::RefPtr<Gnome::Gda::Statement> stmt = parser->parse_string(sql_query);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
+ Glib::RefPtr<Gnome::Gda::Statement> stmt = parser->parse_string(sql_query);
//Specify the STATEMENT_MODEL_CURSOR, so that libgda only gets the rows that we actually use.
m_gda_datamodel = m_connection->get_gda_connection()->statement_execute_select(stmt, Gnome::Gda::STATEMENT_MODEL_CURSOR_FORWARD);
@@ -329,7 +334,8 @@ bool DbTreeModel::refresh_from_database(const FoundSet& found_set)
}
#else
std::auto_ptr<Glib::Error> error;
- m_gda_datamodel = m_connection->get_gda_connection()->statement_execute_select(stmt, set, error);
+ Glib::RefPtr<Gnome::Gda::Statement> stmt = parser->parse_string(sql_query, error);
+ m_gda_datamodel = m_connection->get_gda_connection()->statement_execute_select(stmt, Gnome::Gda::STATEMENT_MODEL_CURSOR_FORWARD, error);
if(error.get())
{
m_gda_datamodel.reset(); //So that it is 0, so we can handle it below.
@@ -955,12 +961,13 @@ void DbTreeModel::get_record_counts(gulong& total, gulong& found) const
//TODO: Apparently, this is very slow:
const Glib::ustring sql_query = "SELECT count(*) FROM \"" + m_found_set.m_table_name + "\"";
Glib::RefPtr<Gnome::Gda::SqlParser> parser = m_connection->get_gda_connection()->create_parser();
- Glib::RefPtr<Gnome::Gda::Statement> stmt = parser->parse_string(sql_query);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ Glib::RefPtr<Gnome::Gda::Statement> stmt = parser->parse_string(sql_query);
Glib::RefPtr<Gnome::Gda::DataModel> datamodel = m_connection->get_gda_connection()->statement_execute_select(stmt);
#else
std::auto_ptr<Glib::Error> error;
- Glib::RefPtr<Gnome::Gda::DataModel> datamodel = m_connection->get_gda_connection()->statement_execute_select(stmt, error);
+ Glib::RefPtr<Gnome::Gda::Statement> stmt = parser->parse_string(sql_query, error);
+ Glib::RefPtr<Gnome::Gda::DataModel> datamodel = m_connection->get_gda_connection()->statement_execute_select(stmt, Gnome::Gda::STATEMENT_MODEL_RANDOM_ACCESS, error);
// Ignore error, datamodel presence is checked below
#endif //GLIBMM_EXCEPTIONS_ENABLED
@@ -968,7 +975,12 @@ void DbTreeModel::get_record_counts(gulong& total, gulong& found) const
{
if(datamodel->get_n_rows())
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
Gnome::Gda::Value value = datamodel->get_value_at(0, 0);
+#else
+ std::auto_ptr<Glib::Error> value_error;
+ Gnome::Gda::Value value = datamodel->get_value_at(0, 0, value_error);
+#endif
total = (gulong)value.get_int64(); //I discovered that it's a int64 by trying it.
}
}
diff --git a/glom/utility_widgets/dialog_image_progress.cc b/glom/utility_widgets/dialog_image_progress.cc
index 095d3b7..c5f3bc0 100644
--- a/glom/utility_widgets/dialog_image_progress.cc
+++ b/glom/utility_widgets/dialog_image_progress.cc
@@ -39,8 +39,10 @@ Dialog_Image_Progress::Dialog_Image_Progress(BaseObjectType* cobject, const Glib
{
builder->get_widget("image_loading_progress_bar", m_progress_bar);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(!m_progress_bar)
throw std::runtime_error("Missing widgets from glade file for Dialog_Image_Progress");
+#endif
}
Dialog_Image_Progress::~Dialog_Image_Progress()
@@ -49,6 +51,7 @@ Dialog_Image_Progress::~Dialog_Image_Progress()
g_free(m_data->data);
if(m_loader)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
m_loader->close();
@@ -59,6 +62,10 @@ Dialog_Image_Progress::~Dialog_Image_Progress()
// not yet been loaded completely, for example when cancelling the
// dialog.
}
+#else
+ std::auto_ptr<Glib::Error> error;
+ m_loader->close(error);
+#endif
}
// TODO: Cancel outstanding async operations in destructor?
@@ -77,6 +84,7 @@ void Dialog_Image_Progress::load(const Glib::ustring& uri)
m_file = Gio::File::create_for_uri(uri);
m_progress_bar->set_text(Glib::ustring::compose("Loading %1...", m_file->get_parse_name()));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
// Open the file for reading:
@@ -86,10 +94,14 @@ void Dialog_Image_Progress::load(const Glib::ustring& uri)
{
error(ex.what());
}
+#else
+ m_file->read_async(sigc::mem_fun(*this, &Dialog_Image_Progress::on_file_read));
+#endif
}
void Dialog_Image_Progress::on_file_read(const Glib::RefPtr<Gio::AsyncResult>& result)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
m_stream = m_file->read_finish(result);
@@ -100,10 +112,19 @@ void Dialog_Image_Progress::on_file_read(const Glib::RefPtr<Gio::AsyncResult>& r
{
error(ex.what());
}
+#else
+ std::auto_ptr<Glib::Error> ex;
+ m_stream = m_file->read_finish(result, ex);
+ // Query size of the file, so that we can show progress:
+ m_stream->query_info_async(sigc::mem_fun(*this, &Dialog_Image_Progress::on_query_info), G_FILE_ATTRIBUTE_STANDARD_SIZE);
+ if (ex.get())
+ error(ex->what());
+#endif
}
void Dialog_Image_Progress::on_query_info(const Glib::RefPtr<Gio::AsyncResult>& result)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
Glib::RefPtr<Gio::FileInfo> info = m_stream->query_info_finish(result);
@@ -120,10 +141,27 @@ void Dialog_Image_Progress::on_query_info(const Glib::RefPtr<Gio::AsyncResult>&
{
error(ex.what());
}
+#else
+ std::auto_ptr<Glib::Error> ex;
+ Glib::RefPtr<Gio::FileInfo> info = m_stream->query_info_finish(result, ex);
+ if (ex.get())
+ {
+ error(ex->what());
+ return;
+ }
+ m_data->binary_length = info->get_size();
+ // We need to use the glib allocater here:
+ m_data->data = static_cast<guchar*>(g_try_malloc(m_data->binary_length));
+ if(!m_data->data)
+ error(_("Not enough memory available to load the image"));
+ // Read the first chunk from the file
+ m_stream->read_async(m_data->data, std::min<gsize>(CHUNK_SIZE, m_data->binary_length), sigc::bind(sigc::mem_fun(*this, &Dialog_Image_Progress::on_stream_read), 0));
+#endif
}
void Dialog_Image_Progress::on_stream_read(const Glib::RefPtr<Gio::AsyncResult>& result, unsigned int offset)
{
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
gssize size = m_stream->read_finish(result);
@@ -148,6 +186,35 @@ void Dialog_Image_Progress::on_stream_read(const Glib::RefPtr<Gio::AsyncResult>&
{
error(ex.what());
}
+#else
+ std::auto_ptr<Glib::Error> ex;
+ gssize size = m_stream->read_finish(result, ex);
+ if (ex.get())
+ {
+ error(ex->what());
+ return;
+ }
+ g_assert(size >= 0); // Would have thrown an exception otherwise
+ // Cannot read more data than there is available in the file:
+ g_assert( static_cast<gssize>(offset + size) <= static_cast<gssize>(m_data->binary_length));
+ // Load image
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ m_loader->write(m_data->data + offset, size);
+#else
+ m_loader->write(m_data->data + offset, size, ex);
+#endif
+ // Set progress
+ m_progress_bar->set_fraction(static_cast<double>(offset + size) / m_data->binary_length);
+ // Read next chunk, if any
+ if( static_cast<gssize>(offset + size) < static_cast<gssize>(m_data->binary_length))
+ // Even if choose a priority lower than GDK_PRIORITY_REDRAW + 10 for the
+ // read_async we don't see the progressbar progressing while the image
+ // is loading. Therefore we put an idle inbetween.
+ Glib::signal_idle().connect(sigc::bind_return(sigc::bind(sigc::mem_fun(*this, &Dialog_Image_Progress::on_read_next), offset + size), false));
+ else
+ // We are done loading the image, close the progress dialog
+ response(Gtk::RESPONSE_ACCEPT);
+#endif
}
void Dialog_Image_Progress::on_read_next(unsigned int at)
diff --git a/glom/utility_widgets/entryglom.cc b/glom/utility_widgets/entryglom.cc
index 9db3eec..cd91253 100644
--- a/glom/utility_widgets/entryglom.cc
+++ b/glom/utility_widgets/entryglom.cc
@@ -74,7 +74,9 @@ void EntryGlom::init()
void EntryGlom::set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib::ustring& table_name)
{
LayoutWidgetField::set_layout_item(layout_item, table_name);
+#ifndef GLOM_ENABLE_MAEMO
get_accessible()->set_name(layout_item->get_name());
+#endif
}
void EntryGlom::set_glom_type(Field::glom_field_type glom_type)
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index 2880413..f592592 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -31,6 +31,9 @@ namespace Glom
{
#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
+
+GtkContainerClass* parent_class = NULL;
+
// TODO: It is probably OK doing static_cast here.
void FlowTable::glom_size_request_impl(GtkWidget* widget, GtkRequisition* requisition)
{
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index 95e6df9..20c17b3 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -80,7 +80,9 @@ ImageGlom::~ImageGlom()
void ImageGlom::set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib::ustring& table_name)
{
LayoutWidgetField::set_layout_item(layout_item, table_name);
+#ifndef GLOM_ENABLE_MAEMO
get_accessible()->set_name(layout_item->get_name());
+#endif
}
bool ImageGlom::on_button_press_event(GdkEventButton *event)
diff --git a/glom/utility_widgets/placeholder-glom.cc b/glom/utility_widgets/placeholder-glom.cc
index 32579fa..3d0656d 100644
--- a/glom/utility_widgets/placeholder-glom.cc
+++ b/glom/utility_widgets/placeholder-glom.cc
@@ -37,6 +37,13 @@ PlaceholderGlom::PlaceholderGlom() :
Gtk::Widget()
{
set_flags(Gtk::NO_WINDOW);
+#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
+ signal_realize().connect(sigc::mem_fun(*this, &PlaceholderGlom::on_realize));
+ signal_unrealize().connect(sigc::mem_fun(*this, &PlaceholderGlom::on_unrealize));
+ signal_expose_event().connect(sigc::mem_fun(*this, &PlaceholderGlom::on_expose_event));
+ signal_size_request().connect(sigc::mem_fun(*this, &PlaceholderGlom::on_size_request));
+ signal_size_allocate().connect(sigc::mem_fun(*this, &PlaceholderGlom::on_size_allocate));
+#endif
}
PlaceholderGlom::~PlaceholderGlom()
@@ -73,20 +80,12 @@ void PlaceholderGlom::on_size_allocate(Gtk::Allocation& allocation)
}
}
-void PlaceholderGlom::on_map()
-{
- Gtk::Widget::on_map();
-}
-
-void PlaceholderGlom::on_unmap()
-{
- Gtk::Widget::on_unmap();
-}
-
void PlaceholderGlom::on_realize()
{
//Call base class:
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
Gtk::Widget::on_realize();
+#endif
ensure_style();
@@ -126,8 +125,9 @@ void PlaceholderGlom::on_realize()
void PlaceholderGlom::on_unrealize()
{
m_refGdkWindow.reset();
-
+#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
Gtk::Widget::on_unrealize();
+#endif
}
bool PlaceholderGlom::on_expose_event(GdkEventExpose* event)
diff --git a/glom/utility_widgets/placeholder-glom.h b/glom/utility_widgets/placeholder-glom.h
index 0fe771a..db7362c 100644
--- a/glom/utility_widgets/placeholder-glom.h
+++ b/glom/utility_widgets/placeholder-glom.h
@@ -47,8 +47,6 @@ private:
virtual void on_size_request(Gtk::Requisition* requisition);
virtual void on_size_allocate(Gtk::Allocation& allocation);
- virtual void on_map();
- virtual void on_unmap();
virtual void on_realize();
virtual void on_unrealize();
virtual bool on_expose_event(GdkEventExpose* event);
diff --git a/glom/utils_ui.cc b/glom/utils_ui.cc
index 00e03af..b470100 100644
--- a/glom/utils_ui.cc
+++ b/glom/utils_ui.cc
@@ -163,6 +163,7 @@ void Utils::show_help(const Glib::ustring& id)
void Utils::show_ok_dialog(const Glib::ustring& title, const Glib::ustring& message, Gtk::Window* parent, Gtk::MessageType message_type)
{
+#undef GLOM_ENABLE_MAEMO
#ifdef GLOM_ENABLE_MAEMO
// TODO_maemo: Map message_type to a senseful stock_id?
Hildon::Note dialog(Hildon::NOTE_TYPE_INFORMATION, parent, message);
@@ -258,7 +259,7 @@ Glib::RefPtr<Gdk::Pixbuf> Utils::get_pixbuf_for_gda_value(const Gnome::Gda::Valu
// std::cout << " name=" << iter->get_name() << ", writable=" << iter->is_writable() << std::endl;
//}
- Glib::RefPtr<Gdk::PixbufLoader> refPixbufLoader;
+ Glib::RefPtr<Gdk::PixbufLoader> refPixbufLoader;
try
{
refPixbufLoader = Gdk::PixbufLoader::create();
@@ -266,7 +267,9 @@ Glib::RefPtr<Gdk::Pixbuf> Utils::get_pixbuf_for_gda_value(const Gnome::Gda::Valu
catch(const Gdk::PixbufError& ex)
{
refPixbufLoader.reset();
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
std::cerr << "PixbufLoader::create failed: " << ex.what() << std::endl;
+#endif
}
if(refPixbufLoader)
diff --git a/glom/xsl_utils.cc b/glom/xsl_utils.cc
index c577349..dca6fec 100644
--- a/glom/xsl_utils.cc
+++ b/glom/xsl_utils.cc
@@ -98,11 +98,17 @@ void GlomXslUtils::transform_and_open(const xmlpp::Document& xml_document, const
catch(const Gio::Error& ex)
{
#else
- std::auto_ptr<Gio::Error> error;
- stream.create(error);
+ std::auto_ptr<Glib::Error> error;
+ if (file->query_exists())
+ {
+ stream = file->replace("" /* etag */, false /*make_backup*/, Gio::FILE_CREATE_NONE, error);
+ }
+ else
+ {
+ stream = file->create_file(Gio::FILE_CREATE_NONE, error);
+ }
if(error.get() != NULL)
{
- const Gio::Error& ex = *error.get();
#endif
// If the operation was not successful, print the error and abort
return; // false; // print_error(ex, output_uri_string);
@@ -122,7 +128,6 @@ void GlomXslUtils::transform_and_open(const xmlpp::Document& xml_document, const
bytes_written = stream->write(result.data(), result_bytes, error);
if(error.get() != NULL)
{
- Gio::Error& ex = *error.get();
#endif
// If the operation was not successful, print the error and abort
return; // false; //print_error(ex, output_uri_string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]