summaryrefslogtreecommitdiff
path: root/modules/computer
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-07-15 06:13:12 -0500
committerLeandro Pereira <leandro@hardinfo.org>2017-07-19 07:20:40 -0700
commitae4750fb3f5f40522bcfadac2d13c28d7d3d7879 (patch)
tree6976c1c33492e76e6781cee0b75e2f96f2271c3c /modules/computer
parentf85f2791487b39c90fa9881343f8f67634239aef (diff)
filesystem: make strings translatable
Plus a couple other minor tweaks. Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/computer')
-rw-r--r--modules/computer/filesystem.c114
-rw-r--r--modules/computer/users.c4
2 files changed, 60 insertions, 58 deletions
diff --git a/modules/computer/filesystem.c b/modules/computer/filesystem.c
index a7162777..397dc636 100644
--- a/modules/computer/filesystem.c
+++ b/modules/computer/filesystem.c
@@ -16,8 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Some code from xfce4-mount-plugin, version 0.4.3
- * Copyright (C) 2005 Jean-Baptiste jb_dul@yahoo.com
- * Distributed under the terms of GNU GPL 2.
+ * Copyright (C) 2005 Jean-Baptiste jb_dul@yahoo.com
+ * Distributed under the terms of GNU GPL 2.
*/
#include <string.h>
@@ -41,62 +41,64 @@ scan_filesystems(void)
mtab = fopen("/etc/mtab", "r");
if (!mtab)
- return;
+ return;
while (fgets(buf, 1024, mtab)) {
- gfloat size, used, avail;
- gchar **tmp;
-
- tmp = g_strsplit(buf, " ", 0);
- if (!statfs(tmp[1], &sfs)) {
- gfloat use_ratio;
-
- size = (float) sfs.f_bsize * (float) sfs.f_blocks;
- avail = (float) sfs.f_bsize * (float) sfs.f_bavail;
- used = size - avail;
-
- if (size == 0.0f) {
- continue;
- }
-
- if (avail == 0.0f) {
- use_ratio = 100.0f;
- } else {
- use_ratio = 100.0f * (used / size);
- }
-
- gchar *strsize = size_human_readable(size),
- *stravail = size_human_readable(avail),
- *strused = size_human_readable(used);
-
- gchar *strhash;
-
- strreplacechr(tmp[0], "#", '_');
- strhash = g_strdup_printf("[%s]\n"
- "Filesystem=%s\n"
- "Mounted As=%s\n"
- "Mount Point=%s\n"
- "Size=%s\n"
- "Used=%s\n"
- "Available=%s\n",
- tmp[0],
- tmp[2],
- strstr(tmp[3], "rw") ? "Read-Write" :
- "Read-Only", tmp[1], strsize, strused,
- stravail);
- gchar *key = g_strdup_printf("FS%d", ++count);
- moreinfo_add_with_prefix("COMP", key, strhash);
- g_free(key);
-
- fs_list = h_strdup_cprintf("$FS%d$%s=%.2f %% (%s of %s)|%s\n",
- fs_list,
- count, tmp[0], use_ratio, stravail, strsize, tmp[1]);
-
- g_free(strsize);
- g_free(stravail);
- g_free(strused);
- }
- g_strfreev(tmp);
+ gfloat size, used, avail;
+ gchar **tmp;
+
+ tmp = g_strsplit(buf, " ", 0);
+ if (!statfs(tmp[1], &sfs)) {
+ gfloat use_ratio;
+
+ size = (float) sfs.f_bsize * (float) sfs.f_blocks;
+ avail = (float) sfs.f_bsize * (float) sfs.f_bavail;
+ used = size - avail;
+
+ if (size == 0.0f) {
+ continue;
+ }
+
+ if (avail == 0.0f) {
+ use_ratio = 100.0f;
+ } else {
+ use_ratio = 100.0f * (used / size);
+ }
+
+ gchar *strsize = size_human_readable(size),
+ *stravail = size_human_readable(avail),
+ *strused = size_human_readable(used);
+
+ gchar *strhash;
+
+ strreplacechr(tmp[0], "#", '_');
+ strhash = g_strdup_printf("[%s]\n"
+ "%s=%s\n"
+ "%s=%s\n"
+ "%s=%s\n"
+ "%s=%s\n"
+ "%s=%s\n"
+ "%s=%s\n",
+ tmp[0], /* path */
+ _("Filesystem"), tmp[2],
+ _("Mounted As"), ( strstr(tmp[3], "rw") != NULL) ? _("Read-Write") : _("Read-Only"),
+ _("Mount Point"), tmp[1],
+ _("Size"), strsize,
+ _("Used"), strused,
+ _("Available"), stravail);
+ gchar *key = g_strdup_printf("FS%d", ++count);
+ moreinfo_add_with_prefix("COMP", key, strhash);
+ g_free(key);
+
+ fs_list = h_strdup_cprintf("$FS%d$%s=%.2f %% (%s of %s)|%s\n",
+ fs_list,
+ count, tmp[0], use_ratio, stravail, strsize, tmp[1]);
+
+ g_free(strsize);
+ g_free(stravail);
+ g_free(strused);
+ }
+ g_strfreev(tmp);
}
fclose(mtab);
diff --git a/modules/computer/users.c b/modules/computer/users.c
index dcb332ac..f47320bb 100644
--- a/modules/computer/users.c
+++ b/modules/computer/users.c
@@ -47,8 +47,8 @@ scan_users_do(void)
_("User Information"),
_("User ID"), (gint) passwd_->pw_uid,
_("Group ID"), (gint) passwd_->pw_gid,
- _("Home directory"), passwd_->pw_dir,
- _("Default shell"), passwd_->pw_shell);
+ _("Home Directory"), passwd_->pw_dir,
+ _("Default Shell"), passwd_->pw_shell);
moreinfo_add_with_prefix("COMP", key, val);
strend(passwd_->pw_gecos, ',');