Re: App exits with extra param - bug or feature?



I also find some features (if that's the right word) of Gtk::Application and Gio::Application overly complicated.

I've added a short description in the gtkmm tutorial, Chapter 8. "Container Widgets", "Multiple-item widgets", "Boxes", "Gtk::Application and command-line options". I've also modified the book/box example code,
http://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/box/main.cc
It didn't work, so something had to be done with it. Right now these changes are stored only in the git repository.

This is not the best possible place for a description of Gtk::Application. The gtkmm tutorial needs a separate chapter or section with a more complete description of Gtk::Application, but for now the description and code I added is better than nothing.

Kjell

2012-11-19 16:08, Jiergir Ogoerg skrev:
Thanks a lot, it works.
However, I mildly hope that whoever envisioned this sophisticated, weird, punishing (by exiting your app) and over-engineered solution for a non-problem (argument access) needs to get itself together and do something about it cause this type of approaches are exactly what app developers don't need nor like.

(sorry for the personal post, it's gmail's default behavior).


On Mon, Nov 19, 2012 at 4:30 PM, Kjell Ahlstedt <kjell ahlstedt bredband net> wrote:
2012-11-19 03:45, Jiergir Ogoerg skrev:
Hi, this is a reply to
https://mail.gnome.org/archives/gtkmm-list/2012-October/msg00047.html

Thanks, but can you please post a /working/ example that handles an argument from the command line?
I think gtkmm is (still) broken on this one, I followed your instruction and it still failed.

Using Ubuntu 12.10 which ships with gtkmm 3.5.13


The attached example works, i.e. it shows the window. I had to read some of glib's source code in order to understand that the signal_command_line() handler is called only if it is run before the default signal handler. I can't find that peculiarity mentioned in the glib documentation, and if it's not mentioned there, it's understandable that it's not mentioned in the documentation of Gio::Application.

An alternative way to handle command line parameters would be to handle them in main(), adjust argc and argv[] accordingly before they are given to Gtk::Application::create() (i.e. remove the handled parameters), and call Gtk::Application::create() without the Gio::APPLICATION_HANDLES_COMMAND_LINE flag.

Kjell




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