Skip to content

Commit

Permalink
struct info: try bools instead of flags
Browse files Browse the repository at this point in the history
  • Loading branch information
bp0 authored and lpereira committed Jul 6, 2019
1 parent 5bd8021 commit 1d22dff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
6 changes: 3 additions & 3 deletions hardinfo/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ static void flatten_group(GString *output, const struct InfoGroup *group, guint
else
snprintf(tag, 255, "ITEM%d-%d", group_count, i);

if (*tag != 0 || field.flags)
if (*tag != 0 || field.highlight || field.report_details)
g_string_append_printf(output, "$%s%s%s$",
field.flags & INFO_FIELD_SELECTED ? "*" : "",
field.flags & INFO_FIELD_SELECTED ? "!" : "",
field.highlight ? "*" : "",
field.report_details ? "!" : "",
tag);

g_string_append_printf(output, "%s=%s\n", field.name, field.value);
Expand Down
22 changes: 2 additions & 20 deletions includes/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
#include <stdarg.h>
#include <glib.h>

enum {
INFO_NONE = 0,
INFO_FIELD_SELECTED = 1, /* '*' */
INFO_FIELD_REPORT_DETAILS
= 1<<1, /* '!' */
};

struct Info {
GArray *groups;

Expand Down Expand Up @@ -58,7 +51,8 @@ struct InfoField {
gchar *tag; /* moreinfo() lookup tag */

int update_interval;
unsigned int flags;
gboolean highlight; /* select in GUI, highlight in report (flag:*) */
gboolean report_details; /* show moreinfo() in report (flag:!) */

gboolean free_value_on_flatten;
int magic;
Expand Down Expand Up @@ -89,18 +83,6 @@ static inline struct InfoField info_field_with_icon(struct InfoField field, cons
field.icon = icon;
return field;
}
static inline struct InfoField info_field_set_flags(struct InfoField field, int flags)
{
field.flags |= flags;
return field;
}
#define info_field_selected(field, INFO_FIELD_SELECTED);
#define info_field_report_details(field, INFO_FIELD_REPORT_DETAILS);
static inline struct InfoField info_field_with_tag(struct InfoField field, const gchar *tag)
{
field.tag = g_strdup(tag);
return field;
}

void info_set_column_title(struct Info *info, const gchar *column, const gchar *title);
void info_set_column_headers_visible(struct Info *info, gboolean setting);
Expand Down

0 comments on commit 1d22dff

Please sign in to comment.