shell, window: Handle old panel arguments in System

The System panel subpages used to be CcPanels. They still have
their own desktop file so that they can be findable in Search.

A future goal is to decouple our Search model from our panel list
model, so that we can better handle panel subpages and other more
grained search results.

Fixes #2930
Fixes #2974
This commit is contained in:
Felipe Borges 2024-03-27 10:44:17 +01:00
parent 08644a7402
commit b823be5614

View file

@ -283,6 +283,8 @@ set_active_panel_from_id (CcWindow *self,
g_autoptr(GIcon) gicon = NULL;
g_autofree gchar *name = NULL;
CcPanelVisibility visibility;
CcPanelCategory category;
g_autoptr(GVariant) system_param_overwrite = NULL;
GtkTreeIter iter;
CcPanelListView view;
gboolean activated;
@ -318,10 +320,31 @@ set_active_panel_from_id (CcWindow *self,
COL_NAME, &name,
COL_GICON, &gicon,
COL_VISIBILITY, &visibility,
COL_CATEGORY, &category,
-1);
/* Handle "System" subpages by overwriting the start_id and parameters arguments.
* This is needed because they have their own desktop files. */
if (category == CC_CATEGORY_SYSTEM)
{
g_autofree gchar *param_str = NULL;
param_str = g_strdup_printf ("[<'%s'>]", start_id);
system_param_overwrite = g_variant_new_parsed (param_str);
g_variant_ref_sink (system_param_overwrite);
g_warning ("The direct access to `%s` is now deprecated. Please, use `system %s` instead.", start_id, start_id);
start_id = "system";
}
/* Activate the panel */
activated = activate_panel (self, start_id, parameters, name, gicon, visibility);
activated = activate_panel (self,
start_id,
system_param_overwrite != NULL ? system_param_overwrite : parameters,
name,
gicon,
visibility);
/* Failed to activate the panel for some reason, let's keep the old
* panel around instead */