Commit 454850cb authored by Murray Cumming's avatar Murray Cumming
Browse files

Remove ifdefs for the gtkmm reduced-api build.

parent 7f6b199d
......@@ -846,7 +846,6 @@ static bool uri_is_writable(const Glib::RefPtr<const Gio::File>& uri)
Glib::RefPtr<const Gio::FileInfo> file_info;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
file_info = uri->query_info(G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);
......@@ -855,12 +854,6 @@ static bool uri_is_writable(const Glib::RefPtr<const Gio::File>& uri)
{
return false;
}
#else
std::auto_ptr<Gio::Error> error;
file_info = uri->query_info(G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, Gio::FILE_QUERY_INFO_NONE, error);
if(error.get())
return false;
#endif
if(file_info)
{
......@@ -1739,26 +1732,12 @@ void Application::fill_menu_tables()
"</ui>";
//Add menus:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
#else
std::auto_ptr<Glib::Error> error;
#endif // GLIBMM_EXCEPTIONS_ENABLED
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
m_menu_tables_ui_merge_id = m_refUIManager->add_ui_from_string(ui_description);
#else
m_menu_tables_ui_merge_id = m_refUIManager->add_ui_from_string(ui_description, error);
#endif // GLIBMM_EXCEPTIONS_ENABLED
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
catch(const Glib::Error& ex)
{
#else
if(error.get())
{
const Glib::Error& ex = *error.get();
#endif // GLIBMM_EXCEPTIONS_ENABLED
std::cerr << " Application::fill_menu_tables(): building menus failed: " << ex.what() << std::endl;
std::cerr << " The ui_description was: " << ui_description << std::endl;
}
......@@ -1838,26 +1817,12 @@ void Application::fill_menu_reports(const Glib::ustring& table_name)
"</ui>";
//Add menus:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
#else
std::auto_ptr<Glib::Error> error;
#endif // GLIBMM_EXCEPTIONS_ENABLED
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
m_menu_reports_ui_merge_id = m_refUIManager->add_ui_from_string(ui_description);
#else
m_menu_reports_ui_merge_id = m_refUIManager->add_ui_from_string(ui_description, error);
#endif // GLIBMM_EXCEPTIONS_ENABLED
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
catch(const Glib::Error& ex)
{
#else
if(error.get())
{
const Glib::Error& ex = *error.get();
#endif // GLIBMM_EXCEPTIONS_ENABLED
std::cerr << " Application::fill_menu_reports(): building menus failed: " << ex.what();
}
}
......@@ -1950,26 +1915,12 @@ void Application::fill_menu_print_layouts(const Glib::ustring& table_name)
"</ui>";
//Add menus:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
#else
std::auto_ptr<Glib::Error> error;
#endif // GLIBMM_EXCEPTIONS_ENABLED
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
m_menu_print_layouts_ui_merge_id = m_refUIManager->add_ui_from_string(ui_description);
#else
m_menu_print_layouts_ui_merge_id = m_refUIManager->add_ui_from_string(ui_description, error);
#endif // GLIBMM_EXCEPTIONS_ENABLED
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
catch(const Glib::Error& ex)
{
#else
if(error.get())
{
const Glib::Error& ex = *error.get();
#endif // GLIBMM_EXCEPTIONS_ENABLED
std::cerr << " Application::fill_menu_reports(): building menus failed: " << ex.what();
}
}
......
......@@ -200,7 +200,6 @@ bool App_WithDoc::file_exists(const Glib::ustring& uri)
// Try to examine the input file.
Glib::RefPtr<Gio::File> file = Gio::File::create_for_uri(uri);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
return file->query_exists();
......@@ -209,9 +208,6 @@ bool App_WithDoc::file_exists(const Glib::ustring& uri)
{
return false; //Something went wrong. It does not exist.
}
#else
return file->query_exists();
#endif
}
}
......
......@@ -50,11 +50,6 @@ App_WithDoc_Gtk::App_WithDoc_Gtk(const Glib::ustring& appname)
m_pAbout(0)
{
init_app_name(appname);
#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
signal_hide().connect(sigc::mem_fun(*this, &App_WithDoc_Gtk::on_hide));
signal_delete_event().connect(sigc::mem_fun(*this, &App_WithDoc_Gtk::on_delete_event));
#endif
}
/// This constructor can be used with Gtk::Builder::get_derived_widget().
......@@ -70,11 +65,6 @@ App_WithDoc_Gtk::App_WithDoc_Gtk(BaseObjectType* cobject, const Glib::ustring& a
//The .glade file needs to specify HildonWindow or features such as HildonAppMenu won't work.
g_assert(HILDON_IS_WINDOW(gobj()));
#endif //GLOM_ENABLE_MAEMO
#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
signal_hide().connect(sigc::mem_fun(*this, &App_WithDoc_Gtk::on_hide));
signal_delete_event().connect(sigc::mem_fun(*this, &App_WithDoc_Gtk::on_delete_event));
#endif
}
......@@ -146,7 +136,6 @@ void App_WithDoc_Gtk::init_layout()
void App_WithDoc_Gtk::add_ui_from_string(const Glib::ustring& ui_description)
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
m_refUIManager->add_ui_from_string(ui_description);
......@@ -155,11 +144,6 @@ void App_WithDoc_Gtk::add_ui_from_string(const Glib::ustring& ui_description)
{
std::cerr << "building menus failed: " << ex.what();
}
#else
std::auto_ptr<Glib::Error> error;
m_refUIManager->add_ui_from_string(ui_description, error);
if(error.get()) std::cerr << "building menus failed: " << error->what();
#endif
}
void App_WithDoc_Gtk::init()
......@@ -554,7 +538,6 @@ static bool uri_is_writable(const Glib::RefPtr<const Gio::File>& uri)
Glib::RefPtr<const Gio::FileInfo> file_info;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
file_info = uri->query_info(G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);
......@@ -563,12 +546,6 @@ static bool uri_is_writable(const Glib::RefPtr<const Gio::File>& uri)
{
return false;
}
#else
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;
#endif
if(file_info)
{
......@@ -721,13 +698,7 @@ void App_WithDoc_Gtk::document_history_add(const Glib::ustring& file_uri)
//Glib::ustring filename_e = Gnome::Vfs::escape_path_string(file_uri);
const Glib::ustring uri = file_uri; // "file://" + filename_e;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Gtk::RecentManager::get_default()->add_item(uri);
#else
std::auto_ptr<Glib::Error> error;
Gtk::RecentManager::get_default()->add_item(uri, error);
// Ignore error
#endif
}
}
......@@ -738,13 +709,7 @@ void App_WithDoc_Gtk::document_history_remove(const Glib::ustring& file_uri)
//Glib::ustring filename_e = Gnome::Vfs::escape_path_string(file_uri.c_str());
const Glib::ustring uri = file_uri; //"file://" + filename_e;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Gtk::RecentManager::get_default()->remove_item(uri);
#else
std::auto_ptr<Glib::Error> error;
Gtk::RecentManager::get_default()->remove_item(uri, error);
// Ignore error
#endif
}
}
......
......@@ -118,19 +118,11 @@ bool Base_DB::fill_from_database()
}
//static:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
sharedptr<SharedConnection> Base_DB::connect_to_server(Gtk::Window* parent_window)
#else
sharedptr<SharedConnection> Base_DB::connect_to_server(Gtk::Window* parent_window, std::auto_ptr<ExceptionConnection>& error)
#endif
{
BusyCursor busy_cursor(parent_window);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
return ConnectionPool::get_and_connect();
#else
return ConnectionPool::get_and_connect(error);
#endif
}
void Base_DB::handle_error(const Glib::Exception& ex)
......@@ -154,6 +146,7 @@ void Base_DB::handle_error(const std::exception& ex)
dialog.set_secondary_text(ex.what());
//TODO: dialog.set_transient_for(*get_application());
#endif
dialog.run();
}
......@@ -347,20 +340,12 @@ sharedptr<Field> Base_DB::change_column(const Glib::ustring& table_name, const s
ConnectionPool* connection_pool = ConnectionPool::get_instance();
sharedptr<Field> result = check_field_change_constraints(field_old, field);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
connection_pool->change_column(table_name, field_old, result);
}
catch(const Glib::Error& ex)
{
#else
std::auto_ptr<Glib::Error> error;
connection_pool->change_column(table_name, field_old, result, error);
if(error.get())
{
const Glib::Error& ex = *error;
#endif
handle_error(ex);
// Gtk::MessageDialog window(*parent_window, Utils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
// window.run();
......@@ -383,20 +368,12 @@ bool Base_DB::change_columns(const Glib::ustring& table_name, const type_vec_con
ConnectionPool* connection_pool = ConnectionPool::get_instance();
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
connection_pool->change_columns(table_name, old_fields, pass_fields);
}
catch(const Glib::Error& ex)
{
#else
std::auto_ptr<Glib::Error> error;
connection_pool->change_columns(table_name, old_fields, pass_fields, error);
if(error.get())
{
const Glib::Error& ex = *error;
#endif
handle_error(ex);
// Gtk::MessageDialog window(*parent_window, Utils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
// window.run();
......@@ -410,7 +387,6 @@ bool Base_DB::change_columns(const Glib::ustring& table_name, const type_vec_con
Glib::RefPtr<Gnome::Gda::Connection> Base_DB::get_connection()
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
sharedptr<SharedConnection> sharedconnection;
try
{
......@@ -420,15 +396,6 @@ Glib::RefPtr<Gnome::Gda::Connection> Base_DB::get_connection()
{
std::cerr << "Base_DB::get_connection(): " << error.what() << std::endl;
}
#else
std::auto_ptr<ExceptionConnection> error;
sharedptr<SharedConnection> sharedconnection = connect_to_server(0, error);
if(error.get())
{
std::cerr << "Base_DB::get_connection(): " << error->what() << std::endl;
// TODO: Rethrow?
}
#endif
if(!sharedconnection)
{
......@@ -936,12 +903,7 @@ 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))
{
......@@ -1046,13 +1008,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
if(field)
{
//We need the connection when we run the script, so that the script may use it.
#ifdef GLIBMM_EXCEPTIONS_ENABLED
sharedptr<SharedConnection> sharedconnection = connect_to_server(0 /* parent window */);
#else
std::auto_ptr<ExceptionConnection> error;
sharedptr<SharedConnection> sharedconnection = connect_to_server(0 /* parent window */, error);
// TODO: Rethrow?
#endif
g_assert(sharedconnection);
......@@ -1120,7 +1076,6 @@ Base_DB::type_map_fields Base_DB::get_record_field_values_for_calculation(const
Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_key(table_name, fieldsToGet, primary_key, primary_key_value);
Glib::RefPtr<const Gnome::Gda::DataModel> data_model;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
data_model = DbUtils::query_execute_select(query);
......@@ -1131,16 +1086,6 @@ 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 DbUtils::query_execute_select() without exceptions
std::auto_ptr<Glib::Error> error;
data_model = DbUtils::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;
......@@ -1148,11 +1093,7 @@ 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())
......@@ -1231,9 +1172,7 @@ bool Base_DB::set_field_value_in_database(const LayoutFieldInRecord& layoutfield
builder->add_field_id(field_in_record.m_key->get_name(), field_in_record.m_table_name),
builder->add_expr_as_value(field_in_record.m_key_value)));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try //TODO: The exceptions are probably already handled by query_execute(
#endif
{
const bool test = DbUtils::query_execute(builder); //TODO: Respond to failure.
if(!test)
......@@ -1242,7 +1181,6 @@ bool Base_DB::set_field_value_in_database(const LayoutFieldInRecord& layoutfield
return false; //failed.
}
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
catch(const Glib::Exception& ex)
{
handle_error(ex);
......@@ -1253,7 +1191,6 @@ bool Base_DB::set_field_value_in_database(const LayoutFieldInRecord& layoutfield
handle_error(ex);
return false;
}
#endif
//Get-and-set values for lookup fields, if this field triggers those relationships:
do_lookups(layoutfield_in_record, row, field_value);
......@@ -1303,12 +1240,7 @@ 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
......@@ -1351,12 +1283,7 @@ 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
......@@ -1627,12 +1554,7 @@ 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
{
......@@ -1912,12 +1834,7 @@ int Base_DB::count_rows_returned_by(const Glib::RefPtr<Gnome::Gda::SqlBuilder>&
Glib::RefPtr<Gnome::Gda::DataModel> datamodel = DbUtils::query_execute_select(builder);
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)
......
......@@ -65,11 +65,7 @@ public:
virtual AppState::userlevels get_userlevel() const;
virtual void set_userlevel(AppState::userlevels value);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static sharedptr<SharedConnection> connect_to_server(Gtk::Window* parent_window = 0);
#else
static sharedptr<SharedConnection> connect_to_server(Gtk::Window* parent_window, std::auto_ptr<ExceptionConnection>& error);
#endif // GLIBMM_EXCEPTIONS_ENABLED
virtual void set_document(Document* pDocument); //View override
virtual void load_from_document(); //View override
......
......@@ -117,16 +117,8 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
const type_map_fields field_values = get_record_field_values_for_calculation(m_table_name, fieldPrimaryKey, primary_key_value);
//We need the connection when we run the script, so that the script may use it.
#ifdef GLIBMM_EXCEPTIONS_ENABLED
// TODO: Is this function supposed to throw an exception?
sharedptr<SharedConnection> sharedconnection = connect_to_server(Application::get_application());
#else
std::auto_ptr<ExceptionConnection> error;
sharedptr<SharedConnection> sharedconnection = connect_to_server(Application::get_application(), error);
if(!error.get())
{
// Don't evaluate function on error
#endif // GLIBMM_EXCEPTIONS_ENABLED
Glib::ustring error_message; //TODO: Check this.
const Gnome::Gda::Value value =
......@@ -140,9 +132,6 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
sharedconnection->get_gda_connection(),
error_message);
set_entered_field_data(layout_item, value);
#ifndef GLIBMM_EXCEPTIONS_ENABLED
}
#endif // !GLIBMM_EXCEPTIONS_ENABLED
}
//Use default values (These are also specified in postgres as part of the field definition,
......@@ -533,12 +522,7 @@ 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;
......
......@@ -61,11 +61,7 @@ Dialog_Connection::~Dialog_Connection()
{
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
sharedptr<SharedConnection> Dialog_Connection::connect_to_server_with_connection_settings() const
#else
sharedptr<SharedConnection> Dialog_Connection::connect_to_server_with_connection_settings(std::auto_ptr<ExceptionConnection>& error) const
#endif
{
//std::cout << "debug: Dialog_Connection::connect_to_server_with_connection_settings()" << std::endl;
......@@ -101,11 +97,7 @@ sharedptr<SharedConnection> Dialog_Connection::connect_to_server_with_connection
connection_pool->set_password(m_entry_password->get_text());
#ifdef GLIBMM_EXCEPTIONS_ENABLED
result = Base_DB::connect_to_server(const_cast<Dialog_Connection*>(this));
#else
result = Base_DB::connect_to_server(const_cast<Dialog_Connection*>(this), error);
#endif
#ifdef GLOM_ENABLE_POSTGRESQL
//Remember the port,
......
......@@ -42,11 +42,7 @@ public:
Dialog_Connection(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
virtual ~Dialog_Connection();
#ifdef GLIBMM_EXCEPTIONS_ENABLED
sharedptr<SharedConnection> connect_to_server_with_connection_settings() const;
#else
sharedptr<SharedConnection> connect_to_server_with_connection_settings(std::auto_ptr<ExceptionConnection>& error) const;
#endif
///Disable irrelevant fields:
void set_connect_to_browsed();
......
......@@ -119,10 +119,9 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
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);
......@@ -404,9 +403,7 @@ 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
throw std::logic_error("Dialog_ExistingOrNew::get_uri: action is neither NEW_FROM_TEMPLATE nor OPEN_URI");
}
return Glib::ustring();
......@@ -419,11 +416,9 @@ EpcServiceInfo* Dialog_ExistingOrNew::get_service_info() const
Action action = get_action_impl(iter);
if(action == OPEN_REMOTE)
return (*iter)[m_existing_columns.m_col_service_info];
#ifdef GLIBMM_EXCEPTIONS_ENABLED
return (*iter)[m_existing_columns.m_col_service_info];
else
throw std::logic_error("Dialog_ExistingOrNew::get_service_info: action is not OPEN_REMOTE");
#endif
return 0;
}
......@@ -434,11 +429,9 @@ Glib::ustring Dialog_ExistingOrNew::get_service_name() const
Action action = get_action_impl(iter);
if(action == OPEN_REMOTE)
return (*iter)[m_existing_columns.m_col_service_name];
#ifdef GLIBMM_EXCEPTIONS_ENABLED
return (*iter)[m_existing_columns.m_col_service_name];
else
throw std::logic_error("Dialog_ExistingOrNew::get_service_name: action is not OPEN_REMOTE");
#endif
return Glib::ustring();
}
......@@ -464,33 +457,14 @@ void Dialog_ExistingOrNew::existing_icon_data_func(Gtk::CellRenderer* renderer,
{
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_ENABLED
pixbuf_renderer->property_stock_size() = Gtk::ICON_SIZE_BUTTON;
pixbuf_renderer->property_stock_id() = "";
pixbuf_renderer->property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>();
if(iter == m_iter_existing_recent)
pixbuf_renderer->property_stock_id() = Gtk::Stock::INDEX.id; // TODO: More meaningful icon?
#ifndef G_OS_WIN32
else if(iter == m_iter_existing_network)
pixbuf_renderer->property_stock_id() = Gtk::Stock::NETWORK.id;
#endif
else if(iter == m_iter_existing_other)
pixbuf_renderer->property_stock_id() = Gtk::Stock::OPEN.id;
else if(m_iter_existing_recent_dummy.get() && iter == *m_iter_existing_recent_dummy)
pixbuf_renderer->property_stock_id() = ""; // TODO: Use Stock::STOP instead?
#ifndef G_OS_WIN32
else if(m_iter_existing_network_dummy.get() && iter == *m_iter_existing_network_dummy)
pixbuf_renderer->property_stock_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());
......@@ -510,8 +484,6 @@ void Dialog_ExistingOrNew::existing_icon_data_func(Gtk::CellRenderer* renderer,
else if(m_iter_existing_network_dummy.get() && iter == *m_iter_existing_network_dummy)
pixbuf_renderer->set_property("stock-id", std::string()); // TODO: Use Stock::STOP instead?
#endif
#endif // Properties enabled
else
{
if(m_existing_model->is_ancestor(m_iter_existing_recent, iter))
......@@ -529,9 +501,7 @@ 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
throw std::logic_error("Unexpected iterator in existing_icon_data_func");
}
}
}
......@@ -540,13 +510,8 @@ void Dialog_ExistingOrNew::existing_title_data_func(Gtk::CellRenderer* renderer,
{