Re: How should I use Gio::APPLICATION_HANDLES_OPEN ?



On Wed, 2013-11-13 at 23:43 +0000, Rupert Swarbrick wrote:
Rupert Swarbrick <rswarbrick gmail com> writes:
Hi there,

I'm trying (and seemingly failing!) to work out how to get GApplication
/ its C++ wrapper to correctly load stuff specified on the command line.

I can't work out what you're supposed to do from the Glibmm
documentation or from the GIO reference manual. Am I supposed to just
pass the flag and then implement some virtual function? Or is there a
different way I should be doing it?

What I've done which works:

 (1) Get hold of the GApplication via the gobj() member function

 (2) Use g_signal_connect to add a (static) handler for the "open"
     signal, passing a pointer to my instance as the user_data
     parameter.

There should be no need to use the C API. Gio::Application has a
signal_open().

However, I think it's simpler to derive your own Application class, like
so:
https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/application/simple/exampleapplication.cc

That then overrides on_open(), which is the default signal handler for
the "open" signal.

(These new Gtk::Application examples are not described in the gtkmm
book's text yet.)

 (3) Call a non-static open() function from that signal handler.

But, given that

  virtual void Gio::Application::on_open (...)

exists, I guess there is a different way that one is supposed to be able
to do it, without grubbing around with void*'s?

Yes. See above.

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