#50525 [Fbk->Opn]: FileSelection Complete Failure

[email protected] ("chezmmd at gmail dot com") Fri, 18 Dec 2009 20:15:26 GMT
Newsgroups php.gtk.dev
Message-ID <[email protected]>
 ID:               50525
 User updated by:  chezmmd at gmail dot com
 Reported By:      chezmmd at gmail dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         PHP-GTK related
 Operating System: WinXP
 PHP Version:      5.2.12
 New Comment:

GtkFileSelection isn't marked as deprecated...???


Previous Comments:
------------------------------------------------------------------------

[2009-12-18 20:06:43] [email protected]

This is a problem in the gtk libraries themselves, not in the PHP
wrapper.  PHP just calls the underlying C method

GtkFileSelection is deprecated as well

Try using GtkFileChooserDialog with  the set_filter method instead

------------------------------------------------------------------------

[2009-12-18 19:58:33] chezmmd at gmail dot com

Description:
------------
Cannot get GtkFileSelection->complete to work, using current release.

Took online Manual example of object construction, and added a complete
stmt.  Results invalid.



Reproduce code:
---------------
<?php
//Creating and initialising the file selection prompt
$filePrompt = new GtkFileSelection('GtkFileSelection Demo');
$filePrompt->connect_simple(
    'destroy',
    array('Gtk', 'main_quit')
);

$filePrompt->complete("*.txt");

 
//Adding a quit button that destroys the prompt
$filePrompt->cancel_button->set_label('Quit');
$filePrompt->cancel_button->connect_simple(
    'clicked',
    array($filePrompt, 'destroy')
);
 
//Add an OK button that displays the file selected on click
$filePrompt->ok_button->set_label('Show the file');
$filePrompt->ok_button->connect('clicked', 'showFile');
 
//Callback function that displays the file name
function showFile($okbutton)
{
    $filePrompt = $okbutton->get_toplevel();
    $fileName = $filePrompt->get_filename();
    $message = new GtkMessageDialog(
        null,
        0,
        Gtk::MESSAGE_INFO,
        Gtk::BUTTONS_OK,
        'You selected: ' . $fileName
    );
    $message->run();
    $message->destroy();
}
 
//Show the prompt and start the main loop
$filePrompt->show();
Gtk::main();
?>

Expected result:
----------------
You should see only txt extension files in results window.  

Actual result:
--------------
You get all files listed


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50525&edit=1