Re: GtkFileSelection Example ?
| From: | Pablo Dall'Oglio | Date: | Fri, 10 May 2002 13:25:22 +0000 |
| Subject: | Re: GtkFileSelection Example ? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1949@lists.php.net to get a copy of this message | ||
a draft for a mp3 player....
I think It's a old example, my first program in php-gtk
<?
function playlist_create()
{
$fileSelection = &new GtkFileSelection();
$fileSelection->set_filename("/usr/local/");
$fileSelection->show();
//$fileSelection->set_position(GTK_WIN_POS_MOUSE);
$fileSelection->connect('delete-event', 'playlist_onDelete');
$cancel_button = $fileSelection->cancel_button;
$cancel_button->connect('clicked', 'playlist_onClose');
$ok_button = $fileSelection->ok_button;
$ok_button->connect('clicked', 'playlist_onOk');
}
function playlist_onClose($widget) //Evento que vem do botao, capturar evento
{
$window = $widget->get_toplevel();
$window->hide();
return true;
}
function playlist_onDelete($window)
{
$window->hide();
return true;
}
function playlist_stop()
{
exec("ps ax |grep mpg123", $output);
foreach ( $output as $t)
{
$a = explode(" ", $t);
// consertar o grep...
ereg('([0-9]+) +([^ ]) +([^ ]) +([^ ]) +([^ ])',$t,$a);
if (substr($a[12],0,6) == 'mpg123')
{
//echo("kill -9 $a[0]\n");
exec("kill -9 $a[0]");
}
}
}
function playlist_onOk($widget)
{
playlist_stop();
$window = $widget->get_toplevel();
$nome = $window->get_filename();
echo "\n Playing.... " . $window->get_filename() . "... \n";
exec("mpg123 \"$nome\" >/dev/null &");
$window->hide();
exit(0);
}
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
dl('php_gtk.dll');
else
dl('php_gtk.so');
playlist_create();
Gtk::main();
?>
On Fri, 10 May 2002 15:09:11 +0200
Holger Banko <holger.banko@pgam.com> wrote:
> Hi,
>
> can anybody give me a little Example how to use the GtkFileSelection Dialog ?
>
> Its look to me a little bit complicated. I don't know which signals I have to
> connect and how.
>
> I just need a the Filename (and path) the user selected. Simple Constructor
> and the getfilename Function seems not to be enough ;-).
>
> Thanks for your help !
>
> Holger
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
echo ereg_replace (" -> ", " \n", "cheers -> Pablo");
PS: A Brasilian word: "Valeu" = "Thanks" + "Bye"
+--------------------------------------------------+
| _ Pablo Dall'Oglio (pablo@php.net) |
| °v° Univates - IT Department +55 51 3714-7040 |
| /(_)\ The best source is the source code |
| ^ ^ Linux User n.223253, Lajeado, RS - Brasil |
+--------------------------------------------------+