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



Bug or feature? I don't really know. Anyway I had to make some changes in Gtk::Application, because applications that used Gtk::ApplicationWindow instead of Gtk::Window crashed. See https://bugzilla.gnome.org/show_bug.cgi?id=681323#c1.

The new version 3.5.13 is more like the example programs shipped with gtk+, so I suppose it's more like the developers of glib and gtk+ think it shall be done.

The problem for you is that if you add Gio::APPLICATION_HANDLES_COMMAND_LINE, the default implementation of virtual function local_command_line() does not emit the activate signal, which is now necessary, or else the window will not be added to the application and shown. If you use Gio::APPLICATION_HANDLES_COMMAND_LINE you must either override Gio::Application:local_command_line_vfunc() in a subclass, or (easier) connect to Gio::Application::signal_command_line(). In your signal handler, handle the command line arguments and then call Gio::Application::activate().

There is a long description of Gio::Application:run() at http://developer.gnome.org/glibmm/unstable/classGio_1_1Application.html. Read carefully and slowly, it's not easy to understand all the details.

Kjell

2012-10-12 21:40, Фамилия Имя skrev:
Hi,

If I add the param "Gio::APPLICATION_HANDLES_COMMAND_LINE" to Gtk::Application it exits automatically.
Is it a bug or feature?
Simple sample:

#include <gtkmm.h>

int
main(int argc, char *argv[]) {
	Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv,
	"org.app.com");//, Gio::APPLICATION_HANDLES_COMMAND_LINE);
	Gtk::Window win;
	win.show_all();
	app->run(win);
	return 0;
}

It compiles and runs fine, however if you add/uncomment the Gio::APPLICATION_HANDLES_COMMAND_LINE param
to the app it will compile fine but the executable execute past app->run(win) and just exit.

It happens on Ubuntu 12.10 amd64 which ships with libgtkmm-3.0-dev version  3.5.13-0ubuntu1

On Ubuntu 12.04 I don't have this subtle issue, however it complains if I don't add this param yet access the param list later on.




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