Class UriLauncher

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class UriLauncher extends GObject

Asynchronous API to open a uri with an application.

GtkUriLauncher collects the arguments that are needed to open the uri.

Depending on system configuration, user preferences and available APIs, this may or may not show an app chooser dialog or launch the default application right away.

The operation is started with the launch(Window, Cancellable, AsyncReadyCallback) function.

To launch a file, use FileLauncher.

Since:
4.10
  • Constructor Details

    • UriLauncher

      public UriLauncher(MemorySegment address)
      Create a UriLauncher instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • UriLauncher

      public UriLauncher(@Nullable String uri)
      Creates a new GtkUriLauncher object.
      Parameters:
      uri - the uri to open
      Since:
      4.10
    • UriLauncher

      public UriLauncher()
      Create a new UriLauncher.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the UriLauncher class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected UriLauncher asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • canLaunch

      public boolean canLaunch(@Nullable Window parent)

      Returns whether the launcher is likely to succeed in launching an application for its uri.

      This can be used to disable controls that trigger the launcher when they are known not to work.

      Parameters:
      parent - the parent window
      Returns:
      false if the launcher is known not to support the uri, true otherwise
      Since:
      4.20
    • getUri

      public @Nullable String getUri()
      Gets the uri that will be opened.
      Returns:
      the uri
      Since:
      4.10
    • launch

      public void launch(@Nullable Window parent, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)

      Launches an application to open the uri.

      This may present an app chooser dialog to the user.

      Parameters:
      parent - the parent window
      cancellable - a cancellable to cancel the operation
      callback - a callback to call when the operation is complete
      Since:
      4.10
    • launchFinish

      public boolean launchFinish(AsyncResult result) throws GErrorException
      Finishes the launch(Window, Cancellable, AsyncReadyCallback) call and returns the result.
      Parameters:
      result - the result
      Returns:
      true if an application was launched
      Throws:
      GErrorException - see GError
      Since:
      4.10
    • setUri

      public void setUri(@Nullable String uri)
      Sets the uri that will be opened.
      Parameters:
      uri - the uri
      Since:
      4.10
    • builder

      public static UriLauncher.Builder<? extends UriLauncher.Builder> builder()
      A UriLauncher.Builder object constructs a UriLauncher with the specified properties. Use the various set...() methods to set properties, and finish construction with UriLauncher.Builder.build().
      Returns:
      the builder object