Class GDBus


  • public class GDBus
    extends java.lang.Object
    General purpose DBus interface for SWT to interact with the operating system and vice versa. (See also WebkitGDBus for the webkit specific gdbus interface). This implementation uses GDBus (Gnome DBus) to implement the DBus interface. It can be reached via: gdbus call --session --dest org.eclipse.swt --object-path /org/eclipse/swt --method org.eclipse.swt.YOUR_METHOD YOUR_ARGS where YOUR_ARGS can be something like "MyString" or "['/tmp/myFile', '/tmp/myFile2']" etc.. For hygiene purposes, GVariant/GDBus native types/values should *never* leave this class. Convert on the way in/out. Technical notes: - Concurrent gdbus names can co-exist. (i.e, multiple session names in single proc). Meaning if you don't like org.eclipse.swt, you can add more session names. - This implementation is only a small subset of GDBus. E.g not all types are translated and not functionality implemented. Add them as you need them. - At time of writing (v 1.4), only handles incoming gdbus calls. But could be easily extended to handle outgoing gdbus calls.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  GDBus.GDBusMethod  
    • Constructor Summary

      Constructors 
      Constructor Description
      GDBus()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void init​(GDBus.GDBusMethod[] methods, java.lang.String appName)
      Instantiate GDBus for use by SWT.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GDBus

        public GDBus()
    • Method Detail

      • init

        public static void init​(GDBus.GDBusMethod[] methods,
                                java.lang.String appName)
        Instantiate GDBus for use by SWT. Note, a new SWT instance that runs this "Steals" the session bus, but upon termination it returns the session back to the previous owner. To make this more flexible we append appName (derived from the application executable but can be set with the command-line argument -name) to the session name.
        Parameters:
        methods - GDBus methods that we should handle.
        appName - appName to append to GDBus object name if not null