I wrote a small app to play sounds at custom speed.
Now I just wanted to read command line arguments from the main to allow to open sound files.
Looking at the example here, it involves creating an Application, an ApplicationWindow and one view window for each opened sound.
In my app, having an ApplicationWindow makes no sense : no visual controls are to be shared between views, and I just need the user to have one window opened, not two, when he wants to open a sound.
So is there a gtk/gnome way for a program to use the filename passed in the command line (and open-with desktop function) without creating an extra useless window ?
You can skip the
Thanks a lot !
So I just skip the ApplicationWindow creation and it works fine.
Doing so, the application is still running for no reason when I close all the views. In order for this not to happen, would getting signals on views destruction, then closing when count reach zero be a good approach ?
The app is supposed to automatically shutdown when all the windows have been closed. Maybe, there is some gtkmm specific behavior that I’m missing (I don’t use C++) or something specific to your app that is causing the issue.
application.hg says that
* If all the windows managed by Gtk::Application are closed (hidden) or
* removed from the application then the call to run() will return,
* unless Gio::Application::hold() has been called.
So it sounds like something else is going on. Maybe you could open a new thread (since this one was solved) and link to your code so far.
Thanks @mazharhussain and @dboles for the detail. Works perfectly : I now call
add_window for each view, and the app automatically closes when none remain.
Nice! I guess the behavior of auto-closing once all windows are hidden only starts taking effect once at least one has been added.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.