diff --git a/sys/common/data_grid.php b/sys/common/data_grid.php index a4fb318..089f797 100644 --- a/sys/common/data_grid.php +++ b/sys/common/data_grid.php @@ -62,13 +62,11 @@ class Data_Grid extends GtkTreeView { // -------------------------------------------------------------------------- /** - * Return a new Data_grid object - * - * @param object $model + * Empty the model */ public function reset($model = null) { - return new Data_Grid($model); + $this->model->clear(); } } // End of data_grid.php \ No newline at end of file diff --git a/sys/windows/widgets/connection_sidebar.php b/sys/windows/widgets/connection_sidebar.php index a53491a..03f218f 100644 --- a/sys/windows/widgets/connection_sidebar.php +++ b/sys/windows/widgets/connection_sidebar.php @@ -83,8 +83,10 @@ class Connection_Sidebar extends GtkVBox { */ protected function _render() { - // Initialize the treeview - $this->treeview = new Data_Grid(); + // Create the treeview + $this->treeview = (isset($this->treeview)) + ? $this->treeview + : new Data_Grid(); $model = $this->treeview->get_model(); @@ -240,6 +242,16 @@ class Connection_Sidebar extends GtkVBox { // -------------------------------------------------------------------------- + /** + * Recreate sidebar widget to update connections + */ + public function refresh() + { + $this->_render(); + } + + // -------------------------------------------------------------------------- + /** * Update the connection information for an existing connection */ diff --git a/sys/windows/widgets/db_info_widget.php b/sys/windows/widgets/db_info_widget.php index ef34be2..b41b64b 100644 --- a/sys/windows/widgets/db_info_widget.php +++ b/sys/windows/widgets/db_info_widget.php @@ -251,7 +251,7 @@ class DB_Info_Widget extends GtkTable { $this->settings->add_db($data['name'], $data); // Pass to connection sidebar to update - // @todo Add new db to treeview + Connection_Sidebar::get_instance()->refresh(); // Destroy the parent window $parent_window =& $this->get_parent_window(); @@ -278,7 +278,7 @@ class DB_Info_Widget extends GtkTable { $this->settings->update_db($data['name'], $data); // Pass to connection sidebar to update - // @todo Update db in treeview + Connection_Sidebar::get_instance()->refresh(); // Let the user know the connection has been updated alert("Changes to database connection have been saved");