Commit c30f4c7c authored by Johannes Schmid's avatar Johannes Schmid
Browse files

Fix the UI part to build on maemo platform

parent 4dc3e67f
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
......
......@@ -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"])
......
......@@ -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);
......
......@@ -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
}
}
......
......@@ -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;
......
This diff is collapsed.
......@@ -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;
......
......@@ -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 */)
......
......@@ -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;
......
......@@ -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
......@@ -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);
......
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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;