[glom] MySQL: Add checkboxes to select MySQL when it is in the build.



commit ee434b337b943819936d06073d73583258022c73
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jan 11 22:19:21 2013 +0100

    MySQL: Add checkboxes to select MySQL when it is in the build.
    
            * glom/utility_widgets/filechooserdialog_saveextras.[h|cc]:
    Add checkboxes for self-hosting and central MySQL servers.
            * glom/frame_glom.cc: Handle MySQL too, though the
    MySQL startup does not actually work here, though it
    does in the tests.

 ChangeLog                                          |   10 ++++++
 glom/frame_glom.cc                                 |    6 ++--
 .../filechooserdialog_saveextras.cc                |   31 +++++++++++++++++++-
 .../utility_widgets/filechooserdialog_saveextras.h |    5 +++
 4 files changed, 48 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8f308b9..b0afe15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2013-01-11  Murray Cumming  <murrayc murrayc com>
 
+        MySQL: Add checkboxes to select MySQL when it is in the build.
+
+        * glom/utility_widgets/filechooserdialog_saveextras.[h|cc]:
+	Add checkboxes for self-hosting and central MySQL servers.
+        * glom/frame_glom.cc: Handle MySQL too, though the 
+	MySQL startup does not actually work here, though it
+	does in the tests.
+
+2013-01-11  Murray Cumming  <murrayc murrayc com>
+
         FileChooserDialog_SaveExtras: Simplify the ifdefing.
 
         * glom/utility_widgets/filechooserdialog_saveextras.cc:
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index e35f5d6..bf97262 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -1926,6 +1926,7 @@ bool Frame_Glom::connection_request_password_and_choose_new_database_name()
   switch(hosting_mode)
   {
     case Document::HOSTING_MODE_POSTGRES_SELF:
+    case Document::HOSTING_MODE_MYSQL_SELF:
     {
       Glib::ustring user, password;
 
@@ -1964,8 +1965,8 @@ bool Frame_Glom::connection_request_password_and_choose_new_database_name()
 
     break;
 
-#ifdef GLOM_ENABLE_POSTGRESQL
     case Document::HOSTING_MODE_POSTGRES_CENTRAL:
+    case Document::HOSTING_MODE_MYSQL_CENTRAL:
     {
       //Ask for connection details:
       m_pDialogConnection->load_from_document(); //Get good defaults.
@@ -1996,11 +1997,10 @@ bool Frame_Glom::connection_request_password_and_choose_new_database_name()
     }
 
     break;
-#endif //GLOM_ENABLE_POSTGRESQL
 #ifdef GLOM_ENABLE_SQLITE
   case Document::HOSTING_MODE_SQLITE:
     {
-      // sqlite
+      // SQLite:
       ConnectionPool::SlotProgress slot_ignored;
       if(!handle_connection_initialize_errors( connection_pool->initialize(slot_ignored)) )
         return false;
diff --git a/glom/utility_widgets/filechooserdialog_saveextras.cc b/glom/utility_widgets/filechooserdialog_saveextras.cc
index f1cc9ff..9abef82 100644
--- a/glom/utility_widgets/filechooserdialog_saveextras.cc
+++ b/glom/utility_widgets/filechooserdialog_saveextras.cc
@@ -143,8 +143,20 @@ void FileChooserDialog_SaveExtras::create_child_widgets()
   m_radiobutton_server_sqlite.set_group(group);
   vbox->pack_start(m_radiobutton_server_sqlite);
   m_radiobutton_server_sqlite.show();
+#endif
 
-  //m_radiobutton_server_postgres_selfhosted.set_active(true); // Default
+#ifdef GLOM_ENABLE_MYSQL
+  m_radiobutton_server_mysql_selfhosted.set_label(_("Create MySQL database in its own folder, to be hosted by this computer."));
+  m_radiobutton_server_mysql_selfhosted.set_tooltip_text(_("MySQL support in Glom is experimental and unlikely to work properly."));
+  m_radiobutton_server_mysql_selfhosted.set_group(group);
+  vbox->pack_start(m_radiobutton_server_mysql_selfhosted);
+  m_radiobutton_server_mysql_selfhosted.show();
+
+  m_radiobutton_server_mysql_central.set_label(_("Create database on an external MySQL database server, to be specified in the next step."));
+  m_radiobutton_server_mysql_central.set_tooltip_text(_("MySQL support in Glom is experimental and unlikely to work properly."));
+  m_radiobutton_server_mysql_central.set_group(group);
+  vbox->pack_start(m_radiobutton_server_mysql_central);
+  m_radiobutton_server_mysql_central.show();
 #endif
 
 #endif // !GLOM_ENABLE_CLIENT_ONLY
@@ -179,6 +191,16 @@ void FileChooserDialog_SaveExtras::set_extra_newdb_hosting_mode(Document::Hostin
     m_radiobutton_server_sqlite.set_active();
     break;
 #endif //GLOM_ENABLE_SQLITE
+
+#ifdef GLOM_ENABLE_MYSQL
+  case Document::HOSTING_MODE_MYSQL_CENTRAL:
+    m_radiobutton_server_mysql_central.set_active();
+    break;
+  case Document::HOSTING_MODE_MYSQL_SELF:
+    m_radiobutton_server_mysql_selfhosted.set_active();
+    break;
+#endif //GLOM_ENABLE_SQLITE
+
   default:
     g_assert_not_reached();
     break;
@@ -204,6 +226,13 @@ Document::HostingMode FileChooserDialog_SaveExtras::get_extra_newdb_hosting_mode
     return Document::HOSTING_MODE_SQLITE;
 #endif //GLOM_ENABLE_SQLITE
 
+#ifdef GLOM_ENABLE_MYSQL
+  if(m_radiobutton_server_mysql_central.get_active())
+    return Document::HOSTING_MODE_MYSQL_CENTRAL;
+  else if(m_radiobutton_server_mysql_selfhosted.get_active())
+    return Document::HOSTING_MODE_MYSQL_SELF;
+#endif //GLOM_ENABLE_MYSQL
+
   g_assert_not_reached();
 
 #ifdef GLOM_ENABLE_SQLITE
diff --git a/glom/utility_widgets/filechooserdialog_saveextras.h b/glom/utility_widgets/filechooserdialog_saveextras.h
index 2eda4c3..e4872f3 100644
--- a/glom/utility_widgets/filechooserdialog_saveextras.h
+++ b/glom/utility_widgets/filechooserdialog_saveextras.h
@@ -77,6 +77,11 @@ private:
   Gtk::RadioButton m_radiobutton_server_sqlite;
 #endif // GLOM_ENABLE_SQLITE
 
+#ifdef GLOM_ENABLE_MYSQL
+  Gtk::RadioButton m_radiobutton_server_mysql_central;
+  Gtk::RadioButton m_radiobutton_server_mysql_selfhosted;
+#endif // GLOM_ENABLE_MYSQL
+
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 };
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]