Socrates has asked for the wisdom of the Perl Monks concerning the following question:

I was able to get Gtk2::MozEmbed working initially, but it's giving me some trouble. The goal of my little project is to provide me with a persistent, bare-bones browser window that I can minimize to the notification area. Basically, I'm making what amounts to a webmail "client". I'm having some problems, however, and I'm wondering if they just result from a misunderstanding on my part. Given the following code, I get the beginnings of what I desire, with a simple system-tray icon that displays a window that, when closed, simply hides itself:
#!/usr/bin/perl use Glib qw(TRUE FALSE); use Gtk2 -init; use Gtk2::MozEmbed; use Gtk2::TrayIcon; Gtk2->init; Gtk2::MozEmbed -> set_profile_path($ENV{ HOME } . "/.mybrowser", "MyBr +owser"); my $window = Gtk2::Window -> new(); my $moz = Gtk2::MozEmbed -> new(); $window -> signal_connect(delete_event => sub { $window->hide_all; return TRUE; }); $window -> set_title("MyBrowser"); $window -> set_default_size(600, 400); $window -> add($moz); $moz -> load_url("http://gmail.com"); # Tray icon my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file("/usr/share/icons/gnome/ +24x24/apps/gnome-window-manager.png"); my $icon = Gtk2::Image->new_from_pixbuf($pixbuf); my $trayicon = Gtk2::TrayIcon->new("browser"); my $tooltip= Gtk2::Tooltips->new; $tooltip->set_tip($trayicon, "browser"); my $eventbox = Gtk2::EventBox->new; $eventbox->add($icon); $trayicon->add($eventbox); $eventbox->signal_connect(button_release_event=> sub{ $window->show_all; }); $trayicon->show_all; Gtk2->main;
When I click the icon for the first time, the window appears just as it is supposed to and gmail renders inside of it. I close it, and it hides. When I click the icon again, however, the window returns, but it is simply grey, with no controls inside of it, and any further attempts to call methods on the MozEmbed object do nothing. I've tried replacing the MozEmbed object with a simple icon, and it works; the icon persists over hide-show cycles. Is there something more I need to be doing, or is this a bug in Gtk2::MozEmbed?

Replies are listed 'Best First'.
Re: Gtk2::MozEmbed difficulties.
by Anonymous Monk on Aug 26, 2008 at 06:23 UTC
    Is there something more I need to be doing, or is this a bug in Gtk2::MozEmbed?

    Try using --gtk-debug for clues