public function alert($title, $message)
 {
     $dialog = new GtkMessageDialog($this->window, 0, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, $message);
     $dialog->set_title($title);
     $dialog->run();
     $dialog->destroy();
 }
 function on_message_dialog_clicked($button)
 {
     $dialog = new GtkMessageDialog($this, Gtk::DIALOG_MODAL | Gtk::DIALOG_DESTROY_WITH_PARENT, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, sprintf('This message box has been popped up %d time%s.', $this->counter, $this->counter == 1 ? '' : 's'));
     $dialog->run();
     $dialog->destroy();
     $this->counter++;
 }
Exemple #3
0
 public function showFile()
 {
     $filePrompt = $this->fileSelect->ok_button->get_toplevel();
     $fileName = $filePrompt->get_filename();
     $message = new GtkMessageDialog(null, 0, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, 'You selected: ' . $fileName);
     $message->run();
     $message->destroy();
 }
Exemple #4
0
function gtk_die($message)
{
    $dialog = new GtkMessageDialog(null, 0, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, $message);
    $dialog->set_markup("<b>{$message}</b>\nPlease refer to the future docs for details!");
    $dialog->run();
    $dialog->destroy();
    die($message . "\n");
}
 function onClickedButton($button, $combo)
 {
     $number = $combo->get_active();
     $text = $combo->get_active_text();
     if ($combo instanceof GtkComboBoxEntry) {
         $owntext = "\r\n\r\nAs this is an GtkComboBoxEntry, we have an extra text:\r\n" . $combo->get_child()->get_text();
     } else {
         $owntext = '';
     }
     $dialog = new GtkMessageDialog($this, Gtk::DIALOG_MODAL | Gtk::DIALOG_DESTROY_WITH_PARENT, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, sprintf('The %s displays "%s" which is item #%d.%s', get_class($combo), $text, $number, $owntext));
     $dialog->run();
     $dialog->destroy();
 }
 /**
  * Inicia o dialogo
  * 
  * @name run() 
  * @return int
  */
 public function run()
 {
     // Inicia o dialogo
     $this->__return = parent::run();
     // Destroi o dialogo
     parent::destroy();
     // Retorna o retorno do dialogo
     return $this->__return;
 }
 function __construct()
 {
     $d = $this->data;
     foreach ($d as $v) {
         if (@md5_file($v["f"]) != $v["md5"]) {
             $this->txt .= "Invalid faile {$v['f']}\n";
         } else {
             $this->cg++;
         }
     }
     if (count($this->data) != $this->cg) {
         $dialog = new GtkMessageDialog(null, Gtk::DIALOG_MODAL | Gtk::DIALOG_DESTROY_WITH_PARENT, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, $this->txt);
         $dialog->run();
         $dialog->destroy();
         exit;
     }
 }
