gui/model: Improve the efficiency of gui_queue_model_clear()
We can cut out several thousand function calls and allocations by reusing the same GtkTreePath structure. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
c2178bc265
commit
53285534b9
|
@ -278,10 +278,15 @@ void gui_queue_model_remove(GuiQueueModel *model, unsigned int row)
|
|||
|
||||
void gui_queue_model_clear(GuiQueueModel *model, unsigned int n)
|
||||
{
|
||||
GtkTreePath *path = gtk_tree_path_new_from_indices(n - 1, -1);
|
||||
unsigned int i;
|
||||
|
||||
for (i = 1; i <= n; i++)
|
||||
gui_queue_model_remove(model, n - i);
|
||||
for (i = 0; i < n; i++) {
|
||||
gtk_tree_model_row_deleted(GTK_TREE_MODEL(model), path);
|
||||
gtk_tree_path_prev(path);
|
||||
}
|
||||
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
|
||||
void gui_queue_model_update(GuiQueueModel *model, unsigned int row)
|
||||
|
|
Loading…
Reference in New Issue