Class GtkSource

java.lang.Object
org.gnome.gtksourceview.GtkSource

@Generated("org.javagi.JavaGI") public final class GtkSource extends Object
Constants and functions that are declared in the global GtkSource namespace.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Like gtk_source_get_major_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
    static final int
    Like gtk_source_get_micro_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
    static final int
    Like gtk_source_get_minor_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    checkVersion(int major, int minor, int micro)
    Like GTK_SOURCE_CHECK_VERSION, but the check for gtk_source_check_version is at runtime instead of compile time.
    static void
    Free the resources allocated by GtkSourceView.
    static int
    Returns the major version number of the GtkSourceView library.
    static int
    Returns the micro version number of the GtkSourceView library.
    static int
    Returns the minor version number of the GtkSourceView library.
    static void
    Initializes the GtkSourceView library (e.g. for the internationalization).
    static void
     
    static long
    schedulerAdd(@Nullable SchedulerCallback callback)
    Adds a new callback that will be executed as time permits on the main thread.
    static void
    schedulerRemove(long handlerId)
    Removes a scheduler callback previously registered with schedulerAdd(SchedulerCallback) or org.gnome.gtksourceview.GtkSource.schedulerAddFull.
    static String
    Use this function to escape the following characters: \\n, \\r, \\t and \\.
    static String
    Use this function before SearchSettings.setSearchText(String), to unescape the following sequences of characters: \\n, \\r, \\t and \\\\.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAJOR_VERSION

      public static final int MAJOR_VERSION
      Like gtk_source_get_major_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
      See Also:
    • MICRO_VERSION

      public static final int MICRO_VERSION
      Like gtk_source_get_micro_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
      See Also:
    • MINOR_VERSION

      public static final int MINOR_VERSION
      Like gtk_source_get_minor_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
      See Also:
  • Constructor Details

    • GtkSource

      public GtkSource()
  • Method Details

    • javagi$ensureInitialized

      public static void javagi$ensureInitialized()
    • checkVersion

      public static boolean checkVersion(int major, int minor, int micro)
      Like GTK_SOURCE_CHECK_VERSION, but the check for gtk_source_check_version is at runtime instead of compile time. This is useful for compiling against older versions of GtkSourceView, but using features from newer versions.
      Parameters:
      major - the major version to check
      minor - the minor version to check
      micro - the micro version to check
      Returns:
      true if the version of the GtkSourceView currently loaded is the same as or newer than the passed-in version.
    • finalize_

      public static void finalize_()

      Free the resources allocated by GtkSourceView. For example it unrefs the singleton objects.

      It is not mandatory to call this function, it's just to be friendlier to memory debugging tools. This function is meant to be called at the end of main(). It can be called several times.

    • getMajorVersion

      public static int getMajorVersion()

      Returns the major version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 3.)

      This function is in the library, so it represents the GtkSourceView library your code is running against. Contrast with the GTK_SOURCE_MAJOR_VERSION macro, which represents the major version of the GtkSourceView headers you have included when compiling your code.

      Returns:
      the major version number of the GtkSourceView library
    • getMicroVersion

      public static int getMicroVersion()

      Returns the micro version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 0.)

      This function is in the library, so it represents the GtkSourceView library your code is running against. Contrast with the GTK_SOURCE_MICRO_VERSION macro, which represents the micro version of the GtkSourceView headers you have included when compiling your code.

      Returns:
      the micro version number of the GtkSourceView library
    • getMinorVersion

      public static int getMinorVersion()

      Returns the minor version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 20.)

      This function is in the library, so it represents the GtkSourceView library your code is running against. Contrast with the GTK_SOURCE_MINOR_VERSION macro, which represents the minor version of the GtkSourceView headers you have included when compiling your code.

      Returns:
      the minor version number of the GtkSourceView library
    • init

      public static void init()

      Initializes the GtkSourceView library (e.g. for the internationalization).

      This function can be called several times, but is meant to be called at the beginning of main(), before any other GtkSourceView function call.

      The counterpart to this function is finalize_() which can be convenient when using memory debugging tools.

    • schedulerAdd

      public static long schedulerAdd(@Nullable SchedulerCallback callback)

      Adds a new callback that will be executed as time permits on the main thread.

      This is useful when you need to do a lot of background work but want to do it incrementally.

      callback will be provided a deadline that it should complete it's work by (or near) and can be checked using GLib#getMonotonicTime for comparison.

      Use schedulerRemove(long) to remove the handler.

      Parameters:
      callback - the callback to execute
      Since:
      5.2
    • schedulerRemove

      public static void schedulerRemove(long handlerId)
      Removes a scheduler callback previously registered with schedulerAdd(SchedulerCallback) or org.gnome.gtksourceview.GtkSource.schedulerAddFull.
      Parameters:
      handlerId - the handler id
      Since:
      5.2
    • utilsEscapeSearchText

      public static String utilsEscapeSearchText(String text)

      Use this function to escape the following characters: \\n, \\r, \\t and \\.

      For a regular expression search, use g_regex_escape_string() instead.

      One possible use case is to take the GtkTextBuffer's selection and put it in a search entry. The selection can contain tabulations, newlines, etc. So it's better to escape those special characters to better fit in the search entry.

      See also: utilsUnescapeSearchText(String).

      Warning: the escape and unescape functions are not reciprocal! For example, escape (unescape (\\)) = \\\\. So avoid cycles such as: search entry -> unescape -> search settings -> escape -> search entry. The original search entry text may be modified.
      Parameters:
      text - the text to escape.
      Returns:
      the escaped text.
    • utilsUnescapeSearchText

      public static String utilsUnescapeSearchText(String text)

      Use this function before SearchSettings.setSearchText(String), to unescape the following sequences of characters: \\n, \\r, \\t and \\\\. The purpose is to easily write those characters in a search entry.

      Note that unescaping the search text is not needed for regular expression searches.

      See also: utilsEscapeSearchText(String).

      Parameters:
      text - the text to unescape.
      Returns:
      the unescaped text.