[gtk+] Add internal accessor for GtkEntry->is_cell_renderer
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add internal accessor for GtkEntry->is_cell_renderer
- Date: Sun, 5 Dec 2010 03:19:16 +0000 (UTC)
commit d351b40a0bd9ee247c5f64858c377378a1eccdbe
Author: Javier Jardón <jjardon gnome org>
Date: Sat Nov 27 04:38:17 2010 +0100
Add internal accessor for GtkEntry->is_cell_renderer
This fixes commit fb3429e5072508570d78dcc7cccb6ef425586bb2
gtk/gtkcombobox.c | 6 ++++++
gtk/gtkentry.c | 18 ++++++++++++++++++
gtk/gtkentryprivate.h | 4 ++++
3 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 0cf0737..4775fe9 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -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);
}
}
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 2e58476..4eb96a3 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -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;
+}
diff --git a/gtk/gtkentryprivate.h b/gtk/gtkentryprivate.h
index 63a5cd0..01c2c7d 100644
--- a/gtk/gtkentryprivate.h
+++ b/gtk/gtkentryprivate.h
@@ -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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]