Draft: cc-shell-model: remove hidden panels from shell search results
Would like to take on #2385 (closed) on as proposed here, but am unsure how to exactly proceed to
traverse the panel model to filter while populating the search provider model
after adding the visibility getter. In which function/module should this be done? An initial thought was to do
static void
cc_search_provider_app_startup (GApplication *application)
{
CcSearchProviderApp *self;
self = CC_SEARCH_PROVIDER_APP (application);
G_APPLICATION_CLASS (cc_search_provider_app_parent_class)->startup (application);
self->model = cc_shell_model_new ();
cc_panel_loader_fill_model (self->model);
GtkTreeIter iter;
gboolean valid;
valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->model), &iter);
while (valid)
{
g_autofree gchar *id = NULL;
gtk_tree_model_get (GTK_TREE_MODEL (self->model), &iter, COL_ID, &id, -1);
if (cc_shell_model_get_panel_visibility (self->model, id) == CC_PANEL_HIDDEN)
gtk_list_store_remove (GTK_LIST_STORE (self->model), &iter);
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (self->model), &iter);
}
}
But this causes a crash in update_panel_visibility
as hidden panels are now calling cc_shell_model_set_panel_visibility
on themselves while they do not exist in the store.
Would be very thankful if someone could point me in the right direction!
Fixes #2385 (closed).
Edited by Eric Daigle