Sign up

gtk.Application's addOnActivate and addOnStartup

I seem to have a complete blind spot for the difference between the startup event and the activate event associated with gtk.Application. No matter how many times I read the gtkmm documentation and the gtk+3 documentation I still can't seem to internalise the lifecycle and thus the difference between these and when to use which.

Anyone out there got an understanding and a "guide to Russel the Unable to Get it"?

Re: gtk.Application's addOnActivate and addOnStartup

On 16-05-18 17:24, Russel Winder wrote:

I seem to have a complete blind spot for the difference between the startup event and the activate event associated with gtk.Application. No matter how many times I read the gtkmm documentation and the gtk+3 documentation I still can't seem to internalise the lifecycle and thus the difference between these and when to use which.

Anyone out there got an understanding and a "guide to Russel the Unable to Get it"?

I think the signals only differ when you are using a "Unique" (Single
instance) application, in that case you have a primary instance which is
the first run of the application, and if the application is started
again it will be a secondary instance that will communicate some info on
why it was started to the primary instance, and exit.

The "startup" signal will only be emitted for the primary instance.
While the "activate" signal will be emitted for every instance.

Re: gtk.Application's addOnActivate and addOnStartup

I think the signals only differ when you are using a "Unique" (Single
instance) application, in that case you have a primary instance which is
the first run of the application, and if the application is started
again it will be a secondary instance that will communicate some info on
why it was started to the primary instance, and exit.

The "startup" signal will only be emitted for the primary instance.
While the "activate" signal will be emitted for every instance.

This is excellent, thank you. This gives the data I have been unable to deduce or infer previously.

Sadly I have such an application, so I am going to have to sort this out.