diff options
author | Burt P <pburt0@gmail.com> | 2017-08-08 22:16:27 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2017-08-14 01:56:47 -0700 |
commit | a621442f194b697113a33eb2c44f2ebc3e1321ce (patch) | |
tree | 496f2b1dc82c969898620d95ee6032cb786dc4b0 /modules/devices/inputdevices.c | |
parent | 8709ccd315712f4b61fdf08451a0dce6c941d000 (diff) |
More "Making input devices information translatable"
Continuation of TotalCaesar659's work, but with the labels
broken out of the c-format string. Some tweaks to the handling of
vendor information and other cleanup.
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/devices/inputdevices.c')
-rw-r--r-- | modules/devices/inputdevices.c | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/modules/devices/inputdevices.c b/modules/devices/inputdevices.c index 9e104ca0..cf1728a9 100644 --- a/modules/devices/inputdevices.c +++ b/modules/devices/inputdevices.c @@ -85,55 +85,55 @@ __scan_input_devices(void) if (name && strstr(name, "PC Speaker")) { d = 3; // INPUT_PCSPKR } - - tmp = g_strdup_printf("INP%d", ++n); - input_list = h_strdup_cprintf("$%s$%s=\n", - input_list, - tmp, name); - input_icons = h_strdup_cprintf("Icon$%s$%s=%s\n", - input_icons, - tmp, name, - input_devices[d].icon); - gchar *strhash = g_strdup_printf(_("[Device Information]\n" - "Name=%s\n" - "Type=%s\n" - "Bus=0x%x\n"), - name, - input_devices[d].name, - bus); - - const gchar *url = vendor_get_url(name); - if (url) { - strhash = h_strdup_cprintf(_("Vendor=%s (%s)\n"), - strhash, - vendor_get_name(name), - url); - } else { - strhash = h_strdup_cprintf(_("Vendor=%x\n"), - strhash, - vendor); - } - strhash = h_strdup_cprintf(_("Product=0x%x\n" - "Version=0x%x\n"), - strhash, product, version); - - if (phys && phys[1] != 0) { - strhash = h_strdup_cprintf(_("Connected to=%s\n"), - strhash, phys); - } - - if (phys && strstr(phys, "ir")) { - strhash = h_strdup_cprintf("InfraRed port=yes\n", - strhash); - } - - moreinfo_add_with_prefix("DEV", tmp, strhash); - g_free(tmp); + tmp = g_strdup_printf("INP%d", ++n); + input_list = h_strdup_cprintf("$%s$%s=\n", + input_list, + tmp, name); + input_icons = h_strdup_cprintf("Icon$%s$%s=%s\n", + input_icons, + tmp, name, + input_devices[d].icon); + + const gchar *v_url = (gchar*)vendor_get_url(name); + const gchar *v_name = (gchar*)vendor_get_name(name); + gchar *v_str = NULL; + if (v_url != NULL) + v_str = g_strdup_printf("[0x%x] %s (%s)", vendor, v_name, v_url); + else + v_str = g_strdup_printf("0x%x", vendor); + v_str = hardinfo_clean_value(v_str, 1); + name = hardinfo_clean_value(name, 1); + + gchar *strhash = g_strdup_printf("[%s]\n" + /* Name */ "%s=%s\n" + /* Type */ "%s=%s\n" + /* Bus */ "%s=0x%x\n" + /* Vendor */ "%s=%s\n" + /* Product */"%s=0x%x\n" + /* Version */"%s=0x%x\n", + _("Device Information"), + _("Name"), name, + _("Type"), input_devices[d].name, + _("Bus"), bus, + _("Vendor"), v_str, + _("Product"), product, + _("Version"), version ); - g_free(phys); - g_free(name); - } + if (phys && phys[1] != 0) { + strhash = h_strdup_cprintf("%s=%s\n", strhash, _("Connected to"), phys); + } + + if (phys && strstr(phys, "ir")) { + strhash = h_strdup_cprintf("%s=%s\n", strhash, _("InfraRed port"), _("Yes") ); + } + + moreinfo_add_with_prefix("DEV", tmp, strhash); + g_free(tmp); + g_free(v_str); + g_free(phys); + g_free(name); + } } fclose(dev); |