forked from AuroraMiddleware/gtk
Changed gtk_cell_area_forall to gtk_cell_area_foreach since thats more widely used semantics.
Also gave a boolean return value to the callback to allow breaking out of the loop.
This commit is contained in:
parent
d28cbd6e6d
commit
4b065f5389
@ -4391,7 +4391,7 @@ GTK_CELL_AREA_WARN_INVALID_CELL_PROPERTY_ID
|
||||
gtk_cell_area_add
|
||||
gtk_cell_area_remove
|
||||
gtk_cell_area_has_renderer
|
||||
gtk_cell_area_forall
|
||||
gtk_cell_area_foreach
|
||||
gtk_cell_area_get_cell_allocation
|
||||
gtk_cell_area_event
|
||||
gtk_cell_area_render
|
||||
|
@ -392,7 +392,7 @@ gtk_cell_area_context_push_preferred_height
|
||||
gtk_cell_area_context_reset
|
||||
gtk_cell_area_create_context
|
||||
gtk_cell_area_event
|
||||
gtk_cell_area_forall
|
||||
gtk_cell_area_foreach
|
||||
gtk_cell_area_focus
|
||||
gtk_cell_area_get_edited_cell
|
||||
gtk_cell_area_get_edit_widget
|
||||
|
@ -418,7 +418,7 @@ static void gtk_cell_area_reorder (GtkCellLayout
|
||||
static GList *gtk_cell_area_get_cells (GtkCellLayout *cell_layout);
|
||||
|
||||
|
||||
/* Used in forall loop to check if a child renderer is present */
|
||||
/* Used in foreach loop to check if a child renderer is present */
|
||||
typedef struct {
|
||||
GtkCellRenderer *renderer;
|
||||
gboolean has_renderer;
|
||||
@ -571,7 +571,7 @@ gtk_cell_area_class_init (GtkCellAreaClass *class)
|
||||
/* general */
|
||||
class->add = NULL;
|
||||
class->remove = NULL;
|
||||
class->forall = NULL;
|
||||
class->foreach = NULL;
|
||||
class->event = gtk_cell_area_real_event;
|
||||
class->render = NULL;
|
||||
class->apply_attributes = gtk_cell_area_real_apply_attributes;
|
||||
@ -1035,13 +1035,15 @@ gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea *area,
|
||||
GTK_CELL_AREA_GET_CLASS (area)->get_preferred_width (area, context, widget, minimum_width, natural_width);
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
get_is_activatable (GtkCellRenderer *renderer,
|
||||
gboolean *activatable)
|
||||
{
|
||||
|
||||
if (gtk_cell_renderer_is_activatable (renderer))
|
||||
*activatable = TRUE;
|
||||
|
||||
return *activatable;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -1055,7 +1057,7 @@ gtk_cell_area_real_is_activatable (GtkCellArea *area)
|
||||
* Subclasses can override this in the case that they are also
|
||||
* rendering widgets as well as renderers.
|
||||
*/
|
||||
gtk_cell_area_forall (area, (GtkCellCallback)get_is_activatable, &activatable);
|
||||
gtk_cell_area_foreach (area, (GtkCellCallback)get_is_activatable, &activatable);
|
||||
|
||||
return activatable;
|
||||
}
|
||||
@ -1229,11 +1231,13 @@ gtk_cell_area_reorder (GtkCellLayout *cell_layout,
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (cell_layout)));
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
accum_cells (GtkCellRenderer *renderer,
|
||||
GList **accum)
|
||||
{
|
||||
*accum = g_list_prepend (*accum, renderer);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GList *
|
||||
@ -1241,9 +1245,9 @@ gtk_cell_area_get_cells (GtkCellLayout *cell_layout)
|
||||
{
|
||||
GList *cells = NULL;
|
||||
|
||||
gtk_cell_area_forall (GTK_CELL_AREA (cell_layout),
|
||||
(GtkCellCallback)accum_cells,
|
||||
&cells);
|
||||
gtk_cell_area_foreach (GTK_CELL_AREA (cell_layout),
|
||||
(GtkCellCallback)accum_cells,
|
||||
&cells);
|
||||
|
||||
return g_list_reverse (cells);
|
||||
}
|
||||
@ -1332,12 +1336,14 @@ gtk_cell_area_remove (GtkCellArea *area,
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (area)));
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
get_has_renderer (GtkCellRenderer *renderer,
|
||||
HasRendererCheck *check)
|
||||
{
|
||||
if (renderer == check->renderer)
|
||||
check->has_renderer = TRUE;
|
||||
|
||||
return check->has_renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1360,13 +1366,13 @@ gtk_cell_area_has_renderer (GtkCellArea *area,
|
||||
g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE);
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), FALSE);
|
||||
|
||||
gtk_cell_area_forall (area, (GtkCellCallback)get_has_renderer, &check);
|
||||
gtk_cell_area_foreach (area, (GtkCellCallback)get_has_renderer, &check);
|
||||
|
||||
return check.has_renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_area_forall:
|
||||
* gtk_cell_area_foreach:
|
||||
* @area: a #GtkCellArea
|
||||
* @callback: the #GtkCellCallback to call
|
||||
* @callback_data: user provided data pointer
|
||||
@ -1376,9 +1382,9 @@ gtk_cell_area_has_renderer (GtkCellArea *area,
|
||||
* Since: 3.0
|
||||
*/
|
||||
void
|
||||
gtk_cell_area_forall (GtkCellArea *area,
|
||||
GtkCellCallback callback,
|
||||
gpointer callback_data)
|
||||
gtk_cell_area_foreach (GtkCellArea *area,
|
||||
GtkCellCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkCellAreaClass *class;
|
||||
|
||||
@ -1387,10 +1393,10 @@ gtk_cell_area_forall (GtkCellArea *area,
|
||||
|
||||
class = GTK_CELL_AREA_GET_CLASS (area);
|
||||
|
||||
if (class->forall)
|
||||
class->forall (area, callback, callback_data);
|
||||
if (class->foreach)
|
||||
class->foreach (area, callback, callback_data);
|
||||
else
|
||||
g_warning ("GtkCellAreaClass::forall not implemented for `%s'",
|
||||
g_warning ("GtkCellAreaClass::foreach not implemented for `%s'",
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (area)));
|
||||
}
|
||||
|
||||
|
@ -65,10 +65,12 @@ typedef struct _GtkCellAreaContext GtkCellAreaContext;
|
||||
* @data: user-supplied data
|
||||
*
|
||||
* The type of the callback functions used for iterating over
|
||||
* the cell renderers of a #GtkCellArea, see gtk_cell_area_forall().
|
||||
* the cell renderers of a #GtkCellArea, see gtk_cell_area_foreach().
|
||||
*
|
||||
* Return value: %TRUE to stop iterating over cells.
|
||||
*/
|
||||
typedef void (*GtkCellCallback) (GtkCellRenderer *renderer,
|
||||
gpointer data);
|
||||
typedef gboolean (*GtkCellCallback) (GtkCellRenderer *renderer,
|
||||
gpointer data);
|
||||
|
||||
|
||||
struct _GtkCellArea
|
||||
@ -84,8 +86,8 @@ struct _GtkCellArea
|
||||
* GtkCellAreaClass:
|
||||
* @add: adds a #GtkCellRenderer to the area.
|
||||
* @remove: removes a #GtkCellRenderer from the area.
|
||||
* @forall: Calls the #GtkCellCallback function on every #GtkCellRenderer in the area
|
||||
* with the provided user data.
|
||||
* @foreach: Calls the #GtkCellCallback function on every #GtkCellRenderer in the area
|
||||
* with the provided user data until the callback returns %TRUE.
|
||||
* @get_cell_allocation: Gets the position (relative to the passed @cell_area rectangle)
|
||||
* and size of a #GtkCellRenderer.
|
||||
* @event: Handle an event in the area, this is generally used to activate a cell
|
||||
@ -149,7 +151,7 @@ struct _GtkCellAreaClass
|
||||
GtkCellRenderer *renderer);
|
||||
void (* remove) (GtkCellArea *area,
|
||||
GtkCellRenderer *renderer);
|
||||
void (* forall) (GtkCellArea *area,
|
||||
void (* foreach) (GtkCellArea *area,
|
||||
GtkCellCallback callback,
|
||||
gpointer callback_data);
|
||||
void (* get_cell_allocation) (GtkCellArea *area,
|
||||
@ -248,7 +250,7 @@ void gtk_cell_area_remove (GtkCellArea
|
||||
GtkCellRenderer *renderer);
|
||||
gboolean gtk_cell_area_has_renderer (GtkCellArea *area,
|
||||
GtkCellRenderer *renderer);
|
||||
void gtk_cell_area_forall (GtkCellArea *area,
|
||||
void gtk_cell_area_foreach (GtkCellArea *area,
|
||||
GtkCellCallback callback,
|
||||
gpointer callback_data);
|
||||
void gtk_cell_area_get_cell_allocation (GtkCellArea *area,
|
||||
|
@ -71,7 +71,7 @@ static void gtk_cell_area_box_add (GtkCellArea
|
||||
GtkCellRenderer *renderer);
|
||||
static void gtk_cell_area_box_remove (GtkCellArea *area,
|
||||
GtkCellRenderer *renderer);
|
||||
static void gtk_cell_area_box_forall (GtkCellArea *area,
|
||||
static void gtk_cell_area_box_foreach (GtkCellArea *area,
|
||||
GtkCellCallback callback,
|
||||
gpointer callback_data);
|
||||
static void gtk_cell_area_box_get_cell_allocation (GtkCellArea *area,
|
||||
@ -266,7 +266,7 @@ gtk_cell_area_box_class_init (GtkCellAreaBoxClass *class)
|
||||
/* GtkCellAreaClass */
|
||||
area_class->add = gtk_cell_area_box_add;
|
||||
area_class->remove = gtk_cell_area_box_remove;
|
||||
area_class->forall = gtk_cell_area_box_forall;
|
||||
area_class->foreach = gtk_cell_area_box_foreach;
|
||||
area_class->get_cell_allocation = gtk_cell_area_box_get_cell_allocation;
|
||||
area_class->event = gtk_cell_area_box_event;
|
||||
area_class->render = gtk_cell_area_box_render;
|
||||
@ -1022,9 +1022,9 @@ gtk_cell_area_box_remove (GtkCellArea *area,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_area_box_forall (GtkCellArea *area,
|
||||
GtkCellCallback callback,
|
||||
gpointer callback_data)
|
||||
gtk_cell_area_box_foreach (GtkCellArea *area,
|
||||
GtkCellCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area);
|
||||
GtkCellAreaBoxPrivate *priv = box->priv;
|
||||
@ -1034,7 +1034,8 @@ gtk_cell_area_box_forall (GtkCellArea *area,
|
||||
{
|
||||
CellInfo *info = list->data;
|
||||
|
||||
callback (info->renderer, callback_data);
|
||||
if (callback (info->renderer, callback_data))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user