Commit 7e070290 authored by Murray Cumming's avatar Murray Cumming
Browse files

Put UI utils in UiUtils namespace.

parent fce3d242
......@@ -172,7 +172,7 @@ void AppWindow::on_connection_avahi_begin()
delete m_avahi_progress_dialog;
m_avahi_progress_dialog = 0;
m_avahi_progress_dialog = new Gtk::MessageDialog(Utils::bold_message(_("Glom: Generating Encryption Certificates")), true, Gtk::MESSAGE_INFO);
m_avahi_progress_dialog = new Gtk::MessageDialog(UiUtils::bold_message(_("Glom: Generating Encryption Certificates")), true, Gtk::MESSAGE_INFO);
m_avahi_progress_dialog->set_secondary_text(_("Please wait while Glom prepares your system for publishing over the network."));
m_avahi_progress_dialog->set_transient_for(*this);
m_avahi_progress_dialog->show();
......@@ -471,10 +471,10 @@ void AppWindow::on_menu_help_about()
//For some reason this use of the resource:// syntax does not work:
const char* about_icon_name = "48x48/glom.png";
//const Glib::ustring glom_icon_path = "resource://" + Utils::get_icon_path(about_icon_name);
//const Glib::ustring glom_icon_path = "resource://" + UiUtils::get_icon_path(about_icon_name);
//Glib::RefPtr<Gdk::Pixbuf> logo = Gdk::Pixbuf::create_from_file(glom_icon_path);
const Glib::ustring glom_icon_path = Utils::get_icon_path(about_icon_name);
const Glib::ustring glom_icon_path = UiUtils::get_icon_path(about_icon_name);
//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);
......@@ -613,7 +613,7 @@ void AppWindow::open_browsed_document(const EpcServiceInfo* server, const Glib::
dialog_connection->set_transient_for(*this);
dialog_connection->set_connect_to_browsed();
dialog_connection->set_database_name(service_name);
const int response = Glom::Utils::dialog_run_with_help(dialog_connection);
const int response = Glom::UiUtils::dialog_run_with_help(dialog_connection);
dialog_connection->hide();
if(response != Gtk::RESPONSE_OK)
keep_trying = false;
......@@ -640,7 +640,7 @@ void AppWindow::open_browsed_document(const EpcServiceInfo* server, const Glib::
{
//std::cout << " SOUP_STATUS_FORBIDDEN or SOUP_STATUS_UNAUTHORIZED" << std::endl;
Utils::show_ok_dialog(_("Connection Failed"), _("Glom could not connect to the database server. Maybe you entered an incorrect user name or password, or maybe the postgres database server is not running."), *this, Gtk::MESSAGE_ERROR); //TODO: Add help button.
UiUtils::show_ok_dialog(_("Connection Failed"), _("Glom could not connect to the database server. Maybe you entered an incorrect user name or password, or maybe the postgres database server is not running."), *this, Gtk::MESSAGE_ERROR); //TODO: Add help button.
}
}
else
......@@ -978,7 +978,7 @@ bool AppWindow::on_document_load()
const AppState::userlevels userlevel = pDocument->get_userlevel(reason);
if( (userlevel == AppState::USERLEVEL_OPERATOR) && (reason == Document::USER_LEVEL_REASON_FILE_READ_ONLY) )
{
Gtk::MessageDialog dialog(Utils::bold_message(_("Opening Read-Only File.")), true, Gtk::MESSAGE_INFO, Gtk::BUTTONS_NONE);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Opening Read-Only File.")), true, Gtk::MESSAGE_INFO, Gtk::BUTTONS_NONE);
dialog.set_secondary_text(_("This file is read only, so you will not be able to enter Developer mode to make design changes."));
dialog.set_transient_for(*this);
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
......@@ -1303,7 +1303,7 @@ bool AppWindow::offer_new_or_existing()
bool ask_again = true;
while(ask_again)
{
const int response_id = Utils::dialog_run_with_help(dialog_raw);
const int response_id = UiUtils::dialog_run_with_help(dialog_raw);
dialog->hide();
if(response_id == Gtk::RESPONSE_ACCEPT)
......@@ -1473,7 +1473,7 @@ void AppWindow::set_mode_find()
void AppWindow::on_menu_help_contents()
{
Glom::Utils::show_help();
Glom::UiUtils::show_help();
}
#ifndef GLOM_ENABLE_CLIENT_ONLY
......@@ -1754,7 +1754,7 @@ bool AppWindow::recreate_database_from_backup(const Glib::ustring& backup_uri, b
const Glib::ustring message = _("Glom could not create the new database. Maybe you do not have the necessary access rights. Please contact your system administrator.");
Gtk::MessageDialog dialog(Utils::bold_message(_("Database Creation Failed")), true, Gtk::MESSAGE_ERROR );
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Database Creation Failed")), true, Gtk::MESSAGE_ERROR );
dialog.set_secondary_text(message);
dialog.set_transient_for(*this);
......@@ -2351,7 +2351,7 @@ void AppWindow::on_menu_developer_changelanguage()
return;
dialog->set_transient_for(*this);
const int response = Glom::Utils::dialog_run_with_help(dialog);
const int response = Glom::UiUtils::dialog_run_with_help(dialog);
dialog->hide();
if(response == Gtk::RESPONSE_OK)
......
......@@ -119,7 +119,7 @@ void Base_DB::handle_error(const Glib::Exception& ex)
{
std::cerr << G_STRFUNC << ": Internal Error (Base_DB::handle_error()): exception type=" << typeid(ex).name() << ", ex.what()=" << ex.what() << std::endl;
Gtk::MessageDialog dialog(Utils::bold_message(_("Internal error")), true, Gtk::MESSAGE_WARNING );
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Internal error")), true, Gtk::MESSAGE_WARNING );
dialog.set_secondary_text(ex.what());
//TODO: dialog.set_transient_for(*get_appwindow());
dialog.run();
......@@ -129,7 +129,7 @@ void Base_DB::handle_error(const std::exception& ex)
{
std::cerr << G_STRFUNC << ": Internal Error (Base_DB::handle_error()): exception type=" << typeid(ex).name() << ", ex.what()=" << ex.what() << std::endl;
Gtk::MessageDialog dialog(Utils::bold_message(_("Internal error")), true, Gtk::MESSAGE_WARNING );
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Internal error")), true, Gtk::MESSAGE_WARNING );
dialog.set_secondary_text(ex.what());
//TODO: dialog.set_transient_for(*get_appwindow());
......@@ -268,7 +268,7 @@ sharedptr<Field> Base_DB::change_column(const Glib::ustring& table_name, const s
catch(const Glib::Error& ex)
{
handle_error(ex);
// Gtk::MessageDialog window(*parent_window, Utils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
// Gtk::MessageDialog window(*parent_window, UiUtils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
// window.run();
return sharedptr<Field>();
}
......@@ -296,7 +296,7 @@ bool Base_DB::change_columns(const Glib::ustring& table_name, const type_vec_con
catch(const Glib::Error& ex)
{
handle_error(ex);
// Gtk::MessageDialog window(*parent_window, Utils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
// Gtk::MessageDialog window(*parent_window, UiUtils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
// window.run();
return false;
}
......@@ -464,7 +464,7 @@ sharedptr<LayoutItem_Text> Base_DB::offer_textobject(const sharedptr<LayoutItem_
dialog->set_transient_for(*transient_for);
dialog->set_textobject(start_textobject, Glib::ustring(), show_title);
const int response = Glom::Utils::dialog_run_with_help(dialog);
const int response = Glom::UiUtils::dialog_run_with_help(dialog);
dialog->hide();
if(response == Gtk::RESPONSE_OK)
{
......@@ -490,7 +490,7 @@ sharedptr<LayoutItem_Image> Base_DB::offer_imageobject(const sharedptr<LayoutIte
dialog->set_transient_for(*transient_for);
dialog->set_imageobject(start_imageobject, Glib::ustring(), show_title);
const int response = Glom::Utils::dialog_run_with_help(dialog);
const int response = Glom::UiUtils::dialog_run_with_help(dialog);
dialog->hide();
if(response == Gtk::RESPONSE_OK)
{
......@@ -517,7 +517,7 @@ sharedptr<LayoutItem_Notebook> Base_DB::offer_notebook(const sharedptr<LayoutIte
dialog->set_notebook(start_notebook);
//dialog->set_transient_for(*this);
const int response = Glom::Utils::dialog_run_with_help(dialog);
const int response = Glom::UiUtils::dialog_run_with_help(dialog);
dialog->hide();
if(response == Gtk::RESPONSE_OK)
{
......
......@@ -254,7 +254,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.");
Gtk::MessageDialog dialog(Utils::bold_message(_("Related Record Does Not Exist")), true);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Related Record Does Not Exist")), true);
dialog.set_secondary_text(message);
dialog.set_transient_for(*AppWindow::get_appwindow());
dialog.run();
......@@ -275,7 +275,7 @@ bool Base_DB_Table_Data::add_related_record_for_field(const sharedptr<const Layo
//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 key in the related record is auto-generated and therefore can not be created with the key value in this record.");
Gtk::MessageDialog dialog(Utils::bold_message(_("Related Record Cannot Be Created")), true);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Related Record Cannot Be Created")), true);
//TODO: This is a very complex error message:
dialog.set_secondary_text(message);
dialog.set_transient_for(*AppWindow::get_appwindow());
......@@ -387,7 +387,7 @@ bool Base_DB_Table_Data::confirm_delete_record()
{
//Ask the user for confirmation:
const Glib::ustring message = _("Are you sure that you would like to delete this record? The data in this record will then be permanently lost.");
Gtk::MessageDialog dialog(Utils::bold_message(_("Delete record")), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Delete record")), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
dialog.set_secondary_text(message);
dialog.set_transient_for(*AppWindow::get_appwindow());
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
......
......@@ -32,13 +32,13 @@ namespace Glom
Box_WithButtons::Box_WithButtons()
: Gtk::Box(Gtk::ORIENTATION_VERTICAL),
m_Box_Buttons(Gtk::ORIENTATION_HORIZONTAL, Utils::DEFAULT_SPACING_SMALL),
m_Box_Buttons(Gtk::ORIENTATION_HORIZONTAL, UiUtils::DEFAULT_SPACING_SMALL),
m_Button_Cancel(_("_Cancel"))
{
//m_pDocument = 0;
//set_border_width(Utils::DEFAULT_SPACING_SMALL);
set_spacing(Utils::DEFAULT_SPACING_SMALL);
//set_border_width(UiUtils::DEFAULT_SPACING_SMALL);
set_spacing(UiUtils::DEFAULT_SPACING_SMALL);
//Connect signals:
m_Button_Cancel.signal_clicked().connect(sigc::mem_fun(*this, &Box_WithButtons::on_Button_Cancel));
......@@ -46,13 +46,13 @@ Box_WithButtons::Box_WithButtons()
Box_WithButtons::Box_WithButtons(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& /* builder */)
: Gtk::Box(cobject),
m_Box_Buttons(Gtk::ORIENTATION_HORIZONTAL, Utils::DEFAULT_SPACING_SMALL),
m_Box_Buttons(Gtk::ORIENTATION_HORIZONTAL, UiUtils::DEFAULT_SPACING_SMALL),
m_Button_Cancel(_("_Cancel"))
{
//m_pDocument = 0;
//set_border_width(Utils::DEFAULT_SPACING_SMALL);
set_spacing(Utils::DEFAULT_SPACING_SMALL);
//set_border_width(UiUtils::DEFAULT_SPACING_SMALL);
set_spacing(UiUtils::DEFAULT_SPACING_SMALL);
//Connect signals:
m_Button_Cancel.signal_clicked().connect(sigc::mem_fun(*this, &Box_WithButtons::on_Button_Cancel));
......@@ -60,7 +60,7 @@ Box_WithButtons::Box_WithButtons(BaseObjectType* cobject, const Glib::RefPtr<Gtk
Box_WithButtons::Box_WithButtons(BaseObjectType* cobject)
: Gtk::Box(cobject),
m_Box_Buttons(Gtk::ORIENTATION_HORIZONTAL, Utils::DEFAULT_SPACING_SMALL),
m_Box_Buttons(Gtk::ORIENTATION_HORIZONTAL, UiUtils::DEFAULT_SPACING_SMALL),
m_Button_Cancel(_("_Cancel"))
{
}
......
......@@ -41,7 +41,7 @@ bool glom_show_dialog_invalid_data(Field::glom_field_type glom_type)
dialog->set_example_data(glom_type);
//dialog->set_transient_for(*this);
const int response = Glom::Utils::dialog_run_with_help(dialog);
const int response = Glom::UiUtils::dialog_run_with_help(dialog);
delete dialog;
return (response == 2); //The glade file has a response of 2 for the Revert button.
......
......@@ -29,7 +29,7 @@ namespace Glom
FileChooser_Export::FileChooser_Export()
: Gtk::FileChooserDialog(_("Export to File"), Gtk::FILE_CHOOSER_ACTION_SAVE),
m_extra_widget(Gtk::ORIENTATION_HORIZONTAL, Utils::DEFAULT_SPACING_SMALL),
m_extra_widget(Gtk::ORIENTATION_HORIZONTAL, UiUtils::DEFAULT_SPACING_SMALL),
#ifndef GLOM_ENABLE_CLIENT_ONLY
m_button_format(_("Define Data _Format"), true /* use mnenomic */),
m_pDialogLayout(0),
......
......@@ -75,7 +75,7 @@ Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
: PlaceHolder(cobject, builder),
m_pLabel_Table_DataMode(0),
m_pLabel_Table_FindMode(0),
m_Box_RecordsCount(Gtk::ORIENTATION_HORIZONTAL, Utils::DEFAULT_SPACING_SMALL),
m_Box_RecordsCount(Gtk::ORIENTATION_HORIZONTAL, UiUtils::DEFAULT_SPACING_SMALL),
m_Button_FindAll(_("Find All")),
m_stack_mode(0),
m_pBox_Tables(0),
......@@ -107,7 +107,7 @@ Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
//QuickFind widgets:
//We don't use Glade for these, so it easier to modify them for the Maemo port.
m_pBox_QuickFind = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Utils::DEFAULT_SPACING_SMALL));
m_pBox_QuickFind = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, UiUtils::DEFAULT_SPACING_SMALL));
Gtk::Label* label = Gtk::manage(new Gtk::Label(_("Quick _search:"), true));
m_pBox_QuickFind->pack_start(*label, Gtk::PACK_SHRINK);
......@@ -492,14 +492,14 @@ bool Frame_Glom::attempt_change_usermode_to_developer()
if(document->get_opened_from_browse())
{
//TODO: Obviously this could be possible but it would require a network protocol and some work:
Gtk::MessageDialog dialog(Utils::bold_message(_("Developer mode not available.")), true, Gtk::MESSAGE_WARNING);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Developer mode not available.")), true, Gtk::MESSAGE_WARNING);
dialog.set_secondary_text(_("Developer mode is not available because the file was opened over the network from a running Glom. Only the original file may be edited."));
dialog.set_transient_for(*get_app_window());
dialog.run();
}
else
{
Gtk::MessageDialog dialog(Utils::bold_message(_("Developer mode not available")), true, Gtk::MESSAGE_WARNING);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Developer mode not available")), true, Gtk::MESSAGE_WARNING);
dialog.set_secondary_text(_("Developer mode is not available. Check that you have sufficient database access rights and that the glom file is not read-only."));
dialog.set_transient_for(*get_app_window());
dialog.run();
......@@ -507,7 +507,7 @@ bool Frame_Glom::attempt_change_usermode_to_developer()
}
else if(document->get_document_format_version() < Document::get_latest_known_document_format_version())
{
Gtk::MessageDialog dialog(Utils::bold_message(_("Saving in new document format")), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Saving in new document format")), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
dialog.set_secondary_text(_("The document was created by an earlier version of the application. Making changes to the document will mean that the document cannot be opened by some earlier versions of the application."));
dialog.set_transient_for(*get_app_window());
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
......@@ -566,7 +566,7 @@ void Frame_Glom::on_menu_file_export()
if(filepath.empty())
return;
filepath = Utils::get_filepath_with_extension(filepath, "csv");
filepath = UiUtils::get_filepath_with_extension(filepath, "csv");
dialog.get_layout_groups(mapGroupSequence);
//std::cout << "DEBUG 0: mapGroupSequence.size()=" << mapGroupSequence.size() << std::endl;
......@@ -729,7 +729,7 @@ void Frame_Glom::on_menu_file_import()
{
if(m_table_name.empty())
{
Utils::show_ok_dialog(_("No Table"), _("There is no table in to which data could be imported."), *get_app_window(), Gtk::MESSAGE_ERROR);
UiUtils::show_ok_dialog(_("No Table"), _("There is no table in to which data could be imported."), *get_app_window(), Gtk::MESSAGE_ERROR);
}
else
{
......@@ -757,7 +757,7 @@ void Frame_Glom::on_menu_file_import()
add_view(dialog);
dialog->import(file_chooser.get_uri(), m_table_name);
while(Glom::Utils::dialog_run_with_help(dialog) == Gtk::RESPONSE_ACCEPT)
while(Glom::UiUtils::dialog_run_with_help(dialog) == Gtk::RESPONSE_ACCEPT)
{
dialog->hide();
......@@ -818,7 +818,7 @@ bool Frame_Glom::attempt_toggle_shared(bool shared)
//TODO: Warn that this will be saved as the default if doing this in developer mode?
if(shared)
{
Gtk::MessageDialog dialog(Utils::bold_message(_("Share on the network")), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Share on the network")), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
dialog.set_secondary_text(_("This will allow other users on the network to use this database."));
dialog.set_transient_for(*get_app_window());
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
......@@ -924,7 +924,7 @@ bool Frame_Glom::attempt_toggle_shared(bool shared)
else //not shared:
{
//TODO: Warn about connected users if possible.
Gtk::MessageDialog dialog(Utils::bold_message(_("Stop sharing on the network")), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Stop sharing on the network")), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE);
dialog.set_secondary_text(_("This will prevent other users on the network from using this database."));
dialog.set_transient_for(*get_app_window());
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
......@@ -1298,7 +1298,7 @@ Gtk::Window* Frame_Glom::get_app_window()
void Frame_Glom::show_ok_dialog(const Glib::ustring& title, const Glib::ustring& message, Gtk::Window& parent, Gtk::MessageType message_type)
{
Utils::show_ok_dialog(title, message, parent, message_type);
UiUtils::show_ok_dialog(title, message, parent, message_type);
}
void Frame_Glom::on_button_quickfind()
......@@ -1332,7 +1332,7 @@ void Frame_Glom::on_notebook_find_criteria(const Gnome::Gda::SqlExpr& where_clau
{
const Glib::ustring message = _("You have not entered any find criteria. Try entering information in the fields.");
Gtk::MessageDialog dialog(Utils::bold_message(_("No Find Criteria")), true, Gtk::MESSAGE_WARNING );
Gtk::MessageDialog dialog(UiUtils::bold_message(_("No Find Criteria")), true, Gtk::MESSAGE_WARNING );
dialog.set_secondary_text(message);
dialog.set_transient_for(*app);
dialog.run();
......@@ -1367,7 +1367,7 @@ void Frame_Glom::on_notebook_find_criteria(const Gnome::Gda::SqlExpr& where_clau
if(!records_found)
{
const bool find_again = Utils::show_warning_no_records_found(*app);
const bool find_again = UiUtils::show_warning_no_records_found(*app);
if(!find_again)
{
......@@ -1407,7 +1407,7 @@ void Frame_Glom::show_table_title()
table_label = m_table_name;
//Show the table title in bold text, because it's important to the user.
const Glib::ustring title = Utils::bold_message(table_label);
const Glib::ustring title = UiUtils::bold_message(table_label);
m_pLabel_Table_DataMode->set_markup(title);
m_pLabel_Table_FindMode->set_markup(title);
}
......@@ -1549,7 +1549,7 @@ void Frame_Glom::on_menu_developer_database_preferences()
add_view(dialog);
dialog->load_from_document();
Glom::Utils::dialog_run_with_help(dialog);
Glom::UiUtils::dialog_run_with_help(dialog);
remove_view(dialog);
delete dialog;
......@@ -1668,7 +1668,7 @@ void Frame_Glom::on_menu_developer_users()
add_view(dialog); //Give it access to the document.
dialog->load_from_document(); //Update the UI now that it has the document.
Glom::Utils::dialog_run_with_help(dialog);
Glom::UiUtils::dialog_run_with_help(dialog);
remove_view(dialog);
delete dialog;
......@@ -1772,7 +1772,7 @@ void Frame_Glom::on_menu_developer_script_library()
dialog->set_transient_for(*(get_app_window()));
add_view(dialog); //Give it access to the document.
dialog->load_from_document();
Glom::Utils::dialog_run_with_help(dialog); //TODO: Create the help section.
Glom::UiUtils::dialog_run_with_help(dialog); //TODO: Create the help section.
dialog->save_to_document();
remove_view(dialog);
delete dialog;
......@@ -1915,7 +1915,7 @@ bool Frame_Glom::handle_connection_initialize_errors(ConnectionPool::InitErrors
message = _("There was an error when attempting to start the database server.");
}
Utils::show_ok_dialog(title, message, *get_app_window(), Gtk::MESSAGE_ERROR);
UiUtils::show_ok_dialog(title, message, *get_app_window(), Gtk::MESSAGE_ERROR);
return false;
}
......@@ -1948,7 +1948,7 @@ bool Frame_Glom::connection_request_initial_password(Glib::ustring& user, Glib::
bool keep_trying = true;
while(keep_trying)
{
response = Utils::dialog_run_with_help(dialog);
response = UiUtils::dialog_run_with_help(dialog);
//Check the password is acceptable:
if(response == Gtk::RESPONSE_OK)
......@@ -2048,7 +2048,7 @@ bool Frame_Glom::connection_request_password_and_choose_new_database_name()
m_pDialogConnection->load_from_document(); //Get good defaults.
m_pDialogConnection->set_transient_for(*get_app_window());
const int response = Glom::Utils::dialog_run_with_help(m_pDialogConnection);
const int response = Glom::UiUtils::dialog_run_with_help(m_pDialogConnection);
m_pDialogConnection->hide();
if(response == Gtk::RESPONSE_OK)
......@@ -2149,7 +2149,7 @@ bool Frame_Glom::connection_request_password_and_choose_new_database_name()
if(ex.get_failure_type() == ExceptionConnection::FAILURE_NO_SERVER)
{
//Warn the user, and let him try again:
Utils::show_ok_dialog(_("Connection Failed"), _("Glom could not connect to the database server. Maybe you entered an incorrect user name or password, or maybe the postgres database server is not running."), *(get_app_window()), Gtk::MESSAGE_ERROR); //TODO: Add help button.
UiUtils::show_ok_dialog(_("Connection Failed"), _("Glom could not connect to the database server. Maybe you entered an incorrect user name or password, or maybe the postgres database server is not running."), *(get_app_window()), Gtk::MESSAGE_ERROR); //TODO: Add help button.
keep_trying = false;
}
else
......@@ -2220,7 +2220,7 @@ bool Frame_Glom::handle_request_password_connection_error(bool asked_for_passwor
if(asked_for_password && ex.get_failure_type() == ExceptionConnection::FAILURE_NO_SERVER)
{
//Warn the user, and let him try again:
Utils::show_ok_dialog(_("Connection Failed"), _("Glom could not connect to the database server. Maybe you entered an incorrect user name or password, or maybe the postgres database server is not running."), *(get_app_window()), Gtk::MESSAGE_ERROR); //TODO: Add help button.
UiUtils::show_ok_dialog(_("Connection Failed"), _("Glom could not connect to the database server. Maybe you entered an incorrect user name or password, or maybe the postgres database server is not running."), *(get_app_window()), Gtk::MESSAGE_ERROR); //TODO: Add help button.
return true;
}
else if(ex.get_failure_type() == ExceptionConnection::FAILURE_NO_DATABASE)
......@@ -2313,7 +2313,7 @@ bool Frame_Glom::connection_request_password_and_attempt(bool& database_not_foun
if(m_pDialogConnection)
{
response = Glom::Utils::dialog_run_with_help(m_pDialogConnection);
response = Glom::UiUtils::dialog_run_with_help(m_pDialogConnection);
m_pDialogConnection->hide();
}
......@@ -2394,7 +2394,7 @@ bool Frame_Glom::create_database(const Glib::ustring& database_name, const Glib:
}
dialog->set_transient_for(*pWindowApp);
Glom::Utils::dialog_run_with_help(dialog, "dialog_error_create_database");
Glom::UiUtils::dialog_run_with_help(dialog, "dialog_error_create_database");
delete dialog;
return false;
......@@ -2426,7 +2426,7 @@ void Frame_Glom::on_menu_report_selected(const Glib::ustring& report_name)
report_builder.set_document(document);
const std::string filepath =
report_builder.report_build_and_save(found_set, report); //TODO: Use found set's where_clause.
Utils::show_report_in_browser(filepath, get_app_window());
UiUtils::show_report_in_browser(filepath, get_app_window());
}
#ifndef GLOM_ENABLE_CLIENT_ONLY
......
......@@ -252,7 +252,7 @@ void Dialog_Import_CSV::clear()
// TODO: Do we explicitely need to cancel async operations?
// TODO: Disconnect idle handlers
m_sample_model.reset();
Utils::treeview_delete_all_columns(m_sample_view);
UiUtils::treeview_delete_all_columns(m_sample_view);
m_sample_view->set_model(m_sample_model);
m_field_model.reset();
m_field_model_sorted.reset();
......@@ -271,7 +271,7 @@ void Dialog_Import_CSV::clear()
void Dialog_Import_CSV::show_error_dialog(const Glib::ustring&, const Glib::ustring& secondary)
{
Utils::show_ok_dialog(_("Error Importing CSV File"),
UiUtils::show_ok_dialog(_("Error Importing CSV File"),
secondary, *this, Gtk::MESSAGE_ERROR);
}
......@@ -433,7 +433,7 @@ void Dialog_Import_CSV::begin_parse()
// Clear sample preview since we reparse everything, perhaps with
// another encoding.
m_sample_model.reset();
Utils::treeview_delete_all_columns(m_sample_view);
UiUtils::treeview_delete_all_columns(m_sample_view);
m_sample_view->set_model(m_sample_model); // Empty model
m_parser->clear();
......@@ -450,7 +450,7 @@ void Dialog_Import_CSV::on_parser_encoding_error()
m_parser->clear();
// Clear sample preview (TODO: Let it visible, and only remove when reparsing?)
m_sample_model.reset();
Utils::treeview_delete_all_columns(m_sample_view);
UiUtils::treeview_delete_all_columns(m_sample_view);
m_sample_view->set_model(m_sample_model); // Empty model
// Don't allow the import button to be pressed when an error occured. This
......
......@@ -779,7 +779,7 @@ void handle_error(const Glib::Exception& ex)
std::cerr << G_STRFUNC << ": Internal Error (handle_error()): exception type=" << typeid(ex).name() << ", ex.what()=" << ex.what() << std::endl;
//TODO_Moved:
//Gtk::MessageDialog dialog(Utils::bold_message(_("Internal error")), true, Gtk::MESSAGE_WARNING );
//Gtk::MessageDialog dialog(UiUtils::bold_message(_("Internal error")), true, Gtk::MESSAGE_WARNING );
//dialog.set_secondary_text(ex.what());
//TODO: dialog.set_transient_for(*get_appwindow());
//dialog.run();
......@@ -790,7 +790,7 @@ void handle_error(const std::exception& ex)
std::cerr << G_STRFUNC << ": Internal Error (handle_error()): exception type=" << typeid(ex).name() << ", ex.what()=" << ex.what() << std::endl;
//TODO_Moved:
//Gtk::MessageDialog dialog(Utils::bold_message(_("Internal error")), true, Gtk::MESSAGE_WARNING );
//Gtk::MessageDialog dialog(UiUtils::bold_message(_("Internal error")), true, Gtk::MESSAGE_WARNING );
//dialog.set_secondary_text(ex.what());
//TODO: dialog.set_transient_for(*get_appwindow());
//dialog.run();
......@@ -1340,7 +1340,7 @@ bool add_column(const Glib::ustring& table_name, const sharedptr<const Field>& f
catch(const Glib::Error& ex)
{
handle_error(ex);
// Gtk::MessageDialog window(*parent_window, Utils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
// Gtk::MessageDialog window(*parent_window, UiUtils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
// window.run();
return false;
}
......@@ -1359,7 +1359,7 @@ bool drop_column(const Glib::ustring& table_name, const Glib::ustring& field_nam
catch(const Glib::Error& ex)
{
handle_error(ex);
// Gtk::MessageDialog window(*parent_window, Utils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
// Gtk::MessageDialog window(*parent_window, UiUtils::bold_message(ex.what()), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
// window.run();
return false;
}
......
......@@ -28,7 +28,7 @@ private:
TestWindow::TestWindow()
: m_box(Gtk::ORIENTATION_VERTICAL, Glom::Utils::DEFAULT_SPACING_SMALL),
: m_box(Gtk::ORIENTATION_VERTICAL, Glom::UiUtils::DEFAULT_SPACING_SMALL),
m_button_start("Start"),
m_button_stop("Stop"),
m_avahi_publisher(0)
......
......@@ -219,7 +219,7 @@ bool check_user_is_not_root_with_warning()
//Make sure this is on stderr too, in case something goes wrong with the UI:
std::cerr << message << std::endl;
Gtk::MessageDialog dialog(Utils::bold_message(_("Running As Root")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Running As Root")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
dialog.set_secondary_text(message);
dialog.run();
......@@ -262,7 +262,7 @@ bool check_postgres_is_available_with_warning()
//Show message to the user about the broken installation:
//This is a packaging bug, but it would probably annoy packagers to mention that in the dialog:
Gtk::MessageDialog dialog(Utils::bold_message(_("Incomplete Glom Installation")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_NONE, true /* modal */);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Incomplete Glom Installation")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_NONE, true /* modal */);
dialog.set_secondary_text(_("Your installation of Glom is not complete, because PostgreSQL is not available on your system. PostgreSQL is needed for self-hosting of Glom databases.\n\nYou may now install PostgreSQL to complete the Glom installation."));
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
dialog.add_button(_("Install PostgreSQL"), Gtk::RESPONSE_OK);
......@@ -280,7 +280,7 @@ bool check_postgres_is_available_with_warning()
//Make sure this is on stderr too, in case something goes wrong with the UI:
std::cerr << message << std::endl;
Gtk::MessageDialog dialog(Utils::bold_message(_("Incomplete Glom Installation")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Incomplete Glom Installation")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
dialog.set_secondary_text(message);
dialog.run();
return false;
......@@ -318,7 +318,7 @@ bool check_mysql_is_available_with_warning()
//Show message to the user about the broken installation:
//This is a packaging bug, but it would probably annoy packagers to mention that in the dialog:
//Unlike for PostgreSQL, this warning is only shown if MySQL was specified in the build.
Gtk::MessageDialog dialog(Utils::bold_message(_("Incomplete Glom Installation")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_NONE, true /* modal */);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Incomplete Glom Installation")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_NONE, true /* modal */);
dialog.set_secondary_text(_("Your installation of Glom is not complete, because MySQL is not available on your system. MySQL is needed for self-hosting of some Glom databases.\n\nYou may now install MySQL to complete the Glom installation."));
dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);
dialog.add_button(_("Install MySQL"), Gtk::RESPONSE_OK);
......@@ -331,7 +331,7 @@ bool check_mysql_is_available_with_warning()
#else //DISTRO_SPECIFIC_MYSQL_INSTALL_IMPLEMENTED
//Show message to the user about the broken installation:
Gtk::MessageDialog dialog(Utils::bold_message(_("Incomplete Glom Installation")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Incomplete Glom Installation")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
dialog.set_secondary_text(_("Your installation of Glom is not complete, because MySQL is not available on your system. MySQL is needed for self-hosting of some Glom databases.\n\nPlease report this bug to your vendor, or your system administrator so it can be corrected."));
dialog.run();
return false;
......@@ -353,7 +353,7 @@ bool check_pyglom_is_available_with_warning()
//Make sure this is on stderr too, in case something goes wrong with the UI:
std::cerr << message << std::endl;
Gtk::MessageDialog dialog(Utils::bold_message(_("Glom Python Module Not Installed")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("Glom Python Module Not Installed")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
dialog.set_secondary_text(message);
dialog.run();
......@@ -371,7 +371,7 @@ bool check_gir_is_available_with_warning()
//Make sure this is on stderr too, in case something goes wrong with the UI:
std::cerr << message << std::endl;
Gtk::MessageDialog dialog(Utils::bold_message(_("gi.repository Python Module Not Installed")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("gi.repository Python Module Not Installed")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
dialog.set_secondary_text(message);
dialog.run();
......@@ -389,7 +389,7 @@ bool check_pygda_is_available_with_warning()
//Make sure this is on stderr too, in case something goes wrong with the UI:
std::cerr << message << std::endl;
Gtk::MessageDialog dialog(Utils::bold_message(_("gi.repository.Gda Python Module Not Installed")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
Gtk::MessageDialog dialog(UiUtils::bold_message(_("gi.repository.Gda Python Module Not Installed")), true /* use_markup */, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true /* modal */);
dialog.set_secondary_text(message);
dialog.run();
......@@ -514,7 +514,7 @@ main(int argc, char* argv[])
//Make sure this is on stderr too, in case something goes wrong with the UI:
std::cerr << message << std::endl;
Gtk::MessageDialog dialog(