[glom] connection_request_password_and_choose_new_database_name(): Simplify more.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] connection_request_password_and_choose_new_database_name(): Simplify more.
- Date: Fri, 18 Dec 2015 10:01:14 +0000 (UTC)
commit 923886bdfae6dd33b9e01c219a3475820206137c
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Dec 18 10:37:49 2015 +0100
connection_request_password_and_choose_new_database_name(): Simplify more.
Extract the code to instantiate the connection dialog.
glom/frame_glom.cc | 39 ++++++++++++++++++---------------------
glom/frame_glom.h | 2 ++
2 files changed, 20 insertions(+), 21 deletions(-)
---
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index ace3430..0c255fb 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -1977,6 +1977,22 @@ bool Frame_Glom::connection_request_initial_password(Glib::ustring& user, Glib::
return (response == Gtk::RESPONSE_OK);
}
+void Frame_Glom::instantiate_dialog_connection()
+{
+ if(m_pDialogConnection)
+ return;
+
+ Utils::get_glade_widget_derived_with_warning(m_pDialogConnection);
+ if(!m_pDialogConnection)
+ {
+ std::cerr << G_STRFUNC << ": m_pDialogConnection is null." << std::endl;
+ }
+
+ add_view(m_pDialogConnection); //Also a composite view.
+
+ m_pDialogConnection->set_transient_for(*get_app_window());
+}
+
bool Frame_Glom::connection_request_password_and_choose_new_database_name()
{
auto document = dynamic_cast<Document*>(get_document());
@@ -2027,17 +2043,7 @@ bool Frame_Glom::connection_request_password_and_choose_new_database_name()
case Document::HostingMode::POSTGRES_CENTRAL:
case Document::HostingMode::MYSQL_CENTRAL:
{
- if(!m_pDialogConnection)
- {
- Utils::get_glade_widget_derived_with_warning(m_pDialogConnection);
- if(!m_pDialogConnection)
- {
- std::cerr << G_STRFUNC << ": m_pBox_Reports is null." << std::endl;
- return false;
- }
-
- add_view(m_pDialogConnection); //Also a composite view.
- }
+ instantiate_dialog_connection();
//Ask for connection details:
m_pDialogConnection->load_from_document(); //Get good defaults.
@@ -2233,18 +2239,9 @@ bool Frame_Glom::connection_request_password_and_attempt(bool& database_not_foun
//We recreate the dialog each time to make sure it is clean of any changes:
delete m_pDialogConnection;
m_pDialogConnection = nullptr;
-
- Utils::get_glade_widget_derived_with_warning(m_pDialogConnection);
- if(!m_pDialogConnection)
- {
- std::cerr << G_STRFUNC << ": m_pDialogConnection is null." << std::endl;
- return false;
- }
-
- add_view(m_pDialogConnection); //Also a composite view.
+ instantiate_dialog_connection();
m_pDialogConnection->load_from_document(); //Get good defaults.
- m_pDialogConnection->set_transient_for(*get_app_window());
//Show alternative text if necessary:
if(confirm_known_user)
diff --git a/glom/frame_glom.h b/glom/frame_glom.h
index a180ef2..60c12c3 100644
--- a/glom/frame_glom.h
+++ b/glom/frame_glom.h
@@ -226,6 +226,8 @@ private:
void alert_no_table();
+ void instantiate_dialog_connection();
+
//Signal handlers:
void on_notebook_find_criteria(const Gnome::Gda::SqlExpr& where_clause);
void on_button_quickfind();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]