glom r1388 - in trunk/glom: . libglom



Author: arminb
Date: Wed Jan 16 23:15:18 2008
New Revision: 1388
URL: http://svn.gnome.org/viewvc/glom?rev=1388&view=rev

Log:
2008-01-17  Armin Burgmeier  <armin openismus com>

	* glom/libglom/connection_pool.h:
	* glom/libglom/connection_pool.cc: Added
	ConnectionPool::get_try_other_ports().

	* glom/frame_glom.cc: Fixed connection proceduce after creating new
	self-hosted database by setting port and try_other_ports into in the
	document. These settings are later used for the connection. If we
	don't do that, port is 0 and we can't connect.


Modified:
   trunk/glom/frame_glom.cc
   trunk/glom/libglom/connectionpool.cc
   trunk/glom/libglom/connectionpool.h

Modified: trunk/glom/frame_glom.cc
==============================================================================
--- trunk/glom/frame_glom.cc	(original)
+++ trunk/glom/frame_glom.cc	Wed Jan 16 23:15:18 2008
@@ -1567,6 +1567,14 @@
         const bool test = connection_pool->start_self_hosting();
         if(!test)
           return false;
+
+        // Store in document, so these values are actually used when connecting
+	Document_Glom* document = get_document();
+	if(document)
+	{
+	  document->set_connection_port(connection_pool->get_port());
+          document->set_connection_try_other_ports(connection_pool->get_try_other_ports());
+	}
       }
       else
         return false;
@@ -1643,6 +1651,7 @@
         {
           //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.
+	  return false;
         }
         else
         {

Modified: trunk/glom/libglom/connectionpool.cc
==============================================================================
--- trunk/glom/libglom/connectionpool.cc	(original)
+++ trunk/glom/libglom/connectionpool.cc	Wed Jan 16 23:15:18 2008
@@ -603,6 +603,11 @@
   return m_port;
 }
 
+bool ConnectionPool::get_try_other_ports() const
+{
+  return m_try_other_ports;
+}
+
 Glib::ustring ConnectionPool::get_user() const
 {
   return m_user;
@@ -822,6 +827,7 @@
   if(!result)
   {
     std::cerr << "Error while attempting to self-host a database." << std::endl;
+    return false;
   }
 
   m_port = available_port; //Remember it for later.

Modified: trunk/glom/libglom/connectionpool.h
==============================================================================
--- trunk/glom/libglom/connectionpool.h	(original)
+++ trunk/glom/libglom/connectionpool.h	Wed Jan 16 23:15:18 2008
@@ -162,6 +162,7 @@
 
   Glib::ustring get_host() const;
   int get_port() const;
+  bool get_try_other_ports() const;
   Glib::ustring get_user() const;
   Glib::ustring get_password() const;
   Glib::ustring get_database() const;



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