/* * remove the currently selected items from the sheet * (especially their goocanvas representators) */ void sheet_delete_selection (Sheet *sheet) { GList *copy, *iter; g_return_if_fail (sheet != NULL); g_return_if_fail (IS_SHEET (sheet)); if (sheet->state != SHEET_STATE_NONE) return; copy = g_list_copy (sheet->priv->selected_objects); for (iter = copy; iter; iter = iter->next) { sheet_remove_item_in_sheet (SHEET_ITEM (iter->data), sheet); goo_canvas_item_remove (GOO_CANVAS_ITEM (iter->data)); } g_list_free (copy); // we need to it like this as <sheet_remove_item_in_sheet> // requires selected_objects, items, floating_objects // to be not NULL! g_list_free (sheet->priv->selected_objects); sheet->priv->selected_objects = NULL; }
void sheet_delete_selection (Sheet *sheet) { GList *list, *copy; g_return_if_fail (sheet != NULL); g_return_if_fail (IS_SHEET (sheet)); if (sheet->state != SHEET_STATE_NONE) return; copy = g_list_copy (sheet->priv->selected_objects); for (list = copy; list; list = list->next) { sheet_remove_item_in_sheet (SHEET_ITEM (list->data), sheet); goo_canvas_item_remove (GOO_CANVAS_ITEM (list->data)); } g_list_free (sheet->priv->selected_objects); sheet->priv->selected_objects = NULL; g_list_free (copy); }