Problem with Gnome2::App menus



I wrote 2 years ago, an little Gnome app. To create the menus, i used 
the code below but it does not work anymore with gnome2. The window 
appears but when i activate the menu, nothing happen except the 
message :

***unhandled exception in callback :
*** Not a CODE reference at ...

The problem, i think, is that i use a wrong method to set up the 
user_data argument. 

Can anybody help me ?

############ example ######################"


    my $app=Gnome2::App->new($NAME,$NAME); 
    $self->fenetre($app); 
    $app->signal_connect('delete_event',sub {Gtk2->main_quit;return 
0;});


# Le menu Fichier
my $FILE_MENU= [
                ['item','Nouveau',undef,
[\&nouveau_document,$self],'stock','gtk-new'],
                ['item','Ouvrir',undef,
[\&ouvrir_document,$self],'stock','gtk-open',111,'control-mask'],
                ['separator'],
                ['item','Enregistrer',undef,
[\&enregistrer_document,$self],'stock','gtk-save',115,'control-mask'],
                ['item','Enregistrer sous',undef,
[\&enregistrer_sous,$self],'stock','gtk-save-as'],
                ['separator'],
                ['item','_Visualiser',undef,
[\&visualiser_document,$self],'stock','gtk-dnd',108,'control-mask'],
                ['separator'],
                ['item','Quitter',undef,[\&quitter,$self],'stock','gtk-
quit',113,'control-mask'],
                ['endofinfo']
               ];

# Pour les plus fainéants, on peut définir un menu
# à l'aide de tableaux mais il fait faire attention
# à l'ordre des éléments !
my $EDIT_MENU= [
                ['item','C_ut',undef,[\&couper,$self],'stock','gtk-
cut'],
                ['item','_Copy',undef,[\&copier,$self],'stock','gtk-
copy'],,
                ['item','_Paste',undef,[\&coller,$self],'stock','gtk-
paste'],
                ['endofinfo']
               ];


my $ABOUT_MENU = [
                  {type=>'item',
                   label=>'_About...',
                   pixmap_type=>'stock',
                   pixmap_info=>'gtk-about',
                   moreinfo=>\&afficher_about,
                   },
                { type=>'endofinfo'}
                  ];

my $MAIN_MENUS = [
               {
                   type=>'subtree',
                   label=>'_File',
                   moreinfo=>$FILE_MENU
                   },
               {
                   type=>'subtree',
                   label=>'_Edit',
                   moreinfo=>$EDIT_MENU
                   },
                 {
                   type=>'subtree',
                   label=>'_Help',
                   moreinfo=>$ABOUT_MENU,
                   }
               ];

#$self->fenetre->create_menus(@$MAIN_MENUS);
$app->create_menus([
               {
                   type=>'subtree',
                   label=>'_File',
                   moreinfo=>$FILE_MENU
                   },
               {
                   type=>'subtree',
                   label=>'_Edit',
                   moreinfo=>$EDIT_MENU
                   },
                 {
                   type=>'subtree',
                   label=>'_Help',
                   moreinfo=>$ABOUT_MENU
                   }
               ]);

##### end of example 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]