diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/benchmark/guibench.c | 2 | ||||
-rw-r--r-- | modules/computer/os.c | 30 | ||||
-rw-r--r-- | modules/devices.c | 3 | ||||
-rw-r--r-- | modules/devices/printers.c | 14 | ||||
-rw-r--r-- | modules/devices/x86/x86_data.c | 3 |
5 files changed, 33 insertions, 19 deletions
diff --git a/modules/benchmark/guibench.c b/modules/benchmark/guibench.c index 0faf6b69..2b4f3b11 100644 --- a/modules/benchmark/guibench.c +++ b/modules/benchmark/guibench.c @@ -333,7 +333,7 @@ double guibench(void) gtk_widget_set_size_request(window, 800, 600); gtk_window_set_title(GTK_WINDOW(window), "guibench"); - gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ALWAYS); + gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ON_PARENT); gtk_widget_show(window); g_signal_connect(window, "key-press-event", G_CALLBACK(keypress_event), NULL); diff --git a/modules/computer/os.c b/modules/computer/os.c index 7648eef3..508f0fa0 100644 --- a/modules/computer/os.c +++ b/modules/computer/os.c @@ -369,8 +369,10 @@ parse_os_release(void) for (line = split; *line; line++) { if (!strncmp(*line, "ID=", sizeof("ID=") - 1)) { id = g_strdup(*line + strlen("ID=")); - } else if (!strncmp(*line, "CODENAME=", sizeof("CODENAME=") - 1)) { + } else if (!strncmp(*line, "CODENAME=", sizeof("CODENAME=") - 1) && codename == NULL) { codename = g_strdup(*line + strlen("CODENAME=")); + } else if (!strncmp(*line, "VERSION_CODENAME=", sizeof("VERSION_CODENAME=") - 1) && codename == NULL) { + codename = g_strdup(*line + strlen("VERSION_CODENAME=")); } else if (!strncmp(*line, "PRETTY_NAME=", sizeof("PRETTY_NAME=") - 1)) { pretty_name = g_strdup(*line + strlen("PRETTY_NAME=\"")); @@ -387,7 +389,7 @@ parse_os_release(void) return (Distro) {}; } -static Distro +/*static Distro parse_lsb_release(void) { gchar *pretty_name = NULL; @@ -395,7 +397,7 @@ parse_lsb_release(void) gchar *codename = NULL; gchar **split, *contents, **line; - if (!hardinfo_spawn_command_line_sync("/usr/bin/lsb_release -di", &contents, NULL, NULL, NULL)) + if (!hardinfo_spawn_command_line_sync("/usr/bin/lsb_release -dic", &contents, NULL, NULL, NULL)) return (Distro) {}; split = g_strsplit(idle_free(contents), "\n", 0); @@ -419,14 +421,14 @@ parse_lsb_release(void) g_free(id); return (Distro) {}; -} + }*/ static Distro detect_distro(void) { static const struct { const gchar *file; - const gchar *codename; + const gchar *id; const gchar *override; } distro_db[] = { #define DB_PREFIX "/etc/" @@ -471,9 +473,9 @@ detect_distro(void) if (distro.distro) return distro; - distro = parse_lsb_release(); + /*distro = parse_lsb_release(); if (distro.distro) - return distro; + return distro;*/ for (i = 0; distro_db[i].file; i++) { if (!g_file_get_contents(distro_db[i].file, &contents, NULL, NULL)) @@ -482,27 +484,27 @@ detect_distro(void) if (distro_db[i].override) { g_free(contents); return (Distro) { .distro = g_strdup(distro_db[i].override), - .codename = g_strdup(distro_db[i].codename) }; + .id = g_strdup(distro_db[i].id) }; } - if (g_str_equal(distro_db[i].codename, "debian")) { + if (g_str_equal(distro_db[i].id, "debian")) { /* HACK: Some Debian systems doesn't include the distribuition * name in /etc/debian_release, so add them here. */ if (isdigit(contents[0]) || contents[0] != 'D') return (Distro) { .distro = g_strdup_printf("Debian GNU/Linux %s", (char*)idle_free(contents)), - .codename = g_strdup(distro_db[i].codename) + .id = g_strdup(distro_db[i].id) }; } - if (g_str_equal(distro_db[i].codename, "fatdog")) { + if (g_str_equal(distro_db[i].id, "fatdog")) { return (Distro) { .distro = g_strdup_printf("Fatdog64 [%.10s]", (char*)idle_free(contents)), - .codename = g_strdup(distro_db[i].codename) + .id = g_strdup(distro_db[i].id) }; } - return (Distro) { .distro = contents, .codename = g_strdup(distro_db[i].codename) }; + return (Distro) { .distro = contents, .id = g_strdup(distro_db[i].id) }; } return (Distro) { .distro = g_strdup(_("Unknown")) }; @@ -542,7 +544,7 @@ computer_get_os(void) os->entropy_avail = computer_get_entropy_avail(); - if (g_strcmp0(os->distrocode, "ubuntu") == 0) { + if (g_strcmp0(os->distroid, "ubuntu") == 0) { GSList *flavs = ubuntu_flavors_scan(); if (flavs) { /* just use the first one */ diff --git a/modules/devices.c b/modules/devices.c index 574896ee..614c43f5 100644 --- a/modules/devices.c +++ b/modules/devices.c @@ -37,6 +37,7 @@ #include "udisks2_util.h" #include "storage_util.h" #include "pci_util.h" +#include <json-glib/json-glib.h> gchar *callback_processors(); gchar *callback_gpu(); @@ -857,11 +858,13 @@ void hi_module_init(void) .file_name = "sdcard.ids", }, #ifdef ARCH_x86 +#if JSON_CHECK_VERSION(0,20,0) { .name = N_("Update CPU flags database"), .file_name = "cpuflags.json", }, #endif +#endif }; guint i; diff --git a/modules/devices/printers.c b/modules/devices/printers.c index fb9389ac..d880e691 100644 --- a/modules/devices/printers.c +++ b/modules/devices/printers.c @@ -42,7 +42,8 @@ struct _CUPSDest { static int (*cups_dests_get) (CUPSDest **dests) = NULL; static int (*cups_dests_free) (int num_dests, CUPSDest *dests) = NULL; -static gboolean cups_init = FALSE; +static void (*cups_set_server)(const char *server) = NULL; +volatile static gboolean cups_init = FALSE; GModule *cups; @@ -66,9 +67,11 @@ init_cups(void) } if (!g_module_symbol(cups, "cupsGetDests", (gpointer) & cups_dests_get) - || !g_module_symbol(cups, "cupsFreeDests", (gpointer) & cups_dests_free)) { - if(cups) g_module_close(cups); + || !g_module_symbol(cups, "cupsFreeDests", (gpointer) & cups_dests_free) + || !g_module_symbol(cups, "cupsSetServer", (gpointer) & cups_set_server)) { + g_module_close(cups); cups_init = FALSE; + return; } } @@ -190,11 +193,16 @@ scan_printers_do(void) if (!cups_init) { init_cups(); + } + if(!cups_init) { printer_icons = g_strdup(""); printer_list = g_strdup(_("[Printers]\n" "No suitable CUPS library found=")); return; + }else{ + //only list from our own cups, use ip for faster/secure answer + cups_set_server("127.0.0.1"); } /* remove old devices from global device table */ diff --git a/modules/devices/x86/x86_data.c b/modules/devices/x86/x86_data.c index f56e8668..a2f8d7ca 100644 --- a/modules/devices/x86/x86_data.c +++ b/modules/devices/x86/x86_data.c @@ -330,7 +330,7 @@ void cpuflags_x86_init(void) gchar *flag_json = g_build_filename(g_get_user_config_dir(), "hardinfo2", "cpuflags.json", NULL); gboolean use_builtin_table = TRUE; - +#if JSON_CHECK_VERSION(0,20,0) if (!g_file_test(flag_json, G_FILE_TEST_EXISTS)) goto use_builtin_table; @@ -357,6 +357,7 @@ void cpuflags_x86_init(void) use_builtin_table_with_json: g_object_unref(parser); use_builtin_table: +#endif g_free(flag_json); if (use_builtin_table) |