### Method

# Gtk TextBuffer add_commit_notify

since: 4.16

#### Declaration [src]

    guint
    gtk_text_buffer_add_commit_notify (
      GtkTextBuffer* buffer,
      GtkTextBufferNotifyFlags flags,
      GtkTextBufferCommitNotify commit_notify,
      gpointer user_data,
      GDestroyNotify destroy
    )

#### Description [src]

Adds a `GtkTextBufferCommitNotify` to be called when a change is to be made to the `GtkTextBuffer`.

Functions are explicitly forbidden from making changes to the `GtkTextBuffer` from this callback. It is intended for tracking changes to the buffer only.

It may be advantageous to use `GtkTextBufferCommitNotify` over connecting to the `GtkTextBuffer::insert-text` or `GtkTextBuffer::delete-range` signals to avoid ordering issues with other signal handlers which may further modify the `GtkTextBuffer`.

Available since: 4.16

#### Parameters

`flags`

  Type: `GtkTextBufferNotifyFlags`

  Which notifications should be dispatched to `callback`.

`commit_notify`

  Type: `GtkTextBufferCommitNotify`

  A `GtkTextBufferCommitNotify` to call for commit notifications.

`user_data`

  Type: `gpointer`

  Closure data for `commit_notify`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`destroy`

  Type: `GDestroyNotify`

  A callback to free `user_data` when `commit_notify` is removed.

#### Return value

Type: `guint`

A handler id which may be used to remove the commit notify callback using `gtk_text_buffer_remove_commit_notify()`.