diff options
30 files changed, 1768 insertions, 911 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d4c60fec..5cd014d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,13 +137,11 @@ set(MODULE_computer_SOURCES ) set(MODULE_devices_SOURCES modules/devices.c - modules/devices/cpu_util.c modules/devices/${HARDINFO_ARCH}/processor.c modules/devices/battery.c modules/devices/devmemory.c modules/devices/dmi.c modules/devices/devicetree.c - modules/devices/devicetree/dt_util.c modules/devices/inputdevices.c modules/devices/pci.c modules/devices/printers.c @@ -222,6 +220,9 @@ add_executable(hardinfo hardinfo/util.c hardinfo/vendor.c hardinfo/info.c + hardinfo/cpu_util.c + hardinfo/dmi_util.c + hardinfo/dt_util.c shell/callbacks.c shell/iconcache.c shell/menu.c @@ -247,6 +248,9 @@ add_executable(hardinfo hardinfo/util.c hardinfo/vendor.c hardinfo/info.c + hardinfo/cpu_util.c + hardinfo/dmi_util.c + hardinfo/dt_util.c shell/callbacks.c shell/iconcache.c shell/menu.c diff --git a/benchmark.conf b/benchmark.conf index de59c9d9..9d2fc882 100644 --- a/benchmark.conf +++ b/benchmark.conf @@ -51,8 +51,8 @@ AMD Athlon(tm) XP 2200+=22.197|1782 MHz|Unknown Intel(R) Pentium(R) 4 CPU 3.06GHz=7.454|2x 3065 MHz|Unknown AMD Processor model unknown=5.242|2x 3006 MHz|Unknown AMD Turion(tm) 64 X2 Mobile Technology TL-62=7.519|2x 800 MHz|Unknown -ARM Cortex-A53 r0p4 (Aarch32)=11.95|4x 1200 MHz|Unknown -ARM ARM1176 r0p7 (Aarch32)=114.57|900 MHz|Unknown +Raspberry_Pi_3_Model_B_Rev_1_2;Broadcom_BCM2837;4800_00=11.97|4|Raspberry Pi 3 Model B Rev 1.2|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1200.00 MHz|945512|4|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits) +Raspberry_Pi_Model_B_Rev_1;Broadcom_BCM2835;900_00=114.42|1|Raspberry Pi Model B Rev 1|Broadcom BCM2835|1x ARM ARM1176 r0p7 (AArch32)|1x 900.00 MHz|233620|1|1|1 [CPU CryptoHash] Intel(R) Atom(TM) CPU330 @ 1.60GHz=105.569|4x 1596 MHz|Unknown Intel(R) Core(TM)2 Duo CPU T5250@ 1.50GHz=102.949|2x 1000 MHz|Unknown @@ -104,6 +104,8 @@ AMD Turion(tm) 64 Mobile Technology ML-37=42.208|2000 MHz|Unknown Intel(R) Xeon(R) CPU3040@ 1.86GHz=127.825|2x 1862 MHz|Unknown AMD Athlon(tm) XP 2500+=39.659|1792 MHz|Unknown Intel(R) Core(TM)2 Duo CPU T9500@ 2.60GHz=172.640|2x 2593 MHz|Unknown +Raspberry_Pi_3_Model_B_Rev_1_2;Broadcom_BCM2837;4800_00=98.27|4|Raspberry Pi 3 Model B Rev 1.2|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1200.00 MHz|945512|4|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits) +Raspberry_Pi_Model_B_Rev_1;Broadcom_BCM2835;900_00=11.70|1|Raspberry Pi Model B Rev 1|Broadcom BCM2835|1x ARM ARM1176 r0p7 (AArch32)|1x 900.00 MHz|233620|1|1|1 [CPU N-Queens] AMD Athlon(tm) 64 X2 Dual Core Processor 5400+=15.057|2x 1000 MHz|Unknown Genuine Intel(R) CPU T2080@ 1.73GHz=33.309|2x 800 MHz|Unknown @@ -155,6 +157,8 @@ AMD Athlon(tm) XP processor 1800+=17.547|1533 MHz|Unknown Intel(R) Core(TM)2 Duo CPU T5750@ 2.00GHz=11.140|2x 1994 MHz|Unknown Intel(R) Core(TM)2 Duo CPU T7250@ 2.00GHz=11.387|2x 2001 MHz|Unknown Intel(R) Pentium(R) 4 CPU 1500MHz=28.460|1495 MHz|Unknown +Raspberry_Pi_3_Model_B_Rev_1_2;Broadcom_BCM2837;4800_00=22.83|4|Raspberry Pi 3 Model B Rev 1.2|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1200.00 MHz|945512|4|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits) +Raspberry_Pi_Model_B_Rev_1;Broadcom_BCM2835;900_00=65.80|1|Raspberry Pi Model B Rev 1|Broadcom BCM2835|1x ARM ARM1176 r0p7 (AArch32)|1x 900.00 MHz|233620|1|1|1 [FPU Raytracing] Intel(R) Core(TM) Duo CPUT2450@ 2.00GHz=28.359|2x 800 MHz|Unknown AMD Athlon(tm) XP 2200+=29.739|1782 MHz|Unknown @@ -206,6 +210,9 @@ Intel(R) Pentium(R) M processor 1.80GHz=27.133|600 MHz|Unknown Intel(R) Celeron(R) CPU 2.80GHz=81.047|2793 MHz|Unknown Genuine Intel(R) CPU T1350@ 1.86GHz=222.178|1867 MHz|Unknown Intel(R) Pentium(R) 4 CPU 2.80GHz=28.658|2791 MHz|Unknown +Raspberry_Pi_3_Model_B_Rev_1_2;Broadcom_BCM2837;4800_00=16.21|4|Raspberry Pi 3 Model B Rev 1.2|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1200.00 MHz|945512|4|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits) +Raspberry_Pi_Model_B_Rev_1;Broadcom_BCM2835;900_00=112.48|1|Raspberry Pi Model B Rev 1|Broadcom BCM2835|1x ARM ARM1176 r0p7 (AArch32)|1x 900.00 MHz|233620|1|1|1 +PowerPC 740/750=161.312647|280.00 MHz|Unknown [CPU Blowfish] Intel(R) Pentium(R) D CPU 3.00GHz=10.838|2x 3000 MHz|Unknown Intel(R) Celeron(R) CPU540@ 1.86GHz=25.494|1861 MHz|Unknown @@ -257,6 +264,9 @@ Intel(R) Core(TM)2 Duo CPU T9400@ 2.53GHz=6.757|2x 800 MHz|Unknown AMD Athlon(tm) 64 X2 Dual Core Processor 4800+=8.735|2x 2512 MHz|Unknown Intel(R) Celeron(R) M CPU520@ 1.60GHz=22.072|1600 MHz|Unknown Intel(R) Core(TM)2 Quad CPUQ8300@ 2.50GHz=3.346|4x 2497 MHz|Unknown +Raspberry_Pi_3_Model_B_Rev_1_2;Broadcom_BCM2837;4800_00=10.41|4|Raspberry Pi 3 Model B Rev 1.2|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1200.00 MHz|945512|4|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits) +Raspberry_Pi_Model_B_Rev_1;Broadcom_BCM2835;900_00=77.47|1|Raspberry Pi Model B Rev 1|Broadcom BCM2835|1x ARM ARM1176 r0p7 (AArch32)|1x 900.00 MHz|233620|1|1|1 +PowerPC 740/750=172.816713|280.00 MHz|Unknown [CPU SHA1] [CPU MD5] [CPU Fibonacci] @@ -310,6 +320,12 @@ AMD Sempron(tm) Processor 3600+=5.696|1000 MHz|Unknown AMD Athlon(tm)=4.475|2305 MHz|Unknown AMD Athlon(tm) X2 Dual Core Processor BE-2300=4.373|2x 1899 MHz|Unknown Intel(R) Core(TM)2 Duo CPU E6750@ 2.66GHz=4.096|2x 2671 MHz|Unknown +Raspberry_Pi_3_Model_B_Rev_1_2;Broadcom_BCM2837;4800_00=12.29|4|Raspberry Pi 3 Model B Rev 1.2|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1200.00 MHz|945512|4|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits) +Raspberry_Pi_Model_B_Rev_1;Broadcom_BCM2835;900_00=20.15|1|Raspberry Pi Model B Rev 1|Broadcom BCM2835|1x ARM ARM1176 r0p7 (AArch32)|1x 900.00 MHz|233620|1|1|1 +PowerPC 740/750=58.07682|280.00 MHz|Unknown [CPU Zlib] -ARM Cortex-A53 r0p4 (Aarch32)=0.18|4x 1200 MHz|Unknown -ARM ARM1176 r0p7 (Aarch32)=0.01|900 MHz|Unknown +Raspberry_Pi_3_Model_B_Rev_1_2;Broadcom_BCM2837;4800_00=0.18|4|Raspberry Pi 3 Model B Rev 1.2|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1200.00 MHz|945512|4|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits) +Raspberry_Pi_Model_B_Rev_1;Broadcom_BCM2835;900_00=7169.12|1|Raspberry Pi Model B Rev 1|Broadcom BCM2835|1x ARM ARM1176 r0p7 (AArch32)|1x 900.00 MHz|233620|1|1|1 +PowerPC 740/750=2150.597408|280.00 MHz|Unknown +[GPU Drawing] +Raspberry_Pi_3_Model_B_Rev_1_2;Broadcom_BCM2837;4800_00=3984.56|4|Raspberry Pi 3 Model B Rev 1.2|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1200.00 MHz|945512|4|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits) diff --git a/modules/devices/cpu_util.c b/hardinfo/cpu_util.c index f5bddd5c..f5bddd5c 100644 --- a/modules/devices/cpu_util.c +++ b/hardinfo/cpu_util.c diff --git a/modules/devices/cpubits.c b/hardinfo/cpubits.c index ba9bffc7..ba9bffc7 100644 --- a/modules/devices/cpubits.c +++ b/hardinfo/cpubits.c diff --git a/hardinfo/dmi_util.c b/hardinfo/dmi_util.c new file mode 100644 index 00000000..28b2c197 --- /dev/null +++ b/hardinfo/dmi_util.c @@ -0,0 +1,157 @@ +/* + * HardInfo - Displays System Information + * Copyright (C) 2003-2017 Leandro A. F. Pereira <leandro@hardinfo.org> + * This file + * Copyright (C) 2017 Burt P. <pburt0@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "hardinfo.h" +#include "dmi_util.h" + +static const char *dmi_sysfs_root(void) { + char *candidates[] = { + "/sys/devices/virtual/dmi", + "/sys/class/dmi", + NULL + }; + int i = 0; + while (candidates[i] != NULL) { + if(access(candidates[i], F_OK) != -1) + return candidates[i]; + i++; + } + return NULL; +} + +char *dmi_get_str(const char *id_str) { + static struct { + char *id; + char *path; + } tab_dmi_sysfs[] = { + /* dmidecode -> sysfs */ + { "bios-release-date", "id/bios_date" }, + { "bios-vendor", "id/bios_vendor" }, + { "bios-version", "id/bios_version" }, + { "baseboard-product-name", "id/board_name" }, + { "baseboard-manufacturer", "id/board_vendor" }, + { "baseboard-version", "id/board_version" }, + { "baseboard-serial-number", "id/board_serial" }, + { "baseboard-asset-tag", "id/board_asset_tag" }, + { "system-product-name", "id/product_name" }, + { "system-manufacturer", "id/sys_vendor" }, + { "system-serial-number", "id/product_serial" }, + { "system-product-family", "id/product_family" }, + { "system-version", "id/product_version" }, + { "system-uuid", "product_uuid" }, + { "chassis-type", "id/chassis_type" }, + { "chassis-serial-number", "id/chassis_serial" }, + { "chassis-manufacturer", "id/chassis_vendor" }, + { "chassis-version", "id/chassis_version" }, + { "chassis-asset-tag", "id/chassis_asset_tag" }, + { NULL, NULL } + }; + const gchar *dmi_root = dmi_sysfs_root(); + gchar *ret = NULL; + gchar full_path[PATH_MAX]; + gboolean spawned; + gchar *out, *err; + + int i = 0; + + /* try sysfs first */ + if (dmi_root) { + while (tab_dmi_sysfs[i].id != NULL) { + if (strcmp(id_str, tab_dmi_sysfs[i].id) == 0) { + snprintf(full_path, PATH_MAX, "%s/%s", dmi_root, tab_dmi_sysfs[i].path); + if (g_file_get_contents(full_path, &ret, NULL, NULL) ) + goto dmi_str_done; + } + i++; + } + } + + /* try dmidecode, but may require root */ + snprintf(full_path, PATH_MAX, "dmidecode -s %s", id_str); + spawned = g_spawn_command_line_sync(full_path, + &out, &err, &i, NULL); + if (spawned) { + if (i == 0) + ret = out; + else + g_free(out); + + g_free(err); + } + +dmi_str_done: + if (ret != NULL) { + ret = strend(ret, '\n'); + ret = g_strstrip(ret); + /* return NULL on empty */ + if (*ret == 0) { + g_free(ret); + ret = NULL; + } + } + return ret; +} + +char *dmi_chassis_type_str(int chassis_type, gboolean with_val) { + static const char *types[] = { + N_("Invalid chassis type (0)"), + N_("Unknown chassis type"), /* 1 is "Other", but not helpful in HardInfo */ + N_("Unknown chassis type"), + N_("Desktop"), + N_("Low-profile Desktop"), + N_("Pizza Box"), + N_("Mini Tower"), + N_("Tower"), + N_("Portable"), + N_("Laptop"), + N_("Notebook"), + N_("Handheld"), + N_("Docking Station"), + N_("All-in-one"), + N_("Subnotebook"), + N_("Space-saving"), + N_("Lunch Box"), + N_("Main Server Chassis"), + N_("Expansion Chassis"), + N_("Sub Chassis"), + N_("Bus Expansion Chassis"), + N_("Peripheral Chassis"), + N_("RAID Chassis"), + N_("Rack Mount Chassis"), + N_("Sealed-case PC"), + }; + + if (chassis_type <= 0) { + gchar *chassis = dmi_get_str("chassis-type"); + if (chassis) { + chassis_type = atoi(chassis); + g_free(chassis); + } else + chassis_type = -1; + } + + if (chassis_type >= 0 && chassis_type < G_N_ELEMENTS(types)) { + if (with_val) + return g_strdup_printf("[%d] %s", chassis_type, _(types[chassis_type])); + + return g_strdup(_(types[chassis_type])); + } + return NULL; +} diff --git a/modules/devices/devicetree/dt_util.c b/hardinfo/dt_util.c index 9678042d..9678042d 100644 --- a/modules/devices/devicetree/dt_util.c +++ b/hardinfo/dt_util.c diff --git a/hardinfo/info.c b/hardinfo/info.c index ef64a420..0bbf7a07 100644 --- a/hardinfo/info.c +++ b/hardinfo/info.c @@ -148,7 +148,8 @@ static void flatten_group(GString *output, const struct InfoGroup *group) { guint i; - g_string_append_printf(output, "[%s]\n", group->name); + if (group->name != NULL) + g_string_append_printf(output, "[%s]\n", group->name); if (group->fields) { for (i = 0; i < group->fields->len; i++) { diff --git a/hardinfo/util.c b/hardinfo/util.c index 6ddf56ad..efa19b9c 100644 --- a/hardinfo/util.c +++ b/hardinfo/util.c @@ -876,9 +876,9 @@ static GSList *modules_check_deps(GSList * modules) module->name, deps[i]); gtk_dialog_add_buttons(GTK_DIALOG(dialog), - GTK_STOCK_NO, + "_No", GTK_RESPONSE_REJECT, - GTK_STOCK_OPEN, + "_Open", GTK_RESPONSE_ACCEPT, NULL); if (gtk_dialog_run(GTK_DIALOG(dialog)) == diff --git a/includes/devices.h b/includes/devices.h index 00787331..e18a3838 100644 --- a/includes/devices.h +++ b/includes/devices.h @@ -3,6 +3,7 @@ #include "hardinfo.h" #include "processor-platform.h" +#include "dmi_util.h" typedef struct _Processor Processor; @@ -45,6 +46,7 @@ gchar *processor_name_default(GSList * processors); gchar *processor_describe(GSList * processors); gchar *processor_describe_default(GSList * processors); gchar *processor_describe_by_counting_names(GSList * processors); +gchar *processor_frequency_desc(GSList *processors); /* Memory */ void init_memory_labels(void); @@ -91,8 +93,8 @@ extern GHashTable *sensor_labels; extern GModule *cups; #if defined(ARCH_x86) || defined(ARCH_x86_64) -extern gchar *dmi_info; extern gchar *spd_info; +extern gchar *dmi_info; #endif extern gchar *dtree_info; diff --git a/includes/dmi_util.h b/includes/dmi_util.h new file mode 100644 index 00000000..aecda739 --- /dev/null +++ b/includes/dmi_util.h @@ -0,0 +1,31 @@ +/* + * HardInfo - Displays System Information + * Copyright (C) 2003-2017 Leandro A. F. Pereira <leandro@hardinfo.org> + * This file + * Copyright (C) 2017 Burt P. <pburt0@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __DMI_UTIL_H__ +#define __DMI_UTIL_H__ + +char *dmi_get_str(const char *id_str); + +/* if chassis_type is <=0 it will be fetched from DMI. + * with_val = true, will return a string like "[3] Desktop" instead of just + * "Desktop". */ +char *dmi_chassis_type_str(int chassis_type, gboolean with_val); + +#endif diff --git a/modules/benchmark.c b/modules/benchmark.c index 50fddf4d..857904a8 100644 --- a/modules/benchmark.c +++ b/modules/benchmark.c @@ -30,6 +30,8 @@ #include "benchmark.h" +#include "benchmark/bench_results.c" + void scan_fft(gboolean reload); void scan_raytr(gboolean reload); void scan_bfsh(gboolean reload); @@ -186,14 +188,62 @@ static gchar *clean_cpuname(gchar *cpuname) return tmp; } +gchar *hi_more_info(gchar * entry) +{ + gchar *info = moreinfo_lookup_with_prefix("BENCH", entry); + if (info) + return g_strdup(info); + return g_strdup("?"); +} + +gchar *hi_get_field(gchar * field) +{ + gchar *info = moreinfo_lookup_with_prefix("BENCH", field); + if (info) + return g_strdup(info); + return g_strdup(field); +} + +static void br_mi_add(char **results_list, bench_result *b, gboolean select) { + gchar *ckey, *rkey; + + ckey = hardinfo_clean_label(b->machine->cpu_name, 0); + rkey = strdup(b->machine->mid); + + *results_list = h_strdup_cprintf("$%s%s$%s=%.2f|%s\n", *results_list, + select ? "*" : "", rkey, ckey, + b->result, b->machine->cpu_config); + + moreinfo_add_with_prefix("BENCH", rkey, bench_result_more_info(b) ); + + g_free(ckey); + g_free(rkey); +} + static gchar *__benchmark_include_results(gdouble result, const gchar * benchmark, ShellOrderType order_type) { + bench_result *b = NULL; GKeyFile *conf; - gchar **machines; + gchar **machines, *temp = NULL;; gchar *path, *results = g_strdup(""), *return_value, *processor_frequency, *processor_name; - int i; + int i, n_threads; + + moreinfo_del_with_prefix("BENCH"); + + if (result > 0.0) { + temp = module_call_method("devices::getProcessorCount"); + n_threads = temp ? atoi(temp) : 1; + g_free(temp); temp = NULL; + + b = bench_result_this_machine(benchmark, result, n_threads); + br_mi_add(&results, b, 1); + + temp = bench_result_benchmarkconf_line(b); + printf("[%s]\n%s", benchmark, temp); + g_free(temp); temp = NULL; + } conf = g_key_file_new(); @@ -205,56 +255,40 @@ static gchar *__benchmark_include_results(gdouble result, } g_key_file_load_from_file(conf, path, 0, NULL); + g_key_file_set_list_separator(conf, '|'); machines = g_key_file_get_keys(conf, benchmark, NULL, NULL); for (i = 0; machines && machines[i]; i++) { - gchar *value, *cleaned_machine; + gchar **values; + bench_result *sbr; - value = g_key_file_get_value(conf, benchmark, machines[i], NULL); - cleaned_machine = clean_cpuname(machines[i]); - results = h_strconcat(results, cleaned_machine, "=", value, "\n", NULL); + values = g_key_file_get_string_list(conf, benchmark, machines[i], NULL, NULL); - g_free(value); - g_free(cleaned_machine); + sbr = bench_result_benchmarkconf(benchmark, machines[i], values); + br_mi_add(&results, sbr, 0); + + bench_result_free(sbr); + g_strfreev(values); } g_strfreev(machines); g_free(path); g_key_file_free(conf); - if (result > 0.0f) { - processor_name = module_call_method("devices::getProcessorName"); - processor_frequency = module_call_method("devices::getProcessorFrequencyDesc"); - return_value = g_strdup_printf("[$ShellParam$]\n" - "Zebra=1\n" - "OrderType=%d\n" - "ViewType=3\n" - "ColumnTitle$Extra1=%s\n" /* CPU Clock */ - "ColumnTitle$Progress=%s\n" /* Results */ - "ColumnTitle$TextValue=%s\n" /* CPU */ - "ShowColumnHeaders=true\n" - "[%s]\n" - "<big><b>%s</b></big>=%.3f|%s\n" - "%s", order_type, - _("CPU Config"), _("Results"), _("CPU"), - benchmark, - processor_name, result, processor_frequency, results); - g_free(processor_frequency); - g_free(processor_name); - } else { - return_value = g_strdup_printf("[$ShellParam$]\n" - "Zebra=1\n" - "OrderType=%d\n" - "ViewType=3\n" - "ColumnTitle$Extra1=%s\n" /* CPU Clock */ - "ColumnTitle$Progress=%s\n" /* Results */ - "ColumnTitle$TextValue=%s\n" /* CPU */ - "ShowColumnHeaders=true\n" - "[%s]\n%s", - order_type, - _("CPU Config"), _("Results"), _("CPU"), - benchmark, results); - } + return_value = g_strdup_printf("[$ShellParam$]\n" + "Zebra=1\n" + "OrderType=%d\n" + "ViewType=4\n" + "ColumnTitle$Extra1=%s\n" /* CPU Clock */ + "ColumnTitle$Progress=%s\n" /* Results */ + "ColumnTitle$TextValue=%s\n" /* CPU */ + "ShowColumnHeaders=true\n" + "[%s]\n%s", + order_type, + _("CPU Config"), _("Results"), _("CPU"), + benchmark, results); + + bench_result_free(b); return return_value; } @@ -388,6 +422,27 @@ static void do_benchmark(void (*benchmark_function)(void), int entry) bench_image = icon_cache_get_image("benchmark.png"); gtk_widget_show(bench_image); +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *button; + GtkWidget *content_area; + GtkWidget *hbox; + GtkWidget *label; + + bench_dialog = gtk_dialog_new_with_buttons("", + NULL, + GTK_DIALOG_MODAL, + _("Cancel"), + GTK_RESPONSE_ACCEPT, + NULL); + content_area = gtk_dialog_get_content_area(GTK_DIALOG(bench_dialog)); + label = gtk_label_new(_("Benchmarking. Please do not move your mouse " \ + "or press any keys.")); + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); + gtk_box_pack_start(GTK_BOX(hbox), bench_image, TRUE, TRUE, 5); + gtk_box_pack_end(GTK_BOX(hbox), label, TRUE, TRUE, 5); + gtk_container_add(GTK_CONTAINER (content_area), hbox); + gtk_widget_show_all(bench_dialog); +#else bench_dialog = gtk_message_dialog_new(GTK_WINDOW(shell_get_main_shell()->window), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, @@ -398,6 +453,7 @@ static void do_benchmark(void (*benchmark_function)(void), int entry) gtk_dialog_add_buttons(GTK_DIALOG(bench_dialog), _("Cancel"), GTK_RESPONSE_ACCEPT, NULL); gtk_message_dialog_set_image(GTK_MESSAGE_DIALOG(bench_dialog), bench_image); +#endif while (gtk_events_pending()) { gtk_main_iteration(); @@ -686,4 +742,3 @@ gchar **hi_module_get_dependencies(void) return deps; } - diff --git a/modules/benchmark/bench_results.c b/modules/benchmark/bench_results.c new file mode 100644 index 00000000..226f595c --- /dev/null +++ b/modules/benchmark/bench_results.c @@ -0,0 +1,413 @@ +/* + * HardInfo - Displays System Information + * Copyright (C) 2003-2017 Leandro A. F. Pereira <leandro@hardinfo.org> + * This file: + * Copyright (C) 2017 Burt P. <pburt0@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/*/ Used for an unknown value. Having it in only one place cleans up the .po line references */ +static const char *unk = N_("(Unknown)"); + +typedef struct { + char *board; + int memory_kiB; + char *cpu_name; + char *cpu_desc; + char *cpu_config; + char *ogl_renderer; + int processors; + int cores; + int threads; + char *mid; +} simple_machine; + +typedef struct { + char *name; + float result; + int threads; + simple_machine *machine; + int legacy; /* an old benchmark.conf result */ +} bench_result; + +static char *cpu_config_retranslate(char *str, int force_en, int replacing) { + char *new_str = NULL; + char *mhz = (force_en) ? "MHz" : _("MHz"); + char *c = str, *tmp; + int t; + float f; + + if (str != NULL) { + new_str = strdup(""); + if (strchr(str, 'x')) { + while (c != NULL && sscanf(c, "%dx %f", &t, &f) ) { + tmp = g_strdup_printf("%s%s%dx %.2f %s", + new_str, strlen(new_str) ? " + " : "", + t, f, mhz ); + free(new_str); + new_str = tmp; + c = strchr(c+1, '+'); + } + } else { + sscanf(c, "%f", &f); + tmp = g_strdup_printf("%s%s%dx %.2f %s", + new_str, strlen(new_str) ? " + " : "", + 1, f, mhz ); + free(new_str); + new_str = tmp; + } + + if (replacing) + free(str); + } + return new_str; +} + +/* "2x 1400.00 MHz + 2x 800.00 MHz" -> 4400.0 */ +static float cpu_config_val(char *str) { + char *c = str; + int t; + float f, r = 0.0; + if (str != NULL) { + if (strchr(str, 'x')) { + while (c != NULL && sscanf(c, "%dx %f", &t, &f) ) { + r += f * t; + c = strchr(c+1, '+'); + } + } else { + sscanf(c, "%f", &r); + } + } + return r; +} + +static int cpu_config_cmp(char *str0, char *str1) { + float r0, r1; + r0 = cpu_config_val(str0); + r1 = cpu_config_val(str1); + if (r0 == r1) return 0; + if (r0 < r1) return -1; + return 1; +} + +static int cpu_config_is_close(char *str0, char *str1) { + float r0, r1, r1n; + r0 = cpu_config_val(str0); + r1 = cpu_config_val(str1); + r1n = r1 * .9; + if (r0 > r1n && r0 < r1) + return 1; + return 0; +} + +static gen_machine_id(simple_machine *m) { + char *s; + if (m) { + if (m->mid != NULL) + free(m->mid); + /* Don't try and translate unknown. The mid string needs to be made of all + * untranslated elements.*/ + m->mid = g_strdup_printf("%s;%s;%.2f", + (m->board != NULL) ? m->board : "(Unknown)", m->cpu_name, cpu_config_val(m->cpu_config) ); + s = m->mid; + while (*s != 0) { + if (!isalnum(*s)) { + if (*s != ';' + && *s != '(' + && *s != '(' + && *s != ')') + *s = '_'; + } + s++; + } + } +} + +simple_machine *simple_machine_new() { + simple_machine *m = NULL; + m = malloc(sizeof(simple_machine)); + if (m) + memset(m, 0, sizeof(simple_machine)); + return m; +} + +simple_machine *simple_machine_this() { + simple_machine *m = NULL; + char *tmp; + + m = simple_machine_new(); + if (m) { + m->board = module_call_method("devices::getMotherboard"); + m->cpu_name = module_call_method("devices::getProcessorName"); + m->cpu_desc = module_call_method("devices::getProcessorDesc"); + m->cpu_config = module_call_method("devices::getProcessorFrequencyDesc"); + m->ogl_renderer = module_call_method("computer::getOGLRenderer"); + tmp = module_call_method("devices::getMemoryTotal"); + m->memory_kiB = atoi(tmp); + free(tmp); + + cpu_procs_cores_threads(&m->processors, &m->cores, &m->threads); + /* + tmp = module_call_method("devices::getProcessorCount"); + m->threads = atoi(tmp); + free(tmp); + */ + + gen_machine_id(m); + } + return m; +} + +void simple_machine_free(simple_machine *s) { + if (s) { + free(s->board); + free(s->cpu_name); + free(s->cpu_desc); + free(s->cpu_config); + free(s->mid); + } +} + +void bench_result_free(bench_result *s) { + if (s) { + free(s->name); + simple_machine_free(s->machine); + } +} + +bench_result *bench_result_this_machine(const char *bench_name, float result, int threads) { + bench_result *b = NULL; + + b = malloc(sizeof(bench_result)); + if (b) { + memset(b, 0, sizeof(bench_result)); + b->machine = simple_machine_this(); + b->name = strdup(bench_name); + b->result = result; + b->threads = threads; + b->legacy = 0; + } + return b; +} + +/* -1 for none */ +static int nx_prefix(const char *str) { + char *s, *x; + if (str != NULL) { + s = (char*)str; + x = strchr(str, 'x'); + if (x && x-s >= 1) { + while(s != x) { + if (!isdigit(*s)) + return -1; + s++; + } + *x = 0; + return atoi(str); + } + } + return -1; +} + +bench_result *bench_result_benchmarkconf(const char *section, const char *key, char **values) { + bench_result *b = NULL; + char *s0, *s1, *s2; + int nx = 0, vl = 0; + float n, m; + + vl = g_strv_length(values); + + b = malloc(sizeof(bench_result)); + if (b) { + memset(b, 0, sizeof(bench_result)); + b->machine = simple_machine_new(); + b->name = strdup(section); + + if (vl >= 10) { /* the 11th could be empty */ + b->machine->mid = strdup(key); + b->result = atof(values[0]); + b->threads = atoi(values[1]); + b->machine->board = strdup(values[2]); + b->machine->cpu_name = strdup(values[3]); + b->machine->cpu_desc = strdup(values[4]); + b->machine->cpu_config = strdup(values[5]); + b->machine->memory_kiB = atoi(values[6]); + b->machine->processors = atoi(values[7]); + b->machine->cores = atoi(values[8]); + b->machine->threads = atoi(values[9]); + if (vl >= 11) + b->machine->ogl_renderer = strdup(values[10]); + b->legacy = 0; + } else if (vl >= 2) { + b->result = atof(values[0]); + b->legacy = 1; + + /* old old format has prefix before cpu name (ex: 4x Pentium...) */ + nx = nx_prefix(key); + if (nx > 0) { + b->machine->cpu_name = strdup(strchr(key, 'x') + 1); + b->machine->threads = nx; + b->threads = nx; + } else { + b->machine->cpu_name = strdup(key); + b->machine->threads = 1; + b->threads = 1; + } + + b->machine->cpu_config = strdup(values[1]); + /* new old format has cpu_config string with nx prefix */ + nx = nx_prefix(values[1]); + if (nx > 0) { + b->machine->threads = nx; + b->threads = nx; + } + + /* If the clock rate in the id string is more than the + * config string, use that. Older hardinfo used current cpu freq + * instead of max freq. + * "...@ 2.00GHz" -> 2000.0 */ + s0 = b->machine->cpu_name; + s2 = strstr(s0, "Hz"); + if (s2 && s2 > s0 + 2) { + m = 1; /* assume M */ + if (*(s2-1) == 'G') + m = 1000; + s1 = s2 - 2; + while (s1 > s0) { + if (!( isdigit(*s1) || *s1 == '.' || *s1 == ' ')) + break; + s1--; + } + + if (s1 > s0) { + n = atof(s1+1); + n *= m; + + s1 = g_strdup_printf("%dx %.2f %s", b->threads, n, _("MHz")); + if ( cpu_config_cmp(b->machine->cpu_config, s1) == -1 + && !cpu_config_is_close(b->machine->cpu_config, s1) ) { + free(b->machine->cpu_config); + b->machine->cpu_config = s1; + } else { + free(s1); + } + } + } + + /* old results only give threads */ + b->machine->processors = -1; + b->machine->cores = -1; + } + + b->machine->cpu_config = cpu_config_retranslate(b->machine->cpu_config, 0, 1); + if (b->machine->board != NULL && strlen(b->machine->board) == 0) { + free(b->machine->board); + b->machine->board = NULL; + } + if (b->machine->cpu_desc != NULL && strlen(b->machine->cpu_desc) == 0) { + free(b->machine->cpu_desc); + b->machine->cpu_desc = NULL; + } + gen_machine_id(b->machine); + } + return b; +} + +char *bench_result_benchmarkconf_line(bench_result *b) { + char *cpu_config = cpu_config_retranslate(b->machine->cpu_config, 1, 0); + char *ret = g_strdup_printf("%s=%.2f|%d|%s|%s|%s|%s|%d|%d|%d|%d|%s\n", + b->machine->mid, b->result, b->threads, + (b->machine->board != NULL) ? b->machine->board : "", + b->machine->cpu_name, + (b->machine->cpu_desc != NULL) ? b->machine->cpu_desc : "", + cpu_config, + b->machine->memory_kiB, + b->machine->processors, b->machine->cores, b->machine->threads, + (b->machine->ogl_renderer != NULL) ? b->machine->ogl_renderer : "" + ); + free(cpu_config); + return ret; +} + +char *bench_result_more_info(bench_result *b) { + char *memory = + (b->machine->memory_kiB > 0) + ? g_strdup_printf("%d %s", b->machine->memory_kiB, _("kiB") ) + : g_strdup(_(unk) ); + + char *ret = g_strdup_printf("[%s]\n" + /* threads */ "%s=%d\n" + /* legacy */ "%s=%s\n" + "[%s]\n" + /* board */ "%s=%s\n" + /* cpu */ "%s=%s\n" + /* cpudesc */ "%s=%s\n" + /* cpucfg */ "%s=%s\n" + /* threads */ "%s=%d\n" + /* ogl rend */ "%s=%s\n" + /* mem */ "%s=%s\n", + _("Benchmark Result"), + _("Threads"), b->threads, + b->legacy ? _("Note") : "#Note", + b->legacy ? _("This result is from an old version of HardInfo. Results might not be comparable to current version. Some details are missing.") : "", + _("Machine"), + _("Board"), (b->machine->board != NULL) ? b->machine->board : _(unk), + _("CPU Name"), b->machine->cpu_name, + _("CPU Description"), (b->machine->cpu_desc != NULL) ? b->machine->cpu_desc : _(unk), + _("CPU Config"), b->machine->cpu_config, + _("Threads Available"), b->machine->threads, + _("OpenGL Renderer"), (b->machine->ogl_renderer != NULL) ? b->machine->ogl_renderer : _(unk), + _("Memory"), memory + ); + free(memory); + return ret; +} + +char *bench_result_more_info_complete(bench_result *b) { + return g_strdup_printf("[%s]\n" + /* bench name */"%s=%s\n" + /* result */ "%s=%0.2f\n" + /* threads */ "%s=%d\n" + /* legacy */ "%s=%s\n" + "[%s]\n" + /* board */ "%s=%s\n" + /* cpu */ "%s=%s\n" + /* cpudesc */ "%s=%s\n" + /* cpucfg */ "%s=%s\n" + /* threads */ "%s=%d\n" + /* ogl rend */ "%s=%s\n" + /* mem */ "%s=%d %s\n" + "[%s]\n" + /* mid */ "%s=%s\n" + /* cfg_val */ "%s=%.2f\n", + _("Benchmark Result"), + _("Benchmark"), b->name, + _("Result"), b->result, + _("Threads"), b->threads, + b->legacy ? _("Note") : "#Note", + b->legacy ? _("This result is from an old version of HardInfo. Results might not be comparable to current version. Some details are missing.") : "", + _("Machine"), + _("Board"), (b->machine->board != NULL) ? b->machine->board : _(unk), + _("CPU Name"), b->machine->cpu_name, + _("CPU Description"), (b->machine->cpu_desc != NULL) ? b->machine->cpu_desc : _(unk), + _("CPU Config"), b->machine->cpu_config, + _("Threads Available"), b->machine->threads, + _("OpenGL Renderer"), (b->machine->ogl_renderer != NULL) ? b->machine->ogl_renderer : _(unk), + _("Memory"), b->machine->memory_kiB, _("kiB"), + _("Handles"), + _("mid"), b->machine->mid, + _("cfg_val"), cpu_config_val(b->machine->cpu_config) + ); +} diff --git a/modules/computer.c b/modules/computer.c index 513d94f5..ea6762a7 100644 --- a/modules/computer.c +++ b/modules/computer.c @@ -32,6 +32,10 @@ #include <vendor.h> #include "computer.h" + +#include "dmi_util.h" /* for dmi_get_str() */ +#include "dt_util.h" /* for dtr_get_string() */ + #include "info.h" /* Callbacks */ @@ -215,7 +219,7 @@ void scan_dev(gboolean reload) { N_("C (GCC)"), "gcc -v", "\\d+\\.\\d+\\.\\d+", FALSE }, { N_("C (Clang)"), "clang -v", "\\d+\\.\\d+", FALSE }, { N_("D (dmd)"), "dmd --help", "\\d+\\.\\d+", TRUE }, - { N_("Gambas3 (gbc3)"), "gbc3 --version", "\\d+\\.\\d+\\.\\d+", FALSE }, + { N_("Gambas3 (gbc3)"), "gbc3 --version", "\\d+\\.\\d+\\.\\d+", TRUE }, { N_("Java"), "javac -version", "\\d+\\.\\d+\\.\\d+", FALSE }, { N_("CSharp (Mono, old)"), "mcs --version", "\\d+\\.\\d+\\.\\d+\\.\\d+", TRUE }, { N_("CSharp (Mono)"), "gmcs --version", "\\d+\\.\\d+\\.\\d+\\.\\d+", TRUE }, @@ -230,7 +234,7 @@ void scan_dev(gboolean reload) { N_("valgrind"), "valgrind --version", "\\d+\\.\\d+\\.\\S+", TRUE }, { N_("QMake"), "qmake --version", "\\d+\\.\\S+", TRUE}, { N_("CMake"), "cmake --version", "\\d+\\.\\d+\\.?\\d*", TRUE}, - { N_("Gambas3 IDE"), "gambas3 --version", "\\d+\\.\\d+\\.\\d+", FALSE }, + { N_("Gambas3 IDE"), "gambas3 --version", "\\d+\\.\\d+\\.\\d+", TRUE }, }; g_free(dev_list); @@ -303,38 +307,19 @@ static gchar *detect_machine_type(void) GDir *dir; gchar *chassis; - if (g_file_get_contents("/sys/devices/virtual/dmi/id/chassis_type", &chassis, NULL, NULL)) { - static const char *types[] = { - N_("Invalid chassis type (0)"), - N_("Unknown chassis type"), /* 1 is "Other", but not helpful in HardInfo */ - N_("Unknown chassis type"), - N_("Desktop"), - N_("Low-profile Desktop"), - N_("Pizza Box"), - N_("Mini Tower"), - N_("Tower"), - N_("Portable"), - N_("Laptop"), - N_("Notebook"), - N_("Handheld"), - N_("Docking Station"), - N_("All-in-one"), - N_("Subnotebook"), - N_("Space-saving"), - N_("Lunch Box"), - N_("Main Server Chassis"), - N_("Expansion Chassis"), - N_("Sub Chassis"), - N_("Bus Expansion Chassis"), - N_("Peripheral Chassis"), - N_("RAID Chassis"), - N_("Rack Mount Chassis"), - N_("Sealed-case PC"), - }; - int chassis_type = atoi(idle_free(chassis)); - - if (chassis_type >= 0 && chassis_type < G_N_ELEMENTS(types)) - return g_strdup(_(types[chassis_type])); + chassis = dmi_chassis_type_str(-1, 0); + if (chassis) + return chassis; + + chassis = dtr_get_string("/model", 0); + if (chassis) { + if (strstr(chassis, "Raspberry Pi") != NULL + || strstr(chassis, "ODROID") != NULL + /* FIXME: consider making a table when adding more models */ ) { + g_free(chassis); + return g_strdup(_("Single-board computer")); + } + g_free(chassis); } if (g_file_test("/proc/pmu/info", G_FILE_TEST_EXISTS)) @@ -381,8 +366,6 @@ static gchar *detect_machine_type(void) /* FIXME: check if batteries are found using /proc/apm */ - /* FIXME: use dmidecode if available to get chassis type */ - return g_strdup(_("Unknown physical machine type")); } @@ -403,35 +386,43 @@ gchar *computer_get_virtualization(void) gchar *vmtype; } vm_types[] = { /* VMware */ - { "VMware", "Virtual (VMware)" }, - { ": VMware Virtual IDE CDROM Drive", "Virtual (VMware)" }, + { "VMware", N_("Virtual (VMware)") }, + { ": VMware Virtual IDE CDROM Drive", N_("Virtual (VMware)") }, /* QEMU */ - { "QEMU", "Virtual (QEMU)" }, - { "QEMU Virtual CPU", "Virtual (QEMU)" }, - { ": QEMU HARDDISK", "Virtual (QEMU)" }, - { ": QEMU CD-ROM", "Virtual (QEMU)" }, + { "QEMU", N_("Virtual (QEMU)") }, + { "QEMU Virtual CPU", N_("Virtual (QEMU)") }, + { ": QEMU HARDDISK", N_("Virtual (QEMU)") }, + { ": QEMU CD-ROM", N_("Virtual (QEMU)") }, /* Generic Virtual Machine */ - { ": Virtual HD,", "Virtual (Unknown)" }, - { ": Virtual CD,", "Virtual (Unknown)" }, + { ": Virtual HD,", N_("Virtual (Unknown)") }, + { ": Virtual CD,", N_("Virtual (Unknown)") }, /* Virtual Box */ - { "VBOX", "Virtual (VirtualBox)" }, - { ": VBOX HARDDISK", "Virtual (VirtualBox)" }, - { ": VBOX CD-ROM", "Virtual (VirtualBox)" }, + { "VBOX", N_("Virtual (VirtualBox)") }, + { ": VBOX HARDDISK", N_("Virtual (VirtualBox)") }, + { ": VBOX CD-ROM", N_("Virtual (VirtualBox)") }, /* Xen */ - { "Xen virtual console", "Virtual (Xen)" }, - { "Xen reported: ", "Virtual (Xen)" }, - { "xen-vbd: registered block device", "Virtual (Xen)" }, + { "Xen virtual console", N_("Virtual (Xen)") }, + { "Xen reported: ", N_("Virtual (Xen)") }, + { "xen-vbd: registered block device", N_("Virtual (Xen)") }, /* Generic */ - { " hypervisor", "Virtual (hypervisor present)"} , + { " hypervisor", N_("Virtual (hypervisor present)") } , { NULL } }; + gchar *tmp; DEBUG("Detecting virtual machine"); if (g_file_test("/proc/xen", G_FILE_TEST_EXISTS)) { DEBUG("/proc/xen found; assuming Xen"); - return g_strdup("Xen"); + return g_strdup(_("Virtual (Xen)")); + } + + tmp = module_call_method("devices::getMotherboard"); + if (strstr(tmp, "VirtualBox") != NULL) { + g_free(tmp); + return g_strdup(_("Virtual (VirtualBox)")); } + g_free(tmp); for (i = 0; files[i+1]; i++) { gchar buffer[512]; @@ -452,7 +443,7 @@ gchar *computer_get_virtualization(void) if (found) { DEBUG("%s found (by reading file %s)", vm_types[j].vmtype, files[i]); - return g_strdup(vm_types[j].vmtype); + return g_strdup(_(vm_types[j].vmtype)); } } @@ -489,9 +480,9 @@ gchar *callback_summary(void) idle_free(computer_get_alsacards(computer))); info_add_computed_group(info, _("Input Devices"), idle_free(module_call_method("devices::getInputDevices"))); - info_add_computed_group(info, _("Printers"), + info_add_computed_group(info, NULL, /* getPrinters provides group headers */ idle_free(module_call_method("devices::getPrinters"))); - info_add_computed_group(info, _("Storage"), + info_add_computed_group(info, NULL, /* getStorageDevices provides group headers */ idle_free(module_call_method("devices::getStorageDevices"))); return info_flatten(info); @@ -591,6 +582,7 @@ gchar *callback_display(void) computer->display->width, computer->display->height), info_field(_("Vendor"), computer->display->vendor), info_field(_("Version"), computer->display->version), + info_field(_("Current Display Name"), computer->display->display_name), info_field_last()); info_add_computed_group(info, _("Monitors"), computer->display->monitors); @@ -645,6 +637,13 @@ gchar *get_os(void) return g_strdup(computer->os->distro); } +gchar *get_ogl_renderer(void) +{ + scan_display(FALSE); + + return g_strdup(computer->display->ogl_renderer); +} + gchar *get_display_summary(void) { scan_display(FALSE); @@ -689,6 +688,7 @@ ShellModuleMethod *hi_exported_methods(void) {"getOSKernel", get_os_kernel}, {"getOS", get_os}, {"getDisplaySummary", get_display_summary}, + {"getOGLRenderer", get_ogl_renderer}, {"getAudioCards", get_audio_cards}, {"getKernelModuleDescription", get_kernel_module_description}, {NULL} diff --git a/modules/computer/boots.c b/modules/computer/boots.c index d8a6d32a..ba458242 100644 --- a/modules/computer/boots.c +++ b/modules/computer/boots.c @@ -24,43 +24,43 @@ void scan_boots_real(void) { - FILE *last; - char buffer[256]; + gchar **tmp; + gboolean spawned; + gchar *out, *err, *p, *s, *next_nl; scan_os(FALSE); if (!computer->os->boots) - computer->os->boots = g_strdup_printf("[%s]\n", _("Boots")); + computer->os->boots = strdup(""); else return; - last = popen("last", "r"); - if (last) { - while (fgets(buffer, 256, last)) { - if (strstr(buffer, "system boot")) { - gchar **tmp, *buf = buffer; - - strend(buffer, '\n'); - - while (*buf) { - if (*buf == ' ' && *(buf + 1) == ' ') { - memmove(buf, buf + 1, strlen(buf) + 1); - - buf--; - } else { - buf++; + spawned = g_spawn_command_line_sync("last", + &out, &err, NULL, NULL); + if (spawned && out != NULL) { + p = out; + while(next_nl = strchr(p, '\n')) { + strend(p, '\n'); + if (strstr(p, "system boot")) { + s = p; + while (*s) { + if (*s == ' ' && *(s + 1) == ' ') { + memmove(s, s + 1, strlen(s) + 1); + s--; + } else { + s++; + } + } + tmp = g_strsplit(p, " ", 0); + computer->os->boots = + h_strdup_cprintf("\n%s %s %s %s=%s", + computer->os->boots, + tmp[4], tmp[5], tmp[6], tmp[7], tmp[3]); + g_strfreev(tmp); } - } - - tmp = g_strsplit(buffer, " ", 0); - computer->os->boots = - h_strdup_cprintf("\n%s %s %s %s=%s|%s", - computer->os->boots, - tmp[4], tmp[5], tmp[6], tmp[7], tmp[3], tmp[8]); - g_strfreev(tmp); + p = next_nl + 1; } - } - - pclose(last); + g_free(out); + g_free(err); } } diff --git a/modules/computer/display.c b/modules/computer/display.c index 2c98b144..61eac4eb 100644 --- a/modules/computer/display.c +++ b/modules/computer/display.c @@ -26,38 +26,39 @@ get_glx_info(DisplayInfo *di) { gchar *output; if (g_spawn_command_line_sync("glxinfo", &output, NULL, NULL, NULL)) { - gchar **output_lines; - gint i = 0; + gchar **output_lines; + gint i = 0; - for (output_lines = g_strsplit(output, "\n", 0); - output_lines && output_lines[i]; - i++) { - if (strstr(output_lines[i], "OpenGL")) { - gchar **tmp = g_strsplit(output_lines[i], ":", 0); + for (output_lines = g_strsplit(output, "\n", 0); + output_lines && output_lines[i]; + i++) { + if (strstr(output_lines[i], "OpenGL")) { + gchar **tmp = g_strsplit(output_lines[i], ":", 0); - tmp[1] = g_strchug(tmp[1]); + tmp[1] = g_strchug(tmp[1]); - get_str("OpenGL vendor str", di->ogl_vendor); - get_str("OpenGL renderer str", di->ogl_renderer); - get_str("OpenGL version str", di->ogl_version); + get_str("OpenGL vendor str", di->ogl_vendor); + get_str("OpenGL renderer str", di->ogl_renderer); + get_str("OpenGL version str", di->ogl_version); - g_strfreev(tmp); - } else if (strstr(output_lines[i], "direct rendering: Yes")) { - di->dri = TRUE; - } - } + g_strfreev(tmp); + } else if (strstr(output_lines[i], "direct rendering: Yes")) { + di->dri = TRUE; + } + } + + g_free(output); + g_strfreev(output_lines); + + if (!di->ogl_vendor) + di->ogl_vendor = _("(Unknown)"); + if (!di->ogl_renderer) + di->ogl_renderer = _("(Unknown)"); + if (!di->ogl_version) + di->ogl_version = _("(Unknown)"); - g_free(output); - g_strfreev(output_lines); - - if (!di->ogl_vendor) - di->ogl_vendor = "Unknown"; - if (!di->ogl_renderer) - di->ogl_renderer = "Unknown"; - if (!di->ogl_version) - di->ogl_version = "Unknown"; } else { - di->ogl_vendor = di->ogl_renderer = di->ogl_version = "Unknown"; + di->ogl_vendor = di->ogl_renderer = di->ogl_version = _("(Unknown)"); } } @@ -66,7 +67,7 @@ static void get_x11_info(DisplayInfo *di) { gchar *output; - + if (g_spawn_command_line_sync("xdpyinfo", &output, NULL, NULL, NULL)) { gchar **output_lines, **old; @@ -74,8 +75,9 @@ get_x11_info(DisplayInfo *di) g_free(output); old = output_lines; - while (*(output_lines++)) { - gchar **tmp = g_strsplit(*output_lines, ":", 0); + while (*output_lines) { + gchar **tmp = g_strsplit(*output_lines, ":", 2); + output_lines++; if (tmp[1] && tmp[0]) { tmp[1] = g_strchug(tmp[1]); @@ -83,20 +85,21 @@ get_x11_info(DisplayInfo *di) get_str("vendor string", di->vendor); get_str("X.Org version", di->version); get_str("XFree86 version", di->version); + get_str("name of display", di->display_name); if (g_str_has_prefix(tmp[0], "number of extensions")) { int n; - + di->extensions = g_strdup(""); - + for (n = atoi(tmp[1]); n; n--) { - di->extensions = h_strconcat(di->extensions, + di->extensions = h_strconcat(di->extensions, g_strstrip(*(++output_lines)), "=\n", NULL); } g_strfreev(tmp); - + break; } } @@ -106,19 +109,19 @@ get_x11_info(DisplayInfo *di) g_strfreev(old); } - + GdkScreen *screen = gdk_screen_get_default(); - + if (screen && GDK_IS_SCREEN(screen)) { gint n_monitors = gdk_screen_get_n_monitors(screen); gint i; - + di->monitors = NULL; for (i = 0; i < n_monitors; i++) { GdkRectangle rect; - + gdk_screen_get_monitor_geometry(screen, i, &rect); - + di->monitors = h_strdup_cprintf(_("Monitor %d=%dx%d pixels\n"), di->monitors, i, rect.width, rect.height); } @@ -131,9 +134,9 @@ DisplayInfo * computer_get_display(void) { DisplayInfo *di = g_new0(DisplayInfo, 1); - + GdkScreen *screen = gdk_screen_get_default(); - + if (screen && GDK_IS_SCREEN(screen)) { di->width = gdk_screen_get_width(screen); di->height = gdk_screen_get_height(screen); diff --git a/modules/computer/uptime.c b/modules/computer/uptime.c index 5f0f1942..6ef3d250 100644 --- a/modules/computer/uptime.c +++ b/modules/computer/uptime.c @@ -30,6 +30,7 @@ computer_get_uptime(void) ui->minutes = minutes / 60; fclose(procuptime); } else { + g_free(ui); return NULL; } diff --git a/modules/devices.c b/modules/devices.c index 9c7a184d..152b6831 100644 --- a/modules/devices.c +++ b/modules/devices.c @@ -359,24 +359,37 @@ gchar *get_memory_total(void) gchar *get_motherboard(void) { - char *board_name, *board_vendor, *product_version; + char *board_name, *board_vendor, *system_version; + char *ret; #if defined(ARCH_x86) || defined(ARCH_x86_64) scan_dmi(FALSE); - board_name = moreinfo_lookup("DEV:DMI:Board:Name"); - board_vendor = moreinfo_lookup("DEV:DMI:Board:Vendor"); - product_version = moreinfo_lookup("DEV:DMI:Product:Version#1"); - - if (!board_name || !*board_name) - board_name = _(" (model unknown)"); - if (!board_vendor || !*board_vendor) - board_vendor = _(" (vendor unknown)"); - - if (product_version && *product_version) - return g_strdup_printf("%s / %s (%s)", product_version, board_name, board_vendor); - - return g_strconcat(board_vendor, " ", board_name, NULL); + board_name = dmi_get_str("baseboard-product-name"); + if (board_name == NULL) + board_name = dmi_get_str("system-product-name"); + + board_vendor = dmi_get_str("baseboard-manufacturer"); + if (board_vendor == NULL) + board_vendor = dmi_get_str("system-manufacturer"); + + system_version = dmi_get_str("system-version"); + + if (board_name && board_vendor && system_version) + ret = g_strdup_printf("%s / %s (%s)", system_version, board_name, board_vendor); + else if (board_name && board_vendor) + ret = g_strconcat(board_vendor, " ", board_name, NULL); + else if (board_name) + ret = g_strdup(board_name); + else if (board_vendor) + ret = g_strdup(board_vendor); + else + ret = g_strdup(_("(Unknown)")); + + free(board_name); + free(board_vendor); + free(system_version); + return ret; #endif /* use device tree "model" */ diff --git a/modules/devices/arm/processor.c b/modules/devices/arm/processor.c index e9446229..37f07d79 100644 --- a/modules/devices/arm/processor.c +++ b/modules/devices/arm/processor.c @@ -264,7 +264,7 @@ gchar *processor_name(GSList *processors) { * ex: "brcm,bcm2837", "brcm,bcm2836"; * would match 2836 when it is a 2837. */ -#define UNKSOC "(Unknown)" +#define UNKSOC "(Unknown)" /* don't translate this */ const struct { char *search_str; char *vendor; @@ -285,6 +285,23 @@ gchar *processor_name(GSList *processors) { { "ti,omap3", "Texas Instruments", "OMAP3-family" }, { "ti,omap2", "Texas Instruments", "OMAP2-family" }, { "ti,omap1", "Texas Instruments", "OMAP1-family" }, + { "mediatek,mt6799", "MediaTek", "MT6799 Helio X30" }, + { "mediatek,mt6799", "MediaTek", "MT6799 Helio X30" }, + { "mediatek,mt6797x", "MediaTek", "MT6797X Helio X27" }, + { "mediatek,mt6797t", "MediaTek", "MT6797T Helio X25" }, + { "mediatek,mt6797", "MediaTek", "MT6797 Helio X20" }, + { "mediatek,mt6757T", "MediaTek", "MT6757T Helio P25" }, + { "mediatek,mt6757", "MediaTek", "MT6757 Helio P20" }, + { "mediatek,mt6795", "MediaTek", "MT6795 Helio X10" }, + { "mediatek,mt6755", "MediaTek", "MT6755 Helio P10" }, + { "mediatek,mt6750t", "MediaTek", "MT6750T" }, + { "mediatek,mt6750", "MediaTek", "MT6750" }, + { "mediatek,mt6753", "MediaTek", "MT6753" }, + { "mediatek,mt6752", "MediaTek", "MT6752" }, + { "mediatek,mt6738", "MediaTek", "MT6738" }, + { "mediatek,mt6737t", "MediaTek", "MT6737T" }, + { "mediatek,mt6735", "MediaTek", "MT6735" }, + { "mediatek,mt6732", "MediaTek", "MT6732" }, { "qcom,msm8939", "Qualcomm", "Snapdragon 615"}, { "qcom,msm", "Qualcomm", "Snapdragon-family"}, { "nvidia,tegra" "nVidia", "Tegra-family" }, @@ -293,6 +310,7 @@ gchar *processor_name(GSList *processors) { { "rockchip," "Rockchip", UNKSOC }, { "ti,", "Texas Instruments", UNKSOC }, { "qcom,", "Qualcom", UNKSOC }, + { "mediatek," "MediaTek", UNKSOC }, { NULL, NULL } }; gchar *ret = NULL; diff --git a/modules/devices/devicetree.c b/modules/devices/devicetree.c index 6fce066a..4f3c85a2 100644 --- a/modules/devices/devicetree.c +++ b/modules/devices/devicetree.c @@ -29,13 +29,16 @@ #include "cpu_util.h" #include "dt_util.h" +/* These should really go into CMakeLists.txt */ +#if defined(__arm__) #include "devicetree/rpi_data.c" +#elif defined(__powerpc__) #include "devicetree/pmac_data.c" +#endif -dtr *dt; gchar *dtree_info = NULL; -gchar *get_node(char *np) { +static gchar *get_node(dtr *dt, char *np) { gchar *nodes = NULL, *props = NULL, *ret = NULL; gchar *tmp = NULL, *pstr = NULL, *lstr = NULL; gchar *dir_path; @@ -90,83 +93,111 @@ gchar *get_node(char *np) { dtr_obj_free(node); g_free(props); g_free(nodes); + return ret; } /* different from dtr_get_string() in that it re-uses the existing dt */ -char *get_dt_string(char *path, int decode) { - dtr_obj *obj; - char *ret = NULL; +static char *get_dt_string(dtr *dt, char *path, gboolean decode) { + char *ret; + if (decode) { - obj = dtr_get_prop_obj(dt, NULL, path); + dtr_obj *obj = dtr_get_prop_obj(dt, NULL, path); + ret = dtr_str(obj); + dtr_obj_free(obj); - } else + } else { ret = dtr_get_prop_str(dt, NULL, path); + } + return ret; } -gchar *get_summary() { +static gchar *get_summary(dtr *dt) { char *model = NULL, *compat = NULL; - char *tmp[10]; char *ret = NULL; - model = get_dt_string("/model", 0); - compat = get_dt_string("/compatible", 1); + model = get_dt_string(dt, "/model", 0); + compat = get_dt_string(dt, "/compatible", 1); UNKIFNULL(model); EMPIFNULL(compat); +#if defined(__arm__) /* Expand on the DT information from known machines, like RPi. * RPi stores a revision value in /proc/cpuinfo that can be used * to look up details. This is just a nice place to pull it all * together for DT machines, with a nice fallback. * PPC Macs could be handled this way too. They store * machine identifiers in /proc/cpuinfo. */ - if ( strstr(model, "Raspberry Pi") != NULL - || strstr(compat, "raspberrypi") != NULL ) { - tmp[0] = get_dt_string("/serial-number", 1); - tmp[1] = get_dt_string("/soc/gpu/compatible", 1); - tmp[9] = rpi_board_details(); - tmp[8] = g_strdup_printf( - "[%s]\n" "%s=%s\n" "%s=%s\n", + if (strstr(model, "Raspberry Pi") + || strstr(compat, "raspberrypi")) { + gchar *gpu_compat = get_dt_string(dt, "/soc/gpu/compatible", 1); + gchar *rpi_details = rpi_board_details(); + gchar *basic_info; + + basic_info = g_strdup_printf( + "[%s]\n" + "%s=%s\n" + "%s=%s\n", _("Platform"), _("Compatible"), compat, - _("GPU-compatible"), tmp[1] ); - if (tmp[9] != NULL) { - ret = g_strdup_printf("%s%s", tmp[9], tmp[8]); + _("GPU-compatible"), gpu_compat); + + if (rpi_details) { + ret = g_strconcat(rpi_details, basic_info, NULL); + + g_free(rpi_details); } else { + gchar *serial_number = get_dt_string(dt, "/serial-number", 1); + ret = g_strdup_printf( - "[%s]\n" "%s=%s\n" "%s=%s\n" "%s=%s\n" "%s", + "[%s]\n" + "%s=%s\n" + "%s=%s\n" + "%s=%s\n" + "%s", _("Raspberry Pi or Compatible"), _("Model"), model, - _("Serial Number"), tmp[0], + _("Serial Number"), serial_number, _("RCode"), _("No revision code available; unable to lookup model details."), - tmp[8]); + basic_info); + + g_free(serial_number); } - free(tmp[0]); free(tmp[1]); - free(tmp[9]); free(tmp[8]); + + g_free(gpu_compat); + g_free(basic_info); } +#endif +#if defined(__powerpc__) /* Power Macintosh */ if (strstr(compat, "PowerBook") != NULL || strstr(compat, "MacRISC") != NULL || strstr(compat, "Power Macintosh") != NULL) { - tmp[9] = ppc_mac_details(); - if (tmp[9] != NULL) { - tmp[0] = get_dt_string("/serial-number", 1); + gchar *mac_details = ppc_mac_details(); + + if (mac_details) { + gchar *serial_number = get_dt_string(dt, "/serial-number", 1); + ret = g_strdup_printf( - "%s[%s]\n" "%s=%s\n", tmp[9], + "%s[%s]\n" + "%s=%s\n", + mac_details, _("More"), - _("Serial Number"), tmp[0] ); - free(tmp[0]); + _("Serial Number"), serial_number); + + free(mac_details); + free(serial_number); } - free(tmp[9]); } +#endif /* fallback */ - if (ret == NULL) { - tmp[0] = get_dt_string("/serial-number", 1); - EMPIFNULL(tmp[0]); + if (!ret) { + gchar *serial_number = get_dt_string(dt, "/serial-number", 1); + EMPIFNULL(serial_number); ret = g_strdup_printf( "[%s]\n" "%s=%s\n" @@ -174,15 +205,18 @@ gchar *get_summary() { "%s=%s\n", _("Board"), _("Model"), model, - _("Serial Number"), tmp[0], + _("Serial Number"), serial_number, _("Compatible"), compat); - free(tmp[0]); + free(serial_number); } + free(model); + free(compat); + return ret; } -void mi_add(const char *key, const char *value) { +static void mi_add(const char *key, const char *value) { gchar *ckey, *rkey; ckey = hardinfo_clean_label(key, 0); @@ -195,7 +229,7 @@ void mi_add(const char *key, const char *value) { g_free(rkey); } -void add_keys(char *np) { +static void add_keys(dtr *dt, char *np) { gchar *dir_path, *dt_path; gchar *ftmp, *ntmp; gchar *n_info; @@ -206,7 +240,7 @@ void add_keys(char *np) { /* add self */ obj = dtr_obj_read(dt, np); dt_path = dtr_obj_path(obj); - n_info = get_node(dt_path); + n_info = get_node(dt, dt_path); mi_add(dt_path, n_info); dir_path = g_strdup_printf("%s/%s", dtr_base_path(dt), np); @@ -219,7 +253,7 @@ void add_keys(char *np) { ntmp = g_strdup_printf("/%s", fn); else ntmp = g_strdup_printf("%s/%s", np, fn); - add_keys(ntmp); + add_keys(dt, ntmp); g_free(ntmp); } g_free(ftmp); @@ -228,7 +262,7 @@ void add_keys(char *np) { g_dir_close(dir); } -char *msg_section(int dump) { +static char *msg_section(dtr *dt, int dump) { gchar *aslbl = NULL; gchar *messages = dtr_messages(dt); gchar *ret = g_strdup_printf("[%s]\n", _("Messages")); @@ -249,8 +283,8 @@ char *msg_section(int dump) { void __scan_dtree() { - dt = dtr_new(NULL); - gchar *summary = get_summary(); + dtr *dt = dtr_new(NULL); + gchar *summary = get_summary(dt); gchar *maps = dtr_maps_info(dt); gchar *messages = NULL; @@ -259,12 +293,10 @@ void __scan_dtree() mi_add("Maps", maps); if(dtr_was_found(dt)) - add_keys("/"); - messages = msg_section(0); + add_keys(dt, "/"); + messages = msg_section(dt, 0); mi_add("Messages", messages); - //printf("%s\n", dtree_info); - g_free(summary); g_free(maps); g_free(messages); diff --git a/modules/devices/devmemory.c b/modules/devices/devmemory.c index 080e2bbe..29094dd8 100644 --- a/modules/devices/devmemory.c +++ b/modules/devices/devmemory.c @@ -23,7 +23,7 @@ GHashTable *memlabels = NULL; void scan_memory_do(void) { - gchar **keys, *tmp, *tmp_label; + gchar **keys, *tmp, *tmp_label, *trans_val; static gint offset = -1; gint i; @@ -68,12 +68,20 @@ void scan_memory_do(void) tmp_label = ""; /* or newkeys[0] */ /* although it doesn't matter... */ - moreinfo_add_with_prefix("DEV", newkeys[0], g_strdup(newkeys[1])); + if (strstr(newkeys[1], "kB")) { + trans_val = g_strdup_printf("%d %s", atoi(newkeys[1]), _("KiB") ); + } else { + trans_val = strdup(newkeys[1]); + } - tmp = g_strconcat(meminfo, newkeys[0], "=", newkeys[1], "|", tmp_label, "\n", NULL); + moreinfo_add_with_prefix("DEV", newkeys[0], g_strdup(trans_val)); + + tmp = g_strconcat(meminfo, newkeys[0], "=", trans_val, "|", tmp_label, "\n", NULL); g_free(meminfo); meminfo = tmp; + g_free(trans_val); + tmp = g_strconcat(lginterval, "UpdateInterval$", newkeys[0], "=1000\n", NULL); g_free(lginterval); diff --git a/modules/devices/dmi.c b/modules/devices/dmi.c index 5f87df13..b25cfe21 100644 --- a/modules/devices/dmi.c +++ b/modules/devices/dmi.c @@ -22,27 +22,38 @@ #include <sys/types.h> #include "devices.h" +#include "dmi_util.h" typedef struct _DMIInfo DMIInfo; struct _DMIInfo { const gchar *name; - const gchar *file; /* for sysfs */ - const gchar *param; /* for dmidecode */ + const gchar *id_str; + int group; }; DMIInfo dmi_info_table[] = { - { "$BIOS", NULL, NULL }, - { "Date", "/sys/class/dmi/id/bios_date", "bios-release-date" }, - { "Vendor", "/sys/class/dmi/id/bios_vendor", "bios-vendor" }, - { "Version#0", "/sys/class/dmi/id/bios_version", "bios-version" }, - { "$Board", NULL, NULL }, - { "Name", "/sys/class/dmi/id/board_name", "baseboard-product-name" }, - { "Vendor", "/sys/class/dmi/id/board_vendor", "baseboard-manufacturer" }, - { "$Product", NULL, NULL }, - { "Name", "/sys/class/dmi/id/product_name", "system-product-name" }, - { "Family", "/sys/class/dmi/id/product_family", "system-product-family" }, - { "Version#1", "/sys/class/dmi/id/product_version", "system-product-version" }, + { N_("Product"), NULL, 1 }, + { N_("Name"), "system-product-name", 0 }, + { N_("Family"), "system-product-family", 0 }, + { N_("Vendor"), "system-manufacturer", 0 }, + { N_("Version"), "system-version", 0 }, + { N_("BIOS"), NULL, 1 }, + { N_("Date"), "bios-release-date", 0 }, + { N_("Vendor"), "bios-vendor", 0 }, + { N_("Version"), "bios-version", 0 }, + { N_("Board"), NULL, 1 }, + { N_("Name"), "baseboard-product-name", 0 }, + { N_("Vendor"), "baseboard-manufacturer", 0 }, + { N_("Version"), "baseboard-version", 0 }, + { N_("Serial Number"), "baseboard-serial-number", 0 }, + { N_("Asset Tag"), "baseboard-asset-tag", 0 }, + { N_("Chassis"), NULL, 1 }, + { N_("Vendor"), "chassis-manufacturer", 0 }, + { N_("Type"), "chassis-type", 0 }, + { N_("Version"), "chassis-version", 0 }, + { N_("Serial Number"), "chassis-serial-number", 0 }, + { N_("Asset Tag"), "chassis-asset-tag", 0 }, }; gchar *dmi_info = NULL; @@ -53,91 +64,13 @@ static void add_to_moreinfo(const char *group, const char *key, char *value) moreinfo_add_with_prefix("DEV", new_key, g_strdup(g_strstrip(value))); } -gboolean dmi_get_info_dmidecode() +gboolean dmi_get_info() { - FILE *dmi_pipe; - gchar buffer[256]; - const gchar *group; - DMIInfo *info; - gboolean dmi_failed = FALSE; - gint i; - - if (dmi_info) { - g_free(dmi_info); - dmi_info = NULL; - } - - for (i = 0; i < G_N_ELEMENTS(dmi_info_table); i++) { - info = &dmi_info_table[i]; - - if (*(info->name) == '$') { - group = info->name + 1; - dmi_info = h_strdup_cprintf("[%s]\n", dmi_info, group); - } else { - gchar *temp; - - if (!info->param) - continue; - - temp = g_strconcat("dmidecode -s ", info->param, NULL); - if ((dmi_pipe = popen(temp, "r"))) { - g_free(temp); - - (void)fgets(buffer, 256, dmi_pipe); - if (pclose(dmi_pipe)) { - dmi_failed = TRUE; - break; - } - - add_to_moreinfo(group, info->name, buffer); - - const gchar *url = vendor_get_url(buffer); - if (url) { - const gchar *vendor = vendor_get_name(buffer); - if (g_strstr_len(vendor, -1, g_strstrip(buffer)) || - g_strstr_len(g_strstrip(buffer), -1, vendor)) { - dmi_info = h_strdup_cprintf("%s=%s (%s)\n", - dmi_info, - info->name, - g_strstrip(buffer), - url); - } else { - dmi_info = h_strdup_cprintf("%s=%s (%s, %s)\n", - dmi_info, - info->name, - g_strstrip(buffer), - vendor, url); - } - } else { - dmi_info = h_strdup_cprintf("%s=%s\n", - dmi_info, - info->name, - buffer); - } - } else { - g_free(temp); - dmi_failed = TRUE; - break; - } - } - } - - if (dmi_failed) { - g_free(dmi_info); - dmi_info = NULL; - } - - return !dmi_failed; -} - -gboolean dmi_get_info_sys() -{ - FILE *dmi_file; - gchar buffer[256]; const gchar *group = NULL; DMIInfo *info; gboolean dmi_succeeded = FALSE; gint i; + gchar *value; if (dmi_info) { g_free(dmi_info); @@ -147,45 +80,40 @@ gboolean dmi_get_info_sys() for (i = 0; i < G_N_ELEMENTS(dmi_info_table); i++) { info = &dmi_info_table[i]; - if (*(info->name) == '$') { - group = info->name + 1; - dmi_info = h_strdup_cprintf("[%s]\n", dmi_info, group); - } else if (group && info->file) { - if ((dmi_file = fopen(info->file, "r"))) { - (void)fgets(buffer, 256, dmi_file); - fclose(dmi_file); + if (info->group) { + group = info->name; + dmi_info = h_strdup_cprintf("[%s]\n", dmi_info, _(info->name) ); + } else if (group && info->id_str) { + if (strcmp(info->id_str, "chassis-type") == 0) + value = dmi_chassis_type_str(-1, 1); + else + value = dmi_get_str(info->id_str); - add_to_moreinfo(group, info->name, buffer); + if (value != NULL) { + add_to_moreinfo(group, info->name, value); - const gchar *url = vendor_get_url(buffer); + const gchar *url = vendor_get_url(value); if (url) { - const gchar *vendor = vendor_get_name(buffer); - if (g_strstr_len(vendor, -1, g_strstrip(buffer)) || - g_strstr_len(g_strstrip(buffer), -1, vendor)) { - dmi_info = h_strdup_cprintf("%s=%s (%s)\n", - dmi_info, - info->name, - g_strstrip(buffer), - url); - } else { - dmi_info = h_strdup_cprintf("%s=%s (%s, %s)\n", - dmi_info, - info->name, - g_strstrip(buffer), - vendor, url); - } + const gchar *vendor = vendor_get_name(value); + dmi_info = h_strdup_cprintf("%s=%s (%s, %s)\n", + dmi_info, + _(info->name), + value, + vendor, url); } else { dmi_info = h_strdup_cprintf("%s=%s\n", dmi_info, - info->name, - g_strstrip(buffer)); + _(info->name), + value); } dmi_succeeded = TRUE; } else { dmi_info = h_strdup_cprintf("%s=%s\n", dmi_info, - info->name, - _("(Not available; Perhaps try running HardInfo as root.)") ); + _(info->name), + (getuid() == 0) + ? _("(Not available)") + : _("(Not available; Perhaps try running HardInfo as root.)") ); } } } @@ -202,11 +130,7 @@ void __scan_dmi() { gboolean dmi_ok; - dmi_ok = dmi_get_info_sys(); - - if (!dmi_ok) { - dmi_ok = dmi_get_info_dmidecode(); - } + dmi_ok = dmi_get_info(); if (!dmi_ok) { dmi_info = g_strdup("[No DMI information]\n" diff --git a/modules/devices/usb.c b/modules/devices/usb.c index e5088bd2..9366c7ce 100644 --- a/modules/devices/usb.c +++ b/modules/devices/usb.c @@ -394,6 +394,7 @@ gboolean __scan_usb_lsusb(void) if (!temp_lsusb) { DEBUG("cannot create temporary file for lsusb"); pclose(lsusb); + g_free(temp); return FALSE; } diff --git a/modules/network/net.c b/modules/network/net.c index 99a5e616..a75cf8b6 100644 --- a/modules/network/net.c +++ b/modules/network/net.c @@ -306,24 +306,19 @@ remove_net_devices(gpointer key, gpointer value, gpointer data) #ifdef HAS_LINUX_WE const char *wifi_bars(int signal, int noise) { - float quality; + signal = -signal; - if (signal <= -100) - quality = 0.0; - else if (signal >= -50) - quality = 1.0; - else - quality = (2.0 * (signal + 100.0)) / 100.0; - - if (quality < 0.20) - return "▰▱▱▱▱"; - if (quality < 0.40) - return "▰▰▱▱▱"; - if (quality < 0.60) - return "▰▰▰▱▱"; - if (quality < 0.80) + if (signal > 80) + return "▰▰▰▰▰"; + if (signal > 55) return "▰▰▰▰▱"; - return "▰▰▰▰▰"; + if (signal > 30) + return "▰▰▰▱▱"; + if (signal > 15) + return "▰▰▱▱▱"; + if (signal > 5) + return "▰▱▱▱▱"; + return "▱▱▱▱▱"; } #endif diff --git a/modules/network/samba.c b/modules/network/samba.c index 71ba6ab6..7e8dc46c 100644 --- a/modules/network/samba.c +++ b/modules/network/samba.c @@ -31,7 +31,7 @@ scan_samba(void) { gchar *str; gsize length; - + if (smb_shares_list) { g_free(smb_shares_list); smb_shares_list = g_strdup(""); @@ -41,7 +41,7 @@ scan_samba(void) &str, &length, NULL)) { shell_status_update("Scanning SAMBA shares..."); scan_samba_from_string(str, length); - g_free(str); + g_free(str); } scan_samba_usershares(); @@ -51,32 +51,34 @@ void scan_samba_usershares(void) { FILE *usershare_list; - - if ((usershare_list = popen("net usershare list", "r"))) { - char buffer[512]; - + gboolean spawned; + int status; + gchar *out, *err, *p, *next_nl; + gchar *usershare, *cmdline; + gsize length; + + spawned = g_spawn_command_line_sync("net usershare list", + &out, &err, &status, NULL); + + if (spawned && status == 0 && out != NULL) { shell_status_update("Scanning SAMBA user shares..."); - - while (fgets(buffer, 512, usershare_list)) { - gchar *usershare, *cmdline; - gsize length; - + p = out; + while(next_nl = strchr(p, '\n')) { cmdline = g_strdup_printf("net usershare info '%s'", - strend(buffer, '\n')); + strend(p, '\n')); if (g_spawn_command_line_sync(cmdline, - &usershare, NULL, - NULL, NULL)) { + &usershare, NULL, NULL, NULL)) { length = strlen(usershare); scan_samba_from_string(usershare, length); g_free(usershare); } - g_free(cmdline); - + shell_status_pulse(); + p = next_nl + 1; } - - pclose(usershare_list); + g_free(out); + g_free(err); } } @@ -87,13 +89,13 @@ scan_samba_from_string(gchar *str, gsize length) GError *error = NULL; gchar **groups; gint i = 0; - + keyfile = g_key_file_new(); - + gchar *_smbconf = str; for (; *_smbconf; _smbconf++) if (*_smbconf == ';') *_smbconf = '\0'; - + if (!g_key_file_load_from_data(keyfile, str, length, 0, &error)) { smb_shares_list = g_strdup("Cannot parse smb.conf=\n"); if (error) @@ -112,12 +114,12 @@ scan_samba_from_string(gchar *str, gsize length) groups[i], path); g_free(path); } - + i++; } - + g_strfreev(groups); - + cleanup: g_key_file_free(keyfile); } @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: hardinfo\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-14 22:23-0500\n" +"POT-Creation-Date: 2017-11-03 05:49+0300\n" "PO-Revision-Date: \n" "Last-Translator: Sergey Rodin <rodin.s@rambler.ru>\n" "Language-Team: \n" @@ -17,6 +17,187 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" +#: hardinfo/cpu_util.c:30 +msgid "Little Endian" +msgstr "" + +#: hardinfo/cpu_util.c:32 +msgid "Big Endian" +msgstr "" + +#: hardinfo/cpu_util.c:178 hardinfo/cpu_util.c:189 +msgid "Frequency Scaling" +msgstr "Масштабирование частоты" + +#: hardinfo/cpu_util.c:179 +msgid "Minimum" +msgstr "Минимальная" + +#: hardinfo/cpu_util.c:179 hardinfo/cpu_util.c:180 hardinfo/cpu_util.c:181 +msgid "kHz" +msgstr "кГц" + +#: hardinfo/cpu_util.c:180 +msgid "Maximum" +msgstr "Максимальная" + +#: hardinfo/cpu_util.c:181 +msgid "Current" +msgstr "Текущая" + +#: hardinfo/cpu_util.c:182 +msgid "Transition Latency" +msgstr "Задержка перехода" + +#: hardinfo/cpu_util.c:182 +msgid "ns" +msgstr "нс" + +#: hardinfo/cpu_util.c:183 +msgid "Governor" +msgstr "Регулятор" + +#: hardinfo/cpu_util.c:184 hardinfo/cpu_util.c:190 +msgid "Driver" +msgstr "Драйвер" + +#: hardinfo/cpu_util.c:196 modules/devices/x86/processor.c:297 +msgid "(Not Available)" +msgstr "(Недоступно)" + +#: hardinfo/cpu_util.c:204 hardinfo/cpu_util.c:206 +msgid "Socket" +msgstr "Сокет" + +#: hardinfo/cpu_util.c:209 hardinfo/cpu_util.c:211 +msgid "Core" +msgstr "Ядро" + +#: hardinfo/cpu_util.c:214 +msgid "Book" +msgstr "Книга" + +#: hardinfo/cpu_util.c:216 +msgid "Drawer" +msgstr "Трассировщик" + +#: hardinfo/cpu_util.c:222 modules/devices/arm/processor.c:356 +msgid "Topology" +msgstr "Топология" + +#: hardinfo/cpu_util.c:223 +msgid "ID" +msgstr "" + +#: hardinfo/dmi_util.c:114 +msgid "Invalid chassis type (0)" +msgstr "" + +#: hardinfo/dmi_util.c:115 hardinfo/dmi_util.c:116 +msgid "Unknown chassis type" +msgstr "" + +#: hardinfo/dmi_util.c:117 +msgid "Desktop" +msgstr "Настольный компьютер" + +#: hardinfo/dmi_util.c:118 +msgid "Low-profile Desktop" +msgstr "Низкопрофильный компьютер" + +#: hardinfo/dmi_util.c:119 +msgid "Pizza Box" +msgstr "" + +#: hardinfo/dmi_util.c:120 +msgid "Mini Tower" +msgstr "" + +#: hardinfo/dmi_util.c:121 +msgid "Tower" +msgstr "" + +#: hardinfo/dmi_util.c:122 +msgid "Portable" +msgstr "Портативный компьютер" + +#: hardinfo/dmi_util.c:123 modules/computer.c:326 modules/computer.c:335 +#: modules/computer.c:357 +msgid "Laptop" +msgstr "" + +#: hardinfo/dmi_util.c:124 +msgid "Notebook" +msgstr "" + +#: hardinfo/dmi_util.c:125 +msgid "Handheld" +msgstr "" + +#: hardinfo/dmi_util.c:126 +msgid "Docking Station" +msgstr "" + +#: hardinfo/dmi_util.c:127 +msgid "All-in-one" +msgstr "" + +#: hardinfo/dmi_util.c:128 +msgid "Subnotebook" +msgstr "" + +#: hardinfo/dmi_util.c:129 +msgid "Space-saving" +msgstr "" + +#: hardinfo/dmi_util.c:130 +msgid "Lunch Box" +msgstr "" + +#: hardinfo/dmi_util.c:131 +msgid "Main Server Chassis" +msgstr "" + +#: hardinfo/dmi_util.c:132 +msgid "Expansion Chassis" +msgstr "" + +#: hardinfo/dmi_util.c:133 +msgid "Sub Chassis" +msgstr "" + +#: hardinfo/dmi_util.c:134 +msgid "Bus Expansion Chassis" +msgstr "" + +#: hardinfo/dmi_util.c:135 +msgid "Peripheral Chassis" +msgstr "" + +#: hardinfo/dmi_util.c:136 +msgid "RAID Chassis" +msgstr "" + +#: hardinfo/dmi_util.c:137 +msgid "Rack Mount Chassis" +msgstr "" + +#: hardinfo/dmi_util.c:138 +msgid "Sealed-case PC" +msgstr "" + +#: hardinfo/dt_util.c:1013 +msgid "phandle Map" +msgstr "" + +#: hardinfo/dt_util.c:1014 +msgid "Alias Map" +msgstr "" + +#: hardinfo/dt_util.c:1015 +msgid "Symbol Map" +msgstr "" + #. / %d will be latest year of copyright #: hardinfo/hardinfo.c:49 #, c-format @@ -45,13 +226,13 @@ msgstr "" " Префикс библиотеки: %s\n" " Скомпилировано на: %s\n" -#: hardinfo/hardinfo.c:57 hardinfo/hardinfo.c:58 modules/computer.c:605 +#: hardinfo/hardinfo.c:57 hardinfo/hardinfo.c:58 modules/computer.c:595 #: modules/devices/inputdevices.c:128 modules/devices/pci.c:112 #: modules/devices/printers.c:138 msgid "Yes" msgstr "Да" -#: hardinfo/hardinfo.c:58 modules/computer.c:605 modules/devices/pci.c:112 +#: hardinfo/hardinfo.c:58 modules/computer.c:595 modules/devices/pci.c:112 #: modules/devices/printers.c:138 msgid "No" msgstr "Нет" @@ -82,18 +263,20 @@ msgstr "" msgid "File Name" msgstr "Имя файла" -#: hardinfo/hardinfo.c:77 modules/computer.c:534 modules/computer.c:562 -#: modules/computer.c:630 modules/computer/languages.c:104 -#: modules/computer/modules.c:146 modules/devices/arm/processor.c:336 +#: hardinfo/hardinfo.c:77 modules/computer.c:524 modules/computer.c:552 +#: modules/computer.c:620 modules/computer/languages.c:104 +#: modules/computer/modules.c:146 modules/devices/arm/processor.c:354 +#: modules/devices/dmi.c:37 modules/devices/dmi.c:46 #: modules/devices/ia64/processor.c:160 modules/devices/inputdevices.c:116 #: modules/devices/pci.c:215 modules/devices/sh/processor.c:84 #: modules/devices/x86/processor.c:455 modules/network.c:326 msgid "Name" msgstr "Название" -#: hardinfo/hardinfo.c:77 modules/computer.c:296 modules/computer.c:505 -#: modules/computer.c:507 modules/computer.c:595 modules/computer.c:603 -#: modules/devices/inputdevices.c:121 +#: hardinfo/hardinfo.c:77 modules/computer.c:300 modules/computer.c:495 +#: modules/computer.c:497 modules/computer.c:584 modules/computer.c:593 +#: modules/devices/dmi.c:40 modules/devices/dmi.c:44 modules/devices/dmi.c:48 +#: modules/devices/dmi.c:54 modules/devices/inputdevices.c:121 msgid "Version" msgstr "Версия" @@ -106,7 +289,7 @@ msgstr "Тест ``%s'' неизвестен или библиотека libbenc msgid "Don't know what to do. Exiting." msgstr "Неизвестно, что делать. Выход." -#: hardinfo/util.c:104 modules/computer/uptime.c:53 +#: hardinfo/util.c:104 modules/computer/uptime.c:54 #, c-format msgid "%d day" msgid_plural "%d days" @@ -114,7 +297,7 @@ msgstr[0] "%d день" msgstr[1] "%d дня" msgstr[2] "%d дней" -#: hardinfo/util.c:105 modules/computer/uptime.c:54 +#: hardinfo/util.c:105 modules/computer/uptime.c:55 #, c-format msgid "%d hour" msgid_plural "%d hours" @@ -122,7 +305,7 @@ msgstr[0] "%d час" msgstr[1] "%d часа" msgstr[2] "%d часов" -#: hardinfo/util.c:106 modules/computer/uptime.c:55 +#: hardinfo/util.c:106 modules/computer/uptime.c:56 #, c-format msgid "%d minute" msgid_plural "%d minutes" @@ -261,16 +444,11 @@ msgstr "" msgid "Scanning: %s..." msgstr "Сканирование: %s..." -#: hardinfo/util.c:1034 shell/shell.c:301 shell/shell.c:760 shell/shell.c:1795 -#: modules/benchmark.c:449 modules/benchmark.c:457 +#: hardinfo/util.c:1034 shell/shell.c:301 shell/shell.c:772 shell/shell.c:1850 +#: modules/benchmark.c:505 modules/benchmark.c:513 msgid "Done." msgstr "Выполнено." -#: shell/callbacks.c:117 -#, c-format -msgid "%s Module" -msgstr "%s модуль" - #: shell/callbacks.c:128 #, c-format msgid "" @@ -460,6 +638,14 @@ msgstr "_Панель инструментов" msgid "Save File" msgstr "Сохранить файл" +#: shell/report.c:497 shell/report.c:929 shell/syncmanager.c:748 +msgid "_Cancel" +msgstr "_Отмена" + +#: shell/report.c:499 +msgid "_Save" +msgstr "_Сохранить" + #: shell/report.c:629 msgid "Cannot create ReportContext. Programming bug?" msgstr "Не могу создать ReportContext. Ошибка программирования?" @@ -468,6 +654,14 @@ msgstr "Не могу создать ReportContext. Ошибка програм msgid "Open the report with your web browser?" msgstr "Открыть отчёт в веб-браузере?" +#: shell/report.c:651 +msgid "_No" +msgstr "_Нет" + +#: shell/report.c:652 +msgid "_Open" +msgstr "_Открыть" + #: shell/report.c:682 msgid "Generating report..." msgstr "Создаётся отчёт..." @@ -490,7 +684,7 @@ msgid "" "Please choose the information that you wish to view in your report:" msgstr "" "<big><b>Создать отчёт</b></big>\n" -"Пожалуйста выберите информацию для отображения в отчёте:" +"Пожалуйста, выберите информацию для отображения в отчёте:" #: shell/report.c:893 msgid "Select _None" @@ -500,10 +694,6 @@ msgstr "Выбор: нет" msgid "Select _All" msgstr "Выбор: все" -#: shell/report.c:929 shell/syncmanager.c:748 -msgid "_Cancel" -msgstr "" - #: shell/report.c:939 msgid "_Generate" msgstr "_Сгенерировать" @@ -517,16 +707,16 @@ msgstr "%s - Информация о системе" msgid "System Information" msgstr "Информация о системе" -#: shell/shell.c:747 +#: shell/shell.c:759 msgid "Loading modules..." msgstr "Загрузка модулей..." -#: shell/shell.c:1660 +#: shell/shell.c:1715 #, c-format msgid "<b>%s → Summary</b>" msgstr "<b>%s → </b>" -#: shell/shell.c:1769 +#: shell/shell.c:1824 msgid "Updating..." msgstr "Обновление..." @@ -619,97 +809,210 @@ msgstr "Сетевое обновление" msgid "_Synchronize" msgstr "_Синхронизировать" -#: modules/benchmark.c:52 -#, fuzzy +#. /or modify +#. * it under the terms of the GNU General Public License as published by +#. * the Free Software Foundation, version 2. +#. * +#. * This program is distributed in the hope that it will be useful, +#. * but WITHOUT ANY WARRANTY; without even the implied warranty of +#. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#. * GNU General Public License for more details. +#. * +#. * You should have received a copy of the GNU General Public License +#. * along with this program; if not, write to the Free Software +#. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#. +#. / Used for an unknown value. Having it in only one place cleans up the .po line references +#: modules/benchmark/bench_results.c:22 modules/computer/display.c:54 +#: modules/computer/display.c:56 modules/computer/display.c:58 +#: modules/computer/display.c:61 modules/computer/os.c:279 +#: modules/devices.c:387 modules/devices/usb.c:48 modules/devices/usb.c:307 +#: modules/devices/usb.c:310 modules/network/net.c:437 includes/cpu_util.h:11 +msgid "(Unknown)" +msgstr "(Неизвестно)" + +#: modules/benchmark/bench_results.c:47 modules/benchmark/bench_results.c:298 +#: modules/devices/alpha/processor.c:90 modules/devices/arm/processor.c:240 +#: modules/devices/arm/processor.c:383 modules/devices.c:299 +#: modules/devices.c:307 modules/devices.c:335 +#: modules/devices/ia64/processor.c:167 modules/devices/ia64/processor.c:196 +#: modules/devices/m68k/processor.c:87 modules/devices/mips/processor.c:77 +#: modules/devices/parisc/processor.c:158 +#: modules/devices/parisc/processor.c:191 modules/devices/pci.c:108 +#: modules/devices/ppc/processor.c:160 modules/devices/ppc/processor.c:187 +#: modules/devices/riscv/processor.c:186 modules/devices/riscv/processor.c:214 +#: modules/devices/s390/processor.c:160 modules/devices/sh/processor.c:87 +#: modules/devices/sh/processor.c:88 modules/devices/sh/processor.c:89 +#: modules/devices/x86/processor.c:420 modules/devices/x86/processor.c:479 +msgid "MHz" +msgstr "МГц" + +#: modules/benchmark/bench_results.c:347 modules/benchmark/bench_results.c:408 +msgid "kiB" +msgstr "КиБ" + +#: modules/benchmark/bench_results.c:361 modules/benchmark/bench_results.c:395 +msgid "Benchmark Result" +msgstr "Результат теста" + +#: modules/benchmark/bench_results.c:362 modules/benchmark/bench_results.c:398 +msgid "Threads" +msgstr "Потоки" + +#: modules/benchmark/bench_results.c:363 modules/benchmark/bench_results.c:399 +msgid "Note" +msgstr "Примечание" + +#: modules/benchmark/bench_results.c:364 modules/benchmark/bench_results.c:400 +msgid "" +"This result is from an old version of HardInfo. Results might not be " +"comparable to current version. Some details are missing." +msgstr "" +"Данный результат получен с использованием старой версии HardInfo.Он может " +"быть несопоставим с результатом текущей версии, поскольку отсутствуют " +"некоторые подробности." + +#: modules/benchmark/bench_results.c:365 modules/benchmark/bench_results.c:401 +#: modules/devices/devicetree/pmac_data.c:81 modules/devices/sh/processor.c:85 +msgid "Machine" +msgstr "Машина" + +#: modules/benchmark/bench_results.c:366 modules/benchmark/bench_results.c:402 +#: modules/devices/devicetree.c:206 modules/devices/dmi.c:45 +msgid "Board" +msgstr "Плата" + +#: modules/benchmark/bench_results.c:367 modules/benchmark/bench_results.c:403 +msgid "CPU Name" +msgstr "Название процессора" + +#: modules/benchmark/bench_results.c:368 modules/benchmark/bench_results.c:404 +msgid "CPU Description" +msgstr "Описание процессора" + +#: modules/benchmark/bench_results.c:369 modules/benchmark/bench_results.c:405 +#: modules/benchmark.c:288 +msgid "CPU Config" +msgstr "Конфигурация процессора" + +#: modules/benchmark/bench_results.c:370 modules/benchmark/bench_results.c:406 +msgid "Threads Available" +msgstr "Доступно потоков" + +#: modules/benchmark/bench_results.c:371 modules/benchmark/bench_results.c:407 +#: modules/computer.c:475 +msgid "OpenGL Renderer" +msgstr "Рендер OpenGL" + +#: modules/benchmark/bench_results.c:372 modules/benchmark/bench_results.c:408 +#: modules/computer.c:108 modules/computer.c:464 modules/devices.c:96 +#: modules/devices/pci.c:149 +msgid "Memory" +msgstr "Память" + +#: modules/benchmark/bench_results.c:396 +msgid "Benchmark" +msgstr "" + +#: modules/benchmark/bench_results.c:397 +msgid "Result" +msgstr "" + +#: modules/benchmark/bench_results.c:409 +msgid "Handles" +msgstr "" + +#: modules/benchmark/bench_results.c:410 +msgid "mid" +msgstr "" + +#: modules/benchmark/bench_results.c:411 +msgid "cfg_val" +msgstr "" + +#: modules/benchmark.c:54 msgid "CPU Blowfish" -msgstr "ЦПУ МГц" +msgstr "" -#: modules/benchmark.c:53 -#, fuzzy +#: modules/benchmark.c:55 msgid "CPU CryptoHash" -msgstr "ЦПУ МГц" +msgstr "" -#: modules/benchmark.c:54 -#, fuzzy +#: modules/benchmark.c:56 msgid "CPU Fibonacci" -msgstr "ЦПУ МГц" +msgstr "" -#: modules/benchmark.c:55 -#, fuzzy +#: modules/benchmark.c:57 msgid "CPU N-Queens" -msgstr "ЦПУ МГц" +msgstr "" -#: modules/benchmark.c:56 +#: modules/benchmark.c:58 msgid "CPU Zlib" msgstr "" -#: modules/benchmark.c:57 +#: modules/benchmark.c:59 msgid "FPU FFT" msgstr "" -#: modules/benchmark.c:58 +#: modules/benchmark.c:60 msgid "FPU Raytracing" msgstr "" -#: modules/benchmark.c:60 +#: modules/benchmark.c:62 msgid "GPU Drawing" msgstr "" -#: modules/benchmark.c:239 modules/benchmark.c:255 -msgid "CPU Config" -msgstr "Конфигурация процессора" - -#: modules/benchmark.c:239 modules/benchmark.c:255 +#: modules/benchmark.c:288 msgid "Results" msgstr "Результаты" -#: modules/benchmark.c:239 modules/benchmark.c:255 modules/computer.c:751 +#: modules/benchmark.c:288 modules/computer.c:749 #: modules/devices/sparc/processor.c:75 msgid "CPU" msgstr "Процессор" -#: modules/benchmark.c:381 +#: modules/benchmark.c:415 #, c-format msgid "Benchmarking: <b>%s</b>." msgstr "Тестирование: <b>%s</b>" -#: modules/benchmark.c:395 -msgid "Benchmarking. Please do not move your mouse or press any keys." -msgstr "Тестирование. Пожалуйста, не двигайте мышь и не нажимайте на кнопки." - -#: modules/benchmark.c:399 +#: modules/benchmark.c:434 modules/benchmark.c:454 msgid "Cancel" msgstr "Отмена" -#: modules/benchmark.c:536 +#: modules/benchmark.c:438 modules/benchmark.c:450 +msgid "Benchmarking. Please do not move your mouse or press any keys." +msgstr "Тестирование. Пожалуйста, не двигайте мышь и не нажимайте на кнопки." + +#: modules/benchmark.c:592 msgid "Results in MiB/second. Higher is better." msgstr "Результаты в МиБ/сек. Чем выше, тем лучше." -#: modules/benchmark.c:540 +#: modules/benchmark.c:596 msgid "Results in HIMarks. Higher is better." msgstr "Результаты в HIMarks. Чем выше, тем лучше." -#: modules/benchmark.c:547 +#: modules/benchmark.c:603 msgid "Results in seconds. Lower is better." msgstr "Результат в секундах. Чем ниже, тем лучше." -#: modules/benchmark.c:555 +#: modules/benchmark.c:611 msgid "Benchmarks" msgstr "Тесты" -#: modules/benchmark.c:573 +#: modules/benchmark.c:629 msgid "Perform tasks and compare with other systems" msgstr "Выполняет задания и сравнивает с другими системами" -#: modules/benchmark.c:663 +#: modules/benchmark.c:719 msgid "Send benchmark results" msgstr "Отправить результаты тестирования" -#: modules/benchmark.c:668 +#: modules/benchmark.c:724 msgid "Receive benchmark results" msgstr "Принять результаты тестирования" -#: modules/computer/alsa.c:26 modules/computer.c:489 +#: modules/computer/alsa.c:26 modules/computer.c:479 msgid "Audio Devices" msgstr "Аудио устройства" @@ -717,326 +1020,254 @@ msgstr "Аудио устройства" msgid "Audio Adapter" msgstr "Звуковая карта" -#: modules/computer/boots.c:33 modules/computer.c:73 modules/computer.c:546 -msgid "Boots" -msgstr "Загрузки" - -#: modules/computer.c:70 +#: modules/computer.c:74 msgid "Summary" msgstr "Общая информация" -#: modules/computer.c:71 modules/computer.c:476 modules/computer.c:750 +#: modules/computer.c:75 modules/computer.c:467 modules/computer.c:748 msgid "Operating System" msgstr "Операционная система" -#: modules/computer.c:72 +#: modules/computer.c:76 msgid "Kernel Modules" msgstr "Модули ядра" -#: modules/computer.c:74 +#: modules/computer.c:77 modules/computer.c:536 +msgid "Boots" +msgstr "Загрузки" + +#: modules/computer.c:78 msgid "Languages" msgstr "Языки" -#: modules/computer.c:75 +#: modules/computer.c:79 msgid "Filesystems" msgstr "Файловые системы" -#: modules/computer.c:76 modules/computer.c:481 modules/computer.c:590 +#: modules/computer.c:80 modules/computer.c:472 modules/computer.c:580 msgid "Display" msgstr "Дисплей" -#: modules/computer.c:77 modules/computer/environment.c:32 +#: modules/computer.c:81 modules/computer/environment.c:32 msgid "Environment Variables" msgstr "Переменные среды" -#: modules/computer.c:79 +#: modules/computer.c:83 msgid "Development" msgstr "Разработка" -#: modules/computer.c:81 modules/computer.c:617 +#: modules/computer.c:85 modules/computer.c:607 msgid "Users" msgstr "Пользователи" -#: modules/computer.c:82 +#: modules/computer.c:86 msgid "Groups" msgstr "Группы" -#: modules/computer.c:104 modules/computer.c:473 modules/devices.c:96 -#: modules/devices/pci.c:149 -msgid "Memory" -msgstr "Память" - -#: modules/computer.c:106 +#: modules/computer.c:110 #, c-format msgid "%dMB (%dMB used)" msgstr "%d Мб (%d Мб занято)" -#: modules/computer.c:108 modules/computer.c:520 +#: modules/computer.c:112 modules/computer.c:510 msgid "Uptime" msgstr "Время работы" -#: modules/computer.c:110 modules/computer.c:478 +#: modules/computer.c:114 modules/computer.c:469 msgid "Date/Time" msgstr "Дата/время" # Должно совпадать с таким-же полем в строке 430 computer.c -#: modules/computer.c:115 modules/computer.c:521 +#: modules/computer.c:119 modules/computer.c:511 msgid "Load Average" msgstr "Средняя нагрузка" -#: modules/computer.c:117 modules/computer.c:522 +#: modules/computer.c:121 modules/computer.c:512 msgid "Available entropy in /dev/random" msgstr "Доступная энтропия в /dev/random" -#: modules/computer.c:203 +#: modules/computer.c:207 msgid "Scripting Languages" msgstr "Скриптовые языки" -#: modules/computer.c:204 +#: modules/computer.c:208 msgid "Gambas3 (gbr3)" msgstr "" -#: modules/computer.c:205 +#: modules/computer.c:209 msgid "Python" msgstr "" -#: modules/computer.c:206 +#: modules/computer.c:210 msgid "Python2" msgstr "" -#: modules/computer.c:207 +#: modules/computer.c:211 msgid "Python3" msgstr "" -#: modules/computer.c:208 +#: modules/computer.c:212 msgid "Perl" msgstr "" -#: modules/computer.c:209 +#: modules/computer.c:213 msgid "Perl6 (VM)" msgstr "" -#: modules/computer.c:210 +#: modules/computer.c:214 msgid "Perl6" msgstr "" -#: modules/computer.c:211 +#: modules/computer.c:215 msgid "PHP" msgstr "" -#: modules/computer.c:212 +#: modules/computer.c:216 msgid "Ruby" msgstr "" -#: modules/computer.c:213 +#: modules/computer.c:217 msgid "Bash" msgstr "" -#: modules/computer.c:214 +#: modules/computer.c:218 msgid "Compilers" msgstr "Компиляторы" -#: modules/computer.c:215 +#: modules/computer.c:219 msgid "C (GCC)" msgstr "" -#: modules/computer.c:216 +#: modules/computer.c:220 msgid "C (Clang)" msgstr "" -#: modules/computer.c:217 +#: modules/computer.c:221 msgid "D (dmd)" msgstr "" -#: modules/computer.c:218 +#: modules/computer.c:222 msgid "Gambas3 (gbc3)" msgstr "" -#: modules/computer.c:219 +#: modules/computer.c:223 #, fuzzy msgid "Java" msgstr "Язык программирования Java" -#: modules/computer.c:220 +#: modules/computer.c:224 #, fuzzy msgid "CSharp (Mono, old)" msgstr "Найдена старая установка %s." -#: modules/computer.c:221 +#: modules/computer.c:225 #, fuzzy msgid "CSharp (Mono)" msgstr "Моноширинный шрифт" -#: modules/computer.c:222 +#: modules/computer.c:226 #, fuzzy msgid "Vala" msgstr "базы данных vala" -#: modules/computer.c:223 +#: modules/computer.c:227 msgid "Haskell (GHC)" msgstr "" -#: modules/computer.c:224 +#: modules/computer.c:228 msgid "FreePascal" msgstr "" -#: modules/computer.c:225 +#: modules/computer.c:229 msgid "Go" msgstr "" -#: modules/computer.c:226 +#: modules/computer.c:230 msgid "Tools" msgstr "Инструменты" -#: modules/computer.c:227 +#: modules/computer.c:231 msgid "make" msgstr "" -#: modules/computer.c:228 +#: modules/computer.c:232 msgid "GDB" msgstr "" -#: modules/computer.c:229 +#: modules/computer.c:233 msgid "strace" msgstr "" -#: modules/computer.c:230 +#: modules/computer.c:234 msgid "valgrind" msgstr "" -#: modules/computer.c:231 +#: modules/computer.c:235 msgid "QMake" msgstr "" -#: modules/computer.c:232 +#: modules/computer.c:236 msgid "CMake" msgstr "" -#: modules/computer.c:233 +#: modules/computer.c:237 msgid "Gambas3 IDE" msgstr "" -#: modules/computer.c:274 +#: modules/computer.c:278 msgid "Not found" msgstr "Не найдено" -#: modules/computer.c:279 +#: modules/computer.c:283 #, c-format msgid "Detecting version: %s" msgstr "Определена версия: %s" -#: modules/computer.c:296 +#: modules/computer.c:300 msgid "Program" msgstr "Программа" -#: modules/computer.c:308 -msgid "Invalid chassis type (0)" -msgstr "" - -#: modules/computer.c:309 modules/computer.c:310 -msgid "Unknown chassis type" -msgstr "" - -#: modules/computer.c:311 -msgid "Desktop" -msgstr "Настольный компьютер" - -#: modules/computer.c:312 -msgid "Low-profile Desktop" -msgstr "Низкопрофильный компьютер" - -#: modules/computer.c:313 -msgid "Pizza Box" -msgstr "" - -#: modules/computer.c:314 -msgid "Mini Tower" -msgstr "" - -#: modules/computer.c:315 -msgid "Tower" -msgstr "" - -#: modules/computer.c:316 -msgid "Portable" -msgstr "Портативный компьютер" - -#: modules/computer.c:317 modules/computer.c:341 modules/computer.c:350 -#: modules/computer.c:372 -msgid "Laptop" -msgstr "" - -#: modules/computer.c:318 -msgid "Notebook" -msgstr "" - -#: modules/computer.c:319 -msgid "Handheld" -msgstr "" - #: modules/computer.c:320 -msgid "Docking Station" -msgstr "" - -#: modules/computer.c:321 -msgid "All-in-one" -msgstr "" - -#: modules/computer.c:322 -msgid "Subnotebook" -msgstr "" - -#: modules/computer.c:323 -msgid "Space-saving" +msgid "Single-board computer" msgstr "" -#: modules/computer.c:324 -msgid "Lunch Box" -msgstr "" - -#: modules/computer.c:325 -msgid "Main Server Chassis" +#. /proc/apm +#: modules/computer.c:369 +msgid "Unknown physical machine type" msgstr "" -#: modules/computer.c:326 -msgid "Expansion Chassis" +#: modules/computer.c:389 modules/computer.c:390 +msgid "Virtual (VMware)" msgstr "" -#: modules/computer.c:327 -msgid "Sub Chassis" +#: modules/computer.c:392 modules/computer.c:393 modules/computer.c:394 +#: modules/computer.c:395 +msgid "Virtual (QEMU)" msgstr "" -#: modules/computer.c:328 -msgid "Bus Expansion Chassis" +#: modules/computer.c:397 modules/computer.c:398 +msgid "Virtual (Unknown)" msgstr "" -#: modules/computer.c:329 -msgid "Peripheral Chassis" +#: modules/computer.c:400 modules/computer.c:401 modules/computer.c:402 +#: modules/computer.c:423 +msgid "Virtual (VirtualBox)" msgstr "" -#: modules/computer.c:330 -msgid "RAID Chassis" +#: modules/computer.c:404 modules/computer.c:405 modules/computer.c:406 +#: modules/computer.c:417 +msgid "Virtual (Xen)" msgstr "" -#: modules/computer.c:331 -msgid "Rack Mount Chassis" +#: modules/computer.c:408 +msgid "Virtual (hypervisor present)" msgstr "" -#: modules/computer.c:332 -msgid "Sealed-case PC" -msgstr "" - -#. /proc/apm -#. FIXME: use dmidecode if available to get chassis type -#: modules/computer.c:386 -msgid "Unknown physical machine type" -msgstr "" - -#: modules/computer.c:470 modules/computer.c:709 +#: modules/computer.c:461 modules/computer.c:707 msgid "Computer" msgstr "Компьютер" -#: modules/computer.c:471 modules/devices/alpha/processor.c:87 +#: modules/computer.c:462 modules/devices/alpha/processor.c:87 #: modules/devices/arm/processor.c:236 modules/devices.c:95 #: modules/devices/ia64/processor.c:159 modules/devices/m68k/processor.c:83 #: modules/devices/mips/processor.c:74 modules/devices/parisc/processor.c:154 @@ -1046,174 +1277,175 @@ msgstr "Компьютер" msgid "Processor" msgstr "Процессор" -#: modules/computer.c:474 +#: modules/computer.c:465 msgid "Machine Type" msgstr "Тип машины" -#: modules/computer.c:477 modules/computer.c:514 +#: modules/computer.c:468 modules/computer.c:504 msgid "User Name" msgstr "Пользователь" -#: modules/computer.c:482 modules/computer.c:591 +#: modules/computer.c:473 modules/computer.c:581 msgid "Resolution" msgstr "Разрешение" -#: modules/computer.c:483 modules/computer.c:592 +#: modules/computer.c:473 modules/computer.c:581 #, c-format msgid "%dx%d pixels" msgstr "%dx%d пикселей" -#: modules/computer.c:485 -msgid "OpenGL Renderer" -msgstr "Рендер OpenGL" - -#: modules/computer.c:486 +#: modules/computer.c:476 msgid "X11 Vendor" msgstr "Поставщик X11" -#: modules/computer.c:491 modules/devices.c:102 +#: modules/computer.c:481 modules/devices.c:102 msgid "Input Devices" msgstr "Устройства ввода" -#: modules/computer.c:493 modules/computer.c:752 modules/devices.c:99 -msgid "Printers" -msgstr "Принтеры" - -#: modules/computer.c:495 modules/computer.c:752 modules/devices.c:103 -msgid "Storage" -msgstr "Устройства хранения" - -#: modules/computer.c:506 +#: modules/computer.c:496 msgid "Kernel" msgstr "Ядро" -#: modules/computer.c:508 +#: modules/computer.c:498 msgid "C Library" msgstr "Библиотека C" -#: modules/computer.c:509 +#: modules/computer.c:499 msgid "Distribution" msgstr "Дистрибутив" -#: modules/computer.c:512 +#: modules/computer.c:502 msgid "Current Session" msgstr "Текущая сессия" -#: modules/computer.c:513 +#: modules/computer.c:503 msgid "Computer Name" msgstr "Имя компьютера" -#: modules/computer.c:515 modules/computer/languages.c:108 +#: modules/computer.c:505 modules/computer/languages.c:108 msgid "Language" msgstr "Язык" -#: modules/computer.c:516 modules/computer/users.c:50 +#: modules/computer.c:506 modules/computer/users.c:50 msgid "Home Directory" msgstr "Домашний каталог" -#: modules/computer.c:519 modules/devices/usb.c:87 modules/devices/usb.c:234 +#: modules/computer.c:509 modules/devices/usb.c:87 modules/devices/usb.c:234 #: modules/devices/usb.c:351 msgid "Misc" msgstr "Разное" -#: modules/computer.c:532 +#: modules/computer.c:522 msgid "Loaded Modules" msgstr "" -#: modules/computer.c:535 modules/computer/modules.c:145 -#: modules/computer/modules.c:147 modules/devices/arm/processor.c:337 -#: modules/devices.c:559 modules/devices/x86/processor.c:456 +#: modules/computer.c:525 modules/computer/modules.c:145 +#: modules/computer/modules.c:147 modules/devices/arm/processor.c:355 +#: modules/devices.c:572 modules/devices/x86/processor.c:456 msgid "Description" msgstr "Описание" -#: modules/computer.c:548 +#: modules/computer.c:538 msgid "Date & Time" msgstr "Дата и время" -#: modules/computer.c:549 +#: modules/computer.c:539 msgid "Kernel Version" msgstr "Версия ядра" -#: modules/computer.c:559 +#: modules/computer.c:549 msgid "Available Languages" msgstr "" -#: modules/computer.c:561 +#: modules/computer.c:551 msgid "Language Code" msgstr "Код языка" -#: modules/computer.c:573 +#: modules/computer.c:563 msgid "Mounted File Systems" msgstr "" -#: modules/computer.c:575 modules/computer/filesystem.c:85 +#: modules/computer.c:565 modules/computer/filesystem.c:85 msgid "Mount Point" msgstr "Точка монтирования" -#: modules/computer.c:576 +#: modules/computer.c:566 msgid "Usage" msgstr "Использование" -#: modules/computer.c:577 +#: modules/computer.c:567 msgid "Device" msgstr "Устройство" -#: modules/computer.c:594 modules/computer.c:601 +#: modules/computer.c:583 modules/computer.c:591 modules/devices/dmi.c:39 +#: modules/devices/dmi.c:43 modules/devices/dmi.c:47 modules/devices/dmi.c:52 #: modules/devices/ia64/processor.c:161 modules/devices/inputdevices.c:119 #: modules/devices/pci.c:225 modules/devices/usb.c:349 #: modules/devices/x86/processor.c:416 msgid "Vendor" msgstr "Производитель" -#: modules/computer.c:598 +#: modules/computer.c:585 +msgid "Current Display Name" +msgstr "Имя текущего дисплея" + +#: modules/computer.c:588 msgid "Monitors" msgstr "Монитор" -#: modules/computer.c:600 +#: modules/computer.c:590 msgid "OpenGL" msgstr "" -#: modules/computer.c:602 +#: modules/computer.c:592 msgid "Renderer" msgstr "Рендер" -#: modules/computer.c:604 +#: modules/computer.c:594 msgid "Direct Rendering" msgstr "Графическое ускорение" -#: modules/computer.c:608 +#: modules/computer.c:598 msgid "Extensions" msgstr "Расширения" -#: modules/computer.c:628 +#: modules/computer.c:618 msgid "Group" msgstr "" -#: modules/computer.c:631 modules/computer/users.c:49 +#: modules/computer.c:621 modules/computer/users.c:49 msgid "Group ID" msgstr "ID группы" -#: modules/computer.c:751 +#: modules/computer.c:749 msgid "RAM" msgstr "Оперативная память" -#: modules/computer.c:751 modules/devices/devicetree/pmac_data.c:82 +#: modules/computer.c:749 modules/devices/devicetree/pmac_data.c:82 msgid "Motherboard" msgstr "Материнская плата" -#: modules/computer.c:751 +#: modules/computer.c:749 msgid "Graphics" msgstr "Графика" -#: modules/computer.c:752 +#: modules/computer.c:750 modules/devices.c:103 +msgid "Storage" +msgstr "Устройства хранения" + +#: modules/computer.c:750 modules/devices.c:99 +msgid "Printers" +msgstr "Принтеры" + +#: modules/computer.c:750 msgid "Audio" msgstr "Аудио" -#: modules/computer.c:807 +#: modules/computer.c:805 msgid "Gathers high-level computer information" msgstr "Собирает высокоуровневую информацию о компьютере" -#: modules/computer/display.c:122 +#: modules/computer/display.c:125 #, c-format msgid "Monitor %d=%dx%d pixels\n" msgstr "Монитор %d=%dx%d пикселей\n" @@ -1272,7 +1504,7 @@ msgstr "Территория" msgid "Revision" msgstr "Ревизия" -#: modules/computer/languages.c:111 +#: modules/computer/languages.c:111 modules/devices/dmi.c:42 msgid "Date" msgstr "Дата" @@ -1286,7 +1518,7 @@ msgstr "Не удается установить среднюю загрузку #: modules/computer/modules.c:125 modules/computer/modules.c:126 #: modules/computer/modules.c:127 modules/computer/modules.c:128 -#: modules/computer/modules.c:129 +#: modules/computer/modules.c:129 modules/devices/dmi.c:115 msgid "(Not available)" msgstr "(Недоступно)" @@ -1302,7 +1534,7 @@ msgstr "Путь" msgid "Used Memory" msgstr "Обьем занимаемой памяти" -#: modules/computer/modules.c:144 +#: modules/computer/modules.c:144 modules/devices/devmemory.c:72 msgid "KiB" msgstr "КиБ" @@ -1340,7 +1572,7 @@ msgid "diet libc" msgstr "" #: modules/computer/os.c:78 modules/computer/os.c:234 modules/computer/os.c:359 -#: modules/devices.c:333 modules/devices.c:387 modules/devices/printers.c:99 +#: modules/devices.c:333 modules/devices.c:400 modules/devices/printers.c:99 #: modules/devices/printers.c:106 modules/devices/printers.c:116 #: modules/devices/printers.c:131 modules/devices/printers.c:140 #: modules/devices/printers.c:243 @@ -1393,11 +1625,6 @@ msgstr "%d бит (средняя)" msgid "%d bits (healthy)" msgstr "%d бит (огромная)" -#: modules/computer/os.c:279 modules/devices/usb.c:48 modules/devices/usb.c:307 -#: modules/devices/usb.c:310 modules/network/net.c:442 includes/cpu_util.h:11 -msgid "(Unknown)" -msgstr "(Неизвестно)" - #: modules/computer/users.c:47 msgid "User Information" msgstr "Информация о пользователе" @@ -1410,8 +1637,8 @@ msgstr "ID пользователя" msgid "Default Shell" msgstr "Оболочка по умолчанию" -#: modules/devices/alpha/processor.c:88 modules/devices/devicetree.c:141 -#: modules/devices/devicetree.c:176 modules/devices/devicetree/pmac_data.c:80 +#: modules/devices/alpha/processor.c:88 modules/devices/devicetree.c:161 +#: modules/devices/devicetree.c:207 modules/devices/devicetree/pmac_data.c:80 #: modules/devices/ia64/processor.c:165 modules/devices/m68k/processor.c:84 #: modules/devices/mips/processor.c:75 modules/devices/parisc/processor.c:155 #: modules/devices/ppc/processor.c:158 modules/devices/riscv/processor.c:182 @@ -1432,21 +1659,6 @@ msgstr "Строка платформы" msgid "Frequency" msgstr "Частота" -#: modules/devices/alpha/processor.c:90 modules/devices/arm/processor.c:240 -#: modules/devices/arm/processor.c:365 modules/devices.c:299 -#: modules/devices.c:307 modules/devices.c:335 -#: modules/devices/ia64/processor.c:167 modules/devices/ia64/processor.c:196 -#: modules/devices/m68k/processor.c:87 modules/devices/mips/processor.c:77 -#: modules/devices/parisc/processor.c:158 -#: modules/devices/parisc/processor.c:191 modules/devices/pci.c:108 -#: modules/devices/ppc/processor.c:160 modules/devices/ppc/processor.c:187 -#: modules/devices/riscv/processor.c:186 modules/devices/riscv/processor.c:214 -#: modules/devices/s390/processor.c:160 modules/devices/sh/processor.c:87 -#: modules/devices/sh/processor.c:88 modules/devices/sh/processor.c:89 -#: modules/devices/x86/processor.c:420 modules/devices/x86/processor.c:479 -msgid "MHz" -msgstr "МГц" - #: modules/devices/alpha/processor.c:91 modules/devices/arm/processor.c:241 #: modules/devices/ia64/processor.c:168 modules/devices/m68k/processor.c:88 #: modules/devices/mips/processor.c:78 modules/devices/parisc/processor.c:159 @@ -1652,7 +1864,7 @@ msgstr "Имя Linux" msgid "Decoded Name" msgstr "Декодированное имя" -#: modules/devices/arm/processor.c:239 modules/network/net.c:458 +#: modules/devices/arm/processor.c:239 modules/network/net.c:453 msgid "Mode" msgstr "Режим" @@ -1682,19 +1894,15 @@ msgstr "Вариант" msgid "Capabilities" msgstr "Возможности" -#: modules/devices/arm/processor.c:335 +#: modules/devices/arm/processor.c:353 msgid "SOC/Package" msgstr "" -#: modules/devices/arm/processor.c:338 modules/devices/cpu_util.c:222 -msgid "Topology" -msgstr "Топология" - -#: modules/devices/arm/processor.c:339 +#: modules/devices/arm/processor.c:357 msgid "Clocks" msgstr "" -#: modules/devices/arm/processor.c:354 +#: modules/devices/arm/processor.c:372 msgid "SOC/Package Information" msgstr "" @@ -1789,7 +1997,7 @@ msgid "PCI Devices" msgstr "Устройства PCI" #: modules/devices.c:98 modules/devices/usb.c:117 modules/devices/usb.c:156 -#: modules/devices/usb.c:415 +#: modules/devices/usb.c:416 msgid "USB Devices" msgstr "Устройства USB" @@ -1847,208 +2055,113 @@ msgstr[2] "%d потоков" msgid "%s; %s; %s" msgstr "" -#: modules/devices.c:372 -msgid " (model unknown)" -msgstr "(модель неизвестна)" - -#: modules/devices.c:374 -msgid " (vendor unknown)" -msgstr "(поставщик неизвестен)" - -#: modules/devices.c:559 +#: modules/devices.c:572 msgid "Field" msgstr "Поле" -#: modules/devices.c:559 modules/devices.c:591 +#: modules/devices.c:572 modules/devices.c:604 msgid "Value" msgstr "Значение" -#: modules/devices.c:591 +#: modules/devices.c:604 msgid "Sensor" msgstr "Сенсор" -#: modules/devices.c:591 modules/devices/inputdevices.c:117 +#: modules/devices.c:604 modules/devices/dmi.c:53 +#: modules/devices/inputdevices.c:117 msgid "Type" msgstr "Тип" -#: modules/devices.c:637 +#: modules/devices.c:650 msgid "Devices" msgstr "Устройства" -#: modules/devices.c:649 +#: modules/devices.c:662 msgid "Update PCI ID listing" msgstr "Обновить список PCI ID" -#: modules/devices.c:661 +#: modules/devices.c:674 msgid "Update CPU feature database" msgstr "Обновить базу данных функций процессора" -#: modules/devices.c:689 +#: modules/devices.c:702 msgid "Gathers information about hardware devices" msgstr "Собирает информацию об устройствах" -#: modules/devices.c:708 +#: modules/devices.c:721 msgid "Resource information requires superuser privileges" msgstr "Для вывода информации о ресурсах нужны права администратора" -#: modules/devices/cpu_util.c:30 -msgid "Little Endian" -msgstr "" - -#: modules/devices/cpu_util.c:32 -msgid "Big Endian" -msgstr "" - -#: modules/devices/cpu_util.c:178 modules/devices/cpu_util.c:189 -msgid "Frequency Scaling" -msgstr "Масштабирование частоты" - -#: modules/devices/cpu_util.c:179 -msgid "Minimum" -msgstr "Минимальная" - -#: modules/devices/cpu_util.c:179 modules/devices/cpu_util.c:180 -#: modules/devices/cpu_util.c:181 -msgid "kHz" -msgstr "кГц" - -#: modules/devices/cpu_util.c:180 -msgid "Maximum" -msgstr "Максимальная" - -#: modules/devices/cpu_util.c:181 -msgid "Current" -msgstr "Текущая" - -#: modules/devices/cpu_util.c:182 -msgid "Transition Latency" -msgstr "Задержка перехода" - -#: modules/devices/cpu_util.c:182 -msgid "ns" -msgstr "нс" - -#: modules/devices/cpu_util.c:183 -msgid "Governor" -msgstr "Регулятор" - -#: modules/devices/cpu_util.c:184 modules/devices/cpu_util.c:190 -msgid "Driver" -msgstr "Драйвер" - -#: modules/devices/cpu_util.c:196 modules/devices/x86/processor.c:297 -msgid "(Not Available)" -msgstr "(Недоступно)" - -#: modules/devices/cpu_util.c:204 modules/devices/cpu_util.c:206 -msgid "Socket" -msgstr "Сокет" - -#: modules/devices/cpu_util.c:209 modules/devices/cpu_util.c:211 -msgid "Core" -msgstr "Ядро" - -#: modules/devices/cpu_util.c:214 -msgid "Book" -msgstr "Книга" - -#: modules/devices/cpu_util.c:216 -msgid "Drawer" -msgstr "Трассировщик" - -#: modules/devices/cpu_util.c:223 -msgid "ID" -msgstr "" - -#: modules/devices/devicetree.c:47 +#: modules/devices/devicetree.c:50 msgid "Properties" msgstr "" -#: modules/devices/devicetree.c:48 +#: modules/devices/devicetree.c:51 msgid "Children" msgstr "" -#: modules/devices/devicetree.c:84 +#: modules/devices/devicetree.c:87 msgid "Node" msgstr "" -#: modules/devices/devicetree.c:85 +#: modules/devices/devicetree.c:88 msgid "Node Path" msgstr "" -#: modules/devices/devicetree.c:86 +#: modules/devices/devicetree.c:89 msgid "Alias" msgstr "" -#: modules/devices/devicetree.c:86 modules/devices/devicetree.c:87 +#: modules/devices/devicetree.c:89 modules/devices/devicetree.c:90 msgid "(None)" msgstr "" -#: modules/devices/devicetree.c:87 +#: modules/devices/devicetree.c:90 msgid "Symbol" msgstr "" -#: modules/devices/devicetree.c:132 modules/devices/devicetree/pmac_data.c:79 +#: modules/devices/devicetree.c:143 modules/devices/devicetree/pmac_data.c:79 msgid "Platform" msgstr "" -#: modules/devices/devicetree.c:133 modules/devices/devicetree.c:178 +#: modules/devices/devicetree.c:144 modules/devices/devicetree.c:209 msgid "Compatible" msgstr "" -#: modules/devices/devicetree.c:134 +#: modules/devices/devicetree.c:145 msgid "GPU-compatible" msgstr "" -#: modules/devices/devicetree.c:140 +#: modules/devices/devicetree.c:160 msgid "Raspberry Pi or Compatible" msgstr "" -#: modules/devices/devicetree.c:142 modules/devices/devicetree.c:160 -#: modules/devices/devicetree.c:177 modules/devices/devicetree/rpi_data.c:160 +#: modules/devices/devicetree.c:162 modules/devices/devicetree.c:189 +#: modules/devices/devicetree.c:208 modules/devices/devicetree/rpi_data.c:160 +#: modules/devices/dmi.c:49 modules/devices/dmi.c:55 msgid "Serial Number" -msgstr "" +msgstr "Серийный номер" -#: modules/devices/devicetree.c:143 modules/devices/devicetree/rpi_data.c:157 +#: modules/devices/devicetree.c:163 modules/devices/devicetree/rpi_data.c:157 msgid "RCode" msgstr "" -#: modules/devices/devicetree.c:143 +#: modules/devices/devicetree.c:163 msgid "No revision code available; unable to lookup model details." msgstr "" -#: modules/devices/devicetree.c:159 +#: modules/devices/devicetree.c:188 msgid "More" msgstr "" -#: modules/devices/devicetree.c:175 -msgid "Board" -msgstr "" - -#: modules/devices/devicetree.c:234 +#: modules/devices/devicetree.c:268 msgid "Messages" msgstr "" -#: modules/devices/devicetree/dt_util.c:1013 -msgid "phandle Map" -msgstr "" - -#: modules/devices/devicetree/dt_util.c:1014 -msgid "Alias Map" -msgstr "" - -#: modules/devices/devicetree/dt_util.c:1015 -msgid "Symbol Map" -msgstr "" - #: modules/devices/devicetree/pmac_data.c:78 msgid "Apple Power Macintosh" msgstr "" -#: modules/devices/devicetree/pmac_data.c:81 modules/devices/sh/processor.c:85 -msgid "Machine" -msgstr "Машина" - #: modules/devices/devicetree/pmac_data.c:83 msgid "Detected as" msgstr "" @@ -2109,43 +2222,65 @@ msgctxt "rpi-ov-bit" msgid "Not set" msgstr "" -#: modules/devices/devmemory.c:93 +#: modules/devices/devmemory.c:101 msgid "Total Memory" msgstr "Общая память" -#: modules/devices/devmemory.c:94 +#: modules/devices/devmemory.c:102 msgid "Free Memory" msgstr "Свободная память" -#: modules/devices/devmemory.c:95 +#: modules/devices/devmemory.c:103 msgid "Cached Swap" msgstr "Кэш подкачки" -#: modules/devices/devmemory.c:96 +#: modules/devices/devmemory.c:104 msgid "High Memory" msgstr "Высокая память" -#: modules/devices/devmemory.c:97 +#: modules/devices/devmemory.c:105 msgid "Free High Memory" msgstr "Свободная высокая память" -#: modules/devices/devmemory.c:98 +#: modules/devices/devmemory.c:106 msgid "Low Memory" msgstr "Низкая память" -#: modules/devices/devmemory.c:99 +#: modules/devices/devmemory.c:107 msgid "Free Low Memory" msgstr "Свободная низкая память" -#: modules/devices/devmemory.c:100 +#: modules/devices/devmemory.c:108 msgid "Virtual Memory" msgstr "Виртуальная память" -#: modules/devices/devmemory.c:101 +#: modules/devices/devmemory.c:109 msgid "Free Virtual Memory" msgstr "Свободная виртуальная память" -#: modules/devices/dmi.c:188 +#: modules/devices/dmi.c:36 modules/devices/inputdevices.c:120 +#: modules/devices/usb.c:83 modules/devices/usb.c:216 modules/devices/usb.c:348 +msgid "Product" +msgstr "Продукт" + +#: modules/devices/dmi.c:38 modules/devices/ia64/processor.c:164 +#: modules/devices/sh/processor.c:86 +msgid "Family" +msgstr "Семейство" + +#: modules/devices/dmi.c:41 +msgid "BIOS" +msgstr "" + +#: modules/devices/dmi.c:50 modules/devices/dmi.c:56 +msgid "Asset Tag" +msgstr "" + +#: modules/devices/dmi.c:51 +msgid "Chassis" +msgstr "Шасси" + +#: modules/devices/dmi.c:116 msgid "(Not available; Perhaps try running HardInfo as root.)" msgstr "(Недоступно, попробуйте выполнить HardInfo с правами администратора.)" @@ -2157,10 +2292,6 @@ msgstr "Процессор IA64" msgid "Architecture Revision" msgstr "Ревизия архитектуры" -#: modules/devices/ia64/processor.c:164 modules/devices/sh/processor.c:86 -msgid "Family" -msgstr "Семейство" - #: modules/devices/ia64/processor.c:170 msgid "CPU regs" msgstr "Регистры" @@ -2179,11 +2310,6 @@ msgstr "Информация об устройстве" msgid "Bus" msgstr "Шина" -#: modules/devices/inputdevices.c:120 modules/devices/usb.c:83 -#: modules/devices/usb.c:216 modules/devices/usb.c:348 -msgid "Product" -msgstr "Продукт" - #: modules/devices/inputdevices.c:124 msgid "Connected to" msgstr "Подключен к" @@ -2584,7 +2710,7 @@ msgid "" msgstr "" "Имя устройства=hd%c\n" "Медиа=%s\n" -"Кэш=%dkb\n" +"Кэш=%d кБ\n" #: modules/devices/storage.c:334 #, c-format @@ -2677,19 +2803,19 @@ msgstr "" #: modules/devices/x86/processor.c:170 msgctxt "cache-type" msgid "Data" -msgstr "" +msgstr "данные" #. /cache type, as appears in: Level 1 (Instruction) #: modules/devices/x86/processor.c:171 msgctxt "cache-type" msgid "Instruction" -msgstr "" +msgstr "инструкции" #. /cache type, as appears in: Level 2 (Unified) #: modules/devices/x86/processor.c:172 msgctxt "cache-type" msgid "Unified" -msgstr "" +msgstr "унифицированный" #: modules/devices/x86/processor.c:410 msgid "Model Name" @@ -2701,7 +2827,7 @@ msgstr "Семейство, модель, степпинг" #: modules/devices/x86/processor.c:417 msgid "Microcode Version" -msgstr "" +msgstr "Версия микрокода" #: modules/devices/x86/processor.c:418 msgid "Configuration" @@ -4162,7 +4288,7 @@ msgid "Shared Directories" msgstr "Общие каталоги" #: modules/network.c:304 modules/network.c:326 modules/network.c:357 -#: modules/network/net.c:477 +#: modules/network/net.c:472 msgid "IP Address" msgstr "IP-адрес" @@ -4226,7 +4352,7 @@ msgstr "Цель / Шлюз" msgid "Flags" msgstr "Флаги" -#: modules/network.c:374 modules/network/net.c:478 +#: modules/network.c:374 modules/network/net.c:473 msgid "Mask" msgstr "Маска" @@ -4396,109 +4522,97 @@ msgctxt "net-if-type" msgid "(Unknown)" msgstr "" -#: modules/network/net.c:348 modules/network/net.c:358 +#: modules/network/net.c:343 modules/network/net.c:353 msgid "Network Interfaces" msgstr "" -#: modules/network/net.c:348 +#: modules/network/net.c:343 msgid "None Found" msgstr "" -#: modules/network/net.c:400 modules/network/net.c:422 -#: modules/network/net.c:423 +#: modules/network/net.c:395 modules/network/net.c:417 +#: modules/network/net.c:418 msgid "MiB" msgstr " МиБ" -#: modules/network/net.c:414 +#: modules/network/net.c:409 msgid "Network Adapter Properties" msgstr "Свойства сетевого адаптера" -#: modules/network/net.c:415 +#: modules/network/net.c:410 msgid "Interface Type" msgstr "Тип интерфейса" -#: modules/network/net.c:416 +#: modules/network/net.c:411 msgid "Hardware Address (MAC)" msgstr "Аппаратный адрес (MAC)" -#: modules/network/net.c:420 +#: modules/network/net.c:415 msgid "MTU" msgstr "" -#: modules/network/net.c:421 +#: modules/network/net.c:416 msgid "Transfer Details" msgstr "Информация о передаче данных" -#: modules/network/net.c:422 +#: modules/network/net.c:417 msgid "Bytes Received" msgstr "Получено байт" -#: modules/network/net.c:423 +#: modules/network/net.c:418 msgid "Bytes Sent" msgstr "Отправлено байт" -#: modules/network/net.c:440 modules/network/net.c:462 -#: modules/network/net.c:463 +#: modules/network/net.c:435 modules/network/net.c:457 +#: modules/network/net.c:458 msgid "dBm" msgstr "" -#: modules/network/net.c:440 +#: modules/network/net.c:435 msgid "mW" msgstr "" -#: modules/network/net.c:454 +#: modules/network/net.c:449 msgid "Wireless Properties" msgstr "" -#: modules/network/net.c:455 +#: modules/network/net.c:450 msgid "Network Name (SSID)" msgstr "" -#: modules/network/net.c:456 +#: modules/network/net.c:451 msgid "Bit Rate" msgstr "" -#: modules/network/net.c:456 +#: modules/network/net.c:451 msgid "Mb/s" msgstr "" -#: modules/network/net.c:457 +#: modules/network/net.c:452 msgid "Transmission Power" msgstr "" -#: modules/network/net.c:459 +#: modules/network/net.c:454 msgid "Status" msgstr "" -#: modules/network/net.c:460 +#: modules/network/net.c:455 msgid "Link Quality" msgstr "" -#: modules/network/net.c:461 +#: modules/network/net.c:456 msgid "Signal / Noise" msgstr "" -#: modules/network/net.c:476 +#: modules/network/net.c:471 msgid "Internet Protocol (IPv4)" msgstr "" -#: modules/network/net.c:477 modules/network/net.c:478 -#: modules/network/net.c:480 +#: modules/network/net.c:472 modules/network/net.c:473 +#: modules/network/net.c:475 msgid "(Not set)" msgstr "" -#: modules/network/net.c:479 +#: modules/network/net.c:474 msgid "Broadcast Address" msgstr "Широковещательный адрес" - -#~ msgid "CPU Clock" -#~ msgstr "Частота процессора" - -#~ msgid "pixels" -#~ msgstr "пикселей" - -#~ msgid "Desktop Environment" -#~ msgstr "Среда рабочего стола" - -#~ msgid "%s$CPU%d$%s=%.2fMHz\n" -#~ msgstr "%s$CPU%d$%s=%.2f МГц\n" diff --git a/shell/callbacks.c b/shell/callbacks.c index 95a7bd61..9bb5c990 100644 --- a/shell/callbacks.c +++ b/shell/callbacks.c @@ -114,7 +114,7 @@ void cb_about_module(GtkAction * action) gtk_window_set_transient_for(GTK_WINDOW(about), GTK_WINDOW(shell->window)); - text = g_strdup_printf(_("%s Module"), sm->name); + text = g_strdup(sm->name); #if GTK_CHECK_VERSION(2, 12, 0) gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(about), text); #else @@ -132,7 +132,7 @@ void cb_about_module(GtkAction * action) if (ma->description) gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about), - ma->description); + _(ma->description)); gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(about), sm->icon); gtk_dialog_run(GTK_DIALOG(about)); diff --git a/shell/menu.c b/shell/menu.c index e966f485..b0f01e58 100644 --- a/shell/menu.c +++ b/shell/menu.c @@ -49,17 +49,17 @@ static GtkActionEntry entries[] = { NULL, G_CALLBACK(cb_sync_manager)}, - {"OpenAction", GTK_STOCK_OPEN, + {"OpenAction", "_Open", N_("_Open..."), NULL, NULL, G_CALLBACK(cb_sync_manager)}, - {"CopyAction", GTK_STOCK_COPY, + {"CopyAction", "_Copy", N_("_Copy to Clipboard"), "<control>C", N_("Copy to clipboard"), G_CALLBACK(cb_copy_to_clipboard)}, - {"RefreshAction", GTK_STOCK_REFRESH, + {"RefreshAction", "_Refresh", N_("_Refresh"), "F5", NULL, G_CALLBACK(cb_refresh)}, @@ -74,12 +74,12 @@ static GtkActionEntry entries[] = { NULL, G_CALLBACK(cb_report_bug)}, - {"AboutAction", GTK_STOCK_ABOUT, + {"AboutAction", "_About", N_("_About HardInfo"), NULL, N_("Displays program version information"), G_CALLBACK(cb_about)}, - {"QuitAction", GTK_STOCK_QUIT, + {"QuitAction", "_Quit", N_("_Quit"), "<control>Q", NULL, G_CALLBACK(cb_quit)} diff --git a/shell/report.c b/shell/report.c index 398af323..135dfd9b 100644 --- a/shell/report.c +++ b/shell/report.c @@ -494,9 +494,9 @@ static gchar *report_get_filename(void) dialog = gtk_file_chooser_dialog_new(_("Save File"), NULL, GTK_FILE_CHOOSER_ACTION_SAVE, - "_Cancel", + _("_Cancel"), GTK_RESPONSE_CANCEL, - "_Save", + _("_Save"), GTK_RESPONSE_ACCEPT, NULL); #else dialog = gtk_file_chooser_dialog_new(_("Save File"), @@ -648,8 +648,8 @@ static gboolean report_generate(ReportDialog * rd) _("Open the report with your web browser?")); #if GTK_CHECK_VERSION(3, 0, 0) gtk_dialog_add_buttons(GTK_DIALOG(dialog), - "_No", GTK_RESPONSE_REJECT, - "_Open", GTK_RESPONSE_ACCEPT, NULL); + _("_No"), GTK_RESPONSE_REJECT, + _("_Open"), GTK_RESPONSE_ACCEPT, NULL); #else gtk_dialog_add_buttons(GTK_DIALOG(dialog), GTK_STOCK_NO, GTK_RESPONSE_REJECT, @@ -918,7 +918,7 @@ static ReportDialog * gtk_dialog_get_action_area has been deprecated since version 3.12 and should not be used in newly-written code. * Direct access to the action area is discouraged; use gtk_dialog_add_button(), etc. */ - dialog1_action_area = gtk_dialog_get_action_area(GTK_DIALOG(dialog)); + dialog1_action_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); #else dialog1_action_area = GTK_DIALOG(dialog)->action_area; #endif diff --git a/shell/shell.c b/shell/shell.c index b81e77b6..8688f9ac 100644 --- a/shell/shell.c +++ b/shell/shell.c @@ -447,7 +447,7 @@ static void create_window(void) shell->status = gtk_label_new(""); #if GTK_CHECK_VERSION(3, 0, 0) - gtk_widget_set_valign(GTK_MISC(shell->status), GTK_ALIGN_CENTER); + gtk_widget_set_valign(GTK_WIDGET(shell->status), GTK_ALIGN_CENTER); #else gtk_misc_set_alignment(GTK_MISC(shell->status), 0.0, 0.5); #endif @@ -512,7 +512,8 @@ static void menu_item_set_icon_always_visible(Shell *shell, path = g_strdup_printf("%s/%s", parent_path, item_id); menuitem = gtk_ui_manager_get_widget(shell->ui_manager, path); -#if GTK_CHECK_VERSION(2, 18, 0) +#if GTK_CHECK_VERSION(3, 0, 0) +#else gtk_image_menu_item_set_always_show_image(GTK_IMAGE_MENU_ITEM(menuitem), TRUE); #endif g_free(path); @@ -690,7 +691,7 @@ ShellSummary *summary_new(void) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); #if GTK_CHECK_VERSION(3, 0, 0) - gtk_container_add(GTK_SCROLLED_WINDOW(summary->scroll), + gtk_container_add(GTK_CONTAINER(summary->scroll), summary->view); #else gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(summary->scroll), @@ -701,6 +702,17 @@ ShellSummary *summary_new(void) return summary; } +static gboolean +select_first_tree_item(gpointer data) +{ + GtkTreeIter first; + + if (gtk_tree_model_get_iter_first(shell->tree->model, &first)) + gtk_tree_selection_select_iter(shell->tree->selection, &first); + + return FALSE; +} + void shell_init(GSList * modules) { if (shell) { @@ -770,6 +782,9 @@ void shell_init(GSList * modules) #else shell_action_set_enabled("SyncManagerAction", sync_manager_count_entries() > 0); #endif + + /* Should select Computer Summary (note: not Computer/Summary) */ + g_idle_add(select_first_tree_item, NULL); } static gboolean update_field(gpointer data) @@ -978,7 +993,10 @@ static void set_view_type(ShellViewType viewtype, gboolean reload) } /* turn off the rules hint */ +#if GTK_CHECK_VERSION(3, 0, 0) +#else gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(shell->info->view), FALSE); +#endif close_note(NULL, NULL); @@ -1148,10 +1166,13 @@ group_handle_special(GKeyFile * key_file, ShellModuleEntry * entry, g_free(file); } } else if (g_str_equal(key, "Zebra")) { +#if GTK_CHECK_VERSION(3, 0, 0) +#else gtk_tree_view_set_rules_hint(GTK_TREE_VIEW (shell->info->view), g_key_file_get_boolean (key_file, group, key, NULL)); +#endif } } @@ -1389,6 +1410,30 @@ select_first_item(gpointer data) return FALSE; } +static gboolean +select_marked_or_first_item(gpointer data) +{ + GtkTreeIter first, it; + gboolean found_selection = FALSE; + gchar *datacol; + + if ( gtk_tree_model_get_iter_first(shell->info->model, &first) ) { + it = first; + while ( gtk_tree_model_iter_next(shell->info->model, &it) ) { + gtk_tree_model_get(shell->info->model, &it, INFO_TREE_COL_DATA, &datacol, -1); + if (datacol != NULL && *datacol == '*') { + gtk_tree_selection_select_iter(shell->info->selection, &it); + found_selection = TRUE; + } + g_free(datacol); + } + + if (!found_selection) + gtk_tree_selection_select_iter(shell->info->selection, &first); + } + return FALSE; +} + static void module_selected_show_info(ShellModuleEntry * entry, gboolean reload) { @@ -1491,7 +1536,7 @@ module_selected_show_info(ShellModuleEntry * entry, gboolean reload) case SHELL_VIEW_DUAL: case SHELL_VIEW_LOAD_GRAPH: case SHELL_VIEW_PROGRESS_DUAL: - g_idle_add(select_first_item, NULL); + g_idle_add(select_marked_or_first_item, NULL); } } } @@ -1507,6 +1552,9 @@ static void info_selected_show_extra(gchar * data) return; if (data) { + /* skip the select marker */ + if (*data == '*') + data++; GKeyFile *key_file = g_key_file_new(); gchar *key_data = shell->selected->morefunc(data); gchar **groups; @@ -1613,15 +1661,22 @@ static void shell_summary_add_item(ShellSummary *summary, gtk_box_pack_start(GTK_BOX(frame_label_box), frame_image, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(frame_label_box), frame_label, FALSE, FALSE, 0); + content = gtk_label_new(temp); /* TODO:GTK3 gtk_alignment_new(), etc is deprecated from 3.14 */ +#if GTK_CHECK_VERSION(3, 0, 0) + GtkWidget *frame_box; + frame_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); + gtk_widget_set_margin_start(GTK_WIDGET(frame_box), 48); + gtk_box_pack_start(GTK_BOX(frame_box), content, FALSE, FALSE, 0); + gtk_container_add(GTK_CONTAINER(frame), frame_box); +#else alignment = gtk_alignment_new(0.5, 0.5, 1, 1); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 48, 0); gtk_widget_show(alignment); gtk_container_add(GTK_CONTAINER(frame), alignment); - - content = gtk_label_new(temp); gtk_misc_set_alignment(GTK_MISC(content), 0.0, 0.5); gtk_container_add(GTK_CONTAINER(alignment), content); +#endif gtk_widget_show_all(frame); gtk_widget_show_all(frame_label_box); diff --git a/shell/stock.c b/shell/stock.c index ad1a0135..86d66778 100644 --- a/shell/stock.c +++ b/shell/stock.c @@ -38,6 +38,8 @@ static GtkIconFactory *icon_factory; void stock_icon_register(gchar * filename, gchar * stock_id) { +#if GTK_CHECK_VERSION(3, 0, 0) +#else GtkIconSet *icon_set; GtkIconSource *icon_source; @@ -52,10 +54,13 @@ void stock_icon_register(gchar * filename, gchar * stock_id) gtk_icon_factory_add(icon_factory, stock_id, icon_set); gtk_icon_set_unref(icon_set); +#endif } void stock_icon_register_pixbuf(GdkPixbuf * pixbuf, gchar * stock_id) { +#if GTK_CHECK_VERSION(3, 0, 0) +#else GtkIconSet *icon_set; GtkIconSource *icon_source; @@ -69,6 +74,7 @@ void stock_icon_register_pixbuf(GdkPixbuf * pixbuf, gchar * stock_id) gtk_icon_factory_add(icon_factory, stock_id, icon_set); gtk_icon_set_unref(icon_set); +#endif } void stock_icons_init(void) @@ -78,14 +84,20 @@ void stock_icons_init(void) DEBUG("initializing stock icons"); +#if GTK_CHECK_VERSION(3, 0, 0) +#else icon_factory = gtk_icon_factory_new(); +#endif for (i = 0; i < n_stock_icons; i++) { stock_icon_register(stock_icons[i].filename, stock_icons[i].stock_id); } +#if GTK_CHECK_VERSION(3, 0, 0) +#else gtk_icon_factory_add_default(icon_factory); +#endif g_object_unref(icon_factory); } |