diff options
-rw-r--r-- | hardinfo2/util.c | 33 | ||||
-rw-r--r-- | includes/hardinfo.h | 2 | ||||
-rw-r--r-- | modules/computer.c | 10 | ||||
-rw-r--r-- | modules/computer/environment.c | 6 |
4 files changed, 47 insertions, 4 deletions
diff --git a/hardinfo2/util.c b/hardinfo2/util.c index 32c93b49..0edd21c2 100644 --- a/hardinfo2/util.c +++ b/hardinfo2/util.c @@ -1347,3 +1347,36 @@ gboolean hardinfo_spawn_command_line_sync(const gchar *command_line, return g_spawn_command_line_sync(command_line, standard_output, standard_error, exit_status, error); } + + +#define MAX_STRWRAP 10000 +gchar *strwrap(const gchar *st, size_t w, gchar delimiter) +{ + gchar retst[MAX_STRWRAP]; + gchar *rst=retst; + const gchar *ist=st; + int first=1; + size_t len; + + if(!st) return NULL; + + while(((len=strlen(ist)) > 0) && (((rst-retst)+w+2)<MAX_STRWRAP)){ + if(len>w) len=w; + while((len>1) && (*(ist+len)!=0)&&(*(ist+len)!=delimiter)) len--; + if(len==1) {len=strlen(ist);if(len>w) len=w;} + if(!first) { + *rst++=13; + strncpy(rst,ist,len); + }else{ + strncpy(rst,ist,len); + } + rst+=len; + ist+=len; + if(*ist==delimiter) ist++; + if(*ist==0x20) ist++; + first=0; + } + *rst=0; + + return g_strdup(retst); +} diff --git a/includes/hardinfo.h b/includes/hardinfo.h index e99d14a0..03449227 100644 --- a/includes/hardinfo.h +++ b/includes/hardinfo.h @@ -227,4 +227,6 @@ gboolean note_cond_bullet(gboolean cond, gchar *note_buff, const gchar *desc_str gboolean note_require_tool(const gchar *tool, gchar *note_buff, const gchar *desc_str); int cpu_procs_cores_threads(int *p, int *c, int *t); +gchar *strwrap(const gchar *st, size_t w, gchar delimiter); + #endif /* __HARDINFO_H__ */ diff --git a/modules/computer.c b/modules/computer.c index 28f630d8..bb05544f 100644 --- a/modules/computer.c +++ b/modules/computer.c @@ -170,8 +170,10 @@ gchar *hi_get_field(gchar * field) void scan_summary(gboolean reload) { SCAN_START(); + gdk_window_freeze_updates(GDK_WINDOW(gtk_widget_get_window(shell_get_main_shell()->info_tree->view))); module_entry_scan_all_except(entries, 0); computer->alsa = computer_get_alsainfo(); + gdk_window_thaw_updates(GDK_WINDOW(gtk_widget_get_window(shell_get_main_shell()->info_tree->view))); SCAN_END(); } @@ -582,6 +584,7 @@ gchar *callback_summary(void) return info_flatten(info); } + gchar *callback_os(void) { struct Info *info = info_new(); @@ -602,7 +605,7 @@ gchar *callback_os(void) struct InfoGroup *version_group = info_add_group( info, _("Version"), info_field(_("Kernel"), computer->os->kernel), - info_field(_("Command Line"), computer->os->kcmdline ?: _("Unknown")), + info_field(_("Command Line"), idle_free(strwrap(computer->os->kcmdline,80,' ')) ?: _("Unknown")), info_field(_("Version"), computer->os->kernel_version), info_field(_("C Library"), computer->os->libc), info_field(_("Distribution"), distro, @@ -634,6 +637,7 @@ gchar *callback_os(void) gchar *callback_security(void) { + gchar *st; struct Info *info = info_new(); info_set_view_type(info, SHELL_VIEW_DETAIL); @@ -686,9 +690,11 @@ gchar *callback_security(void) g_strstr_len(contents, -1, "vulnerable")) icon = "circle_red_x.svg"; + st=strwrap(contents,90,','); + g_free(contents); info_group_add_fields(vulns, info_field(g_strdup(vuln), - idle_free(contents), .icon = icon, + idle_free(st), .icon = icon, .free_name_on_flatten = TRUE), info_field_last()); } diff --git a/modules/computer/environment.c b/modules/computer/environment.c index 2f29c861..bdec7456 100644 --- a/modules/computer/environment.c +++ b/modules/computer/environment.c @@ -25,14 +25,16 @@ void scan_env_var(gboolean reload) SCAN_START(); gchar **envlist; + gchar *st; gint i; g_free(_env); _env = g_strdup_printf("[%s]\n", _("Environment Variables") ); for (i = 0, envlist = g_listenv(); envlist[i]; i++) { - _env = h_strdup_cprintf("%s=%s\n", _env, - envlist[i], g_getenv(envlist[i])); + st=strwrap(g_getenv(envlist[i]),80,':'); + _env = h_strdup_cprintf("%s=%s\n", _env, envlist[i], st); + g_free(st); } g_strfreev(envlist); |