public class Application extends Application
Applications are unique in your desktop session; once the program is running subsequent invocations of the binary will result in a signal being sent to the original, known as the "primary" instance.
You can model several different program styles this way. A straight forward and common use is for subsequent invocations merely to "wake" the primary, perhaps bringing it to front. In this example, you start by constructing an Application object:
 app = new Application("com.example.MasterControlProgram");
 
 
 in this case "registering" the DBus name
 com.example.MasterControlProgram as the unique identifier for
 this application. As with a plain GTK program, you then enter the main
 loop, but instead of Gtk.main() you use Application's
 run() to do so:
 
 app.run(args);
 the original process blocks in this call (and runs a GTK main loop and your
 widgets start receiving event signals). Subsequent programs attempting to
 register that name (ie, this same code being run through a second time but
 by a different invocation of your program) will implicitly discover that
 they are not the primary instance; the remote
 will return from the call to run() although how fast this
 occurs depends on actions the primary takes.
 
 
 The Application.Startup will be fired once for an instance
 when it becomes primary. So, that's the place to put your UI
 setup code.
 
 
 Application.Activate will occurs when when Application's
 activate() is called. It is also raised when the
 primary begins running the first time if no flags were passed to the
 Application constructor.
 
 
 If the application has been configured as passing command line arguments
 from remote instances to the primary, then instead of
 Application.Activate, the Application.CommandLine
 signal will be raised on the primary. You can always call
 activate() from this handler thereby concentrating the code to
 deal with raising the UI there.
 
 
 For each principle GTK Window you create, call Application's
 addWindow() and be sure to put a call to
 Application's removeWindow() in
 that Window's Window.DeleteEvent handler. The runtime system
 will keep track of these registered Windows; your application will
 terminate when the last one is destroyed.
 
 
 You can also call Application's quit() to exit
 the program.
 
 
 The call to Gtk.init() or creating a
 new Application() must be the first thing done in your
 program.
| Modifier and Type | Class and Description | 
|---|---|
static interface  | 
Application.Activate
This signal is emitted on the primary instance when an
 activation occurs. 
 | 
static interface  | 
Application.CommandLine
This signal is emitted on the primary instance when command
 line arguments are to be processed. 
 | 
static interface  | 
Application.Startup
This signal is emitted on the primary instance when any of
 the conditions starting the program are raised. 
 | 
| Constructor and Description | 
|---|
Application(long pointer)  | 
Application(String id)
Creates a new Application instance. 
 | 
Application(String id,
           ApplicationFlags flags)
Creates a new Application instance. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addWindow(Window window)
Adds a window from the Application. 
 | 
void | 
connect(Application.Activate handler)
Hook up the  
Application.Activate handler. | 
void | 
connect(Application.CommandLine handler)
Hook up the  
Application.CommandLine handler. | 
void | 
connect(Application.Startup handler)
Hook up the  
Application.Startup handler. | 
Window[] | 
getWindows()
Returns an array of the  
windows currently associated
 with Application. | 
int | 
inhibit(Window window,
       ApplicationInhibitFlags flags,
       String reason)
Inform the session manager that certain types of actions should be
 inhibited. 
 | 
boolean | 
isInhibited(ApplicationInhibitFlags flags)
Determines if any of the actions specified in  
flags are
 currently inhibited (possibly by another application). | 
void | 
removeWindow(Window window)
Removes a window from the Application. 
 | 
void | 
uninhibit(int cookie)
Removes an inhibitor that has been established with
  
inhibit(). | 
activate, getApplicationId, getFlags, getInactivityTimeout, hold, isRemote, quit, run, setApplicationId, setFlags, setInactivityTimeout, unholdpublic Application(long pointer)
public Application(String id)
id must be a valid
 identifier; see isValidID(). This id needs to be common between all instances of the
 application; it is what enables the uniqueness mechanism.
 
 This constructor implies a normal application with default uniqueness behaviour: first instance will become primary, subsequent instances will communicate activation to the primary then terminate.
public Application(String id,
           ApplicationFlags flags)
id needs to be a
 valid identifier, see
 isValidID() for
 details. The flags argument allows you to specify
 different behaviour, marking this program as a
 launcher or
 service, for
 example.public void addWindow(Window window)
removeWindow() is called.public void connect(Application.Activate handler)
Application.Activate handler.public void connect(Application.CommandLine handler)
Application.CommandLine handler. This signal
 will only be raised if the Application was constructed with the
 HANDLES_COMMAND_LINE
 flag.public void connect(Application.Startup handler)
Application.Startup handler.public Window[] getWindows()
windows currently associated
 with Application.public int inhibit(Window window, ApplicationInhibitFlags flags, String reason)
 Applications should invoke this method when they begin an operation
 that should not be interrupted, such as creating a CD or DVD. The types
 of actions that may be blocked are specified by the flags
 parameter. When the application completes the operation it should call
 uninhibit() to remove the inhibitor. Note that
 an application can have multiple inhibitors, and all of them must be
 individually removed. Inhibitors are also cleared when the application
 exits.
 
 
Applications should not expect that they will always be able to block the action. In most cases, users will be given the option to force the action to take place.
 Reasons should be short and to the point. If window is not
 null, the session manager may point the user to this window to find out
 more about why the action is inhibited.
public boolean isInhibited(ApplicationInhibitFlags flags)
flags are
 currently inhibited (possibly by another application).public void removeWindow(Window window)
public void uninhibit(int cookie)
inhibit().
 Inhibitors are also cleared when the application exits.