Exemple #8
0
 /**
  * on close the main window
  */
 function onClose()
 {
     $dialog = new GtkMessageDialog(null, Gtk::DIALOG_MODAL, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, 'Close the window ?');
     $dialog->set_position(GTK::WIN_POS_CENTER);
     $response = $dialog->run();
     if ($response == Gtk::RESPONSE_YES) {
         $dialog->destroy();
         return false;
     } else {
         $dialog->destroy();
         return true;
     }
 }
 public function onFullTextSearchClick()
 {
     if (!$this->manual) {
         // TODO: One might think aobut using an external browser or the online docs...
         $dialog = new \GtkMessageDialog($this->glade->get_widget('mainwindow'), 0, \Gtk::MESSAGE_ERROR, \Gtk::BUTTONS_OK, 'GtkHTML needed');
         $dialog->set_markup('For doing full text searches GtkHTML support is required in your PHP configuration.');
         $dialog->run();
         $dialog->destroy();
         return;
     }
     $input = trim($this->glade->get_widget('searchentry')->get_text());
     if (strlen($input) == 0) {
         $dialog = new \GtkMessageDialog($this->glade->get_widget('mainwindow'), 0, \Gtk::MESSAGE_ERROR, \Gtk::BUTTONS_OK, 'No input');
         $dialog->set_markup('No search term entered');
         $dialog->run();
         $dialog->destroy();
         return;
     }
     $results = $this->manual->searchFulltext($input);
     $store = new \GtkTreeStore(\GObject::TYPE_STRING, \GObject::TYPE_PHP_VALUE);
     foreach ($results as $title => $found) {
         $man_container = $store->append(null, array($title, null));
         $basenamelen = strlen('phar://' . $found->getArchiveFileName());
         echo 'phar://' . $found->getArchiveFileName(), "\n";
         foreach ($found as $item) {
             /** @var $item \SplFileObject */
             $doc = \DomDocument::loadHTMLFile($item->getPathname());
             $caption = $doc->getElementsByTagName('title')->item(0)->firstChild->wholeText;
             $store->append($man_container, array($caption, $item));
         }
     }
     $tree = $this->glade->get_widget('searchtreeview');
     $tree->set_model($store);
     $tree->get_selection()->connect('changed', array($this->mainWindow, 'onSearchResultClick'));
     /* TODO: Move to view  */
     $cell_renderer = new \GtkCellRendererText();
     $colExt = new \GtkTreeViewColumn('', $cell_renderer, 'text', 0);
     $tree->append_column($colExt);
 }
 public function onSaveClick()
 {
     // obtém os valores dos campos
     $dados['id'] = $this->campos['id']->get_text();
     $dados['nome'] = $this->campos['nome']->get_text();
     $dados['endereco'] = $this->campos['endereco']->get_text();
     $dados['telefone'] = $this->campos['telefone']->get_text();
     $dados['id_cidade'] = $this->campos['id_cidade']->get_active();
     try {
         // instancia cliente SOAP
         $client = new SoapClient(NULL, array('encoding' => 'ISO-8859-1', 'exceptions' => TRUE, 'location' => "http://127.0.0.1/server.php", 'uri' => "http://test-uri/"));
         // realiza chamada remota de método
         $retorno = $client->salvar($dados);
         // exibe diálogo de mensagem
         $dialog = new GtkMessageDialog(null, Gtk::DIALOG_MODAL, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, 'Registro inserido com sucesso!');
         $dialog->run();
         $dialog->destroy();
     } catch (SoapFault $excecao) {
         // exibe diálogo de erro
         $error = new GtkMessageDialog(null, Gtk::DIALOG_MODAL, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, $excecao->getMessage());
         $error->run();
         $error->destroy();
     }
 }
 public function confirmDeletion()
 {
     $dialog = new GtkMessageDialog($this->window, 0, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, 'Are you sure?');
     $dialog->set_title('Confirm Deletion');
     $dialog->run() === Gtk::RESPONSE_YES && call_user_func_array($this->events[self::E_DELETE], array());
     $dialog->destroy();
 }
Exemple #12
0
    function about_dialog()
    {
        $message = '
		HashGen v0.1
			
1. To select a file click Open.
2. To enter a string click Type.
3. Click Hash to get the hashes.

Copyright 2010.  Nayan Shah (nayanmange@gmail.com) ';
        $dialog = new GtkMessageDialog($this, Gtk::DIALOG_DESTROY_WITH_PARENT, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, $message);
        $dialog->run();
        $dialog->destroy();
    }
Exemple #13
0
 function ask()
 {
     $response = parent::run();
     parent::destroy();
     return $response;
 }
 /**
  * on close the main window
  */
 function onClose()
 {
     $dialog = new GtkMessageDialog(null, Gtk::DIALOG_MODAL, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, TAdiantiCoreTranslator::translate('Quit the application ?'));
     $dialog->set_position(GTK::WIN_POS_CENTER);
     $response = $dialog->run();
     if ($response == Gtk::RESPONSE_YES) {
         $dialog->destroy();
         return false;
     } else {
         $dialog->destroy();
         return true;
     }
 }
