Commit 13d4491b authored by Christian Hergert's avatar Christian Hergert

projects: use GListModel properly for project info removal

parent c70e1395
......@@ -358,8 +358,10 @@ ide_recent_projects_remove (IdeRecentProjects *self,
g_autofree gchar *file_uri = NULL;
GSequenceIter *iter;
GFile *file;
guint position;
g_assert (IDE_IS_PROJECT_INFO (liter->data));
g_assert (IDE_IS_PROJECT_INFO (project_info));
g_assert (self->projects != NULL);
iter = g_sequence_lookup (self->projects,
project_info,
......@@ -397,7 +399,9 @@ ide_recent_projects_remove (IdeRecentProjects *self,
g_clear_error (&error);
}
position = g_sequence_iter_get_position (iter);
g_sequence_remove (iter);
g_list_model_items_changed (G_LIST_MODEL (self), position, 1, 0);
}
if (!g_bookmark_file_to_file (projects_file, self->file_uri, &error))
......
......@@ -253,7 +253,6 @@ gbp_recent_section_collect_selected_cb (GtkWidget *widget,
project_info = ide_greeter_row_get_project_info (row);
*list = g_list_prepend (*list, g_object_ref (project_info));
gtk_widget_destroy (GTK_WIDGET (row));
}
}
......@@ -380,7 +379,6 @@ gbp_recent_section_purge_selected_full (IdeGreeterSection *section,
/* Remove the projects from the list of recent projects */
projects = ide_recent_projects_get_default ();
ide_recent_projects_remove (projects, infos);
/* Now asynchronously remove all the project files */
reaper = dzl_directory_reaper_new ();
......@@ -388,7 +386,7 @@ gbp_recent_section_purge_selected_full (IdeGreeterSection *section,
for (const GList *iter = infos; iter != NULL; iter = iter->next)
{
g_autoptr(IdeProjectInfo) info = iter->data;
IdeProjectInfo *info = iter->data;
const gchar *name = ide_project_info_get_name (info);
GFile *directory = _ide_project_info_get_real_directory (info);
GFile *file = ide_project_info_get_file (info);
......@@ -507,7 +505,8 @@ gbp_recent_section_purge_selected_full (IdeGreeterSection *section,
gbp_recent_section_reap_cb,
g_steal_pointer (&directories));
g_list_free (infos);
ide_recent_projects_remove (projects, infos);
g_list_free_full (infos, g_object_unref);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment