glom r1534 - in trunk: . glom/libglom glom/utility_widgets



Author: murrayc
Date: Tue Apr  8 04:27:22 2008
New Revision: 1534
URL: http://svn.gnome.org/viewvc/glom?rev=1534&view=rev

Log:
2008-04-08  Murray Cumming  <murrayc murrayc com>

* glom/libglom/Makefile.am:
* glom/libglom/test_connectionpool.cc: Added this test.

* glom/utility_widgets/Makefile.am:
* glom/utility_widgets/test_flowtable.cc: Revived this test.

Added:
   trunk/glom/libglom/test_connectionpool.cc
Modified:
   trunk/ChangeLog
   trunk/glom/libglom/Makefile.am
   trunk/glom/utility_widgets/Makefile.am
   trunk/glom/utility_widgets/test_flowtable.cc

Modified: trunk/glom/libglom/Makefile.am
==============================================================================
--- trunk/glom/libglom/Makefile.am	(original)
+++ trunk/glom/libglom/Makefile.am	Tue Apr  8 04:27:22 2008
@@ -48,13 +48,20 @@
 libglom_la_LIBADD += -lutil
 endif
 
-noinst_PROGRAMS = test_sharedptr_layoutitem
+
+#Small test programs:
+noinst_PROGRAMS = test_sharedptr_layoutitem test_connectionpool
 
 test_sharedptr_layoutitem_SOURCES = test_sharedptr_layoutitem.cc
 test_sharedptr_layoutitem_LDADD =  libglom.la \
               $(GLOM_LIBS)
 
+test_connectionpool_SOURCES = test_connectionpool.cc
+test_connectionpool_LDADD =  libglom.la \
+              $(GLOM_LIBS)
+
 if !WIN32
 test_sharedptr_layoutitem_LDADD += -lutil
+test_connectionpool_LDADD += -lutil
 endif
 

Added: trunk/glom/libglom/test_connectionpool.cc
==============================================================================
--- (empty file)
+++ trunk/glom/libglom/test_connectionpool.cc	Tue Apr  8 04:27:22 2008
@@ -0,0 +1,71 @@
+/* Glom
+ *
+ * Copyright (C) 2008 Murray Cumming
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+ 
+#include <libgdamm/init.h>
+#include <glom/libglom/connectionpool.h>
+
+
+int
+main(int argc, char* argv[])
+{
+  Gnome::Gda::init("test", "0.1", argc, argv);
+
+  //Set the connection details:
+  Glom::ConnectionPool* connection_pool = Glom::ConnectionPool::get_instance();
+  if(connection_pool)
+  {
+    //Set the connection details in the ConnectionPool singleton.
+    //The ConnectionPool will now use these every time it tries to connect.
+
+    connection_pool->set_database("glom_musiccollection217");
+    connection_pool->set_host("localhost");
+    connection_pool->set_user("murrayc");
+    connection_pool->set_password("murraycpw");
+
+    connection_pool->set_port(5433);
+    connection_pool->set_try_other_ports(false);
+
+    connection_pool->set_ready_to_connect(); //Box_DB::connect_to_server() will now attempt the connection-> Shared instances of m_Connection will also be usable.
+  }
+
+  //Connect:
+  Glom::sharedptr<Glom::SharedConnection> connection;
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  connection = Glom::ConnectionPool::get_and_connect();
+#else
+  std::auto_ptr<ExceptionConnection> error;
+  connection = Glom::ConnectionPool::get_and_connect(error);
+#endif
+
+  if(connection)
+    std::cout << "Connected" << std::endl;
+  else
+    std::cout << "Connection failed." << std::endl;
+
+  //Cleanup:
+  Glom::ConnectionPool::delete_instance();
+
+  return 0;
+}
+
+
+
+
+

Modified: trunk/glom/utility_widgets/Makefile.am
==============================================================================
--- trunk/glom/utility_widgets/Makefile.am	(original)
+++ trunk/glom/utility_widgets/Makefile.am	Tue Apr  8 04:27:22 2008
@@ -54,9 +54,9 @@
                               db_adddel/libutility_widgets_db_adddel.a \
                               canvas/libutility_widgets_canvas.a
 
-#noinst_PROGRAMS = test_flowtable
-#test_flowtable_SOURCES = test_flowtable.cc flowtable.cc flowtable.h
-#test_flowtable_LDADD =  $(GLOM_LIBS)
+noinst_PROGRAMS = test_flowtable
+test_flowtable_SOURCES = test_flowtable.cc flowtable.cc flowtable.h
+test_flowtable_LDADD =  $(GLOM_LIBS)
 
 
 

Modified: trunk/glom/utility_widgets/test_flowtable.cc
==============================================================================
--- trunk/glom/utility_widgets/test_flowtable.cc	(original)
+++ trunk/glom/utility_widgets/test_flowtable.cc	Tue Apr  8 04:27:22 2008
@@ -19,11 +19,12 @@
  */
  
 #include <gtkmm.h>
-#include "flowtablewithfields.h"
+#include "flowtable.h"
 
 
-#include "dragwindow.h"
+//#include "dragwindow.h"
 
+/*
 void on_drag_data_get_label(const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData& selection_data, guint, guint)
 {
   selection_data.set(selection_data.get_target(), 8, (const guchar*)"label", 5);
@@ -33,14 +34,13 @@
 {
   selection_data.set(selection_data.get_target(), 8, (const guchar*)"entry", 5);
 }
-
-#include "dragwindow.h"
+*/
 
 int
 main(int argc, char* argv[])
 {
   Gtk::Main mainInstance(argc, argv);
-#if 0
+
   Gtk::Window window;
   //Gtk::VBox flowtable;
   Glom::FlowTable flowtable;
@@ -76,11 +76,10 @@
 
   flowtable.set_padding(20);
 
-  Glom::DragWindow drag_window;
-  drag_window.show();
+//  Glom::DragWindow drag_window;
+//  drag_window.show();
   
   Gtk::Main::run(window);
-#endif
 
   return 0;
 }



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