### Method

# Gtk TreeModelFilterset_visible_func

deprecated: 4.10

#### Declaration [src]

    void
    gtk_tree_model_filter_set_visible_func (
      GtkTreeModelFilter* filter,
      GtkTreeModelFilterVisibleFunc func,
      gpointer data,
      GDestroyNotify destroy
    )

#### Description [src]

Sets the visible function used when filtering the `filter` to be `func`. The function should return `TRUE` if the given row should be visible and `FALSE` otherwise.

If the condition calculated by the function changes over time (e.g. because it depends on some global parameters), you must call `gtk_tree_model_filter_refilter()` to keep the visibility information of the model up-to-date.

Note that `func` is called whenever a row is inserted, when it may still be empty. The visible function should therefore take special care of empty rows, like in the example below.

    static gboolean
    visible_func (GtkTreeModel *model,
                  GtkTreeIter  *iter,
                  gpointer      data)
    {
      // Visible if row is non-empty and first column is “HI”
      char *str;
      gboolean visible = FALSE;

      gtk_tree_model_get (model, iter, 0, &str, -1);
      if (str && strcmp (str, "HI") == 0)
        visible = TRUE;
      g_free (str);

      return visible;
    }

Note that `gtk_tree_model_filter_set_visible_func()` or `gtk_tree_model_filter_set_visible_column()` can only be called once for a given filter model.

Deprecated since: 4.10

Please do not use it in newly written code.

#### Parameters

`func`

  Type: `GtkTreeModelFilterVisibleFunc`

  A `GtkTreeModelFilterVisibleFunc`, the visible function.

`data`

  Type: `gpointer`

  User data to pass to the visible function.

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

`destroy`

  Type: `GDestroyNotify`

  Destroy notifier of `data`.

  The argument can be `NULL`.