diff options
author | Burt P <pburt0@gmail.com> | 2019-07-11 20:51:37 -0500 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2019-07-11 20:31:37 -0700 |
commit | 3a333a773e524b8f167168e0b50025e0ba3bf9c9 (patch) | |
tree | 0123e52d7193da993b63bf9d89647ae81e52c7f3 /shell/shell.c | |
parent | 89d149a497123e2841c50aaf7315e1ffa7e3f1f9 (diff) |
info struct bug Fixes, add tagged update fields
* tag was always included even when it didn't need to be. Now only
include it when tag specified, flagged, or includes an icon.
This messed up the existing update fields system.
* The update fields system has been changed to allow updating by tag
instead of the translated label. By label still works, however.
I think it would be best to switch to using tags in the future.
* info_flatten() calls flatten_shell_param() after flatten_group()
which could cause a field name or tag to be used after it was freed.
Created special free functions to handle this after all is used.
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'shell/shell.c')
-rw-r--r-- | shell/shell.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/shell/shell.c b/shell/shell.c index a7bf51c4..674280f7 100644 --- a/shell/shell.c +++ b/shell/shell.c @@ -1126,7 +1126,13 @@ static void group_handle_special(GKeyFile *key_file, ms = g_key_file_get_integer(key_file, group, key, NULL); - fu->field_name = g_strdup(g_utf8_strchr(key, -1, '$') + 1); + /* Old style used just the label which has to be checked by translating it, + * and potentially could by ambiguous. + * New style can use tag or label. If new style including a tag, + * send both tag and label and let the hi_get_field() function use + * key_get_components() to split it. */ + const gchar *chk = g_utf8_strchr(key, -1, '$'); + fu->field_name = g_strdup(key_is_flagged(chk) ? chk : chk + 1); fu->entry = entry; sfutbl = g_new0(ShellFieldUpdateSource, 1); @@ -1537,7 +1543,7 @@ static void module_selected_show_info_detail(GKeyFile *key_file, if (entry && entry->fieldfunc && value && g_str_equal(value, "...")) { g_free(value); - value = entry->fieldfunc(name); + value = entry->fieldfunc(keys[j]); } key_markup = |