apps: Uniquify application instances explicitly by id
Commit 0af108211c
introduced a
regression where applications that appear in multiple categories were
duplicated in the "All Apps" list, because we switched from
uniquifying on desktop file ID to the GMenuTreeEntry.
Switch back to keeping the set of apps based on ID. To flesh this
out, we keep the ShellApp instance for a given ID around forever, and
when we're loading new contents, we replace the GMenuTreeEntry inside
the app. That means callers still get new data.
We still keep around the running app list, though we could just
recompute it from the app list now.
https://bugzilla.gnome.org/show_bug.cgi?id=659351
This commit is contained in:
@ -819,12 +819,25 @@ _shell_app_new (GMenuTreeEntry *info)
|
||||
ShellApp *app;
|
||||
|
||||
app = g_object_new (SHELL_TYPE_APP, NULL);
|
||||
app->entry = gmenu_tree_item_ref (info);
|
||||
app->name_collation_key = g_utf8_collate_key (shell_app_get_name (app), -1);
|
||||
|
||||
_shell_app_set_entry (app, info);
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
void
|
||||
_shell_app_set_entry (ShellApp *app,
|
||||
GMenuTreeEntry *entry)
|
||||
{
|
||||
if (app->entry != NULL)
|
||||
gmenu_tree_item_unref (app->entry);
|
||||
app->entry = gmenu_tree_item_ref (entry);
|
||||
|
||||
if (app->name_collation_key != NULL)
|
||||
g_free (app->name_collation_key);
|
||||
app->name_collation_key = g_utf8_collate_key (shell_app_get_name (app), -1);
|
||||
}
|
||||
|
||||
static void
|
||||
shell_app_state_transition (ShellApp *app,
|
||||
ShellAppState state)
|
||||
|
Reference in New Issue
Block a user