Use g_get_os_info() to read os-release
Settings contains, in panels/common/cc-os-release.c
, an open-coded parser for /etc/os-release
/ /usr/lib/os-release
.
Happily, GLib 2.64 includes a g_get_os_info() function to pick individual keys out of this file, as well as a bunch of string constants for well-known keys. It would be nice to delete a bunch of code in gnome-control-center and use this instead.
The only complication is that gnome-control-center has some hardcoded defaults for NAME
, ID
, PRETTY_NAME
. But there are only 2 functions which use cc_os_release_get_value[s]
and, with one exception in cc_diagnostics_panel_init
, they already cope with NULL
values for these keys, so it should be straightforward to adjust these call sites.