help on child menus (Re: MDI Child menus don't show.)



Thanks Jaka, I tried it, but I only can say that I don't wrote the
function you say, so the breakpoint only tells me that the function
don't executes the piece of the code creating the menu because
menu =! NULL is FALSE or something else, I don't remember. So I cleaned
my hard disk, I reinstalled Debian 2.1, I recompiled all libraries and
gnome sources, and STILL HAPPENS... :(.
I have written a very small problem to isolate the problem. I would
appreciate very much is someone can compile and execute it and tell what
happens.
After compiling the program, I execute it and a window containing a mdi child
appers, also, the "File" menu and the "child" menu, but, the problem is that
the child is not listed in the child menu, and neither the menu associated to it.
Please, tell me if something is wrong!
Thanks in advance.
Here is the program:
(compile with gcc `gnome-config --cflags gnomeui` `gnome-config --libs gnomeui`
child_menu_test.c
---begin child_menu_test.c---
#include <gnome.h>
/* Menu definitions */
static GnomeUIInfo file_menu[]= {
{ 
GNOME_APP_UI_ITEM,
N_("Exit"), N_("Exit ..."),
NULL, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_QUIT,
'Q', GDK_CONTROL_MASK, NULL
},
GNOMEUIINFO_END
};
GnomeUIInfo empty_menu[] = {
{ GNOME_APP_UI_ENDOFINFO }
};
static GnomeUIInfo main_menu[]= 
{
GNOMEUIINFO_SUBTREE(N_("File"), file_menu),
GNOMEUIINFO_SUBTREE(N_("Children"), empty_menu),
GNOMEUIINFO_END
};
/*Child Menu*/
GnomeUIInfo commands_menu[]= {
{
GNOME_APP_UI_ITEM,
N_("New"), N_("New ..."),
NULL, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_NEW,
0, (GdkModifierType)0, NULL
},
GNOMEUIINFO_END
};
/*Main Child Menu*/
GnomeUIInfo main_child_menu[] = {
GNOMEUIINFO_SUBTREE(N_("Commands"), commands_menu),
GNOMEUIINFO_END
};
GtkWidget *make_view(GnomeMDIChild *child, gpointer data)
{
GtkWidget *label;
label = gtk_label_new("This works!");
return label;
}
int
main(int argc, char *argv[])
{
GnomeMDI *mdi;
GnomeMDIGenericChild *child;
GnomeClient *client;
gnome_init ("control", 0, argc, argv);
client = gnome_master_client ();
mdi = GNOME_MDI(gnome_mdi_new("gdc", "GDC"));
gnome_mdi_set_menubar_template(mdi, main_menu);
gnome_mdi_set_child_menu_path(mdi, _("File"));
gnome_mdi_set_child_list_path(mdi, _("Children/"));
gnome_mdi_open_toplevel(mdi);
child = gnome_mdi_generic_child_new("Batch");
gnome_mdi_child_set_menu_template(GNOME_MDI_CHILD(child),
main_child_menu);
gnome_mdi_generic_child_set_view_creator(child, make_view, NULL);
gnome_mdi_add_child(mdi, GNOME_MDI_CHILD(child));
gnome_mdi_add_view(mdi, GNOME_MDI_CHILD(child));
gtk_main();	
}
---end child_menu_test.c---
Manuel Clos.
Jaka Mocnik wrote:
> 
> mclos000@correu.udg.es wrote:
> 
> > When doing:
> > gnome_mdi_child_set_menu_template(GNOME_MDI_CHILD(child), main_child_menu);
> > I receive no warning/error but when running the gnome app the menus won't change!
> > I come back to the gnome-hello-7-MDI and I changed the
> > #undef USE_TEMPLATES
> > to
> > #define USE_TEMPLATES
> well, it works fine for me. I am using the CVS gnome-libs, but neither
> apphelper or mdi have been changed much lately. if the problem still
> exists with your setup, could you go into a bit more detail about it.
> setting a breakpoint in gnome-mdi code (libgnomeui, gnome-mdi.c,
> app_set_view) and observing what happens there would also help a great
> deal.
> 
> > so, the menu creation is done trough the apphelper, but then the child menu don't
> > shows
> > and the "Children" menu won't contain any menuitem.
> does the child show at all?
> 
> > If a go back and use #undef USE_TEMPLATES to create the menus it works ok.
> > I have looked at ghex code, but they are using a subclass, ...
> there should be no great difference, really, the MDI only knows about
> GnomeMDIChild class, which is the base class for both generic children
> and the hex-document children.
> 
> > Won't this simple way work??
> it does on my here. and I don't see why it wouldn't on any other
> machine.
> 
> regards,
>         jaKa
> 
> --
> 
> w3:    http://pluton.ijs.si/~jaka
> email: jaka.mocnik@kiss.uni-lj.si
> 
> --
> To unsubscribe: mail gnome-devel-list-request@gnome.org with "unsubscribe"
> as the Subject.



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