url doesn't show properly on first GtkAboutDialog creation with set_url_hook
| From: | Elizabeth Smith | Date: | Thu, 07 Sep 2006 13:39:31 +0000 |
| Subject: | url doesn't show properly on first GtkAboutDialog creation with set_url_hook | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-3396@lists.php.net to get a copy of this message | ||
I've run into a very strange bug with php-gtk 2.0.0alpha
GtkAboutDialog has a problem when using set_url_hook
The first time the GtkAboutDialog is created the url is not shown correctly (clickable), but the second time a GtkAboutDialog is created (and every subsequent time), it is shown correctly.
If you create two about dialogs - the second one is shown correctly if you use set_url_hook on the first one - even if you never show the first one or call $dialog->destroy() or unset it - so there is a workaround
A quick example -
<?php
$wnd = new GtkWindow();
$wnd->set_title('Hello world');
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
$button = new GtkButton('About');
$button->connect_simple('clicked', 'show_about');
$wnd->add($button);
$wnd->show_all();
Gtk::main();
function show_about()
{
$window = new GtkAboutDialog();
$window->set_website('http://php.net');
$window->set_url_hook('url_hook');
$window->show_all();
return;
}
function url_hook($window)
{
echo 'here I open a url';
return;
}
?>
Workaround Version of show_about
<?php
function show_about()
{
$window = new GtkAboutDialog();
$window->set_url_hook('url_hook');
$window = new GtkAboutDialog();
$window->set_website('http://php.net');
$window->set_url_hook('url_hook');
$window->show_all();
return;
}
?>
btw - this is on windows (XPproSP2) with the 5.1 version of php and php-gtk2 just in case that's important :)