Re: [[gnomemm] Initializing an inherited Gtk::Widget with Glade XML's get_widget()]



James Widman wrote:
Murray Cumming wrote:
> Have you ruled out the dynamic_cast<> gcc bug mentioned in the gtkmm FAQ?


Suddenly it dawned me that I *hadn't* ruled out that bug. :)

Ok, so after getting rid of more C++ stuff, I found that:

class Base : public Gtk::Menu {
public:
    Base(const Glib::ustring& menu_name) : Gtk::Menu(
        GTK_MENU(glade_xml_get_widget(
            (_xml = glade_xml_new(
                 (ENV_VARS.pkgdatadir + menu_name + ".glade").c_str(), menu_name.c_str(), "" )),
            menu_name.c_str())))
    {}
    ~Base() {
        // gtk_object_unref( GTK_OBJECT(_xml));
    }
private:
    GladeXML* _xml;
};

...works well, except for the leaking GladeXML :)
(can't seem to convince my build environment that
 <gtk/gtkobject.h> defines gtk_object_unref(), but that's
another issue).

Thanks Murray

--James




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