]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcellview.c
Minor documentation improvements
[~andy/gtk] / gtk / gtkcellview.c
index beb7ebb2292e7827bec72c09a1f453580dadfb69..cc2daf6107e33ad098961a13a6dab37bfeba0f33 100644 (file)
@@ -26,7 +26,7 @@
 #include "gtkcellrenderertext.h"
 #include "gtkcellrendererpixbuf.h"
 #include "gtkprivate.h"
-#include "gtkorientable.h"
+#include "gtkorientableprivate.h"
 #include <gobject/gmarshal.h>
 #include "gtkbuildable.h"
 
@@ -253,7 +253,7 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
    * 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).
    *
@@ -347,15 +347,14 @@ gtk_cell_view_constructor (GType                  type,
 
   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);
 
@@ -421,15 +420,16 @@ gtk_cell_view_set_property (GObject      *object,
                             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;
@@ -462,16 +462,34 @@ gtk_cell_view_set_property (GObject      *object,
     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:
@@ -809,8 +827,15 @@ static GtkCellArea *
 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 */
@@ -1303,10 +1328,10 @@ gtk_cell_view_set_background_rgba (GtkCellView   *cell_view,
  * 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
@@ -1328,7 +1353,7 @@ gtk_cell_view_get_draw_sensitive (GtkCellView     *cell_view)
  * @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.
@@ -1391,8 +1416,8 @@ gtk_cell_view_get_fit_model (GtkCellView     *cell_view)
  * 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;