Exemple #15
0
function run_gource(GtkWindow $wnd, GtkEntry $txtRepositoryPath, $options)
{
    //fetch the values from the widgets into variables
    $strRepositoryPath = $txtRepositoryPath->get_text();
    //Do some error checking
    $errors = null;
    if (strlen($strRepositoryPath) == 0) {
        $errors .= "you need some path!.\r\n";
    }
    if ($errors !== null) {
        //save setting
        $settings = new Settings();
        $settings->set("last_repo_path", $strRepositoryPath);
        //There was at least one error.
        //We show a message box with the errors
        $dialog = new GtkMessageDialog($wnd, Gtk::DIALOG_MODAL, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, $errors);
        $dialog->set_markup("The following errors occured:\r\n" . "<span foreground='red'>" . $errors . "</span>");
        $dialog->run();
        $dialog->destroy();
    } else {
        $dialog = new GtkMessageDialog($wnd, Gtk::DIALOG_MODAL, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK);
        $dialog->set_markup("running gource on repository...\npath: " . $txtRepositoryPath->get_text() . "\n");
        $dialog->run();
        $dialog->destroy();
        $arr_hide_options = array();
        $arr_normal_options = array();
        foreach ($options as $option_name => $option) {
            if ($option->get_active() != 1) {
                continue;
            }
            switch ($option_name) {
                case 'chkOptionHideFiles':
                    $arr_hide_options[] = "files";
                    break;
                case 'chkOptionHideFilenames':
                    $arr_hide_options[] = "filenames";
                    break;
                case 'chkOptionHideDirnames':
                    $arr_hide_options[] = "dirnames";
                    break;
                case 'chkOptionHideDates':
                    $arr_hide_options[] = "date";
                    break;
                case 'chkOptionHideProgress':
                    $arr_hide_options[] = "progress";
                    break;
                case 'chkOptionHideBloom':
                    $arr_hide_options[] = "bloom";
                    break;
                case 'chkOptionHideMouse':
                    $arr_hide_options[] = "mouse";
                    break;
                case 'chkOptionHideTree':
                    $arr_hide_options[] = "tree";
                    break;
                case 'chkOptionHideUsers':
                    $arr_hide_options[] = "users";
                    break;
                case 'chkOptionHideUsernames':
                    $arr_hide_options[] = "usernames";
                    break;
                case 'chkOptionFullscreen':
                    $arr_normal_options[] = "--fullscreen";
                    break;
                case 'chkOptionMultiSampling':
                    $arr_normal_options[] = "--multi-sampling";
                    break;
                case 'chkOptionTransparent':
                    $arr_normal_options[] = "--transparent";
                    break;
                case 'chkOptionSaveConfig':
                    $arr_normal_options[] = "--save-config default.conf";
                    break;
            }
        }
        // "&" is added to run gource in background
        if (!empty($arr_hide_options)) {
            $str_hide_options = implode(',', $arr_hide_options);
            $str_normal_options = implode(' ', $arr_normal_options);
            system('gource ' . $txtRepositoryPath->get_text() . " --hide {$str_hide_options} {$str_normal_options} &", $gource_return);
        } else {
            $str_normal_options = implode(' ', $arr_normal_options);
            system('gource ' . $txtRepositoryPath->get_text() . " {$str_normal_options}  &", $gource_return);
        }
        //No error. You would need to hide the dialog now
        //instead of destroying it (because when you destroy it,
        //Gtk::main_quit() gets called) and show the main window
        //$wnd->destroy();
    }
}
Exemple #16
0
    function about_dialog()
    {
        $message = '
		File Shredder v0.1
			
1. Click Open to select a file to delete.
2. Click the Delete button to PERMANENTLY delete the file.

Copyright 2010.  Nayan Shah (nayanmange@gmail.com) ';
        $dialog = new GtkMessageDialog($this, Gtk::DIALOG_DESTROY_WITH_PARENT, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, $message);
        $dialog->run();
        $dialog->destroy();
    }