Commit dd352eab authored by Murray Cumming's avatar Murray Cumming
Browse files

C++11: Use auto for Glib::RefPtr<>s.

parent 5b2e5671
......@@ -119,7 +119,7 @@ void Application::on_open(const Gio::Application::type_vec_files& files,
//std::cout << "debug: files.size()=" << files.size() << std::endl;
for(guint i = 0; i < files.size(); i++)
{
Glib::RefPtr<Gio::File> file = files[i];
auto file = files[i];
if(!file)
{
std::cerr << G_STRFUNC << ": file is null." << std::endl;
......
......@@ -111,9 +111,9 @@ AppWindow::AppWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>&
builder->get_widget_derived("infobar_progress", m_infobar_progress);
//Add menu bar at the top:
Glib::RefPtr<Glib::Object> object =
auto object =
builder->get_object("mainmenu");
Glib::RefPtr<Gio::Menu> gmenu =
auto gmenu =
Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
if(!gmenu)
g_warning("GMenu not found");
......@@ -291,7 +291,7 @@ void AppWindow::init_menus_file()
#ifndef GLOM_ENABLE_CLIENT_ONLY
Glib::RefPtr<Gio::SimpleAction> action_print_edit =
auto action_print_edit =
m_refActionGroup_File->add_action("edit-print-layouts",
sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_file_print_edit_layouts));
m_listDeveloperActions.push_back(action_print_edit);
......@@ -449,7 +449,7 @@ void AppWindow::on_menu_help_about()
{
m_pAbout->set_transient_for(*this);
Glib::RefPtr<Gdk::Window> about_win = m_pAbout->get_window();
auto about_win = m_pAbout->get_window();
about_win->show();
about_win->raise();
}
......@@ -477,7 +477,7 @@ void AppWindow::on_menu_help_about()
//TODO: Use this, instead of the C API, when we can depend on gtkmm 3.12, with a try/catch:
//Glib::RefPtr<Gdk::Pixbuf> logo = Gdk::Pixbuf::create_from_resource(glom_icon_path);
GError* gerror = nullptr;
Glib::RefPtr<Gdk::Pixbuf> logo =
auto logo =
Glib::wrap(gdk_pixbuf_new_from_resource(glom_icon_path.c_str(), &gerror));
if(gerror)
{
......@@ -1791,9 +1791,9 @@ void AppWindow::fill_menu_tables()
m_refNavTablesActionGroup = Gio::SimpleActionGroup::create();
Glib::RefPtr<Glib::Object> object =
auto object =
m_builder->get_object("tables-list");
Glib::RefPtr<Gio::Menu> menu =
auto menu =
Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
if(!menu)
{
......@@ -1823,7 +1823,7 @@ void AppWindow::fill_menu_tables()
menu->append(title, ACTION_GROUP_NAME_TABLES + "." + action_name);
Glib::RefPtr<Gio::SimpleAction> action = m_refNavTablesActionGroup->add_action(action_name,
auto action = m_refNavTablesActionGroup->add_action(action_name,
sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_box_tables_selected), table_info->get_name()) );
m_listNavTableActions.push_back(action);
}
......@@ -1837,9 +1837,9 @@ void AppWindow::fill_menu_reports(const Glib::ustring& table_name)
m_listNavReportActions.clear();
//Remove existing items.
Glib::RefPtr<Glib::Object> object =
auto object =
m_builder->get_object("reports-list");
Glib::RefPtr<Gio::Menu> menu =
auto menu =
Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
if(!menu)
{
......@@ -1881,7 +1881,7 @@ void AppWindow::fill_menu_reports(const Glib::ustring& table_name)
menu->append(title, ACTION_GROUP_NAME_REPORTS + "." + report_name);
Glib::RefPtr<Gio::SimpleAction> action = m_refNavReportsActionGroup->add_action(action_name,
auto action = m_refNavReportsActionGroup->add_action(action_name,
sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_report_selected), report->get_name()) );
m_listNavReportActions.push_back(action);
}
......@@ -1917,9 +1917,9 @@ void AppWindow::fill_menu_print_layouts(const Glib::ustring& table_name)
m_listNavPrintLayoutActions.clear();
//Remove existing items.
Glib::RefPtr<Glib::Object> object =
auto object =
m_builder->get_object("print-layouts-list");
Glib::RefPtr<Gio::Menu> menu =
auto menu =
Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
if(!menu)
{
......@@ -1964,7 +1964,7 @@ void AppWindow::fill_menu_print_layouts(const Glib::ustring& table_name)
menu->append(title, ACTION_GROUP_NAME_PRINT_LAYOUTS + "." + action_name);
Glib::RefPtr<Gio::SimpleAction> action = m_refNavPrintLayoutsActionGroup->add_action(action_name,
auto action = m_refNavPrintLayoutsActionGroup->add_action(action_name,
sigc::bind( sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_print_layout_selected), name) );
m_listNavPrintLayoutActions.push_back(action);
......@@ -2121,10 +2121,10 @@ Glib::ustring AppWindow::ui_file_select_save(const Glib::ustring& old_file_uri)
{
//Just start with the parent folder,
//instead of the whole name, to avoid overwriting:
Glib::RefPtr<Gio::File> gio_file = Gio::File::create_for_uri(old_file_uri);
auto gio_file = Gio::File::create_for_uri(old_file_uri);
if(gio_file)
{
Glib::RefPtr<Gio::File> parent = gio_file->get_parent();
auto parent = gio_file->get_parent();
if(parent)
{
const auto uri_parent = parent->get_uri();
......@@ -2151,7 +2151,7 @@ Glib::ustring AppWindow::ui_file_select_save(const Glib::ustring& old_file_uri)
const auto uri = Utils::get_file_uri_without_extension(uri_chosen);
//Check whether the file exists, and that we have rights to it:
Glib::RefPtr<Gio::File> file = Gio::File::create_for_uri(uri);
auto file = Gio::File::create_for_uri(uri);
if(!file)
return Glib::ustring(); //Failure.
......@@ -2226,7 +2226,7 @@ Glib::ustring AppWindow::ui_file_select_save(const Glib::ustring& old_file_uri)
//Check that the directory does not exist already.
//The GtkFileChooser could not check for that because it could not know that we would create a directory based on the filename:
//Note that uri has no extension at this point:
Glib::RefPtr<Gio::File> dir = Gio::File::create_for_uri(uri);
auto dir = Gio::File::create_for_uri(uri);
if(dir->query_exists())
{
ui_warning(_("Directory Already Exists"), _("There is an existing directory with the same name as the directory that should be created for the new database files. You should specify a different filename to use a new directory instead."));
......@@ -2248,11 +2248,11 @@ Glib::ustring AppWindow::ui_file_select_save(const Glib::ustring& old_file_uri)
}
//Add the filename (Note that the caller will add the extension if necessary, so we don't do it here.)
Glib::RefPtr<Gio::File> file_with_ext = Gio::File::create_for_uri(uri_chosen);
auto file_with_ext = Gio::File::create_for_uri(uri_chosen);
const auto filename_part = file_with_ext->get_basename();
//Add the filename part to the newly-created directory:
Glib::RefPtr<Gio::File> file_whole = dir->get_child(filename_part);
auto file_whole = dir->get_child(filename_part);
return file_whole->get_uri();
}
......@@ -2396,7 +2396,7 @@ void AppWindow::on_menu_developer_restore_backup()
file_dlg.set_transient_for(*this);
file_dlg.set_local_only(); //Because we can't untar remote files.
Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
auto filter = Gtk::FileFilter::create();
filter->set_name(_(".tar.gz Backup files"));
filter->add_pattern("*.tar.gz");
filter->add_pattern("*.tgz");
......@@ -2865,10 +2865,10 @@ void AppWindow::on_menu_edit_copy_activate()
auto textview = dynamic_cast<Gtk::TextView*>(widget);
if(textview)
{
Glib::RefPtr<Gtk::TextBuffer> buffer = textview->get_buffer();
auto buffer = textview->get_buffer();
if(buffer)
{
Glib::RefPtr<Gtk::Clipboard> clipboard =
auto clipboard =
Gtk::Clipboard::get_for_display(get_display());
buffer->copy_clipboard(clipboard);
}
......@@ -2891,10 +2891,10 @@ void AppWindow::on_menu_edit_cut_activate()
auto textview = dynamic_cast<Gtk::TextView*>(widget);
if(textview)
{
Glib::RefPtr<Gtk::TextBuffer> buffer = textview->get_buffer();
auto buffer = textview->get_buffer();
if(buffer)
{
Glib::RefPtr<Gtk::Clipboard> clipboard =
auto clipboard =
Gtk::Clipboard::get_for_display(get_display());
buffer->cut_clipboard(clipboard, textview->get_editable());
}
......@@ -2917,10 +2917,10 @@ void AppWindow::on_menu_edit_paste_activate()
auto textview = dynamic_cast<Gtk::TextView*>(widget);
if(textview)
{
Glib::RefPtr<Gtk::TextBuffer> buffer = textview->get_buffer();
auto buffer = textview->get_buffer();
if(buffer)
{
Glib::RefPtr<Gtk::Clipboard> clipboard =
auto clipboard =
Gtk::Clipboard::get_for_display(get_display());
buffer->paste_clipboard(clipboard);
}
......
......@@ -324,7 +324,7 @@ Glib::RefPtr<Gnome::Gda::Connection> Base_DB::get_connection()
return Glib::RefPtr<Gnome::Gda::Connection>();
}
Glib::RefPtr<Gnome::Gda::Connection> gda_connection = sharedconnection->get_gda_connection();
auto gda_connection = sharedconnection->get_gda_connection();
return gda_connection;
}
......@@ -742,11 +742,11 @@ void Base_DB::calculate_field_in_all_records(const Glib::ustring& table_name, co
{
//Get primary key values for every record:
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_SELECT);
auto builder = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_SELECT);
builder->select_add_field(primary_key->get_name(), table_name);
builder->select_add_target(table_name);
Glib::RefPtr<Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(builder);
auto data_model = DbUtils::query_execute_select(builder);
if(!data_model || !data_model->get_n_rows() || !data_model->get_n_columns())
{
//HandleError();
......@@ -1030,7 +1030,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const LayoutFieldInRecord
type_vecConstLayoutFields list_fields;
auto layout_item = field_in_record.m_field;
list_fields.push_back(layout_item);
Glib::RefPtr<Gnome::Gda::SqlBuilder> sql_query = Utils::build_sql_select_with_key(field_in_record.m_table_name,
auto sql_query = Utils::build_sql_select_with_key(field_in_record.m_table_name,
list_fields, field_in_record.m_key, field_in_record.m_key_value, type_sort_clause(), 1);
Glib::RefPtr<const Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(sql_query);
......@@ -1070,7 +1070,7 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const std::shared_ptr<Fie
auto layout_item = std::make_shared<LayoutItem_Field>();
layout_item->set_full_field_details(field);
list_fields.push_back(layout_item);
Glib::RefPtr<Gnome::Gda::SqlBuilder> sql_query = Utils::build_sql_select_with_where_clause(found_set.m_table_name,
auto sql_query = Utils::build_sql_select_with_where_clause(found_set.m_table_name,
list_fields,
found_set.m_where_clause,
std::shared_ptr<const Relationship>() /* extra_join */, type_sort_clause(),
......@@ -1290,7 +1290,7 @@ bool Base_DB::get_field_value_is_unique(const Glib::ustring& table_name, const s
const auto table_name_used = field->get_table_used(table_name);
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder =
auto builder =
Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_SELECT);
builder->select_add_field(field->get_name(), table_name_used);
builder->select_add_target(table_name_used);
......@@ -1372,7 +1372,7 @@ bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gn
layout_item->set_full_field_details(primary_key);
fieldsToGet.push_back(layout_item);
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_SELECT);
auto builder = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_SELECT);
builder->select_add_target(found_set.m_table_name);
const auto eq_id = builder->add_cond(Gnome::Gda::SQL_OPERATOR_TYPE_EQ,
......@@ -1393,7 +1393,7 @@ bool Base_DB::get_primary_key_is_in_foundset(const FoundSet& found_set, const Gn
builder->set_where(cond_id); //This might be unnecessary.
cond_id = eq_id;
Glib::RefPtr<Gnome::Gda::SqlBuilder> query =
auto query =
Utils::build_sql_select_with_where_clause(found_set.m_table_name, fieldsToGet,
builder->export_expression(cond_id));
Glib::RefPtr<const Gnome::Gda::DataModel> data_model = DbUtils::query_execute_select(query);
......
......@@ -82,13 +82,13 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
}
//Get all entered field name/value pairs:
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_INSERT);
auto builder = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_INSERT);
builder->set_table(m_table_name);
//Avoid specifying the same field twice:
typedef std::map<Glib::ustring, bool> type_map_added;
type_map_added map_added;
Glib::RefPtr<Gnome::Gda::Set> params = Gnome::Gda::Set::create();
auto params = Gnome::Gda::Set::create();
for(const auto& layout_item : fieldsToAdd)
{
......@@ -283,7 +283,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const std::shared_ptr<cons
//Generate the new key value;
}
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder_insert = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_INSERT);
auto builder_insert = Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_INSERT);
builder_insert->set_table(relationship->get_to_table());
builder_insert->add_field_value(primary_key_field->get_name(), primary_key_value);
if(!DbUtils::query_execute(builder_insert))
......@@ -328,7 +328,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const std::shared_ptr<cons
else
{
const auto target_table = relationship->get_from_table();
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder_update =
auto builder_update =
Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_UPDATE);
builder_update->set_table(target_table);
builder_update->add_field_value_as_value(relationship->get_from_field(), primary_key_value);
......@@ -385,7 +385,7 @@ bool Base_DB_Table_Data::record_delete(const Gnome::Gda::Value& primary_key_valu
auto field_primary_key = get_field_primary_key();
if(field_primary_key && !Conversions::value_is_empty(primary_key_value))
{
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder =
auto builder =
Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_DELETE);
builder->set_table(m_table_name);
builder->set_where(
......@@ -422,7 +422,7 @@ bool Base_DB_Table_Data::get_related_record_exists(const std::shared_ptr<const R
const auto related_table = relationship->get_to_table();
//TODO_Performance: Is this the best way to just find out whether there is one record that meets this criteria?
Glib::RefPtr<Gnome::Gda::SqlBuilder> builder =
auto builder =
Gnome::Gda::SqlBuilder::create(Gnome::Gda::SQL_STATEMENT_SELECT);
builder->select_add_field(to_field, related_table);
builder->select_add_target(related_table);
......@@ -431,7 +431,7 @@ bool Base_DB_Table_Data::get_related_record_exists(const std::shared_ptr<const R
builder->add_field_id(to_field, related_table),
builder->add_expr(key_value)));
Glib::RefPtr<Gnome::Gda::DataModel> records = DbUtils::query_execute_select(builder);
auto records = DbUtils::query_execute_select(builder);
if(!records)
handle_error();
else
......@@ -492,7 +492,7 @@ void Base_DB_Table_Data::refresh_related_fields(const LayoutFieldInRecord& field
if(!fieldsToGet.empty())
{
Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_key(field_in_record_changed.m_table_name, fieldsToGet, field_in_record_changed.m_key, field_in_record_changed.m_key_value);
auto query = Utils::build_sql_select_with_key(field_in_record_changed.m_table_name, fieldsToGet, field_in_record_changed.m_key, field_in_record_changed.m_key_value);
//std::cout << "debug: " << G_STRFUNC << ": query=" << query << std::endl;
Glib::RefPtr<const Gnome::Gda::DataModel> result = DbUtils::query_execute_select(query);
......
......@@ -203,7 +203,7 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
m_notebook->signal_switch_page().connect(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_switch_page));
#endif /* !GLOM_ENABLE_CLIENT_ONLY */
Glib::RefPtr<Gtk::TreeView::Selection> existing_view_selection = m_existing_view->get_selection();
auto existing_view_selection = m_existing_view->get_selection();
existing_view_selection->signal_changed().connect(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_existing_selection_changed));
existing_view_selection->set_select_function( sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_existing_select_func) );
......@@ -231,7 +231,7 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
m_iter_new_template_dummy = create_dummy_item_new(m_iter_new_template, "No templates available.");
Glib::RefPtr<Gtk::TreeView::Selection> new_view_selection = m_new_view->get_selection();
auto new_view_selection = m_new_view->get_selection();
new_view_selection->signal_changed().connect(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_new_selection_changed));
new_view_selection->set_select_function( sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_new_select_func) );
#else /* GLOM_ENABLE_CLIENT_ONLY */
......@@ -639,7 +639,7 @@ Glib::ustring Dialog_ExistingOrNew::get_title_from_example(const std::string& re
{
try
{
Glib::RefPtr<Gio::InputStream> stream =
auto stream =
Gio::Resource::open_stream_global(resource_name);
//TODO: Really do this asynchronously?
......@@ -786,7 +786,7 @@ void Dialog_ExistingOrNew::on_select_clicked()
dialog.add_button(_("_Open"), Gtk::RESPONSE_OK);
dialog.set_default_response(Gtk::RESPONSE_OK);
Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
auto filter = Gtk::FileFilter::create();
filter->add_mime_type("application/x-glom");
filter->set_name("Glom files");
dialog.add_filter(filter);
......
......@@ -388,7 +388,7 @@ void Frame_Glom::show_table_allow_empty(const Glib::ustring& table_name, const G
layout_item_temp->set_full_field_details(field_primary_key);
type_vecLayoutFields layout_fields;
layout_fields.push_back(layout_item_temp);
Glib::RefPtr<Gnome::Gda::SqlBuilder> sql_query_without_sort = Utils::build_sql_select_with_where_clause(found_set.m_table_name, layout_fields, found_set.m_where_clause, found_set.m_extra_join, type_sort_clause());
auto sql_query_without_sort = Utils::build_sql_select_with_where_clause(found_set.m_table_name, layout_fields, found_set.m_where_clause, found_set.m_extra_join, type_sort_clause());
const Privileges table_privs = Privs::get_current_privs(found_set.m_table_name);
int count = 0;
......@@ -596,10 +596,10 @@ void Frame_Glom::export_data_to_vector(Document::type_example_rows& the_vector,
return;
}
Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_where_clause(found_set.m_table_name, fieldsSequence, found_set.m_where_clause, found_set.m_extra_join, found_set.m_sort_clause);
auto query = Utils::build_sql_select_with_where_clause(found_set.m_table_name, fieldsSequence, found_set.m_where_clause, found_set.m_extra_join, found_set.m_sort_clause);
//TODO: Lock the database (prevent changes) during export.
Glib::RefPtr<Gnome::Gda::DataModel> result = DbUtils::query_execute_select(query);
auto result = DbUtils::query_execute_select(query);
guint rows_count = 0;
if(result)
......@@ -646,7 +646,7 @@ void Frame_Glom::export_data_to_stream(std::ostream& the_stream, const FoundSet&
return;
}
Glib::RefPtr<Gnome::Gda::SqlBuilder> query = Utils::build_sql_select_with_where_clause(found_set.m_table_name, fieldsSequence, found_set.m_where_clause, found_set.m_extra_join, found_set.m_sort_clause);
auto query = Utils::build_sql_select_with_where_clause(found_set.m_table_name, fieldsSequence, found_set.m_where_clause, found_set.m_extra_join, found_set.m_sort_clause);
//TODO: Lock the database (prevent changes) during export.
Glib::RefPtr<const Gnome::Gda::DataModel> result = DbUtils::query_execute_select(query);
......@@ -736,11 +736,11 @@ void Frame_Glom::on_menu_file_import()
Gtk::FileChooserDialog file_chooser(*get_app_window(), _("Open CSV Document"), Gtk::FILE_CHOOSER_ACTION_OPEN);
file_chooser.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
file_chooser.add_button(_("_Open"), Gtk::RESPONSE_ACCEPT);
Glib::RefPtr<Gtk::FileFilter> filter_csv = Gtk::FileFilter::create();
auto filter_csv = Gtk::FileFilter::create();
filter_csv->set_name(_("CSV files"));
filter_csv->add_mime_type("text/csv");
file_chooser.add_filter(filter_csv);
Glib::RefPtr<Gtk::FileFilter> filter_any = Gtk::FileFilter::create();
auto filter_any = Gtk::FileFilter::create();
filter_any->set_name(_("All files"));
filter_any->add_pattern("*");
file_chooser.add_filter(filter_any);
......@@ -1457,7 +1457,7 @@ void Frame_Glom::update_table_in_document_from_database()
else //if it was found.
{
//Compare the information:
Glib::RefPtr<Gnome::Gda::Column> field_info_db = field_database->get_field_info();
auto field_info_db = field_database->get_field_info();
auto field_document = *iterFindDoc;
if(field_document)
{
......@@ -1806,7 +1806,7 @@ void Frame_Glom::add_window_to_app(Gtk::ApplicationWindow* window)
}
//This probably lets the GtkApplication know about the window's actions, which might be useful.
Glib::RefPtr<Gtk::Application> app = app_window->get_application();
auto app = app_window->get_application();
if(app)
app->add_window(*window);
else
......
......@@ -153,12 +153,12 @@ static bool delete_directory(const Glib::RefPtr<Gio::File>& directory)
//(Recursively) Delete any child files and directories,
//so we can delete this directory.
Glib::RefPtr<Gio::FileEnumerator> enumerator = directory->enumerate_children();
auto enumerator = directory->enumerate_children();
Glib::RefPtr<Gio::FileInfo> info = enumerator->next_file();
auto info = enumerator->next_file();
while(info)
{
Glib::RefPtr<Gio::File> child = directory->get_child(info->get_name());
auto child = directory->get_child(info->get_name());
bool removed_child = false;
if(child->query_file_type() == Gio::FILE_TYPE_DIRECTORY)
removed_child = delete_directory(child);
......@@ -186,7 +186,7 @@ static bool delete_directory(const std::string& uri)
if(uri.empty())
return true;
Glib::RefPtr<Gio::File> file = Gio::File::create_for_uri(uri);
auto file = Gio::File::create_for_uri(uri);
return delete_directory(file);
}
......@@ -287,7 +287,7 @@ int main(int argc, char* argv[])
if(!input_uri.empty())
{
//Get a URI (file://something) from the filepath:
Glib::RefPtr<Gio::File> file = Gio::File::create_for_commandline_arg(input_uri);
auto file = Gio::File::create_for_commandline_arg(input_uri);
if(!file->query_exists())
{
......@@ -328,7 +328,7 @@ int main(int argc, char* argv[])
else
{
//Get a URI (file://something) from the filepath:
Glib::RefPtr<Gio::File> file = Gio::File::create_for_commandline_arg(group.m_arg_filepath_dir_output);
auto file = Gio::File::create_for_commandline_arg(group.m_arg_filepath_dir_output);
if(!file->query_exists())
{
......@@ -389,7 +389,7 @@ int main(int argc, char* argv[])
if(uri.empty())
return EXIT_FAILURE;
Glib::RefPtr<Gio::File> file = Gio::File::create_for_commandline_arg(uri);
auto file = Gio::File::create_for_commandline_arg(uri);
if(file->query_exists())
{
std::cerr << G_STRFUNC << ": The output path already exists: " << filepath_dir << std::endl;
......
......@@ -152,7 +152,7 @@ int main(int argc, char* argv[])
}
//Get a URI (file://something) from the filepath:
Glib::RefPtr<Gio::File> file_input = Gio::File::create_for_commandline_arg(input_uri);
auto file_input = Gio::File::create_for_commandline_arg(input_uri);
//Make sure it is really a URI:
input_uri = file_input->get_uri();
......@@ -183,7 +183,7 @@ int main(int argc, char* argv[])
}
//Get a URI (file://something) from the filepath:
Glib::RefPtr<Gio::File> file_output = Gio::File::create_for_commandline_arg(group.m_arg_filepath_output);
auto file_output = Gio::File::create_for_commandline_arg(group.m_arg_filepath_output);
const auto output_uri = file_output->get_uri();
/* Silently overwriting is easier when we use this in a batch:
......
......@@ -133,7 +133,7 @@ int main(int argc, char* argv[])
}
//Get a URI (file://something) from the filepath:
Glib::RefPtr<Gio::File> file_input = Gio::File::create_for_commandline_arg(input_uri);
auto file_input = Gio::File::create_for_commandline_arg(input_uri);
//Make sure it is really a URI:
input_uri = file_input->get_uri();
......@@ -164,7 +164,7 @@ int main(int argc, char* argv[])
}
//Get a URI (file://something) from the filepath:
Glib::RefPtr<Gio::File> file_output = Gio::File::create_for_commandline_arg(group.m_arg_filepath_output);
auto file_output = Gio::File::create_for_commandline_arg(group.m_arg_filepath_output);
//Create the directory, if necessary:
if(!(file_output->query_exists()))
......
......@@ -134,7 +134,7 @@ int main(int argc, char* argv[])
}
//Get a URI (file://something) from the filepath:
Glib::RefPtr<Gio::File> file_input = Gio::File::create_for_commandline_arg(input_uri);
auto file_input = Gio::File::create_for_commandline_arg(input_uri);
//Make sure it is really a URI:
input_uri = file_input->get_uri();
......@@ -165,7 +165,7 @@ int main(int argc, char* argv[])
}
//Get a URI (file://something) from the filepath:
Glib::RefPtr<Gio::File> file_output = Gio::File::create_for_commandline_arg(group.m_arg_filepath_po_input);
auto file_output = Gio::File::create_for_commandline_arg(group.m_arg_filepath_po_input);
file_type = file_output->query_file_type();
if(file_type != Gio::FILE_TYPE_DIRECTORY)
......@@ -190,11 +190,11 @@ int main(int argc, char* argv[])
}
//Import all .po files from the directory:
Glib::RefPtr<Gio::FileEnumerator> enumerator = file_output->enumerate_children();
auto enumerator = file_output->enumerate_children();
Glib::RefPtr<Gio::FileInfo> info;
while( (info = enumerator->next_file()) )
{
Glib::RefPtr<Gio::File> child = file_output->get_child(info->get_name());
auto child = file_output->get_child(info->get_name());
if(child->query_file_type() == Gio::FILE_TYPE_DIRECTORY)
continue;
......
......@@ -572,7 +572,7 @@ bool ConnectionPool::handle_error_cerr_only()
if(sharedconnection)
{
Glib::RefPtr<Gnome::Gda::Connection> gda_connection = sharedconnection->get_gda_connection();
auto gda_connection = sharedconnection->get_gda_connection();
const auto list_errors = gda_connection->get_events();
......@@ -864,7 +864,7 @@ gboolean ConnectionPool::on_publisher_document_authentication(EpcAuthContext* co
//Attempt a connection with this username/password:
std::shared_ptr<ExceptionConnection> error;
Glib::RefPtr<Gnome::Gda::Connection> connection = connection_pool->m_backend->connect(connection_pool->get_database(), user_name, password);
auto connection = connection_pool->m_backend->connect(connection_pool->get_database(), user_name, password);
if(connection)
{
......
......@@ -408,7 +408,7 @@ bool MySQL::attempt_create_database(const SlotProgress& slot_progress, const Gli
if(slot_progress)
slot_progress();
Glib::RefPtr<Gnome::Gda::ServerOperation> op =
auto op =
Gnome::Gda::ServerOperation::prepare_create_database("MySQL", database_name);
if(slot_progress)
......
......@@ -438,7 +438,7 @@ Backend::StartupErrors MySQLSelfHosted::startup(const SlotProgress& slot_progres
void MySQLSelfHosted::show_active_connections()
{
/* TODO_MySQL