app: rename all "children_type" members and variables to "child_type"

This commit is contained in:
Michael Natterer 2025-07-17 09:20:59 +02:00
parent e00afd9d54
commit 77bb857046
13 changed files with 101 additions and 100 deletions

View file

@ -72,7 +72,7 @@ typedef struct
struct _GimpContainerPrivate
{
GType children_type;
GType child_type;
GimpContainerPolicy policy;
gint n_children;
@ -247,12 +247,13 @@ static void
gimp_container_init (GimpContainer *container)
{
container->priv = gimp_container_get_instance_private (container);
container->priv->handlers = NULL;
container->priv->freeze_count = 0;
container->priv->children_type = G_TYPE_NONE;
container->priv->policy = GIMP_CONTAINER_POLICY_STRONG;
container->priv->n_children = 0;
container->priv->handlers = NULL;
container->priv->freeze_count = 0;
container->priv->child_type = G_TYPE_NONE;
container->priv->policy = GIMP_CONTAINER_POLICY_STRONG;
container->priv->n_children = 0;
}
static void
@ -267,10 +268,10 @@ gimp_container_dispose (GObject *object)
((GimpContainerHandler *)
container->priv->handlers->data)->quark);
if (container->priv->children_type != G_TYPE_NONE)
if (container->priv->child_type != G_TYPE_NONE)
{
g_type_class_unref (g_type_class_peek (container->priv->children_type));
container->priv->children_type = G_TYPE_NONE;
g_type_class_unref (g_type_class_peek (container->priv->child_type));
container->priv->child_type = G_TYPE_NONE;
}
G_OBJECT_CLASS (parent_class)->dispose (object);
@ -287,8 +288,8 @@ gimp_container_set_property (GObject *object,
switch (property_id)
{
case PROP_CHILDREN_TYPE:
container->priv->children_type = g_value_get_gtype (value);
g_type_class_ref (container->priv->children_type);
container->priv->child_type = g_value_get_gtype (value);
g_type_class_ref (container->priv->child_type);
break;
case PROP_POLICY:
container->priv->policy = g_value_get_enum (value);
@ -310,7 +311,7 @@ gimp_container_get_property (GObject *object,
switch (property_id)
{
case PROP_CHILDREN_TYPE:
g_value_set_gtype (value, container->priv->children_type);
g_value_set_gtype (value, container->priv->child_type);
break;
case PROP_POLICY:
g_value_set_enum (value, container->priv->policy);
@ -481,12 +482,12 @@ gimp_container_deserialize (GimpConfig *config,
return FALSE;
}
if (! g_type_is_a (type, container->priv->children_type))
if (! g_type_is_a (type, container->priv->child_type))
{
g_scanner_error (scanner,
"'%s' is not a subclass of '%s'",
scanner->value.v_identifier,
g_type_name (container->priv->children_type));
g_type_name (container->priv->child_type));
return FALSE;
}
@ -606,7 +607,7 @@ gimp_container_get_children_type (GimpContainer *container)
{
g_return_val_if_fail (GIMP_IS_CONTAINER (container), G_TYPE_NONE);
return container->priv->children_type;
return container->priv->child_type;
}
GimpContainerPolicy
@ -635,7 +636,7 @@ gimp_container_add (GimpContainer *container,
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
g_return_val_if_fail (object != NULL, FALSE);
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object,
container->priv->children_type),
container->priv->child_type),
FALSE);
if (gimp_container_have (container, object))
@ -707,7 +708,7 @@ gimp_container_remove (GimpContainer *container,
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
g_return_val_if_fail (object != NULL, FALSE);
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object,
container->priv->children_type),
container->priv->child_type),
FALSE);
if (! gimp_container_have (container, object))
@ -777,7 +778,7 @@ gimp_container_insert (GimpContainer *container,
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
g_return_val_if_fail (object != NULL, FALSE);
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object,
container->priv->children_type),
container->priv->child_type),
FALSE);
g_return_val_if_fail (index >= -1 &&
@ -820,7 +821,7 @@ gimp_container_reorder (GimpContainer *container,
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
g_return_val_if_fail (object != NULL, FALSE);
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object,
container->priv->children_type),
container->priv->child_type),
FALSE);
g_return_val_if_fail (new_index >= -1 &&
@ -1080,7 +1081,7 @@ gimp_container_get_child_index (GimpContainer *container,
g_return_val_if_fail (GIMP_IS_CONTAINER (container), -1);
g_return_val_if_fail (object != NULL, -1);
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object,
container->priv->children_type),
container->priv->child_type),
-1);
return GIMP_CONTAINER_GET_CLASS (container)->get_child_index (container,
@ -1175,7 +1176,7 @@ gimp_container_add_handler (GimpContainer *container,
if (! g_str_has_prefix (signame, "notify::"))
g_return_val_if_fail (g_signal_lookup (signame,
container->priv->children_type), 0);
container->priv->child_type), 0);
handler = g_slice_new0 (GimpContainerHandler);

