Signal

Gtk.ComboBox::format-entry-text

Declaration

gchar*
format_entry_text (
  GtkComboBox self,
  gchar* path,
  gpointer user_data
)

Description [src]

Emitted to allow changing how the text in a combo box’s entry is displayed.

See GtkComboBox:has-entry.

Connect a signal handler which returns an allocated string representing path. That string will then be used to set the text in the combo box’s entry. The default signal handler uses the text from the GtkComboBox:entry-text-column model column.

Here’s an example signal handler which fetches data from the model and displays it in the entry.

static char *
format_entry_text_callback (GtkComboBox *combo,
                            const char *path,
                            gpointer     user_data)
{
  GtkTreeIter iter;
  GtkTreeModel model;
  double       value;

  model = gtk_combo_box_get_model (combo);

  gtk_tree_model_get_iter_from_string (model, &iter, path);
  gtk_tree_model_get (model, &iter,
                      THE_DOUBLE_VALUE_COLUMN, &value,
                      -1);

  return g_strdup_printf ("%g", value);
}
Default handler:

The default handler is called after the handlers added via g_signal_connect()

Parameters

path gchar*
 

the GtkTreePath string from the combo box’s current model to format text for

 Ownership is not transferred to the callee
 The string is a NUL terminated UTF-8 string

Return value

Returns: gchar*

a newly allocated string representing path for the current GtkComboBox model.

Ownership of the data is transferred to the caller
The string is a NUL terminated UTF-8 string