From 97196ac6c37cb92b3a16b60d30304f53905a581b Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 31 Jan 2012 12:42:38 -0500 Subject: [PATCH] Started Fleshing out add db connection window --- src/windows/add_db.php | 42 ++++++++++++++++++++++++++++++++++++++++++ src/windows/main.php | 7 +++++++ 2 files changed, 49 insertions(+) diff --git a/src/windows/add_db.php b/src/windows/add_db.php index 761e545..40b9989 100644 --- a/src/windows/add_db.php +++ b/src/windows/add_db.php @@ -20,6 +20,48 @@ class Add_DB extends GtkWindow { function __construct() { parent::__construct(); + + $this->set_title("OpenSQLManager - Add Database Connection"); + + $this->resize(400, 300); + + // Add the Vbox, and show the window + $this->add($this->_layout()); + $this->show_all(); + } + + /** + * Window layout + * + * @return GtkVBox + */ + private function _layout() + { + $table = new GtkTable(); + + $db_types = array( + 'MySQL', + 'PostgreSQL', + 'SQLite', + 'ODBC' + ); + + //Row 1 - Database type + $dbtypelbl = new GtkLabel("Database Type"); + $dbtype = GtkComboBox::new_text(); + $align = new GtkAlignment(0, 0.5, 0, 0); + $align->add($dbtypelbl); + + foreach($db_types as $t) + { + $dbtype->append_text($t); + } + + $table->attach($align, 0,1,0,1); + $table->attach($dbtype, 1,2,0,1); + + + return $table; } } diff --git a/src/windows/main.php b/src/windows/main.php index 24b80af..2262939 100644 --- a/src/windows/main.php +++ b/src/windows/main.php @@ -210,6 +210,8 @@ class Main extends GtkWindow { $add_button->set_label("New Connnection"); $add_button->set_image(GTKImage::new_from_stock(GTK::STOCK_ADD, Gtk::ICON_SIZE_SMALL_TOOLBAR)); + $add_button->connect_simple('clicked', array($this, 'new_conn')); + $conn_vbox = new GtkVBox(); $conn_vbox->pack_start($dblabel, FALSE); @@ -217,6 +219,11 @@ class Main extends GtkWindow { return $conn_vbox; } + + function new_conn() + { + return new Add_DB(); + } }