/* main window */
$this->window = new GtkWindow();
$this->window->set_title('PHPGtkTwitter');
$this->window->connect_simple('destroy', array('gtk', 'main_quit'));
/* virtical container box */
$vbox = new GtkVBox(false, 6);
$vbox->set_border_width(10);
$this->window->add($vbox);
/* title logo */
$image = GtkImage::new_from_pixbuf(
GdkPixbuf::new_from_file(DATADIR . "/twitter.png"));
$vbox->pack_start($image, false, true, 0);
/* status viewer on scrolled window */
$textview = new GtkTextView();
$textview->set_editable(false);
$textview->set_cursor_visible(false);
$textview->set_wrap_mode(Pango::WRAP_CHAR);
$textview->connect('motion-notify-event', array($this, 'textview_motion'));
$textview->connect('visibility-notify-event', array($this, 'textview_visibility'));
$textview->connect('event-after', array($this, 'textview_event_after'));
$swin = new GtkScrolledwindow();
$swin->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
$swin->add($textview);
$vbox->add($swin);
$buffer = $textview->get_buffer();
$buffer->connect('delete-range', array($this, 'buffer_delete_range'));
$this->window->set_data('buffer', $buffer);
...snip...
/* horizontal container box for buttons and entry */
$hbox = new GtkHBox(false, 6);
$vbox->pack_start($hbox, false, true, 0);
$this->window->set_data("toolbox", $hbox);
/* update button */
$button = new GtkButton();
$button->connect('clicked', array($this, 'update_friends_statuses'));
$image = GtkImage::new_from_pixbuf(
GdkPixbuf::new_from_file(DATADIR . "/reload.png"));
$button->add($image);
$hbox->pack_start($button, false, true, 0);
/* post button */
$button = new GtkButton();
$button->connect('clicked', array($this, 'post_status'));
$image = GtkImage::new_from_pixbuf(
GdkPixbuf::new_from_file(DATADIR . "/post.png"));
$button->add($image);
$hbox->pack_start($button, false, true, 0);
/* text entry */
$entry = new GtkEntry();
$this->window->set_data('entry', $entry);
$entry->connect('key-press-event', array($this, 'on_entry_keyp_ress'));
$hbox->pack_start($entry, true, true, 0);
/* request initial window size */
$this->window->set_size_request(300, 400);
$this->window->show_all();
/* show login dialog, and update friends status */
if ($this->login_dialog()) {
$this->update_friends_statuses();
Gtk::main();
}