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

Remove trailing whitespace.

parent 9d28701d
......@@ -60,7 +60,7 @@ void Application::create_window(const Glib::RefPtr<Gio::File>& file)
//Delete the window when it is hidden:
window->signal_hide().connect(sigc::bind<Gtk::Window*>(sigc::mem_fun(*this,
&Application::on_window_hide), window));
Glib::ustring input_uri;
if(file) //If it's empty then this is a new empty file, as a result of an activation rather than an open.
{
......@@ -113,7 +113,7 @@ void Application::on_open(const Gio::Application::type_vec_files& files,
const Glib::ustring& hint)
{
//std::cout << G_STRFUNC << ": debug\n";
// The application has been asked to open some files,
// so let's open a new window for each one.
//std::cout << "debug: files.size()=" << files.size() << std::endl;
......@@ -134,7 +134,7 @@ void Application::on_open(const Gio::Application::type_vec_files& files,
int Application::on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine>& command_line)
{
//std::cout << G_STRFUNC << ": debug\n";
//Parse command-line arguments that were passed either to the main (first) instance
//or to subsequent instances.
//Note that this parsing is happening in the main (not remote) instance.
......@@ -143,7 +143,7 @@ int Application::on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine>
Glib::OptionContext context;
context.set_main_group(m_remote_option_group);
//Note that these options should really be parsed in main(),
//but we do it here because of glib bug: https://bugzilla.gnome.org/show_bug.cgi?id=634990#c6
//Handling the two groups together here is possible due to our use of Gio::APPLICATION_NON_UNIQUE .
......@@ -169,7 +169,7 @@ int Application::on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine>
//Get command-line parameters, if any:
if(!local_group.handle_options())
return EXIT_FAILURE;
bool stop = false;
const auto date_check_ok = local_group.get_debug_date_check_result(stop);
if(stop)
......
......@@ -34,7 +34,7 @@ protected:
public:
static Glib::RefPtr<Application> create();
protected:
//Overrides of default signal handlers:
void on_activate() override;
......@@ -47,7 +47,7 @@ private:
void create_window(const Glib::RefPtr<Gio::File>& file = Glib::RefPtr<Gio::File>());
void on_window_hide(Gtk::Window* window);
RemoteOptionGroup m_remote_option_group;
};
......
......@@ -159,7 +159,7 @@ AppWindow::~AppWindow()
m_avahi_progress_dialog = nullptr;
#endif // !GLOM_ENABLE_CLIENT_ONLY
delete m_about;
m_about = nullptr;
......@@ -195,7 +195,7 @@ void AppWindow::on_connection_avahi_done()
#endif // !GLOM_ENABLE_CLIENT_ONLY
void AppWindow::init()
{
{
GlomBakery::AppWindow_WithDoc::init(); //Create document and ask to show it in the UI.
init_layout();
show();
......@@ -428,9 +428,9 @@ void AppWindow::init_menus()
insert_action_group("developer", m_action_group_developer);
m_help_action_group = Gio::SimpleActionGroup::create();
m_help_action_group->add_action("about",
sigc::mem_fun(*this, &AppWindow::on_menu_help_about) );
m_help_action_group->add_action("contents",
......@@ -466,7 +466,7 @@ void AppWindow::on_menu_help_about()
m_about->set_copyright(_("© 2000-2011 Murray Cumming, Openismus GmbH"));
const std::vector<Glib::ustring> vecAuthors({"Murray Cumming <murrayc@murrayc.com>"});
m_about->set_authors(vecAuthors);
//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://" + UiUtils::get_icon_path(about_icon_name);
......@@ -1231,10 +1231,10 @@ void AppWindow::update_table_sensitive_ui()
has_table = !m_frame->get_shown_table_name().empty();
for(const auto& action : m_listTableSensitiveActions)
{
{
bool sensitive = has_table;
const bool is_developer_item =
const bool is_developer_item =
(Utils::find_exists(m_listDeveloperActions, action));
if(is_developer_item)
sensitive = sensitive && (userlevel == AppState::userlevels::DEVELOPER);
......@@ -1284,7 +1284,7 @@ void AppWindow::update_userlevel_ui()
// Remove the drag layout toolbar
}
*/
}
#endif // !GLOM_ENABLE_CLIENT_ONLY
......@@ -1841,7 +1841,7 @@ void AppWindow::fill_menu_tables()
{
const auto title = Utils::string_escape_underscores(item_get_title_or_name(table_info));
const auto action_name = escape_for_action_name(table_info->get_name());
menu->append(title, ACTION_GROUP_NAME_TABLES + "." + action_name);
auto action = m_nav_tables_action_group->add_action(action_name,
......@@ -1899,7 +1899,7 @@ void AppWindow::fill_menu_reports(const Glib::ustring& table_name)
{
const auto title = Utils::string_escape_underscores(item_get_title_or_name(report));
const Glib::ustring action_name = report_name;
menu->append(title, ACTION_GROUP_NAME_REPORTS + "." + report_name);
auto action = m_nav_reports_action_group->add_action(action_name,
......@@ -1924,7 +1924,7 @@ void AppWindow::enable_menu_print_layouts_details(bool enable)
//TODO: Suggest a simpler get_actions() method?
for(const auto& name : m_nav_print_layouts_action_group->list_actions())
{
auto action =
auto action =
Glib::RefPtr<Gio::SimpleAction>::cast_dynamic(m_nav_print_layouts_action_group->lookup_action(name));
if(action)
action->set_enabled(enable);
......@@ -2311,7 +2311,7 @@ void AppWindow::on_menu_developer_changelanguage()
Utils::get_glade_widget_derived_with_warning(dialog);
if(!dialog) //Unlikely and it already warns on stderr.
return;
dialog->set_transient_for(*this);
const auto response = Glom::UiUtils::dialog_run_with_help(dialog);
dialog->hide();
......@@ -2449,7 +2449,7 @@ bool AppWindow::do_restore_backup(const Glib::ustring& backup_uri)
auto document = std::dynamic_pointer_cast<Document>(get_document());
if(!document)
return false;
ShowProgressMessage progress_message(_("Restoring backup"));
const auto backup_glom_file_contents = Glom::Document::extract_backup_file(
backup_uri, m_backup_data_filepath,
......@@ -2503,7 +2503,7 @@ void AppWindow::document_history_add(const Glib::ustring& file_uri)
//This can sometimes be called for a file that does not yet exist on disk.
//Avoid warning in RecentManager if that is the case.
//For instance, Glom does this when the user chooses a new filename,
//For instance, Glom does this when the user chooses a new filename,
//but before Glom has enough information to save a useful file.
if(!file_exists(file_uri))
return;
......@@ -2625,7 +2625,7 @@ void AppWindow::set_progress_message(const Glib::ustring& message)
// Pulse the progress bar regardless of whether the message is new or not.
m_infobar_progress->pulse();
//Block interaction with the rest of the UI.
if(m_menubar)
m_menubar->set_sensitive(false);
......@@ -2671,7 +2671,7 @@ Glib::ustring AppWindow::get_original_locale()
if(m_original_locale.empty())
m_original_locale = "en";
return m_original_locale;
return m_original_locale;
}
bool AppWindow::get_current_locale_not_original()
......@@ -2727,7 +2727,7 @@ void AppWindow::on_hide()
void AppWindow::ui_hide()
{
hide();
hide();
}
void AppWindow::ui_bring_to_front()
......@@ -2738,7 +2738,7 @@ void AppWindow::ui_bring_to_front()
void AppWindow::init_menus_edit()
{
//Edit menu
//Build actions:
m_action_group_edit = Gio::SimpleActionGroup::create();
......@@ -2839,7 +2839,7 @@ AppWindow::enumSaveChanges AppWindow::ui_offer_to_save_changes()
if(!m_document)
return result;
GlomBakery::Dialog_OfferSave* pDialogQuestion
GlomBakery::Dialog_OfferSave* pDialogQuestion
= new GlomBakery::Dialog_OfferSave( m_document->get_file_uri() );
Gtk::Window* pWindow = this;
......@@ -2890,7 +2890,7 @@ void AppWindow::on_menu_edit_copy_activate()
auto buffer = textview->get_buffer();
if(buffer)
{
auto clipboard =
auto clipboard =
Gtk::Clipboard::get_for_display(get_display());
buffer->copy_clipboard(clipboard);
}
......@@ -2916,7 +2916,7 @@ void AppWindow::on_menu_edit_cut_activate()
auto buffer = textview->get_buffer();
if(buffer)
{
auto clipboard =
auto clipboard =
Gtk::Clipboard::get_for_display(get_display());
buffer->cut_clipboard(clipboard, textview->get_editable());
}
......@@ -2942,7 +2942,7 @@ void AppWindow::on_menu_edit_paste_activate()
auto buffer = textview->get_buffer();
if(buffer)
{
auto clipboard =
auto clipboard =
Gtk::Clipboard::get_for_display(get_display());
buffer->paste_clipboard(clipboard);
}
......
......@@ -145,8 +145,8 @@ public:
void pulse_progress_message();
void clear_progress_message();
/** Set the locale used for original text of titles. This
* must usually be stored in the document.
/** Set the locale used for original text of titles. This
* must usually be stored in the document.
* Ideally, it would be English.
*/
static void set_original_locale(const Glib::ustring& locale);
......@@ -308,7 +308,7 @@ private:
Gtk::Box* m_box_top;
Frame_Glom* m_frame;
bool m_about_shown;
Gtk::AboutDialog* m_about; //About box.
......
......@@ -75,17 +75,17 @@ void AppWindow::on_menu_edit_cut()
void AppWindow::on_menu_edit_copy()
{
}
void AppWindow::on_menu_edit_paste()
{
}
void AppWindow::on_menu_edit_clear()
{
}
void AppWindow::set_operation_cancelled(bool value /* = true */)
......
......@@ -34,7 +34,7 @@ namespace GlomBakery
* - Override methods to add/change menus/toolbars/statusbar.
* - Default is basic File, Edit, Help menus and toolbar icons.
*
*
* TODO:
* - Command-line args - wrap popt?
......@@ -72,17 +72,17 @@ protected:
virtual void init_menus_file() = 0;
/** Call this from init_menus() to add the standard edit menu
*/
*/
virtual void init_menus_edit() = 0;
virtual void new_instance(const Glib::ustring& uri = Glib::ustring()) = 0; //Must override in order to new() the derived document class.
// virtual void close_window() = 0;
// virtual void bring_to_front() = 0;
//Signal handlers:
public: // We can not take function pointers of these methods in a
// derived class, if they are protected - for instance, with sigc::mem_fun()
public: // We can not take function pointers of these methods in a
// derived class, if they are protected - for instance, with sigc::mem_fun()
//Menus:
virtual void on_menu_file_new();
virtual void on_menu_file_close();
......@@ -102,12 +102,12 @@ protected:
//operation_cancelled:
//e.g. A File|Open tries to save existing data,
//but this needs to be cancelled if the save failed.
//but this needs to be cancelled if the save failed.
static void set_operation_cancelled(bool value = true);
static bool get_operation_cancelled();
//Member data:
//'About Box'/WM Class information:
static Glib::ustring m_strAppName;
......
......@@ -29,7 +29,7 @@ namespace GlomBakery
*
* This is an abstract class. You must use a class such as AppWindow_WithDoc_Gtk, which implements
* the ui_* methods for a particular GUI toolkit.
* Features:
* - 1 document per application instance. Uses Document-derived class polymorphically.
* - Override init_create_document() to create new blank document.
......@@ -54,7 +54,7 @@ namespace GlomBakery
*/
class AppWindow_WithDoc : public AppWindow
{
public:
public:
///Don't forget to call init() too.
explicit AppWindow_WithDoc(const Glib::ustring& appname = ""); //TODO: appname when using get_derived_widget()
......@@ -108,7 +108,7 @@ protected:
virtual void document_history_remove(const Glib::ustring& file_uri);
public:
// We can not take function pointers of these methods in
// We can not take function pointers of these methods in
// a derived class if they are protected - for instance, with sigc::mem_fun()
//Signal handlers:
......@@ -131,7 +131,7 @@ protected:
///override this to show document contents.
virtual bool on_document_load();
///override this to do extra cleanup.
virtual void on_document_close();
......@@ -147,7 +147,7 @@ protected:
virtual void ui_warning(const Glib::ustring& text, const Glib::ustring& secondary_text) = 0;
/** Warn the user about a failure while loading a document.
* Override this to show a specific message in response to your application's
* Override this to show a specific message in response to your application's
* custom @a failure_code.
*/
virtual void ui_warning_load_failed(int failure_code = 0);
......
......@@ -28,7 +28,7 @@ namespace Glom
/** Changes the cursor for as long as this instance lives.
* For instance, put it at the start of code in a { and } block.
*/
*/
class BusyCursor
{
public:
......
......@@ -21,7 +21,7 @@
#include <glom/bakery/dialog_offersave.h>
#include <glom/appwindow.h>
#include <libglom/utils.h>
#include <glibmm/convert.h>
#include <glibmm/convert.h>
#include <glibmm/i18n.h>
namespace
......@@ -50,7 +50,7 @@ Dialog_OfferSave::Dialog_OfferSave(const Glib::ustring& file_uri)
: Gtk::MessageDialog( Glom::AppWindow::util_bold_message(_("Close without Saving")), true /* use markup */, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE)
{
set_title(""); //The HIG says that alert dialogs should not have titles. The default comes from the message type.
set_secondary_text(get_confirmation_message(file_uri));
add_button(_("Discard"), Glom::Utils::to_utype(enumButtons::Discard));
......
......@@ -742,10 +742,10 @@ bool Base_DB::set_field_value_in_database(const LayoutFieldInRecord& layoutfield
const auto field_name = field_in_record.m_field->get_name();
if(!field_name.empty()) //This should not happen.
{
const Gnome::Gda::SqlExpr where_clause =
const Gnome::Gda::SqlExpr where_clause =
SqlUtils::build_simple_where_expression(field_in_record.m_table_name,
field_in_record.m_key, field_in_record.m_key_value);
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
const Glib::RefPtr<const Gnome::Gda::SqlBuilder> builder =
SqlUtils::build_sql_update_with_where_clause(field_in_record.m_table_name,
field_in_record.m_field, field_value, where_clause);
......@@ -810,14 +810,14 @@ Gnome::Gda::Value Base_DB::get_field_value_in_database(const LayoutFieldInRecord
{
to_field = field_in_record.m_field->get_relationship()->get_to_field();
}
if(!to_field.empty())
{
std::cerr << G_STRFUNC << ": field_in_record.m_key is empty.\n";
return result;
}
}
type_vecConstLayoutFields list_fields;
auto layout_item = field_in_record.m_field;
......
......@@ -28,19 +28,19 @@
namespace Glom
{
/** A base class that is a Bakery View with some database functionality
/** A base class that is a Bakery View with some database functionality
* for use with a specific database table.
*/
class Base_DB_Table : public Base_DB
{
public:
public:
Base_DB_Table();
bool init_db_details(const Glib::ustring& table_name);
Glib::ustring get_table_name() const;
protected:
protected:
Glib::ustring m_table_name;
};
......
......@@ -105,7 +105,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
const auto field = layout_item->get_full_field_details();
if(!field)
continue;
//Use the specified (generated) primary key value, if there is one:
if(primary_key_name == field_name && !Conversions::value_is_empty(primary_key_value))
{
......@@ -154,7 +154,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
//Use auto-increment values:
if(field->get_auto_increment() && Conversions::value_is_empty(value))
{
value =
value =
DbUtils::get_next_auto_increment_value(m_table_name, field->get_name());
}
......
......@@ -36,7 +36,7 @@ class Box_DB_Table
: public Box_WithButtons,
public Base_DB_Table
{
public:
public:
Box_DB_Table();
Box_DB_Table(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
......
......@@ -77,7 +77,7 @@ const Gtk::Window* Box_WithButtons::get_app_window() const
auto nonconst = const_cast<Box_WithButtons*>(this);
return nonconst->get_app_window();
}
Gtk::Window* Box_WithButtons::get_app_window()
{
return dynamic_cast<Gtk::Window*>(get_toplevel());
......
......@@ -33,14 +33,14 @@
namespace Glom
{
/** A Gtk::Box base widget class,
* with some extra signals to allow derived classes to be used generically in
/** A Gtk::Box base widget class,
* with some extra signals to allow derived classes to be used generically in
* Window_BoxHolder, allowing the dialog to respond to buttons in the box.
*/
class Box_WithButtons :
public Gtk::Box
{
public:
public:
Box_WithButtons();
Box_WithButtons(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
......
......@@ -63,7 +63,7 @@ std::shared_ptr<SharedConnection> Dialog_Connection::connect_to_server_with_conn
auto connection_pool = ConnectionPool::get_instance();
g_assert(connection_pool);
//Set the connection details in the ConnectionPool singleton.
//The ConnectionPool will now use these every time it tries to connect.
......@@ -92,7 +92,7 @@ std::shared_ptr<SharedConnection> Dialog_Connection::connect_to_server_with_conn
result = Base_DB::connect_to_server(const_cast<Dialog_Connection*>(this));
#ifdef GLOM_ENABLE_POSTGRESQL
//Remember the port,
//Remember the port,
//to make opening faster next time,
//and so we can tell connecting clients (using browse network) what port to use:
auto unconst = std::const_pointer_cast<Document>(document);
......@@ -120,9 +120,9 @@ std::shared_ptr<SharedConnection> Dialog_Connection::connect_to_server_with_conn
unconst->set_connection_try_other_ports(false);
}
#endif //GLOM_ENABLE_CLIENT_ONLY
#endif //GLOM_ENABLE_POSTGRESQL
return result;
}
......@@ -146,7 +146,7 @@ void Dialog_Connection::load_from_document()
Glib::ustring host = document->get_connection_server();
if(host.empty())
host = "localhost";
m_entry_host->set_text(host);
m_entry_host->set_sensitive(true);
}
......@@ -156,7 +156,7 @@ void Dialog_Connection::load_from_document()
if(user.empty())
{
//Default to the UNIX user name, which is often the same as the Postgres user name:
const auto pchUser = getenv("USER");
const auto pchUser = getenv("USER");
if(pchUser)
user = pchUser;
}
......
......@@ -46,8 +46,8 @@ public:
///Disable irrelevant fields:
void set_connect_to_browsed();
/** Change the main message text of the dialog, so we can use the dialog
* to confirm that the user knows a password before disconnecting, when
/** Change the main message text of the dialog, so we can use the dialog
* to confirm that the user knows a password before disconnecting, when
* switching to network sharing.
*/
void set_confirm_existing_user_note();
......
......@@ -198,7 +198,7 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
#endif
m_select_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_select_clicked));
#ifndef GLOM_ENABLE_CLIENT_ONLY
m_notebook->signal_switch_page().connect(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_switch_page));
#endif /* !GLOM_ENABLE_CLIENT_ONLY */
......@@ -262,7 +262,7 @@ bool Dialog_ExistingOrNew::list_examples()
{
const char* examples_dir = "/org/gnome/glom/examples/";
const auto examples = Gio::Resource::enumerate_children_global(examples_dir);
bool example_found = false;
for(const auto& example_name : examples)
{
......@@ -641,7 +641,7 @@ Glib::ustring Dialog_ExistingOrNew::get_title_from_example(const std::string& re
{
auto stream =
Gio::Resource::open_stream_global(resource_name);
//TODO: Really do this asynchronously?
m_current_buffer.reset(new buffer);
const auto bytes_read = stream->read(m_current_buffer->buf, buffer::SIZE);
......
......@@ -92,12 +92,12 @@ private:
bool on_new_select_func(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool path_currently_selected);
void on_new_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
bool list_examples();
Glib::ustring get_title_from_example(const std::string& resource_name);
void append_example(const Glib::ustring& title, const std::string& resource_name);
#endif /* !GLOM_ENABLE_CLIENT_ONLY */
#ifndef G_OS_WIN32
static void on_service_found_static(EpcServiceMonitor* monitor, gchar* name, EpcServiceInfo* info, gpointer user_data);
static void on_service_removed_static(EpcServiceMonitor* monitor, gchar* name, gchar* type, gpointer user_data);
......@@ -108,8 +108,8 @@ private:
void on_existing_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
void on_select_clicked();
Gtk::Notebook* m_notebook;
Gtk::Button* m_select_button;
......@@ -142,7 +142,7 @@ private:
// For recently used resources:
Gtk::TreeModelColumn< Glib::RefPtr<Gtk::RecentInfo> > m_col_recent_info;
};