]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcellarea.c
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtkcellarea.c
index 27ae333db31b4af338c89c50cf08422bde8ebe3b..df9c70968a0ce52235da79cda714a05ea0c76a60 100644 (file)
@@ -16,9 +16,7 @@
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /**
  * call to #GtkWidgetClass.get_preferred_height_for_width(). Returning
  * a perfect height for width that is larger than the screen area is
  * inconsequential since after the layouting receives an allocation
- * from a scrolled window it simply continues to drive the the scrollbar
+ * from a scrolled window it simply continues to drive the scrollbar
  * values while more and more height is required for the row heights
  * that are calculated in the background.
  * </para>
@@ -709,6 +707,8 @@ gtk_cell_area_class_init (GtkCellAreaClass *class)
                   GTK_TYPE_TREE_ITER,
                   G_TYPE_BOOLEAN,
                   G_TYPE_BOOLEAN);
+  g_signal_set_va_marshaller (cell_area_signals[SIGNAL_APPLY_ATTRIBUTES], G_TYPE_FROM_CLASS (class),
+                              _gtk_marshal_VOID__OBJECT_BOXED_BOOLEAN_BOOLEANv);
 
   /**
    * GtkCellArea::add-editable:
@@ -1069,7 +1069,7 @@ gtk_cell_area_real_event (GtkCellArea          *area,
     {
       GdkEventButton *button_event = (GdkEventButton *)event;
 
-      if (button_event->button == 1)
+      if (button_event->button == GDK_BUTTON_PRIMARY)
         {
           GtkCellRenderer *renderer = NULL;
           GtkCellRenderer *focus_renderer;
@@ -1204,6 +1204,9 @@ gtk_cell_area_real_render (GtkCellArea          *area,
   if (gtk_cell_area_get_edited_cell (area))
     render_data.paint_focus = FALSE;
 
+  if (!gtk_widget_has_visible_focus (widget))
+    render_data.paint_focus = FALSE;
+
   /* If no cell can activate but the caller wants focus painted,
    * then we paint focus around all cells */
   if ((flags & GTK_CELL_RENDERER_FOCUSED) != 0 && paint_focus &&
@@ -1247,7 +1250,7 @@ apply_cell_attributes (GtkCellRenderer *renderer,
 {
   CellAttribute *attribute;
   GSList        *list;
-  GValue         value = { 0, };
+  GValue         value = G_VALUE_INIT;
   gboolean       is_expander;
   gboolean       is_expanded;
 
@@ -2072,8 +2075,8 @@ gtk_cell_area_get_request_mode (GtkCellArea *area)
  *
  * Retrieves a cell area's initial minimum and natural width.
  *
- * @area will store some geometrical information in @context along the way,
- * when requesting sizes over an arbitrary number of rows, its not important
+ * @area will store some geometrical information in @context along the way;
+ * when requesting sizes over an arbitrary number of rows, it's not important
  * to check the @minimum_width and @natural_width of this call but rather to
  * consult gtk_cell_area_context_get_preferred_width() after a series of
  * requests.
@@ -2148,8 +2151,8 @@ gtk_cell_area_get_preferred_height_for_width (GtkCellArea        *area,
  *
  * Retrieves a cell area's initial minimum and natural height.
  *
- * @area will store some geometrical information in @context along the way,
- * when requesting sizes over an arbitrary number of rows, its not important
+ * @area will store some geometrical information in @context along the way;
+ * when requesting sizes over an arbitrary number of rows, it's not important
  * to check the @minimum_height and @natural_height of this call but rather to
  * consult gtk_cell_area_context_get_preferred_height() after a series of
  * requests.
@@ -2266,7 +2269,7 @@ gtk_cell_area_attribute_connect (GtkCellArea        *area,
           g_warning ("Cannot connect attribute `%s' for cell renderer class `%s' "
                      "since `%s' is already attributed to column %d",
                      attribute,
-                     g_type_name (G_TYPE_FROM_INSTANCE (area)),
+                     G_OBJECT_TYPE_NAME (renderer),
                      attribute, cell_attribute->column);
           return;
         }
@@ -2279,7 +2282,7 @@ gtk_cell_area_attribute_connect (GtkCellArea        *area,
       g_warning ("Cannot connect attribute `%s' for cell renderer class `%s' "
                  "since attribute does not exist",
                  attribute,
-                 g_type_name (G_TYPE_FROM_INSTANCE (area)));
+                 G_OBJECT_TYPE_NAME (renderer));
       return;
     }
 
@@ -2332,7 +2335,7 @@ gtk_cell_area_attribute_disconnect (GtkCellArea        *area,
 }
 
 /**
- * gtk_cell_area_apply_attributes
+ * gtk_cell_area_apply_attributes:
  * @area: a #GtkCellArea
  * @tree_model: the #GtkTreeModel to pull values from
  * @iter: the #GtkTreeIter in @tree_model to apply values for
@@ -2376,7 +2379,7 @@ gtk_cell_area_apply_attributes (GtkCellArea  *area,
  *
  * Since: 3.0
  */
-G_CONST_RETURN gchar *
+const gchar *
 gtk_cell_area_get_current_path_string (GtkCellArea *area)
 {
   GtkCellAreaPrivate *priv;
@@ -2490,8 +2493,8 @@ gtk_cell_area_class_list_cell_properties (GtkCellAreaClass  *aclass,
  * @area: a #GtkCellArea
  * @renderer: a #GtkCellRenderer to be placed inside @area
  * @first_prop_name: the name of the first cell property to set
- * @Varargs: a %NULL-terminated list of property names and values, starting
- *           with @first_prop_name
+ * @...: a %NULL-terminated list of property names and values, starting
+ *     with @first_prop_name
  *
  * Adds @renderer to @area, setting cell properties at the same time.
  * See gtk_cell_area_add() and gtk_cell_area_cell_set() for more details.
@@ -2531,7 +2534,7 @@ gtk_cell_area_add_with_properties (GtkCellArea        *area,
  * @area: a #GtkCellArea
  * @renderer: a #GtkCellRenderer which is a cell inside @area
  * @first_prop_name: the name of the first cell property to set
- * @Varargs: a %NULL-terminated list of property names and values, starting
+ * @...: a %NULL-terminated list of property names and values, starting
  *           with @first_prop_name
  *
  * Sets one or more cell properties for @cell in @area.
@@ -2559,7 +2562,7 @@ gtk_cell_area_cell_set (GtkCellArea        *area,
  * @area: a #GtkCellArea
  * @renderer: a #GtkCellRenderer which is inside @area
  * @first_prop_name: the name of the first cell property to get
- * @Varargs: return location for the first cell property, followed
+ * @...: return location for the first cell property, followed
  *     optionally by more name/return location pairs, followed by %NULL
  *
  * Gets the values of one or more cell properties for @renderer in @area.
@@ -2599,7 +2602,7 @@ area_set_cell_property (GtkCellArea     *area,
                         GParamSpec      *pspec,
                         const GValue    *value)
 {
-  GValue tmp_value = { 0, };
+  GValue tmp_value = G_VALUE_INIT;
   GtkCellAreaClass *class = g_type_class_peek (pspec->owner_type);
 
   /* provide a copy to work from, convert (if necessary) and validate */
@@ -2653,7 +2656,7 @@ gtk_cell_area_cell_set_valist (GtkCellArea        *area,
   name = first_property_name;
   while (name)
     {
-      GValue value = { 0, };
+      GValue value = G_VALUE_INIT;
       gchar *error = NULL;
       GParamSpec *pspec =
         g_param_spec_pool_lookup (cell_property_pool, name,
@@ -2715,7 +2718,7 @@ gtk_cell_area_cell_get_valist (GtkCellArea        *area,
   name = first_property_name;
   while (name)
     {
-      GValue value = { 0, };
+      GValue value = G_VALUE_INIT;
       GParamSpec *pspec;
       gchar *error;
 
@@ -2821,7 +2824,7 @@ gtk_cell_area_cell_get_property (GtkCellArea        *area,
                G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (area));
   else
     {
-      GValue *prop_value, tmp_value = { 0, };
+      GValue *prop_value, tmp_value = G_VALUE_INIT;
 
       /* auto-conversion of the callers value type
        */
@@ -3461,11 +3464,14 @@ gtk_cell_area_activate_cell (GtkCellArea          *area,
  * @area: a #GtkCellArea
  * @canceled: whether editing was canceled.
  *
- * Explicitly stops the editing of the currently
- * edited cell (see gtk_cell_area_get_edited_cell()).
+ * Explicitly stops the editing of the currently edited cell.
  *
- * If @canceled is %TRUE, the cell renderer will emit
- * the ::editing-canceled signal.
+ * If @canceled is %TRUE, the currently edited cell renderer
+ * will emit the ::editing-canceled signal, otherwise the
+ * the ::editing-done signal will be emitted on the current
+ * edit widget.
+ *
+ * See gtk_cell_area_get_edited_cell() and gtk_cell_area_get_edit_widget().
  *
  * Since: 3.0
  */
@@ -3487,6 +3493,13 @@ gtk_cell_area_stop_editing (GtkCellArea *area,
       /* Stop editing of the cell renderer */
       gtk_cell_renderer_stop_editing (priv->edited_cell, canceled);
 
+      /* When editing is explicitly halted either
+       * the "editing-canceled" signal is emitted on the cell 
+       * renderer or the "editing-done" signal on the GtkCellEditable widget
+       */
+      if (!canceled)
+       gtk_cell_editable_editing_done (edit_widget);
+
       /* Remove any references to the editable widget */
       gtk_cell_area_set_edited_cell (area, NULL);
       gtk_cell_area_set_edit_widget (area, NULL);