php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50525 FileSelection Complete Failure
Submitted: 2009-12-18 19:58 UTC Modified: 2009-12-26 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: chezmmd at gmail dot com Assigned:
Status: No Feedback Package: PHP-GTK related
PHP Version: 5.2.12 OS: WinXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chezmmd at gmail dot com
New email:
PHP Version: OS:

 

 [2009-12-18 19:58 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-18 20:06 UTC] auroraeosrose@php.net
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 20:15 UTC] chezmmd at gmail dot com
GtkFileSelection isn't marked as deprecated...???
 [2009-12-18 20:37 UTC] auroraeosrose@php.net
GtkFileSelection has been deprecated since Gtk 2.12, so the 2.0.1 release of PHP-GTK does not yet mark it deprecated.

However the example code for me is working perfectly.

Run your script and then in the selection box hit the tab key

Notice how only files/folders that match *.txt are now shown?

You can probably simulate the keypress in your code to make the filter action transparent to the user.



 [2009-12-26 01:00 UTC] php-gtk-dev at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC