Added generic confirm dialog

This commit is contained in:
Timothy Warren 2012-03-27 15:47:56 -04:00
parent fcd7ab58a8
commit 407bd26b0f
3 changed files with 50 additions and 0 deletions

View File

@ -118,6 +118,7 @@ if(function_exists('fbird_connect'))
/**
* Create info dialog to retun an informational message
*
* @param string $message
* @return void
*/
function alert($message)
@ -138,6 +139,7 @@ function alert($message)
/**
* Create info dialog to retun an informational message
*
* @param string $message
* @return void
*/
function error($message)
@ -155,6 +157,30 @@ function error($message)
// --------------------------------------------------------------------------
/**
* Creates a binary confirmation dialog
*
* @param string $message
* @return bool
*/
function confirm($message)
{
$dialog = new GTKMessageDialog(
NULL,
Gtk::DIALOG_MODAL,
Gtk::MESSAGE_QUESTION,
Gtk::BUTTONS_YES_NO,
$message
);
$answer = $dialog->run();
$dialog->destroy();
return ($answer === Gtk::RESPONSE_YES) ? TRUE : FALSE;
}
// --------------------------------------------------------------------------
// Create the main window
new Main();

View File

@ -123,6 +123,9 @@ class Settings {
{
return FALSE;
}
// Save the json
$this->__destruct();
}
// --------------------------------------------------------------------------
@ -143,6 +146,9 @@ class Settings {
{
return FALSE;
}
// Save the json
$this->__destruct();
}
// --------------------------------------------------------------------------
@ -161,6 +167,9 @@ class Settings {
// Remove the db name from the object
unset($this->current->dbs->{$name});
// Save the json
$this->__destruct();
}
// --------------------------------------------------------------------------

View File

@ -232,6 +232,16 @@ class Connection_Sidebar extends GtkVBox {
// --------------------------------------------------------------------------
/**
* Update the connection information for an existing connection
*/
public function edit_connection()
{
//@todo implement
}
// --------------------------------------------------------------------------
/**
* Remove a connection from the connection manager
*
@ -239,6 +249,11 @@ class Connection_Sidebar extends GtkVBox {
*/
public function remove_connection($col)
{
if ( ! confirm("Are you sure you want to remove this database connection?"))
{
return;
}
//@todo implement
$model = $this->treeview->get_model();
}