Re: Gtk::Application and signal_startup()




2014-07-09 22:54, Christoph Brill skrev:
Hi list,

I'm currently working on porting meld (the diff viewer) from pygtk to gtkmm. It basically does the following when starting:

class MeldApp(Gtk.Application):
    def some_method():
        Gtk.Application.do_startup(self)
        widget = builder.get_widget()
        self.add_window(widget)
        app.run(sys.argv)

I'm trying to do the same, but calling this->add_window() segfaults in gtkapplicationimpl.c:88. I guess this is simply because I don't call "do_start()" prior to this->add_window(). This is due to the reason it only seems to exist in form of a signal in gtkmm. So my code basically does:

class MeldApp : public Gtk::Application {
    void some_method() {
#if 0
        Gtk::Application::do_startup();
#endif
        builder->get_widget("window", widget);
        this->add_window(widget);
        this->run(argc, argv);
    }
}

Can anyone suggest on how to initialize a child class of Gtk::Application (that was not instantiated using Gtk::Application::create())?

In case anyone wants to take a look at the code: https://github.com/egore/meld

I amend the last commit from time to time as way to much stuff is still if'ed out :D

Thanks in advance,
 Christoph


For examples of classes derived from Gtk::Application, see
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/application

Kjell


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