Added general "alert" dialog, and "error" dialog

This commit is contained in:
Timothy Warren 2012-03-26 15:55:36 -04:00
parent 427a1c0ccb
commit a77591dfa7
3 changed files with 44 additions and 22 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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.");
}
/**