[Glade-users] Problem with menu accelerators in glade-2



Hi all.

I'm using glade-2 for generating interfaces, using libglade2 while
executing.

I've defined the main application window in a file called "main.glade",
and then, I'm defining different "component" interfaces in other
different glade files.

I've defined a Menubar widget, with associated accelerator keys (as
Ctrl+N for "New", etc.), and another "component" widgets in a file
called "vat.glade"

But when I launch the main window, loading the GladeXML object from
"main.glade" and I insert manually the widgets in "vat.glade" (after
loading them), the accelerator keys in the menubar don't work.

This is the code that creates the main window and the others about the
menubar. What changes must I do for making it work?
--
void main_window_show()
{
        gchar     * xml_file = NULL;
        GtkWidget * widget = NULL;

        main_window_active_component = MAIN_WINDOW_VAT_COMPONENT;

        if (! main_window_xml) {                
                xml_file = g_build_filename (PACKAGE_DATA_DIR,  
                           "aspl-fact", "glade", "main.glade", NULL );
                
                main_window_xml = glade_xml_new (xml_file, 
                                  "main_window", NULL);
                
                glade_xml_signal_autoconnect (main_window_xml);
        }

        widget = glade_xml_get_widget (main_window_xml, "main_window");

        if (!widget) {
                g_error (_("Couldn't find 'main_window' widget in  
                            main.glade"));
                exit (1);
        }


        main_window_menubar_create ();
        main_window_toolbar_create ();
        main_window_component_create ();

        gtk_widget_show (widget);

        return;
}

void main_window_menubar_create () 
{
        GtkWidget          * menubar;
        GtkWidget          * menubar_container;
                
        menubar = create_menubar ();

        menubar_container = glade_xml_get_widget (main_window_xml, 
                            "main_window_menubar_handlebox");
        
        gtk_container_add (GTK_CONTAINER(menubar_container), menubar);

        return;
}

GtkWidget *create_menubar()
{
        gchar     * xml_file = NULL;
        GtkWidget * widget = NULL;

        if (! tax_vat_menubar_xml) {
                xml_file = g_build_filename (PACKAGE_DATA_DIR, 
                         "aspl-fact", "glade", "vat.glade", NULL );
                
                tax_vat_menubar_xml = glade_xml_new (xml_file, 
                        "vat_menubar", NULL);
                
                glade_xml_signal_autoconnect (tax_vat_menubar_xml);

        }

        widget = glade_xml_get_widget (tax_vat_menubar_xml, 
                        "vat_menubar");

        gtk_widget_show (widget);

        return widget;
}


Thank you

-- 
David Mar�n Carre�o <david aspl es>
Advanced Software Production Line, S.L.





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