View file

@ -304,17 +304,17 @@ gimp_filtered_container_new (GimpContainer *src_container,
GimpObjectFilterFunc filter_func,
gpointer filter_data)
{
GType children_type;
GType child_type;
GCompareFunc sort_func;
g_return_val_if_fail (GIMP_IS_LIST (src_container), NULL);
children_type = gimp_container_get_children_type (src_container);
sort_func = gimp_list_get_sort_func (GIMP_LIST (src_container));
child_type = gimp_container_get_children_type (src_container);
sort_func = gimp_list_get_sort_func (GIMP_LIST (src_container));
return g_object_new (GIMP_TYPE_FILTERED_CONTAINER,
"sort-func", sort_func,
"children-type", children_type,
"children-type", child_type,
"policy", GIMP_CONTAINER_POLICY_WEAK,
"unique-names", FALSE,
"src-container", src_container,

View file

@ -429,12 +429,12 @@ gimp_list_get_child_index (GimpContainer *container,
/**
* gimp_list_new:
* @children_type: the #GType of objects the list is going to hold
* @unique_names: if the list should ensure that all its children
* have unique names.
* @child_type: the #GType of objects the list is going to hold
* @unique_names: if the list should ensure that all its children
* have unique names.
*
* Creates a new #GimpList object. Since #GimpList is a #GimpContainer
* implementation, it holds GimpObjects. Thus @children_type must be
* implementation, it holds GimpObjects. Thus @child_type must be
* GIMP_TYPE_OBJECT or a type derived from it.
*
* The returned list has the #GIMP_CONTAINER_POLICY_STRONG.
@ -442,33 +442,33 @@ gimp_list_get_child_index (GimpContainer *container,
* Returns: a new #GimpList object
**/
GimpContainer *
gimp_list_new (GType children_type,
gimp_list_new (GType child_type,
gboolean unique_names)
{
GimpList *list;
g_return_val_if_fail (g_type_is_a (children_type, GIMP_TYPE_OBJECT), NULL);
g_return_val_if_fail (g_type_is_a (child_type, GIMP_TYPE_OBJECT), NULL);
list = g_object_new (GIMP_TYPE_LIST,
"children-type", children_type,
"children-type", child_type,
"policy", GIMP_CONTAINER_POLICY_STRONG,
"unique-names", unique_names ? TRUE : FALSE,
NULL);
/* for debugging purposes only */
gimp_object_set_static_name (GIMP_OBJECT (list), g_type_name (children_type));
gimp_object_set_static_name (GIMP_OBJECT (list), g_type_name (child_type));
return GIMP_CONTAINER (list);
}
/**
* gimp_list_new_weak:
* @children_type: the #GType of objects the list is going to hold
* @unique_names: if the list should ensure that all its children
* have unique names.
* @child_type: the #GType of objects the list is going to hold
* @unique_names: if the list should ensure that all its children
* have unique names.
*
* Creates a new #GimpList object. Since #GimpList is a #GimpContainer
* implementation, it holds GimpObjects. Thus @children_type must be
* implementation, it holds GimpObjects. Thus @child_type must be
* GIMP_TYPE_OBJECT or a type derived from it.
*
* The returned list has the #GIMP_CONTAINER_POLICY_WEAK.
@ -476,21 +476,21 @@ gimp_list_new (GType children_type,
* Returns: a new #GimpList object
**/
GimpContainer *
gimp_list_new_weak (GType children_type,
gimp_list_new_weak (GType child_type,
gboolean unique_names)
{
GimpList *list;
g_return_val_if_fail (g_type_is_a (children_type, GIMP_TYPE_OBJECT), NULL);
g_return_val_if_fail (g_type_is_a (child_type, GIMP_TYPE_OBJECT), NULL);
list = g_object_new (GIMP_TYPE_LIST,
"children-type", children_type,
"children-type", child_type,
"policy", GIMP_CONTAINER_POLICY_WEAK,
"unique-names", unique_names ? TRUE : FALSE,
NULL);
/* for debugging purposes only */
gimp_object_set_static_name (GIMP_OBJECT (list), g_type_name (children_type));
gimp_object_set_static_name (GIMP_OBJECT (list), g_type_name (child_type));
return GIMP_CONTAINER (list);
}

View file

@ -51,9 +51,9 @@ struct _GimpListClass
GType gimp_list_get_type (void) G_GNUC_CONST;
GimpContainer * gimp_list_new (GType children_type,
GimpContainer * gimp_list_new (GType child_type,
gboolean unique_names);
GimpContainer * gimp_list_new_weak (GType children_type,
GimpContainer * gimp_list_new_weak (GType child_type,
gboolean unique_names);
void gimp_list_reverse (GimpList *list);

View file

@ -261,17 +261,17 @@ GimpContainer *
gimp_tagged_container_new (GimpContainer *src_container)
{
GimpTaggedContainer *tagged_container;
GType children_type;
GType child_type;
GCompareFunc sort_func;
g_return_val_if_fail (GIMP_IS_LIST (src_container), NULL);
children_type = gimp_container_get_children_type (src_container);
sort_func = gimp_list_get_sort_func (GIMP_LIST (src_container));
child_type = gimp_container_get_children_type (src_container);
sort_func = gimp_list_get_sort_func (GIMP_LIST (src_container));
tagged_container = g_object_new (GIMP_TYPE_TAGGED_CONTAINER,
"sort-func", sort_func,
"children-type", children_type,
"children-type", child_type,
"policy", GIMP_CONTAINER_POLICY_WEAK,
"unique-names", FALSE,
"src-container", src_container,

View file

@ -505,11 +505,11 @@ gimp_tree_proxy_find_object (GimpContainer *container,
/* public functions */
GimpContainer *
gimp_tree_proxy_new (GType children_type)
gimp_tree_proxy_new (GType child_type)
{
GTypeClass *children_class;
children_class = g_type_class_ref (children_type);
children_class = g_type_class_ref (child_type);
g_return_val_if_fail (G_TYPE_CHECK_CLASS_TYPE (children_class,
GIMP_TYPE_VIEWABLE),
@ -518,7 +518,7 @@ gimp_tree_proxy_new (GType children_type)
g_type_class_unref (children_class);
return g_object_new (GIMP_TYPE_TREE_PROXY,
"children-type", children_type,
"children-type", child_type,
"policy", GIMP_CONTAINER_POLICY_WEAK,
"append", TRUE,
NULL);

View file

@ -49,7 +49,7 @@ struct _GimpTreeProxyClass
GType gimp_tree_proxy_get_type (void) G_GNUC_CONST;
GimpContainer * gimp_tree_proxy_new (GType children_type);
GimpContainer * gimp_tree_proxy_new (GType child_type);
GimpContainer * gimp_tree_proxy_new_for_container (GimpContainer *container);
void gimp_tree_proxy_set_container (GimpTreeProxy *tree_proxy,

View file

@ -462,13 +462,13 @@ gimp_container_editor_select_items (GimpContainerView *view,
if (editor->priv->container)
{
const gchar *signal_name;
GType children_type;
GType child_type;
children_type = gimp_container_get_children_type (editor->priv->container);
signal_name = gimp_context_type_to_signal_name (children_type);
child_type = gimp_container_get_children_type (editor->priv->container);
signal_name = gimp_context_type_to_signal_name (child_type);
if (signal_name)
gimp_context_set_by_type (editor->priv->context, children_type,
gimp_context_set_by_type (editor->priv->context, child_type,
GIMP_OBJECT (viewable));
}

View file

@ -905,11 +905,11 @@ gimp_container_icon_view_get_selected (GimpContainerView *view,
{
const gchar *signal_name;
GimpContext *context;
GType children_type;
GType child_type;
context = gimp_container_view_get_context (view);
children_type = gimp_container_get_children_type (container);
signal_name = gimp_context_type_to_signal_name (children_type);
context = gimp_container_view_get_context (view);
child_type = gimp_container_get_children_type (container);
signal_name = gimp_context_type_to_signal_name (child_type);
/* As a special case, for containers tied to a context object, we
* look up this object as being selected.
@ -918,7 +918,7 @@ gimp_container_icon_view_get_selected (GimpContainerView *view,
{
GimpObject *object;
object = gimp_context_get_by_type (context, children_type);
object = gimp_context_get_by_type (context, child_type);
selected_count = object ? 1 : 0;
if (items)

View file

@ -260,7 +260,7 @@ gimp_container_popup_create_view (GimpContainerPopup *popup)
GimpEditor *editor;
GtkWidget *button;
const gchar *signal_name;
GType children_type;
GType child_type;
gint rows;
gint columns;
@ -341,15 +341,15 @@ gimp_container_popup_create_view (GimpContainerPopup *popup)
/* Special-casing the object types managed by the context to make sure
* the right items are selected when opening the popup.
*/
children_type = gimp_container_get_children_type (popup->container);
signal_name = gimp_context_type_to_signal_name (children_type);
child_type = gimp_container_get_children_type (popup->container);
signal_name = gimp_context_type_to_signal_name (child_type);
if (signal_name)
{
GimpObject *object;
GList *items = NULL;
object = gimp_context_get_by_type (popup->orig_context, children_type);
object = gimp_context_get_by_type (popup->orig_context, child_type);
if (object)
items = g_list_prepend (NULL, object);

View file

@ -70,12 +70,12 @@ gimp_container_view_remove_active (GimpContainerView *view)
if (context && container)
{
GType children_type;
GType child_type;
GimpObject *active;
children_type = gimp_container_get_children_type (container);
child_type = gimp_container_get_children_type (container);
active = gimp_context_get_by_type (context, children_type);
active = gimp_context_get_by_type (context, child_type);
if (active)
{
@ -84,7 +84,7 @@ gimp_container_view_remove_active (GimpContainerView *view)
new = gimp_container_get_neighbor_of (container, active);
if (new)
gimp_context_set_by_type (context, children_type, new);
gimp_context_set_by_type (context, child_type, new);
gimp_container_remove (container, active);
}

View file

@ -487,17 +487,17 @@ gimp_container_view_set_dnd_widget (GimpContainerView *view,
void
gimp_container_view_enable_dnd (GimpContainerView *view,
GtkButton *button,
GType children_type)
GType child_type)
{
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
g_return_if_fail (GTK_IS_BUTTON (button));
gimp_dnd_viewable_list_dest_add (GTK_WIDGET (button),
children_type,
child_type,
gimp_container_view_button_viewables_dropped,
view);
gimp_dnd_viewable_dest_add (GTK_WIDGET (button),
children_type,
child_type,
gimp_container_view_button_viewable_dropped,
view);
}
@ -620,15 +620,15 @@ gimp_container_view_item_selected (GimpContainerView *view,
/* HACK */
if (private->container && private->context)
{
GType children_type;
GType child_type;
const gchar *signal_name;
children_type = gimp_container_get_children_type (private->container);
signal_name = gimp_context_type_to_signal_name (children_type);
child_type = gimp_container_get_children_type (private->container);
signal_name = gimp_context_type_to_signal_name (child_type);
if (signal_name)
{
gimp_context_set_by_type (private->context, children_type,
gimp_context_set_by_type (private->context, child_type,
GIMP_OBJECT (viewable));
return TRUE;
}
@ -640,19 +640,19 @@ gimp_container_view_item_selected (GimpContainerView *view,
if (success && private->container && private->context)
{
GimpContext *context;
GType children_type;
GType child_type;
/* ref and remember the context because private->context may
* become NULL by calling gimp_context_set_by_type()
*/
context = g_object_ref (private->context);
children_type = gimp_container_get_children_type (private->container);
context = g_object_ref (private->context);
child_type = gimp_container_get_children_type (private->container);
g_signal_handlers_block_by_func (context,
gimp_container_view_context_changed,
view);
gimp_context_set_by_type (context, children_type, GIMP_OBJECT (viewable));
gimp_context_set_by_type (context, child_type, GIMP_OBJECT (viewable));
g_signal_handlers_unblock_by_func (context,
gimp_container_view_context_changed,
@ -963,7 +963,7 @@ gimp_container_view_real_get_selected (GimpContainerView *view,
GList **items_data)
{
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
GType children_type;
GType child_type;
GimpObject *object;
if (items)
@ -981,8 +981,8 @@ gimp_container_view_real_get_selected (GimpContainerView *view,
if (! private->container || ! private->context)
return 0;
children_type = gimp_container_get_children_type (private->container);
if (gimp_context_type_to_property (children_type) == -1)
child_type = gimp_container_get_children_type (private->container);
if (gimp_context_type_to_property (child_type) == -1)
{
/* If you experience this warning, it means you should implement
* your own definition for get_selected() because the default one
@ -994,7 +994,7 @@ gimp_container_view_real_get_selected (GimpContainerView *view,
}
object = gimp_context_get_by_type (private->context,
children_type);
child_type);
/* Base interface provides the API for multi-selection but only
* implements single selection. Classes must implement their own
@ -1018,11 +1018,11 @@ gimp_container_view_add_container (GimpContainerView *view,
if (container == private->container)
{
GType children_type;
GType child_type;
GimpViewableClass *viewable_class;
children_type = gimp_container_get_children_type (container);
viewable_class = g_type_class_ref (children_type);
child_type = gimp_container_get_children_type (container);
viewable_class = g_type_class_ref (child_type);
private->name_changed_handler =
gimp_tree_handler_connect (container,
@ -1234,17 +1234,17 @@ gimp_container_view_thaw (GimpContainerView *view,
if (private->context)
{
GType children_type;
GType child_type;
const gchar *signal_name;
children_type = gimp_container_get_children_type (private->container);
signal_name = gimp_context_type_to_signal_name (children_type);
child_type = gimp_container_get_children_type (private->container);
signal_name = gimp_context_type_to_signal_name (child_type);
if (signal_name)
{
GimpObject *object;
object = gimp_context_get_by_type (private->context, children_type);
object = gimp_context_get_by_type (private->context, child_type);
gimp_container_view_select_item (view, GIMP_VIEWABLE (object));
}
@ -1289,11 +1289,11 @@ static void
gimp_container_view_connect_context (GimpContainerView *view)
{
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
GType children_type;
GType child_type;
const gchar *signal_name;
children_type = gimp_container_get_children_type (private->container);
signal_name = gimp_context_type_to_signal_name (children_type);
child_type = gimp_container_get_children_type (private->container);
signal_name = gimp_context_type_to_signal_name (child_type);
if (signal_name)
{
@ -1304,14 +1304,14 @@ gimp_container_view_connect_context (GimpContainerView *view)
if (private->dnd_widget)
gimp_dnd_viewable_dest_add (private->dnd_widget,
children_type,
child_type,
gimp_container_view_viewable_dropped,
view);
if (! gimp_container_frozen (private->container))
{
GimpObject *object = gimp_context_get_by_type (private->context,
children_type);
child_type);
gimp_container_view_select_item (view, GIMP_VIEWABLE (object));
}
@ -1322,11 +1322,11 @@ static void
gimp_container_view_disconnect_context (GimpContainerView *view)
{
GimpContainerViewPrivate *private = GIMP_CONTAINER_VIEW_GET_PRIVATE (view);
GType children_type;
GType child_type;
const gchar *signal_name;
children_type = gimp_container_get_children_type (private->container);
signal_name = gimp_context_type_to_signal_name (children_type);
child_type = gimp_container_get_children_type (private->container);
signal_name = gimp_context_type_to_signal_name (child_type);
if (signal_name)
{
@ -1338,7 +1338,7 @@ gimp_container_view_disconnect_context (GimpContainerView *view)
{
gtk_drag_dest_unset (private->dnd_widget);
gimp_dnd_viewable_dest_remove (private->dnd_widget,
children_type);
child_type);
}
}
}

View file

@ -118,7 +118,7 @@ void gimp_container_view_set_dnd_widget (GimpContainerView *v
void gimp_container_view_enable_dnd (GimpContainerView *editor,
GtkButton *button,
GType children_type);
GType child_type);
gboolean gimp_container_view_select_items (GimpContainerView *view,
GList *viewables);