Adding DBs works
Well, adding the information. You have to close the program for the dbs to update, and there's no way to connect yet...
This commit is contained in:
parent
7ec35088b1
commit
b0da1994f5
@ -99,8 +99,9 @@ class Settings {
|
|||||||
*/
|
*/
|
||||||
function add_db($name, $params)
|
function add_db($name, $params)
|
||||||
{
|
{
|
||||||
if(empty($this->current->dbs->{$name}))
|
if(! isset($this->current->dbs->{$name}))
|
||||||
{
|
{
|
||||||
|
$this->current->dbs->{$name} = array();
|
||||||
$this->current->dbs->{$name} = $params;
|
$this->current->dbs->{$name} = $params;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
class Add_DB extends GtkWindow {
|
class Add_DB extends GtkWindow {
|
||||||
|
|
||||||
var $conn, $dbtype, $host, $user, $password, $database, $settings;
|
var $conn, $dbtype, $host, $user, $pass, $database, $settings;
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
@ -89,6 +89,15 @@ class Add_DB extends GtkWindow {
|
|||||||
$this->_add_row($table, "DB Password", $this->pass, $y1, $y2);
|
$this->_add_row($table, "DB Password", $this->pass, $y1, $y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add connection button
|
||||||
|
{
|
||||||
|
$add_button = new GtkButton();
|
||||||
|
$add_button->set_label("Add Connnection");
|
||||||
|
$add_button->set_image(GTKImage::new_from_stock(GTK::STOCK_ADD, Gtk::ICON_SIZE_SMALL_TOOLBAR));
|
||||||
|
$table->attach($add_button, 0, 3, ++$y1, ++$y2);
|
||||||
|
$add_button->connect_simple("clicked", array($this, 'db_add'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $table;
|
return $table;
|
||||||
}
|
}
|
||||||
@ -156,6 +165,24 @@ class Add_DB extends GtkWindow {
|
|||||||
$table->attach($lblalign, 0, 1, ++$y1, ++$y2);
|
$table->attach($lblalign, 0, 1, ++$y1, ++$y2);
|
||||||
$table->attach($vname, 1, 2, $y1, $y2);
|
$table->attach($vname, 1, 2, $y1, $y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the database to the settings file
|
||||||
|
*/
|
||||||
|
function db_add()
|
||||||
|
{
|
||||||
|
$data = array(
|
||||||
|
'type' => $this->dbtype->get_active_text(),
|
||||||
|
'host' => $this->host->get_text(),
|
||||||
|
'user' => $this->user->get_text(),
|
||||||
|
'pass' => $this->pass->get_text(),
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->settings->add_db($this->conn->get_text(), $data);
|
||||||
|
|
||||||
|
// Destroy this window
|
||||||
|
$this->destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of add_db.php
|
// End of add_db.php
|
@ -202,7 +202,7 @@ class Main extends GtkWindow {
|
|||||||
foreach($db_conns as $name => $props)
|
foreach($db_conns as $name => $props)
|
||||||
{
|
{
|
||||||
$db = $props;
|
$db = $props;
|
||||||
$db['name'] = $name;
|
$db->name = $name;
|
||||||
|
|
||||||
$iter = $model->append();
|
$iter = $model->append();
|
||||||
$model->set($iter, 0, $db);
|
$model->set($iter, 0, $db);
|
||||||
@ -237,7 +237,7 @@ class Main extends GtkWindow {
|
|||||||
function set_label($col, $cell, $model, $iter)
|
function set_label($col, $cell, $model, $iter)
|
||||||
{
|
{
|
||||||
$info = $model->get_value($iter, 0);
|
$info = $model->get_value($iter, 0);
|
||||||
$cell->set_property('text', $info['name']);
|
$cell->set_property('text', $info->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user