Add internal accessor for GtkEntry->is_cell_renderer

This fixes commit fb3429e507
This commit is contained in:
Javier Jardón 2010-11-27 04:38:17 +01:00
parent 5fdc140dd8
commit d351b40a0b
3 changed files with 28 additions and 0 deletions

View File

@ -50,6 +50,7 @@
#include "gtkmarshalers.h"
#include "gtkintl.h"
#include "gtkentryprivate.h"
#include "gtktreeprivate.h"
@ -1495,6 +1496,10 @@ gtk_combo_box_add (GtkContainer *container,
if (priv->has_entry)
{
/* this flag is a hack to tell the entry to fill its allocation.
*/
_gtk_entry_set_is_cell_renderer (GTK_ENTRY (widget), TRUE);
g_signal_connect (widget, "changed",
G_CALLBACK (gtk_combo_box_entry_contents_changed),
combo_box);
@ -1522,6 +1527,7 @@ gtk_combo_box_remove (GtkContainer *container,
g_signal_handlers_disconnect_by_func (widget,
gtk_combo_box_entry_contents_changed,
container);
_gtk_entry_set_is_cell_renderer (GTK_ENTRY (widget), FALSE);
}
}

View File

@ -10216,3 +10216,21 @@ keymap_state_changed (GdkKeymap *keymap,
else
remove_capslock_feedback (entry);
}
/*
* _gtk_entry_set_is_cell_renderer:
* @entry: a #GtkEntry
* @is_cell_renderer: new value
*
* This is a helper function for GtkComboBox. A GtkEntry in a GtkComboBox
* is supposed to behave like a GtkCellEditable when placed in a combo box.
*
* I.e take up it's allocation and get GtkEntry->is_cell_renderer = TRUE.
*
*/
void
_gtk_entry_set_is_cell_renderer (GtkEntry *entry,
gboolean is_cell_renderer)
{
entry->priv->is_cell_renderer = is_cell_renderer;
}

View File

@ -85,6 +85,10 @@ void _gtk_entry_effective_inner_border (GtkEntry *entry,
GtkBorder *border);
void _gtk_entry_reset_im_context (GtkEntry *entry);
GtkIMContext* _gtk_entry_get_im_context (GtkEntry *entry);
void _gtk_entry_set_is_cell_renderer (GtkEntry *entry,
gboolean is_cell_renderer);
G_END_DECLS
#endif /* __GTK_ENTRY_PRIVATE_H__ */