diff options
author | Ondrej Čerman <ondrej.cerman@gmail.com> | 2020-01-04 21:18:52 +0100 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2020-01-05 10:00:56 -0800 |
commit | 43498b2a714b7fabd61c9a90ff7fabb910165893 (patch) | |
tree | 7fa192abc0a06c5551fcad65f083098e902b6206 /hardinfo | |
parent | b6f45ad47930a2d40f7d0c85cad97912f78d678f (diff) |
firmware: switched to D-Bus
Diffstat (limited to 'hardinfo')
-rw-r--r-- | hardinfo/info.c | 13 | ||||
-rw-r--r-- | hardinfo/util.c | 20 |
2 files changed, 33 insertions, 0 deletions
diff --git a/hardinfo/info.c b/hardinfo/info.c index f888ddac..2d1d4159 100644 --- a/hardinfo/info.c +++ b/hardinfo/info.c @@ -431,6 +431,19 @@ gchar *info_flatten(struct Info *info) return g_string_free(values, FALSE); } +void info_remove_group(struct Info *info, guint index) +{ + struct InfoGroup *grp; + + if (index >= info->groups->len) + return; + + grp = &g_array_index(info->groups, struct InfoGroup, index); + free_group_fields(grp); + + g_array_remove_index(info->groups, index); +} + struct InfoField *info_find_field(struct Info *info, const gchar *tag, const gchar *name) { struct InfoGroup *group; struct InfoField *field; diff --git a/hardinfo/util.c b/hardinfo/util.c index b1db6922..89c3ffd4 100644 --- a/hardinfo/util.c +++ b/hardinfo/util.c @@ -1349,6 +1349,26 @@ gboolean g_strv_contains(const gchar * const * strv, const gchar *str) { } #endif +gchar *hardinfo_clean_grpname(const gchar *v, int replacing) { + gchar *clean, *p; + + p = clean = g_strdup(v); + while (*p != 0) { + switch(*p) { + case '[': + *p = '('; break; + case ']': + *p = ')'; break; + default: + break; + } + p++; + } + if (replacing) + g_free((gpointer)v); + return clean; +} + /* Hardinfo labels that have # are truncated and/or hidden. * Labels can't have $ because that is the delimiter in * moreinfo. */ |