diff --git a/index.php b/index.php index 2d2b474..3bcc0c2 100644 --- a/index.php +++ b/index.php @@ -115,6 +115,46 @@ if(function_exists('fbird_connect')) // -------------------------------------------------------------------------- +/** + * Create info dialog to retun an informational message + * + * @return void + */ +function alert($message) +{ + $dialog = new GTKMessageDialog( + NULL, + Gtk::DIALOG_MODAL, + Gtk::MESSAGE_INFO, + Gtk::BUTTONS_OK, + $message + ); + $dialog->run(); + $dialog->destroy(); +} + +// -------------------------------------------------------------------------- + +/** + * Create info dialog to retun an informational message + * + * @return void + */ +function error($message) +{ + $dialog = new GTKMessageDialog( + NULL, + Gtk::DIALOG_MODAL, + Gtk::MESSAGE_ERROR, + Gtk::BUTTONS_OK, + $message + ); + $dialog->run(); + $dialog->destroy(); +} + +// -------------------------------------------------------------------------- + // Create the main window new Main(); diff --git a/sys/windows/widgets/connection_sidebar.php b/sys/windows/widgets/connection_sidebar.php index 812c83f..01cbd24 100644 --- a/sys/windows/widgets/connection_sidebar.php +++ b/sys/windows/widgets/connection_sidebar.php @@ -223,6 +223,7 @@ class Connection_Sidebar extends GtkVBox { { $remove = new GtkImageMenuItem('Delete Connection'); $remove->set_image(GtkImage::new_from_stock(GTK::STOCK_CANCEL, Gtk::ICON_SIZE_MENU)); + $remove->connect_simple('activate', array($this, 'remove_connection')); $this->menu->append($remove); } @@ -237,10 +238,9 @@ class Connection_Sidebar extends GtkVBox { /** * Remove a connection from the connection manager * - * @param string $key * @return void */ - public function remove_connection($key) + public function remove_connection() { //@todo implement $model = $this->treeview->get_model(); diff --git a/sys/windows/widgets/db_info_widget.php b/sys/windows/widgets/db_info_widget.php index 72f1831..814bc69 100644 --- a/sys/windows/widgets/db_info_widget.php +++ b/sys/windows/widgets/db_info_widget.php @@ -259,31 +259,13 @@ class DB_Info_Widget extends GtkTable { } catch (PDOException $e) { - $dialog = new GTKMessageDialog( - NULL, - Gtk::DIALOG_MODAL, - Gtk::MESSAGE_ERROR, - Gtk::BUTTONS_OK, - "Error connecting to database: \n\n" . $e->getMessage() - ); - $dialog->run(); - $dialog->destroy(); - + error("Error connecting to database: \n\n" . $e->getMessage()); return; } // Successful Connection? // Tell the user! - $dialog = new GTKMessageDialog( - NULL, - Gtk::DIALOG_MODAL, - Gtk::MESSAGE_INFO, - Gtk::BUTTONS_OK, - "Successfully connected" - ); - - $dialog->run(); - $dialog->destroy(); + alert("Successfully Connected."); } /**