Interface GObject.NotifyCallback

All Superinterfaces:
FunctionPointer
Enclosing class:
GObject
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface GObject.NotifyCallback extends FunctionPointer

Functional interface declaration of the NotifyCallback callback.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run(@Nullable ParamSpec pspec)
    The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
    Creates a native function pointer to the upcall(MemorySegment, MemorySegment) method.
    default void
    upcall(MemorySegment sourceObject, MemorySegment pspec)
    The upcall method is called from native code.
  • Method Details

    • run

      void run(@Nullable ParamSpec pspec)

      The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

      Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with ParamFlags.EXPLICIT_NOTIFY, then any call to g_object_set_property() results in ::notify being emitted, even if the new value is the same as the old. If they did pass ParamFlags.EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

      This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

      g_signal_connect (text_view->buffer, "notify::paste-target-list",
                        G_CALLBACK (gtk_text_view_target_list_notify),
                        text_view)
      

      It is important to note that you must use GObject.ParamSpec#parameter-names as detail strings for the notify signal.

    • upcall

      default void upcall(MemorySegment sourceObject, MemorySegment pspec)
      The upcall method is called from native code. The parameters are marshaled and run(ParamSpec) is executed.
    • toCallback

      default MemorySegment toCallback(Arena arena)
      Creates a native function pointer to the upcall(MemorySegment, MemorySegment) method.
      Specified by:
      toCallback in interface FunctionPointer
      Parameters:
      arena - the arena in which the function pointer is allocated
      Returns:
      the native function pointer