#!/usr/bin/perl -w

#TITLE: Gnome App
#REQUIRES: Gtk Gnome

use strict;
use Gnome;

init Gnome "app-helper", "0.1";
my $app = new Gnome::App "app-helper", "gnome-app-helper test";
signal_connect $app 'delete_event', sub { Gtk->main_quit; return 0 };
$app->position('mouse');

$app->create_menus( 
{
    type        => 'subtree',
	label       => '_File',
    subtree     => [
        {
            type        => 'item',
			label       => 'New item',
			hint        => "New item tooltip",
            callback    => sub {print "New was triggered\n"}, 
			pixmap_type => 'stock',
			pixmap_info => 'Menu_New',
            accelerator_key => '78',
            ac_mods     => ['control-mask']

        }, [ 'item',
            "_Open...",
            "Open a file",
            sub {print "Array Open was triggered\n"},
            'stock',
            'Menu_Open',
            ord('O'),
            'control-mask'

        ]
    ]
}
);

$app->create_toolbar(
{   
    type        => 'item', 
    label       => 'Fred', 
    hint        => "Click here to quit",
    callback    => sub { Gtk->main_quit },
    pixmap_type => 'stock', 
    pixmap_info => 'Quit',
    accelerator_key => '81',
    ac_mods     => ['control_mask']

}, {
    type        => 'item', 
    label       => 'Wilma',
    pixmap_type => 'stock', 
    pixmap_info => 'Timer'

}, [
    'item', 
    'Barney', 
    'A tooltip for Barney', 
    sub {print "Barney was triggered\n"}, 
    'stock', 
    'About', 
    ord('A'),
    ['control-mask']
]

);

show_all $app;
main Gtk;

