summaryrefslogtreecommitdiff
path: root/gtk/gtkentrycompletion.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-01-31 17:34:37 -0500
committerMatthias Clasen <mclasen@redhat.com>2011-01-31 17:39:42 -0500
commit726b0d8736a9d5ac8d7f2395f234662b204290fc (patch)
treea189b93f5ce6aaec7a300efb170d6c1231a5639b /gtk/gtkentrycompletion.c
parent1f3a5a8d92927ce9ce22bc8dcd8fe990e6f8431f (diff)
downloadgtk+-726b0d8736a9d5ac8d7f2395f234662b204290fc.tar.gz
Bandaid fix for icon view subclassing
I've decided that it is isn't feasible to make cell areas runtime-settable in the time we have left before 3.0, therefore, I'm going with the approach to allow init() functions to instantiate the default cell area and issue a warning if a construct property is ignored. This is not ideal, but it keeps existing icon view and combo box subclasses working. https://bugzilla.gnome.org/show_bug.cgi?id=639139
Diffstat (limited to 'gtk/gtkentrycompletion.c')
-rw-r--r--gtk/gtkentrycompletion.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index 77ec2b837e..763b670992 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -481,9 +481,9 @@ gtk_entry_completion_init (GtkEntryCompletion *completion)
}
static GObject *
-gtk_entry_completion_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
+gtk_entry_completion_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
{
GtkEntryCompletion *completion;
GtkEntryCompletionPrivate *priv;
@@ -657,9 +657,17 @@ gtk_entry_completion_set_property (GObject *object,
case PROP_CELL_AREA:
/* Construct-only, can only be assigned once */
area = g_value_get_object (value);
-
if (area)
- priv->cell_area = g_object_ref_sink (area);
+ {
+ if (priv->cell_area != NULL)
+ {
+ g_warning ("cell-area has already been set, ignoring construct property");
+ g_object_ref_sink (area);
+ g_object_unref (area);
+ }
+ else
+ priv->cell_area = g_object_ref_sink (area);
+ }
break;
default:
@@ -786,6 +794,12 @@ gtk_entry_completion_get_area (GtkCellLayout *cell_layout)
priv = GTK_ENTRY_COMPLETION (cell_layout)->priv;
+ if (G_UNLIKELY (!priv->cell_area))
+ {
+ priv->cell_area = gtk_cell_area_box_new ();
+ g_object_ref_sink (priv->cell_area);
+ }
+
return priv->cell_area;
}