Re: ? gnome_startup_acquire_token in GNOME2

Sergey V. Udaltsov wrote:

	I've precisely no idea what you want that API for, or what it did in
Gnome 1.4, and/or whether it's a good idea to have it. Can you state the
problem you are trying to solve in a clear fashion.
I will try to explain. gnome_startup_acquire_token can be considered as
an atomic "check and conditionally set" function. The first parameter
(char*) is a kind of key. So when I wrote

if ( gnome_startup_acquire_token( "SOME_MY_KEY",
                                 gnome_client_get_id( client ) ) )
 // some code

I could be sure that my code is executed once per gnome session. Very
simple. I know I can work with OS-dependant mutexes, root window
properties etc - but gnome did all this work for me (well, at least I
believed it did). How can I code the same logic in GNOME 2?
From memory, this feature was implemented by setting a property on the root window. There are a number of problems with this, including:

  1. Using the root window does not give you "once per session"
     behaviour, but instead "once per screen".  If you really want once
     per session, then this may cause problems in multi-head setups.
      If you mean once per screen, then you will need to change what
     your code looks like in order to perform the initialisation on all
  2. causes problems if you run more than one session on the same
     display: consider getting X to start a single xterm.  Run
     gnome-session once in the xterm, then close the session.  Run
     gnome-session again.  The second time, you would still have the
     left over startup tokens.

Most of the things that used to use the above API have been integrated into gnome-settings-daemon. This daemon applies all those settings at session startup, and then listens for notification of preference changes from GConf, and updates the settings accordingly. The various control panels simply make the changes in the gconf database and things get applied.

Maybe you could get a better answer if you explained what you wanted to use the API for.


Email: james daa com au              |
WWW: | Jan 22-25 Perth, Western Australia.

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