aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:48 -0500
committerSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:48 -0500
commit7c47b5b9584f5011aeba18d7e1b26b3d3124825f (patch)
tree11b07e1c73a22a6ec5ebd710c9a72e972a4c571b
parent4979bb6cbbbe39eb44c32530cd13f86bf44e5d77 (diff)
Import Upstream version 0.5.1
-rw-r--r--Makefile.in22
-rw-r--r--TODO3
-rw-r--r--arch/common/languages.h2
-rw-r--r--arch/linux/common/alsa.h2
-rw-r--r--arch/linux/common/battery.h2
-rw-r--r--arch/linux/common/dmi.h60
-rw-r--r--arch/linux/common/loadavg.h2
-rw-r--r--arch/linux/common/modules.h2
-rw-r--r--arch/linux/common/os.h28
-rw-r--r--arch/linux/common/pci.h2
-rw-r--r--arch/linux/common/storage.h10
-rw-r--r--arch/linux/common/uptime.h2
-rw-r--r--autopackage/default.apspec6
-rw-r--r--benchmark.c13
-rwxr-xr-xconfigure2
-rw-r--r--devices.c6
-rw-r--r--fftbench.h4
-rw-r--r--hardinfo.c6
-rw-r--r--network.c8
-rw-r--r--report.c23
-rw-r--r--shell.c9
-rw-r--r--syncmanager.c4
-rw-r--r--util.c2
-rw-r--r--vendor.c144
-rw-r--r--vendor.h2
25 files changed, 250 insertions, 116 deletions
diff --git a/Makefile.in b/Makefile.in
index 5639db69..03a9df8b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -13,9 +13,7 @@ BENCHMARK_OBJECTS = fbench.o sha1.o blowfish.o md5.o nqueens.o fftbench.o
MODULES = computer.so devices.so benchmark.so network.so
-all: $(OBJECTS) $(MODULES) hardinfo
-
-hardinfo:
+all: $(OBJECTS) $(MODULES)
$(CC) $(CCFLAGS) -o hardinfo -Wl,-export-dynamic $(OBJECTS) $(GTK_LIBS) \
$(SOUP_LIBS)
@@ -38,14 +36,12 @@ nqueens.o:
$(CCSLOW) $(CCFLAGS) $(CFLAGS) -c nqueens.c -o $@
benchmark.so: benchmark.c
- @echo "--- Module: $< ($@)"
make $(BENCHMARK_OBJECTS)
$(CCSLOW) $(CCFLAGS) $(CFLAGS) -o $@ -shared $< $(BENCHMARK_OBJECTS) \
$(GTK_FLAGS) $(GTK_LIBS)
ln -sf ../$@ modules
%.so: %.c
- @echo "--- Module: $< ($@)"
$(CC) $(CCFLAGS) $(CFLAGS) -o $@ -shared $< $(GTK_FLAGS) $(GTK_LIBS)
ln -sf ../$@ modules
@@ -68,39 +64,27 @@ deb: dist-clean
dpkg-buildpackage -rfakeroot -k${USER}
install: all
- @echo '*** Cleaning up installation...'
rm -rf ${DESTDIR}${LIBDIR}/hardinfo/modules ${DESTDIR}/usr/share/hardinfo/pixmaps
- @echo '*** Creating directories...'
mkdir -p ${DESTDIR}/usr/bin
mkdir -p ${DESTDIR}/usr/local
mkdir -p ${DESTDIR}/usr/share/applications
-
-
mkdir -p ${DESTDIR}${LIBDIR}/hardinfo/modules
mkdir -p ${DESTDIR}/usr/share/hardinfo/pixmaps
- @echo '*** Installing icon...'
cp hardinfo.desktop ${DESTDIR}/usr/share/applications
- @echo '*** Installing executable...'
cp hardinfo ${DESTDIR}/usr/bin/hardinfo
- @echo '*** Installing modules...'
- cp -Lvr modules/*.so ${DESTDIR}${LIBDIR}/hardinfo/modules
+ cp -Lr modules/*.so ${DESTDIR}${LIBDIR}/hardinfo/modules
- @echo '*** Installing pixmaps...'
- cp -Lvr pixmaps/* ${DESTDIR}/usr/share/hardinfo/pixmaps
+ cp -Lr pixmaps/* ${DESTDIR}/usr/share/hardinfo/pixmaps
- @echo '*** Installing misc data...'
cp benchmark.conf ${DESTDIR}/usr/share/hardinfo
cp benchmark.data ${DESTDIR}/usr/share/hardinfo
- @echo '*** Fixing permissions...'
chmod 755 ${DESTDIR}/usr/bin/hardinfo
- @echo '*** Done installing.'
-
installer:
makepackage
diff --git a/TODO b/TODO
index b77f4f49..fcdba7be 100644
--- a/TODO
+++ b/TODO
@@ -34,6 +34,9 @@
* Round benchmark results to two decimal places at most,
or get rid of decimal places altogether.
* Add preferences window
+ * Save/restore
+ * Window position
+ * Window size
* Proxy configuration
* Use HTTP_PROXY variable;
* Use GNOME settings;
diff --git a/arch/common/languages.h b/arch/common/languages.h
index 45eb2b6a..c1839ee9 100644
--- a/arch/common/languages.h
+++ b/arch/common/languages.h
@@ -40,7 +40,7 @@ scan_languages(OperatingSystem * os)
while (fgets(buf, 512, locale)) {
if (!strncmp(buf, "locale:", 7)) {
sscanf(buf, "locale: %s", name);
- fgets(buf, 128, locale);
+ (void)fgets(buf, 128, locale);
} else if (strchr(buf, '|')) {
gchar **tmp = g_strsplit(buf, "|", 2);
diff --git a/arch/linux/common/alsa.h b/arch/linux/common/alsa.h
index 5609471c..ddd58edd 100644
--- a/arch/linux/common/alsa.h
+++ b/arch/linux/common/alsa.h
@@ -60,7 +60,7 @@ computer_get_alsainfo(void)
ai->cards = g_slist_append(ai->cards, ac);
g_strfreev(tmp);
- fgets(buffer, 128, cards); /* skip next line */
+ (void)fgets(buffer, 128, cards); /* skip next line */
}
fclose(cards);
diff --git a/arch/linux/common/battery.h b/arch/linux/common/battery.h
index 7dfa5423..d378fdef 100644
--- a/arch/linux/common/battery.h
+++ b/arch/linux/common/battery.h
@@ -217,7 +217,7 @@ __scan_battery_apm(void)
if ((procapm = fopen("/proc/apm", "r"))) {
int old_percentage = percentage;
- fscanf(procapm, "%s %s %s 0x%x %s %s %d%%",
+ (void)fscanf(procapm, "%s %s %s 0x%x %s %s %d%%",
apm_drv_ver, apm_bios_ver, trash,
&ac_bat, trash, trash, &percentage);
fclose(procapm);
diff --git a/arch/linux/common/dmi.h b/arch/linux/common/dmi.h
index f69fdc21..7c5e6e6f 100644
--- a/arch/linux/common/dmi.h
+++ b/arch/linux/common/dmi.h
@@ -70,16 +70,35 @@ gboolean dmi_get_info_dmidecode()
if ((dmi_pipe = popen(temp, "r"))) {
g_free(temp);
- fgets(buffer, 256, dmi_pipe);
+ (void)fgets(buffer, 256, dmi_pipe);
if (pclose(dmi_pipe)) {
dmi_failed = TRUE;
break;
}
-
- dmi_info = h_strdup_cprintf("%s=%s\n",
- dmi_info,
- 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;
@@ -120,13 +139,32 @@ gboolean dmi_get_info_sys()
continue;
if ((dmi_file = fopen(info->file, "r"))) {
- fgets(buffer, 256, dmi_file);
+ (void)fgets(buffer, 256, dmi_file);
fclose(dmi_file);
- dmi_info = h_strdup_cprintf("%s=%s\n",
- dmi_info,
- 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,
+ g_strstrip(buffer));
+ }
} else {
dmi_failed = TRUE;
break;
diff --git a/arch/linux/common/loadavg.h b/arch/linux/common/loadavg.h
index 7c028679..ce2d8775 100644
--- a/arch/linux/common/loadavg.h
+++ b/arch/linux/common/loadavg.h
@@ -23,7 +23,7 @@ computer_get_loadinfo(void)
FILE *procloadavg;
procloadavg = fopen("/proc/loadavg", "r");
- fscanf(procloadavg, "%f %f %f", &(li->load1), &(li->load5),
+ (void)fscanf(procloadavg, "%f %f %f", &(li->load1), &(li->load5),
&(li->load15));
fclose(procloadavg);
diff --git a/arch/linux/common/modules.h b/arch/linux/common/modules.h
index 7ea238b7..78fb9de3 100644
--- a/arch/linux/common/modules.h
+++ b/arch/linux/common/modules.h
@@ -56,7 +56,7 @@ scan_modules_do(void)
return;
}
- fgets(buffer, 1024, lsmod); /* Discards the first line */
+ (void)fgets(buffer, 1024, lsmod); /* Discards the first line */
while (fgets(buffer, 1024, lsmod)) {
gchar *buf, *strmodule, *hashkey;
diff --git a/arch/linux/common/os.h b/arch/linux/common/os.h
index 01853123..f3c2c2d8 100644
--- a/arch/linux/common/os.h
+++ b/arch/linux/common/os.h
@@ -28,11 +28,13 @@ get_default_gcc_version(void)
NULL)) {
char *return_value;
- if (!(return_value = strstr(buf, "gcc version "))) {
+ if (!(return_value = strstr(buf, "gcc "))) {
goto err;
}
- return_value += sizeof("gcc version");
+ return_value = strstr(return_value, " ") + 1;
+ return_value = strstr(return_value, " ") + 1;
+
return_value = g_strdup_printf("GNU C Compiler version %s", return_value);
g_free(buf);
@@ -53,7 +55,7 @@ get_libc_version(void)
libc = popen("/lib/libc.so.6", "r");
if (!libc) goto err;
- fgets(buf, 256, libc);
+ (void)fgets(buf, 256, libc);
if (pclose(libc)) goto err;
tmp = strstr(buf, "version ");
@@ -80,7 +82,7 @@ get_os_compiled_date(void)
if (!procversion)
return g_strdup("Unknown");
- fgets(buf, 512, procversion);
+ (void)fgets(buf, 512, procversion);
fclose(procversion);
return g_strdup(buf);
@@ -103,7 +105,7 @@ detect_desktop_environment(OperatingSystem * os)
obtain the version. */
version = popen("gnome-about --gnome-version", "r");
if (version) {
- fscanf(version, "Version: %s", vers);
+ (void)fscanf(version, "Version: %s", vers);
if (pclose(version))
goto unknown;
} else {
@@ -112,13 +114,19 @@ detect_desktop_environment(OperatingSystem * os)
os->desktop = g_strdup_printf("GNOME %s", vers);
} else if (g_getenv("KDE_FULL_SESSION")) {
- version = popen("kcontrol --version", "r");
+
+ if (g_getenv("KDE_SESSION_VERSION") && strstr(g_getenv("KDE_SESSION_VERSION"),(gchar *)"4")) {
+ version = popen("kwin --version", "r");
+ } else {
+ version = popen("kcontrol --version", "r");
+ }
+
if (version) {
char buf[32];
- fgets(buf, 32, version);
+ (void)fgets(buf, 32, version);
- fscanf(version, "KDE: %s", vers);
+ (void)fscanf(version, "KDE: %s", vers);
if (pclose(version))
goto unknown;
} else {
@@ -172,7 +180,7 @@ computer_get_os(void)
release = popen("lsb_release -d", "r");
if (release) {
- fgets(buffer, 128, release);
+ (void)fgets(buffer, 128, release);
pclose(release);
os->distro = buffer;
@@ -192,7 +200,7 @@ computer_get_os(void)
char buf[128];
distro_ver = fopen(distro_db[i].file, "r");
- fgets(buf, 128, distro_ver);
+ (void)fgets(buf, 128, distro_ver);
fclose(distro_ver);
buf[strlen(buf) - 1] = 0;
diff --git a/arch/linux/common/pci.h b/arch/linux/common/pci.h
index a1ea1021..73d87c7f 100644
--- a/arch/linux/common/pci.h
+++ b/arch/linux/common/pci.h
@@ -33,7 +33,7 @@ __scan_pci(void)
{
FILE *lspci;
gchar buffer[256], *buf, *strhash = NULL, *strdevice = NULL;
- gchar *category = NULL, *name = NULL, *icon, *lspci_path, *command_line;
+ gchar *category = NULL, *name = NULL, *icon, *lspci_path, *command_line = NULL;
gint n = 0, x = 0;
if ((lspci_path = find_program("lspci")) == NULL) {
diff --git a/arch/linux/common/storage.h b/arch/linux/common/storage.h
index 5208f028..06593a09 100644
--- a/arch/linux/common/storage.h
+++ b/arch/linux/common/storage.h
@@ -180,7 +180,7 @@ __scan_ide_devices(void)
cache = 0;
proc_ide = fopen(device, "r");
- fgets(buf, 128, proc_ide);
+ (void)fgets(buf, 128, proc_ide);
fclose(proc_ide);
buf[strlen(buf) - 1] = 0;
@@ -191,7 +191,7 @@ __scan_ide_devices(void)
device = g_strdup_printf("/proc/ide/hd%c/media", iface);
proc_ide = fopen(device, "r");
- fgets(buf, 128, proc_ide);
+ (void)fgets(buf, 128, proc_ide);
fclose(proc_ide);
buf[strlen(buf) - 1] = 0;
@@ -257,7 +257,7 @@ __scan_ide_devices(void)
device = g_strdup_printf("/proc/ide/hd%c/cache", iface);
if (g_file_test(device, G_FILE_TEST_EXISTS)) {
proc_ide = fopen(device, "r");
- fscanf(proc_ide, "%d", &cache);
+ (void)fscanf(proc_ide, "%d", &cache);
fclose(proc_ide);
}
g_free(device);
@@ -268,7 +268,7 @@ __scan_ide_devices(void)
proc_ide = fopen(device, "r");
- fgets(buf, 64, proc_ide);
+ (void)fgets(buf, 64, proc_ide);
for (tmp = buf; *tmp; tmp++) {
if (*tmp >= '0' && *tmp <= '9')
break;
@@ -276,7 +276,7 @@ __scan_ide_devices(void)
pgeometry = g_strdup(g_strstrip(tmp));
- fgets(buf, 64, proc_ide);
+ (void)fgets(buf, 64, proc_ide);
for (tmp = buf; *tmp; tmp++) {
if (*tmp >= '0' && *tmp <= '9')
break;
diff --git a/arch/linux/common/uptime.h b/arch/linux/common/uptime.h
index b2412cd2..8fdc3a27 100644
--- a/arch/linux/common/uptime.h
+++ b/arch/linux/common/uptime.h
@@ -24,7 +24,7 @@ computer_get_uptime(void)
gulong minutes;
if ((procuptime = fopen("/proc/uptime", "r")) != NULL) {
- fscanf(procuptime, "%lu", &minutes);
+ (void)fscanf(procuptime, "%lu", &minutes);
ui->minutes = minutes / 60;
fclose(procuptime);
} else {
diff --git a/autopackage/default.apspec b/autopackage/default.apspec
index a1c0bbbe..a8598d01 100644
--- a/autopackage/default.apspec
+++ b/autopackage/default.apspec
@@ -2,9 +2,9 @@
# Generated by mkapspec 0.2
[Meta]
ShortName: hardinfo
-SoftwareVersion: 0.4.3-beta2
-DisplayName: HardInfo $SOFTWAREVERSION
-RootName: @tia.mat.br/hardinfo:$SOFTWAREVERSION
+SoftwareVersion: 0.5.1
+DisplayName: HardInfo
+RootName: @hardinfo.org/hardinfo:$SOFTWAREVERSION
Summary: System profiler and benchmark tool
Maintainer: Leandro A. F. Pereira <leandro@hardinfo.org>
Packager: Leandro A. F. Pereira <leandro@hardinfo.org>
diff --git a/benchmark.c b/benchmark.c
index 8bbfe11a..e31d6b34 100644
--- a/benchmark.c
+++ b/benchmark.c
@@ -1,6 +1,6 @@
/*
* HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
+ * Copyright (C) 2003-2009 Leandro A. F. Pereira <leandro@hardinfo.org>
*
* 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
@@ -236,8 +236,8 @@ gchar *callback_fft()
gchar *callback_nqueens()
{
- return benchmark_include_results_reverse(bench_results[BENCHMARK_NQUEENS],
- "CPU N-Queens");
+ return benchmark_include_results(bench_results[BENCHMARK_NQUEENS],
+ "CPU N-Queens");
}
gchar *callback_raytr()
@@ -255,7 +255,7 @@ gchar *callback_bfsh()
gchar *callback_cryptohash()
{
return benchmark_include_results_reverse(bench_results[BENCHMARK_CRYPTOHASH],
- "CPU Cryptohash");
+ "CPU CryptoHash");
}
gchar *callback_fib()
@@ -320,6 +320,7 @@ const gchar *hi_note_func(gint entry)
case BENCHMARK_CRYPTOHASH:
return "Results in MiB/second. Higher is better.";
+ case BENCHMARK_FFT:
case BENCHMARK_RAYTRACE:
case BENCHMARK_BLOWFISH:
case BENCHMARK_FIB:
@@ -397,12 +398,12 @@ void hi_module_init(void)
{
static SyncEntry se[] = {
{
- .fancy_name = "Send Benchmark Results",
+ .fancy_name = "Send benchmark results",
.name = "SendBenchmarkResults",
.save_to = NULL,
.get_data = get_benchmark_results},
{
- .fancy_name = "Receive Benchmark Results",
+ .fancy_name = "Receive benchmark results",
.name = "RecvBenchmarkResults",
.save_to = "benchmark.conf",
.get_data = NULL}
diff --git a/configure b/configure
index f9373062..b5903adf 100755
--- a/configure
+++ b/configure
@@ -135,7 +135,7 @@ fi
# ---------------------------------------------------------------------------
SOUP=-1
-MIN_VERSION="2.24"
+MIN_VERSION="2.4"
echo -n "Checking for libsoup version >= ${MIN_VERSION}... "
for i in `which pkg-config`; do
$i --errors-to-stdout libsoup-2.4 \
diff --git a/devices.c b/devices.c
index 49f84413..35c3ea27 100644
--- a/devices.c
+++ b/devices.c
@@ -424,16 +424,14 @@ guchar hi_module_get_weight(void)
void hi_module_init(void)
{
if (!g_file_test("/usr/share/misc/pci.ids", G_FILE_TEST_EXISTS)) {
- static SyncEntry se[] = {
- {
+ static SyncEntry se = {
.fancy_name = "Update PCI ID listing",
.name = "GetPCIIds",
.save_to = "pci.ids",
.get_data = NULL
- }
};
- sync_manager_add_entry(&se[0]);
+ sync_manager_add_entry(&se);
}
moreinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
diff --git a/fftbench.h b/fftbench.h
index 055226e0..3598baf1 100644
--- a/fftbench.h
+++ b/fftbench.h
@@ -5,4 +5,6 @@ void fft_bench_init(void);
void fft_bench_start(void);
void fft_bench_finish(void);
-#endif /* __FFTBENCH_H__ */ \ No newline at end of file
+#endif /* __FFTBENCH_H__ */
+
+
diff --git a/hardinfo.c b/hardinfo.c
index 34caca04..651a39e0 100644
--- a/hardinfo.c
+++ b/hardinfo.c
@@ -23,6 +23,7 @@
#include <hardinfo.h>
#include <iconcache.h>
#include <stock.h>
+#include <vendor.h>
#include <binreloc.h>
@@ -45,7 +46,7 @@ int main(int argc, char **argv)
if (params.show_version) {
g_print("HardInfo version " VERSION "\n");
g_print
- ("Copyright (C) 2003-2008 Leandro A. F. Pereira. See COPYING for details.\n\n");
+ ("Copyright (C) 2003-2009 Leandro A. F. Pereira. See COPYING for details.\n\n");
g_print("Compile-time options:\n"
" Release version: %s (%s)\n"
@@ -110,6 +111,9 @@ int main(int argc, char **argv)
modules = modules_load_all();
}
+ /* initialize vendor database */
+ vendor_init();
+
if (params.gui_running) {
/* initialize gui and start gtk+ main loop */
icon_cache_init();
diff --git a/network.c b/network.c
index 52029598..d3397412 100644
--- a/network.c
+++ b/network.c
@@ -178,8 +178,8 @@ void scan_route(gboolean reload)
if ((route = popen(command_line, "r"))) {
/* eat first two lines */
- fgets(buffer, 256, route);
- fgets(buffer, 256, route);
+ (void)fgets(buffer, 256, route);
+ (void)fgets(buffer, 256, route);
while (fgets(buffer, 256, route)) {
buffer[15] = '\0';
@@ -218,7 +218,7 @@ void scan_arp(gboolean reload)
if ((arp = fopen("/proc/net/arp", "r"))) {
/* eat first line */
- fgets(buffer, 256, arp);
+ (void)fgets(buffer, 256, arp);
while (fgets(buffer, 256, arp)) {
buffer[15] = '\0';
@@ -325,7 +325,7 @@ gchar *callback_network()
"[$ShellParam$]\n"
"ReloadInterval=3000\n"
"ViewType=1\n"
- "ColumnTitle$TextValue=Device\n"
+ "ColumnTitle$TextValue=Interface\n"
"ColumnTitle$Value=IP Address\n"
"ColumnTitle$Extra1=Sent\n"
"ColumnTitle$Extra2=Received\n"
diff --git a/report.c b/report.c
index c0cc8563..39e96faf 100644
--- a/report.c
+++ b/report.c
@@ -737,7 +737,7 @@ static ReportDialog
GtkWidget *dialog1_vbox;
GtkWidget *scrolledwindow2;
GtkWidget *treeview2;
- GtkWidget *hbuttonbox3;
+ GtkWidget *vbuttonbox3;
GtkWidget *button3;
GtkWidget *button6;
GtkWidget *dialog1_action_area;
@@ -781,10 +781,14 @@ static ReportDialog
FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0);
gtk_widget_show_all(hbox);
+
+ hbox = gtk_hbox_new(FALSE, 5);
+ gtk_box_pack_start(GTK_BOX(dialog1_vbox), hbox, TRUE, TRUE, 0);
+ gtk_widget_show(hbox);
scrolledwindow2 = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(scrolledwindow2);
- gtk_box_pack_start(GTK_BOX(dialog1_vbox), scrolledwindow2, TRUE, TRUE,
+ gtk_box_pack_start(GTK_BOX(hbox), scrolledwindow2, TRUE, TRUE,
0);
gtk_widget_set_size_request(scrolledwindow2, -1, 200);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow2),
@@ -818,22 +822,23 @@ static ReportDialog
gtk_tree_view_column_add_attribute(column, cr_text, "markup",
TREE_COL_NAME);
- hbuttonbox3 = gtk_hbutton_box_new();
- gtk_widget_show(hbuttonbox3);
- gtk_box_pack_start(GTK_BOX(dialog1_vbox), hbuttonbox3, FALSE, TRUE, 0);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox3),
- GTK_BUTTONBOX_SPREAD);
+ vbuttonbox3 = gtk_vbutton_box_new();
+ gtk_widget_show(vbuttonbox3);
+ gtk_box_pack_start(GTK_BOX(hbox), vbuttonbox3, FALSE, TRUE, 0);
+ gtk_box_set_spacing(GTK_BOX(vbuttonbox3), 5);
+ gtk_button_box_set_layout(GTK_BUTTON_BOX(vbuttonbox3),
+ GTK_BUTTONBOX_START);
button3 = gtk_button_new_with_mnemonic("Select _None");
gtk_widget_show(button3);
- gtk_container_add(GTK_CONTAINER(hbuttonbox3), button3);
+ gtk_container_add(GTK_CONTAINER(vbuttonbox3), button3);
GTK_WIDGET_SET_FLAGS(button3, GTK_CAN_DEFAULT);
g_signal_connect(button3, "clicked",
G_CALLBACK(report_dialog_sel_none), rd);
button6 = gtk_button_new_with_mnemonic("Select _All");
gtk_widget_show(button6);
- gtk_container_add(GTK_CONTAINER(hbuttonbox3), button6);
+ gtk_container_add(GTK_CONTAINER(vbuttonbox3), button6);
GTK_WIDGET_SET_FLAGS(button6, GTK_CAN_DEFAULT);
g_signal_connect(button6, "clicked", G_CALLBACK(report_dialog_sel_all),
rd);
diff --git a/shell.c b/shell.c
index 376f1034..2fb36010 100644
--- a/shell.c
+++ b/shell.c
@@ -846,7 +846,7 @@ group_handle_special(GKeyFile * key_file, ShellModuleEntry * entry,
} else if (g_str_equal(key, "ShowColumnHeaders")) {
headers_visible = g_key_file_get_boolean(key_file, group, key, NULL);
} else if (g_str_has_prefix(key, "ColumnTitle")) {
- GtkTreeViewColumn *column;
+ GtkTreeViewColumn *column = NULL;
gchar *value, *title = strchr(key, '$') + 1;
value = g_key_file_get_value(key_file, group, key, NULL);
@@ -863,8 +863,10 @@ group_handle_special(GKeyFile * key_file, ShellModuleEntry * entry,
column = shell->info->col_progress;
}
- gtk_tree_view_column_set_title(column, value);
- gtk_tree_view_column_set_visible(column, TRUE);
+ if (column) {
+ gtk_tree_view_column_set_title(column, value);
+ gtk_tree_view_column_set_visible(column, TRUE);
+ }
g_free(value);
} else if (g_str_equal(key, "OrderType")) {
@@ -1253,7 +1255,6 @@ static void module_selected(gpointer data)
ShellModuleEntry *entry;
static ShellModuleEntry *current = NULL;
static gboolean updating = FALSE;
-
/* Gets the currently selected item on the left-side TreeView; if there is no
selection, silently return */
diff --git a/syncmanager.c b/syncmanager.c
index 12b0465e..37788a7b 100644
--- a/syncmanager.c
+++ b/syncmanager.c
@@ -1,6 +1,6 @@
/*
* HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
+ * Copyright (C) 2003-2009 Leandro A. F. Pereira <leandro@hardinfo.org>
*
* 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
@@ -107,7 +107,7 @@ void sync_manager_add_entry(SyncEntry * entry)
DEBUG("registering syncmanager entry ''%s''", entry->fancy_name);
entry->selected = TRUE;
- entries = g_slist_prepend(entries, entry);
+ entries = g_slist_append(entries, entry);
#else
DEBUG("libsoup support is disabled.");
#endif /* HAS_LIBSOUP */
diff --git a/util.c b/util.c
index 924b9b45..266ce4eb 100644
--- a/util.c
+++ b/util.c
@@ -1127,7 +1127,7 @@ gint
h_sysfs_read_int(gchar *endpoint, gchar *entry)
{
gchar *tmp, *buffer;
- gint return_value = 0.0f;
+ gint return_value = 0;
tmp = g_build_filename(endpoint, entry, NULL);
if (g_file_get_contents(tmp, &buffer, NULL, NULL))
diff --git a/vendor.c b/vendor.c
index f75e4e38..0897341a 100644
--- a/vendor.c
+++ b/vendor.c
@@ -1,6 +1,6 @@
/*
* HardInfo - Displays System Information
- * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org>
+ * Copyright (C) 2003-2009 Leandro A. F. Pereira <leandro@hardinfo.org>
*
* List of vendors based on GtkSysInfo (c) Pissens Sebastien.
*
@@ -20,13 +20,17 @@
#include <string.h>
#include <gtk/gtk.h>
+
#include "vendor.h"
+#include "syncmanager.h"
+#include "config.h"
+#include "hardinfo.h"
static const Vendor vendors[] = {
- {"ATI", "ATI Technologies, Inc.", "www.ati.com"},
- {"nVidia", "NVIDIA Corporation", "www.nvidia.com"},
+ {"ATI", "ATI Technologies", "www.ati.com"},
+ {"nVidia", "NVIDIA", "www.nvidia.com"},
{"3Com", "3Com", "www.3com.com"},
- {"Intel", "Intel Corp.", "www.intel.com"},
+ {"Intel", "Intel", "www.intel.com"},
{"Cirrus Logic", "Cirrus Logic", "www.cirrus.com"},
{"VIA Technologies", "VIA Technologies", "www.via.com.tw"},
{"VIA", "VIA Technologies", "www.via.com.tw"},
@@ -48,20 +52,21 @@ static const Vendor vendors[] = {
{"Brooktree", "Conexant", "www.brooktree.com"},
{"Atheros", "Atheros Communications", "www.atheros.com"},
{"MATSHITA", "Panasonic", "www.panasonic.com"},
- {"Silicon Image", "Silicon Image, Inc.", "www.siliconimage.com"},
- {"Silicon Integrated Image", "Silicon Image, Inc.", "www.siliconimage.com"},
- {"KYE", "KYE Systems Corp.", "www.genius-kye.com"},
- {"Broadcom", "Broadcom Corp.", "www.broadcom.com"},
- {"Apple", "Apple Computer, Inc.", "www.apple.com"},
- {"IBM", "IBM Corp.", "www.ibm.com"},
- {"Dell", "Dell Computer Corp.", "www.dell.com"},
- {"Logitech", "Logitech International SA", "www.logitech.com"},
+ {"Silicon Image", "Silicon Image", "www.siliconimage.com"},
+ {"Silicon Integrated Image", "Silicon Image", "www.siliconimage.com"},
+ {"KYE", "KYE Systems", "www.genius-kye.com"},
+ {"Broadcom", "Broadcom", "www.broadcom.com"},
+ {"Apple", "Apple", "www.apple.com"},
+ {"IBM", "IBM", "www.ibm.com"},
+ {"Dell", "Dell Computer", "www.dell.com"},
+ {"Logitech", "Logitech International", "www.logitech.com"},
{"FUJITSU", "Fujitsu", "www.fujitsu.com"},
{"CDU", "Sony", "www.sony.com"},
{"SanDisk", "SanDisk", "www.sandisk.com"},
{"ExcelStor", "ExcelStor Technology", "www.excelstor.com"},
{"D-Link", "D-Link", "www.dlink.com.tw"},
- {"Giga-byte", "Gigabyte", "www.gigabyte.com.tw"},
+ {"Giga-byte", "Gigabyte Technology", "www.gigabyte.com.tw"},
+ {"Gigabyte", "Gigabyte Technology", "www.gigabyte.com.tw"},
{"C-Media", "C-Media Electronics", "www.cmedia.com.tw"},
{"Avermedia", "AVerMedia Technologies", "www.aver.com"},
{"Philips", "Philips", "www.philips.com"},
@@ -69,22 +74,99 @@ static const Vendor vendors[] = {
{"Siemens", "Siemens AG", "www.siemens.com"},
{"HP", "Hewlett-Packard", "www.hp.com"},
{"Hewlett-Packard", "Hewlett-Packard", "www.hp.com"},
- {"TEAC", "TEAC America Inc.", "www.teac.com"},
- {"Microsoft", "Microsoft Corp.", "www.microsoft.com"},
- {"Memorex", "Memorex Products, Inc.", "www.memorex.com"},
- {"eMPIA", "eMPIA Technology, Inc.", "www.empiatech.com.tw"},
- {"Canon", "Canon Inc.", "www.canon.com"},
- {"A4Tech", "A4tech Co., Ltd.", "www.a4tech.com"},
- {NULL, NULL, NULL},
+ {"TEAC", "TEAC America", "www.teac.com"},
+ {"Microsoft", "Microsoft", "www.microsoft.com"},
+ {"Memorex", "Memorex Products", "www.memorex.com"},
+ {"eMPIA", "eMPIA Technology", "www.empiatech.com.tw"},
+ {"Canon", "Canon", "www.canon.com"},
+ {"A4Tech", "A4tech", "www.a4tech.com"},
+ {"ALCOR", "Alcor", "www.alcor.org"},
+ {"Vimicro", "Vimicro", "www.vimicro.com"},
+ {"OTi", "Ours Technology", "www.oti.com.tw"},
+ {"BENQ", "BenQ", "www.benq.com"},
+ {"Acer", "Acer", "www.acer.com"},
+ /* BIOS manufacturers */
+ {"American Megatrends", "American Megatrends", "www.ami.com"},
+ {"Award", "Award Software International", "www.award-bios.com"},
+ {"Phoenix", "Phoenix Technologies", "www.phoenix.com"},
};
+static GSList *vendor_list = NULL;
+
+void vendor_init(void)
+{
+ gint i;
+ gchar *path;
+ static SyncEntry se = {
+ .fancy_name = "Update vendor list",
+ .name = "RecvVendorList",
+ .save_to = "vendor.conf",
+ .get_data = NULL
+ };
+
+ DEBUG("initializing vendor list");
+ sync_manager_add_entry(&se);
+
+ path = g_build_filename(g_get_home_dir(), ".hardinfo", "vendor.conf", NULL);
+ if (!g_file_test(path, G_FILE_TEST_EXISTS)) {
+ DEBUG("local vendor.conf not found, trying system-wise");
+ g_free(path);
+ path = g_build_filename(params.path_data, "vendor.conf", NULL);
+ }
+
+ if (g_file_test(path, G_FILE_TEST_EXISTS)) {
+ GKeyFile *vendors;
+ gchar *tmp;
+ gint num_vendors;
+
+ DEBUG("loading %s", path);
+
+ vendors = g_key_file_new();
+ if (g_key_file_load_from_file(vendors, path, 0, NULL)) {
+ num_vendors = g_key_file_get_integer(vendors, "vendors", "number", NULL);
+
+ for (i = num_vendors - 1; i >= 0; i--) {
+ Vendor *v = g_new0(Vendor, 1);
+
+ tmp = g_strdup_printf("vendor%d", i);
+
+ v->id = g_key_file_get_string(vendors, tmp, "id", NULL);
+ v->name = g_key_file_get_string(vendors, tmp, "name", NULL);
+ v->url = g_key_file_get_string(vendors, tmp, "url", NULL);
+
+ vendor_list = g_slist_prepend(vendor_list, v);
+
+ g_free(tmp);
+ }
+ }
+
+ g_key_file_free(vendors);
+ } else {
+ DEBUG("system-wise vendor.conf not found, using internal database");
+
+ for (i = G_N_ELEMENTS(vendors) - 1; i >= 0; i--) {
+ vendor_list = g_slist_prepend(vendor_list, (gpointer) &vendors[i]);
+ }
+ }
+
+ g_free(path);
+}
+
const gchar *vendor_get_name(const gchar * id)
{
+ GSList *vendor;
int i;
-
- for (i = 0; vendors[i].id; i++) {
- if (strstr(id, vendors[i].id))
- return vendors[i].name;
+
+ if (!id) {
+ return NULL;
+ }
+
+ for (vendor = vendor_list; vendor; vendor = vendor->next) {
+ Vendor *v = (Vendor *)vendor->data;
+
+ if (v && v->id && strstr(id, v->id)) {
+ return g_strdup(v->name);
+ }
}
return id;
@@ -92,11 +174,19 @@ const gchar *vendor_get_name(const gchar * id)
const gchar *vendor_get_url(const gchar * id)
{
+ GSList *vendor;
int i;
- for (i = 0; vendors[i].id; i++) {
- if (strstr(id, vendors[i].id))
- return vendors[i].url;
+ if (!id) {
+ return NULL;
+ }
+
+ for (vendor = vendor_list; vendor; vendor = vendor->next) {
+ Vendor *v = (Vendor *)vendor->data;
+
+ if (v && v->id && strstr(id, v->id)) {
+ return g_strdup(v->url);
+ }
}
return NULL;
diff --git a/vendor.h b/vendor.h
index b40dafb1..778e2ea3 100644
--- a/vendor.h
+++ b/vendor.h
@@ -26,8 +26,8 @@ struct _Vendor {
char *url;
};
+void vendor_init(void);
const gchar *vendor_get_name(const gchar *id);
const gchar *vendor_get_url(const gchar *id);
-
#endif /* __VENDOR_H__ */