Drop gtk_multi_selection-copy

It is not used anymore.
This commit is contained in:
Matthias Clasen 2020-06-05 00:15:09 -04:00
parent eeb2d2cc38
commit 843bf23f84
2 changed files with 0 additions and 50 deletions

View File

@ -387,51 +387,3 @@ gtk_multi_selection_new (GListModel *model)
"model", model,
NULL);
}
/**
* gtk_multi_selection_copy:
* @selection: the #GtkSelectionModel to copy
*
* Creates a #GtkMultiSelection that has the same underlying
* model and the same selected items as @selection.
*
* Returns: (transfer full): a new #GtkMultiSelection
*/
GtkMultiSelection *
gtk_multi_selection_copy (GtkSelectionModel *selection)
{
GtkMultiSelection *copy;
GListModel *model;
g_object_get (selection, "model", &model, NULL);
copy = GTK_MULTI_SELECTION (gtk_multi_selection_new (model));
if (GTK_IS_MULTI_SELECTION (selection))
{
GtkMultiSelection *multi = GTK_MULTI_SELECTION (selection);
gtk_set_free (copy->selected);
copy->selected = gtk_set_copy (multi->selected);
copy->last_selected = multi->last_selected;
}
else
{
guint pos, n;
guint start, n_items;
gboolean selected;
n = g_list_model_get_n_items (model);
n_items = 0;
for (pos = 0; pos < n; pos += n_items)
{
gtk_selection_model_query_range (selection, pos, &start, &n_items, &selected);
if (selected)
gtk_selection_model_select_range (GTK_SELECTION_MODEL (copy), start, n_items, FALSE);
}
}
g_object_unref (model);
return copy;
}

View File

@ -33,8 +33,6 @@ G_DECLARE_FINAL_TYPE (GtkMultiSelection, gtk_multi_selection, GTK, MULTI_SELECTI
GDK_AVAILABLE_IN_ALL
GListModel * gtk_multi_selection_new (GListModel *model);
GDK_AVAILABLE_IN_ALL
GtkMultiSelection * gtk_multi_selection_copy (GtkSelectionModel *selection);
G_END_DECLS