#include "gtkcellrenderertext.h"
#include "gtkcellrendererpixbuf.h"
#include "gtkprivate.h"
-#include "gtkorientable.h"
+#include "gtkorientableprivate.h"
#include <gobject/gmarshal.h>
#include "gtkbuildable.h"
* the same context.
*
* #GtkComboBox menus uses this to assign the same context to all cell views
- * in the menu items for a single menu (each submenu creates it's own
+ * in the menu items for a single menu (each submenu creates its own
* context since the size of each submenu does not depend on parent
* or sibling menus).
*
if (!priv->area)
{
- GtkCellArea *area = gtk_cell_area_box_new ();
-
- priv->area = g_object_ref_sink (area);
+ priv->area = gtk_cell_area_box_new ();
+ g_object_ref_sink (priv->area);
}
if (!priv->context)
priv->context = gtk_cell_area_create_context (priv->area);
- priv->size_changed_id =
+ priv->size_changed_id =
g_signal_connect (priv->context, "notify",
G_CALLBACK (context_size_changed_cb), view);
GParamSpec *pspec)
{
GtkCellView *view = GTK_CELL_VIEW (object);
+ GtkCellViewPrivate *priv = view->priv;
GtkCellArea *area;
GtkCellAreaContext *context;
switch (param_id)
{
case PROP_ORIENTATION:
- view->priv->orientation = g_value_get_enum (value);
- if (view->priv->context)
- gtk_cell_area_context_reset (view->priv->context);
+ priv->orientation = g_value_get_enum (value);
+ if (priv->context)
+ gtk_cell_area_context_reset (priv->context);
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (object));
break;
case PROP_CELL_AREA:
/* Construct-only, can only be assigned once */
area = g_value_get_object (value);
-
+
if (area)
- view->priv->area = g_object_ref_sink (area);
+ {
+ if (priv->area != NULL)
+ {
+ g_warning ("cell-area has already been set, ignoring construct property");
+ g_object_ref_sink (area);
+ g_object_unref (area);
+ }
+ else
+ priv->area = g_object_ref_sink (area);
+ }
break;
case PROP_CELL_AREA_CONTEXT:
/* Construct-only, can only be assigned once */
context = g_value_get_object (value);
-
+
if (context)
- view->priv->context = g_object_ref (context);
+ {
+ if (priv->context != NULL)
+ {
+ g_warning ("cell-area-context has already been set, ignoring construct property");
+ g_object_ref_sink (context);
+ g_object_unref (context);
+ }
+ else
+ priv->context = g_object_ref (context);
+ }
break;
case PROP_DRAW_SENSITIVE:
gtk_cell_view_cell_layout_get_area (GtkCellLayout *layout)
{
GtkCellView *cellview = GTK_CELL_VIEW (layout);
+ GtkCellViewPrivate *priv = cellview->priv;
+
+ if (G_UNLIKELY (!priv->area))
+ {
+ priv->area = gtk_cell_area_box_new ();
+ g_object_ref_sink (priv->area);
+ }
- return cellview->priv->area;
+ return priv->area;
}
/* GtkBuildable implementation */
cell_view->priv->displayed_row = NULL;
g_object_unref (cell_view->priv->model);
- cell_view->priv->model = NULL;
}
cell_view->priv->model = model;
* gtk_cell_view_get_draw_sensitive:
* @cell_view: a #GtkCellView
*
- * Gets whether @cell_view is configured to draw all of it's
+ * Gets whether @cell_view is configured to draw all of its
* cells in a sensitive state.
*
- * Return value: whether @cell_view draws all of it's
+ * Return value: whether @cell_view draws all of its
* cells in a sensitive state
*
* Since: 3.0
* @cell_view: a #GtkCellView
* @draw_sensitive: whether to draw all cells in a sensitive state.
*
- * Sets whether @cell_view should draw all of it's
+ * Sets whether @cell_view should draw all of its
* cells in a sensitive state, this is used by #GtkComboBox menus
* to ensure that rows with insensitive cells that contain
* children appear sensitive in the parent menu item.
* Since: 3.0
*/
void
-gtk_cell_view_set_fit_model (GtkCellView *cell_view,
- gboolean fit_model)
+gtk_cell_view_set_fit_model (GtkCellView *cell_view,
+ gboolean fit_model)
{
GtkCellViewPrivate *priv;