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?

In reply to Gtk2::MozEmbed difficulties. by Socrates

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.