gtk_entry_completion_get_cells: revert returning NULL

Too many applications and libraries depend on accessing the internally
created cell renderer. Allow that again, but print a warning.
This commit is contained in:
Lars Uebernickel 2013-11-03 19:02:01 +01:00
parent c9892df362
commit a9a6fb045a

View File

@ -844,20 +844,21 @@ gtk_entry_completion_clear_text_column_renderer (GtkEntryCompletion *completion)
static GList * static GList *
gtk_entry_completion_get_cells (GtkCellLayout *cell_layout) gtk_entry_completion_get_cells (GtkCellLayout *cell_layout)
{ {
GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (cell_layout); static gboolean warned = FALSE;
if (completion->priv->text_column == -1) GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (cell_layout);
{
GtkCellArea *area; GtkCellArea *area;
area = gtk_entry_completion_get_area (cell_layout); if (!warned && completion->priv->text_column != -1)
return gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (area));
}
else
{ {
/* Don't expose the internally created cell renderer */ g_warning ("GtkEntryCompletion: don't call gtk_cell_layout_get_cells() to get "
return NULL; "the cell renderer that was created by setting 'text-column'.");
warned = TRUE;
} }
area = gtk_entry_completion_get_area (cell_layout);
return gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (area));
} }
static void static void
@ -1475,6 +1476,9 @@ gtk_entry_completion_delete_action (GtkEntryCompletion *completion,
* to have a list displaying all (and just) strings in the completion list, * to have a list displaying all (and just) strings in the completion list,
* and to get those strings from @column in the model of @completion. * and to get those strings from @column in the model of @completion.
* *
* The cell renderer added by this function is managed internally. Do
* not access or modify it.
*
* Any cell renderers that were added to @completion before calling this * Any cell renderers that were added to @completion before calling this
* function will be removed. * function will be removed.
* *