X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkcellarea.c;h=df9c70968a0ce52235da79cda714a05ea0c76a60;hb=fa4878979e0a72890ca577a210ccd7cf6291dbf0;hp=56cb0a396cee01ffe54bb1c0cd8c538506531df1;hpb=b01fc35c189c8f934e0a63d09691ce1a6d7e01db;p=~andy%2Fgtk diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index 56cb0a396..df9c70968 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -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 . */ /** @@ -35,7 +33,7 @@ * size requests and allocations for a given row of data. * * Usually users dont have to interact with the #GtkCellArea directly - * unless they are implementing a cell layouting widget themselves. + * unless they are implementing a cell-layouting widget themselves. * * * Requesting area sizes @@ -47,7 +45,7 @@ * size of an area for an arbitrary number of #GtkTreeModel rows. * * When requesting the size of a cell area one needs to calculate - * the size for a handful of rows, this will be done differently by + * the size for a handful of rows, and this will be done differently by * different layouting widgets. For instance a #GtkTreeViewColumn * always lines up the areas from top to bottom while a #GtkIconView * on the other hand might enforce that all areas received the same @@ -65,10 +63,10 @@ * * The #GtkCellAreaContext is an opaque object specific to the * #GtkCellArea which created it (see gtk_cell_area_create_context()). - * The owning cell layouting widget can create as many contexts as + * The owning cell-layouting widget can create as many contexts as * it wishes to calculate sizes of rows which should receive the * same size in at least one orientation (horizontally or vertically), - * however it's important that the same #GtkCellAreaContext which + * However, it's important that the same #GtkCellAreaContext which * was used to request the sizes for a given #GtkTreeModel row be * used when rendering or processing events for that row. * @@ -94,7 +92,7 @@ * * Note that in this example it's not important to observe the * returned minimum and natural width of the area for each row - * unless the cell layouting object is actually interested in the + * unless the cell-layouting object is actually interested in the * widths of individual rows. The overall width is however stored * in the accompanying #GtkCellAreaContext object and can be consulted * at any time. @@ -136,7 +134,7 @@ * Requesting the height for width (or width for height) of an area is * a similar task except in this case the #GtkCellAreaContext does not * store the data (actually, it does not know how much space the layouting - * widget plans to allocate it for every row, it's up to the layouting + * widget plans to allocate it for every row. It's up to the layouting * widget to render each row of data with the appropriate height and * width which was requested by the #GtkCellArea). * @@ -185,7 +183,7 @@ * 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. * @@ -228,7 +226,7 @@ * * Note that the cached height in this example really depends on how * the layouting widget works. The layouting widget might decide to - * give every row it's minimum or natural height or, if the model content + * give every row its minimum or natural height or, if the model content * is expected to fit inside the layouting widget without scrolling, it * would make sense to calculate the allocation for each row at * #GtkWidget::size-allocate time using gtk_distribute_natural_allocation(). @@ -337,7 +335,7 @@ * for #GtkWidgets. This provides some general interfaces for defining * the relationship cell areas have with their cells. For instance in a * #GtkCellAreaBox a cell might "expand" and receive extra space when - * the area is allocated more than it's full natural request, or a cell + * the area is allocated more than its full natural request, or a cell * might be configured to "align" with adjacent rows which were requested * and rendered with the same #GtkCellAreaContext. * @@ -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: @@ -720,7 +720,7 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) * @path: the #GtkTreePath string this edit was initiated for * * Indicates that editing has started on @renderer and that @editable - * should be added to the owning cell layouting widget at @cell_area. + * should be added to the owning cell-layouting widget at @cell_area. * * Since: 3.0 */ @@ -745,7 +745,7 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) * @editable: the #GtkCellEditable widget to remove * * Indicates that editing finished on @renderer and that @editable - * should be removed from the owning cell layouting widget. + * should be removed from the owning cell-layouting widget. * * Since: 3.0 */ @@ -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. @@ -2107,7 +2110,7 @@ gtk_cell_area_get_preferred_width (GtkCellArea *area, * the specified @width. * * @area stores some geometrical information in @context along the way - * while calling gtk_cell_area_get_preferred_width(), it's important to + * while calling gtk_cell_area_get_preferred_width(). It's important to * perform a series of gtk_cell_area_get_preferred_width() requests with * @context first and then call gtk_cell_area_get_preferred_height_for_width() * on each cell area individually to get the height for width of each @@ -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. @@ -2183,7 +2186,7 @@ gtk_cell_area_get_preferred_height (GtkCellArea *area, * the specified @height. * * @area stores some geometrical information in @context along the way - * while calling gtk_cell_area_get_preferred_height(), it's important to + * while calling gtk_cell_area_get_preferred_height(). It's important to * perform a series of gtk_cell_area_get_preferred_height() requests with * @context first and then call gtk_cell_area_get_preferred_width_for_height() * on each cell area individually to get the height for width of each @@ -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, @@ -2671,8 +2674,8 @@ gtk_cell_area_cell_set_valist (GtkCellArea *area, break; } - g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); - G_VALUE_COLLECT (&value, var_args, 0, &error); + G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec), + var_args, 0, &error); if (error) { g_warning ("%s: %s", G_STRLOC, error); @@ -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 */ @@ -2887,7 +2890,7 @@ gtk_cell_area_is_activatable (GtkCellArea *area) * for a given @direction and row data. * * Implementing #GtkCellArea classes should implement this - * method to receive and navigate focus in it's own way particular + * method to receive and navigate focus in its own way particular * to how it lays out cells. * * Return value: %TRUE if focus remains inside @area as a result of this call. @@ -3015,7 +3018,7 @@ gtk_cell_area_get_focus_cell (GtkCellArea *area) * @sibling: the #GtkCellRenderer to add to @renderer's focus area * * Adds @sibling to @renderer's focusable area, focus will be drawn - * around @renderer and all of it's siblings if @renderer can + * around @renderer and all of its siblings if @renderer can * focus for a given row. * * Events handled by focus siblings can also activate the given @@ -3100,9 +3103,11 @@ gtk_cell_area_remove_focus_sibling (GtkCellArea *area, * @renderer: the #GtkCellRenderer expected to have focus * @sibling: the #GtkCellRenderer to check against @renderer's sibling list * - * Returns %TRUE if @sibling is one of @renderer's focus siblings + * Returns whether @sibling is one of @renderer's focus siblings * (see gtk_cell_area_add_focus_sibling()). * + * Return value: %TRUE if @sibling is a focus sibling of @renderer + * * Since: 3.0 */ gboolean @@ -3366,7 +3371,7 @@ gtk_cell_area_get_edit_widget (GtkCellArea *area) * * This is used by #GtkCellArea subclasses when handling events * to activate cells, the base #GtkCellArea class activates cells - * for keyboard events for free in it's own GtkCellArea->activate() + * for keyboard events for free in its own GtkCellArea->activate() * implementation. * * Return value: whether cell activation was successful @@ -3459,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 currently edited cell renderer + * will emit the ::editing-canceled signal, otherwise the + * the ::editing-done signal will be emitted on the current + * edit widget. * - * If @canceled is %TRUE, the cell renderer will emit - * the ::editing-canceled signal. + * See gtk_cell_area_get_edited_cell() and gtk_cell_area_get_edit_widget(). * * Since: 3.0 */ @@ -3485,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); @@ -3627,8 +3642,8 @@ _gtk_cell_area_set_cell_data_func_with_proxy (GtkCellArea *area, info = g_hash_table_lookup (priv->cell_info, cell); /* Note we do not take a reference to the proxy, the proxy is a GtkCellLayout - * that is forwarding it's implementation to a delegate GtkCellArea therefore - * it's life-cycle is longer than the area's life cycle. + * that is forwarding its implementation to a delegate GtkCellArea therefore + * its life-cycle is longer than the area's life cycle. */ if (info) {