Hide labels when hiding form fields in the add_db window

Addresses Issue #1
This commit is contained in:
Timothy Warren 2012-02-22 11:57:25 -05:00
parent 9827a86a20
commit 9c41237f42

View File

@ -81,7 +81,7 @@ class Add_DB extends GtkWindow {
// Connection name // Connection name
{ {
$this->_add_row("Connection name", $this->conn, $y1, $y2); $this->_add_row("Connection name", 'conn', $y1, $y2);
} }
// Database type // Database type
@ -95,27 +95,27 @@ class Add_DB extends GtkWindow {
// DB File // DB File
{ {
$this->_add_row("Database File", $this->db_file, $y1, $y2); $this->_add_row("Database File", 'db_file', $y1, $y2);
} }
// Host // Host
{ {
$this->_add_row("Host", $this->host, $y1, $y2); $this->_add_row("Host", 'host', $y1, $y2);
} }
// Port // Port
{ {
$this->_add_row("Port", $this->port, $y1, $y2); $this->_add_row("Port", 'port', $y1, $y2);
} }
// Username // Username
{ {
$this->_add_row("User", $this->user, $y1, $y2); $this->_add_row("User", 'user', $y1, $y2);
} }
// Password // Password
{ {
$this->_add_row("Password", $this->pass, $y1, $y2); $this->_add_row("Password", 'pass', $y1, $y2);
} }
// Add connection button // Add connection button
@ -178,15 +178,19 @@ class Add_DB extends GtkWindow {
* *
* @param GtkTable &$table * @param GtkTable &$table
* @param string $label * @param string $label
* @param mixed &$vname * @param string $vname
* @param int &$y1 * @param int &$y1
* @param int &$y2 * @param int &$y2
*/ */
private function _add_row($label, &$vname, &$y1, &$y2) private function _add_row($label, $vname, &$y1, &$y2)
{ {
$lbl = new GtkLabel($label); $lbl = 'lbl'.$vname;
$this->$lbl = new GtkLabel($label);
$lblalign = new GtkAlignment(0, 0.5, 0, 0); $lblalign = new GtkAlignment(0, 0.5, 0, 0);
$lblalign->add($lbl); $lblalign->add($this->$lbl);
$vname =& $this->$vname;
$this->table->attach($lblalign, 0, 1, ++$y1, ++$y2); $this->table->attach($lblalign, 0, 1, ++$y1, ++$y2);
$this->table->attach($vname, 1, 2, $y1, $y2); $this->table->attach($vname, 1, 2, $y1, $y2);
@ -205,8 +209,11 @@ class Add_DB extends GtkWindow {
$this->host->set_text('localhost'); $this->host->set_text('localhost');
$this->db_file->set_filename(NULL); $this->db_file->set_filename(NULL);
$this->port->show(); $this->port->show();
$this->lblport->show();
$this->db_file->hide(); $this->db_file->hide();
$this->lbldb_file->hide();
$this->host->show(); $this->host->show();
$this->lblhost->show();
$this->user->set_text(''); $this->user->set_text('');
$this->pass->set_text(''); $this->pass->set_text('');
$this->port->set_text(''); $this->port->set_text('');
@ -229,17 +236,22 @@ class Add_DB extends GtkWindow {
case "Firebird": case "Firebird":
$this->user->set_text('sysdba'); $this->user->set_text('sysdba');
$this->pass->set_text('masterkey'); $this->pass->set_text('masterkey');
$this->lbldb_file->show();
$this->db_file->show(); $this->db_file->show();
break; break;
case "ODBC": case "ODBC":
$this->lbldb_file->show();
$this->db_file->show(); $this->db_file->show();
break; break;
case "SQLite": case "SQLite":
$this->lbldb_file->show();
$this->db_file->show(); $this->db_file->show();
$this->port->hide(); $this->port->hide();
$this->lblport->hide();
$this->host->hide(); $this->host->hide();
$this->lblhost->hide();
break; break;
} }
} }