Re: gnome_program_init() error while loading main window with libglademm



Yes, you should derive your window from Window. Loading it from the gladefile is done by:

---- begin main.cpp ----
...
Glib::RefPtr<Gnome::Glade::Xml> refXml = Gnome::Glade::Xml::create("fogwer.glade");
Gtk::Main kit(argc, argv);
FogwerGui* window;
window = refXml->get_widget_derived("app_main", window);
kit.run(window)
...

---- end main.cpp ----

Of course you should then also define a constructor for FogwerGui that takes the right arguments like seen in the documentation (http://gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch19s03.html), because then you will get a reference to refXml inside the constructor and can load the children of window by using refXml->get_widget().


Andrea schrieb:
I tried to write a little program that opens loads a window from a glade file.
When the program starts I get this error:
GnomeUI-ERROR **: You must call gnome_program_init() before creating a GnomeApp
aborting...

Have I to call this function or it is the same og a Gtk::Main object?
Here's my code:
(main.cpp)
>     Gtk::Main kit(argc, argv);
>     FogwerGui window;
>     kit.run(window.get_main_window());

(fogwergui.h)
> class FogwerGui {
> ...
>    Gtk::Window &get_main_window(); // just returns *main_window
>    Gtk::Window *main_window, *pref_window;
>    Gtk::VBox *menubox_auto, *menubox_generic;
> ... }

(fogwergui.cpp)
>FogwerGui::FogwerGui(MenuManager &m)
>{
> Glib::RefPtr<Gnome::Glade::Xml> refXml = Gnome::Glade::Xml::create("fogwer.glade");
>    if(!refXml) return;
>    refXml->get_widget("app_main", main_window);
>    refXml->get_widget("win_pref", pref_window);
>    refXml->get_widget("auto_menu", menubox_auto);
>    refXml->get_widget("generic_menu", menubox_generic);
>    main_window->show();
>}

Have I to make my class derive from Gtk::Window?
But if I do so, I can't load the window from the glade file... i haven't understood anything.

What's wring? and I'm sorry... I can't speak English. I hope you will understand me.




--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Vuoi proteggere la tua casa? Chiedi a Ras come, clicca e fai un preventivo online!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4028&d=9-1
_______________________________________________
gnomemm-list mailing list
gnomemm-list gnome org
http://mail.gnome.org/mailman/listinfo/gnomemm-list






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