void rut_bin_set_child (RutBin *bin, RutObject *child_widget) { if (child_widget) rut_refable_ref (child_widget); if (bin->child) { rut_graphable_remove_child (bin->child); rut_closure_disconnect (bin->child_preferred_size_closure); bin->child_preferred_size_closure = NULL; rut_refable_unref (bin->child); } bin->child = child_widget; if (child_widget) { rut_graphable_add_child (bin->child_transform, child_widget); bin->child_preferred_size_closure = rut_sizable_add_preferred_size_callback (child_widget, child_preferred_size_cb, bin, NULL /* destroy */); queue_allocation (bin); } preferred_size_changed (bin); }
void rut_shim_set_child (RutShim *shim, RutObject *child) { g_return_if_fail (rut_object_get_type (shim) == &rut_shim_type); if (shim->child == child) return; if (shim->child) { rut_graphable_remove_child (shim->child); rut_closure_disconnect (shim->child_preferred_size_closure); shim->child_preferred_size_closure = NULL; rut_refable_unref (shim->child); } if (child) { shim->child = rut_refable_ref (child); rut_graphable_add_child (shim, child); shim->child_preferred_size_closure = rut_sizable_add_preferred_size_callback (child, child_preferred_size_cb, shim, NULL /* destroy */); queue_allocation (shim); } else shim->child = NULL; rut_shell_queue_redraw (shim->context->shell); }
void rig_selection_tool_set_active (RigSelectionTool *tool, bool active) { RigObjectsSelection *selection = tool->view->engine->objects_selection; GList *l; if (tool->active == active) return; tool->active = active; if (active) { tool->objects_selection_closure = rig_objects_selection_add_event_callback (selection, objects_selection_event_cb, tool, NULL); /* destroy notify */ for (l = selection->objects; l; l = l->next) { objects_selection_event_cb (selection, RIG_OBJECTS_SELECTION_ADD_EVENT, l->data, tool); } } else { for (l = selection->objects; l; l = l->next) { objects_selection_event_cb (selection, RIG_OBJECTS_SELECTION_REMOVE_EVENT, l->data, tool); } rut_closure_disconnect (tool->objects_selection_closure); tool->objects_selection_closure = NULL; } }
void rut_bin_set_child (RutBin *bin, RutObject *child_widget) { g_return_if_fail (rut_object_get_type (bin) == &rut_bin_type); if (bin->child == child_widget) return; if (child_widget) rut_refable_claim (child_widget, bin); if (bin->child) { rut_graphable_remove_child (bin->child); rut_closure_disconnect (bin->child_preferred_size_closure); bin->child_preferred_size_closure = NULL; rut_refable_release (bin->child, bin); } bin->child = child_widget; if (child_widget) { rut_graphable_add_child (bin->child_transform, child_widget); bin->child_preferred_size_closure = rut_sizable_add_preferred_size_callback (child_widget, child_preferred_size_cb, bin, NULL /* destroy */); queue_allocation (bin); } preferred_size_changed (bin); rut_shell_queue_redraw (bin->context->shell); }