Class SignalGroup

All Implemented Interfaces:
PointerInterface

public class SignalGroup extends Object
#GSignalGroup manages to simplify the process of connecting
many signals to a #GObject as a group. As such there is no API
to disconnect a signal from the group.

In particular, this allows you to:

- Change the target instance, which automatically causes disconnection
of the signals from the old instance and connecting to the new instance.
- Block and unblock signals as a group
- Ensuring that blocked state transfers across target instances.

One place you might want to use such a structure is with #GtkTextView and
#GtkTextBuffer. Often times, you'll need to connect to many signals on
#GtkTextBuffer from a #GtkTextView subclass. This allows you to create a
signal group during instance construction, simply bind the
#GtkTextView:buffer property to #GSignalGroup:target and connect
all the signals you need. When the #GtkTextView:buffer property changes
all of the signals will be transitioned correctly.

https://docs.gtk.org/gobject/class.SignalGroup.html

  • Field Details

  • Constructor Details

    • SignalGroup

      public SignalGroup(PointerContainer pointer)
    • SignalGroup

      public SignalGroup(long target_type)
      Creates a new #GSignalGroup for target instances of @target_type.
      Parameters:
      target_type - the #GType of the target instance.
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • block

      public void block()
      Blocks all signal handlers managed by @self so they will not
      be called during any signal emissions. Must be unblocked exactly
      the same number of times it has been blocked to become active again.

      This blocked state will be kept across changes of the target instance.
    • connect

      public void connect(@Nonnull Str detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data)
      Connects @c_handler to the signal @detailed_signal
      on the target instance of @self.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form "signal-name::detail"
      c_handler - the #GCallback to connect
      data - the data to pass to @c_handler calls
    • connect

      public void connect(String detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data)
      Connects @c_handler to the signal @detailed_signal
      on the target instance of @self.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form "signal-name::detail"
      c_handler - the #GCallback to connect
      data - the data to pass to @c_handler calls
    • connectAfter

      public void connectAfter(@Nonnull Str detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data)
      Connects @c_handler to the signal @detailed_signal
      on the target instance of @self.

      The @c_handler will be called after the default handler of the signal.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form "signal-name::detail"
      c_handler - the #GCallback to connect
      data - the data to pass to @c_handler calls
    • connectAfter

      public void connectAfter(String detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data)
      Connects @c_handler to the signal @detailed_signal
      on the target instance of @self.

      The @c_handler will be called after the default handler of the signal.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form "signal-name::detail"
      c_handler - the #GCallback to connect
      data - the data to pass to @c_handler calls
    • connectClosure

      public void connectClosure(@Nonnull Str detailed_signal, @Nonnull Closure closure, boolean after)
      Connects @closure to the signal @detailed_signal on #GSignalGroup:target.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form `signal-name` with optional `::signal-detail`
      closure - the closure to connect.
      after - whether the handler should be called before or after the default handler of the signal.
    • connectClosure

      public void connectClosure(String detailed_signal, @Nonnull Closure closure, boolean after)
      Connects @closure to the signal @detailed_signal on #GSignalGroup:target.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form `signal-name` with optional `::signal-detail`
      closure - the closure to connect.
      after - whether the handler should be called before or after the default handler of the signal.
    • connectData

      public void connectData(@Nonnull Str detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data, SignalGroup.OnClosureNotify notify, int flags)
      Connects @c_handler to the signal @detailed_signal
      on the target instance of @self.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form "signal-name::detail"
      c_handler - the #GCallback to connect
      data - the data to pass to @c_handler calls
      notify - function to be called when disposing of @self
      flags - the flags used to create the signal connection
    • connectData

      public void connectData(String detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data, SignalGroup.OnClosureNotify notify, int flags)
      Connects @c_handler to the signal @detailed_signal
      on the target instance of @self.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form "signal-name::detail"
      c_handler - the #GCallback to connect
      data - the data to pass to @c_handler calls
      notify - function to be called when disposing of @self
      flags - the flags used to create the signal connection
    • connectObject

      public void connectObject(@Nonnull Str detailed_signal, SignalGroup.OnCallback c_handler, @Nonnull Pointer object, int flags)
      Connects @c_handler to the signal @detailed_signal on #GSignalGroup:target.

      Ensures that the @object stays alive during the call to @c_handler
      by temporarily adding a reference count. When the @object is destroyed
      the signal handler will automatically be removed.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form `signal-name` with optional `::signal-detail`
      c_handler - the #GCallback to connect
      object - the #GObject to pass as data to @c_handler calls
      flags - #GConnectFlags for the signal connection
    • connectObject

      public void connectObject(String detailed_signal, SignalGroup.OnCallback c_handler, @Nonnull Pointer object, int flags)
      Connects @c_handler to the signal @detailed_signal on #GSignalGroup:target.

      Ensures that the @object stays alive during the call to @c_handler
      by temporarily adding a reference count. When the @object is destroyed
      the signal handler will automatically be removed.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form `signal-name` with optional `::signal-detail`
      c_handler - the #GCallback to connect
      object - the #GObject to pass as data to @c_handler calls
      flags - #GConnectFlags for the signal connection
    • connectSwapped

      public void connectSwapped(@Nonnull Str detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data)
      Connects @c_handler to the signal @detailed_signal
      on the target instance of @self.

      The instance on which the signal is emitted and @data
      will be swapped when calling @c_handler.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form "signal-name::detail"
      c_handler - the #GCallback to connect
      data - the data to pass to @c_handler calls
    • connectSwapped

      public void connectSwapped(String detailed_signal, SignalGroup.OnCallback c_handler, @Nullable Pointer data)
      Connects @c_handler to the signal @detailed_signal
      on the target instance of @self.

      The instance on which the signal is emitted and @data
      will be swapped when calling @c_handler.

      You cannot connect a signal handler after #GSignalGroup:target has been set.
      Parameters:
      detailed_signal - a string of the form "signal-name::detail"
      c_handler - the #GCallback to connect
      data - the data to pass to @c_handler calls
    • dupTarget

      public Pointer dupTarget()
      Gets the target instance used when connecting signals.
      Returns:
      The target instance
    • setTarget

      public void setTarget(@Nullable Pointer target)
      Sets the target instance used when connecting signals. Any signal
      that has been registered with g_signal_group_connect_object() or
      similar functions will be connected to this object.

      If the target instance was previously set, signals will be
      disconnected from that object prior to connecting to @target.
      Parameters:
      target - The target instance used when connecting signals.
    • unblock

      public void unblock()
      Unblocks all signal handlers managed by @self so they will be
      called again during any signal emissions unless it is blocked
      again. Must be unblocked exactly the same number of times it
      has been blocked to become active again.
    • onBind

      public SignalHandler onBind(SignalGroup.OnBind signal)
      Connect to signal "bind".
      See SignalGroup.OnBind.onBind(ch.bailu.gtk.gobject.Object) for signal description.
      Field SIGNAL_ON_BIND contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onUnbind

      public SignalHandler onUnbind(SignalGroup.OnUnbind signal)
      Connect to signal "unbind".
      See SignalGroup.OnUnbind.onUnbind() for signal description.
      Field SIGNAL_ON_UNBIND contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()