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



On Mon, 2006-01-09 at 16:56 +0100, Andrea wrote:
> 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);

I guess you need to use Gnome::Main. However, it isn't very nice, and
you almost certainly don't need/want to use a GnomeApp anyway. It's
unpleasant and soon to be deprecated. A regular GtkWindow with a menu
and toolbar should be fine.

>  >     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.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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