diff options
| -rw-r--r-- | hardinfo/dmi_util.c | 4 | ||||
| -rw-r--r-- | hardinfo/pci_util.c | 10 | ||||
| -rw-r--r-- | hardinfo/usb_util.c | 4 | ||||
| -rw-r--r-- | hardinfo/util.c | 11 | ||||
| -rw-r--r-- | hardinfo/x_util.c | 6 | ||||
| -rw-r--r-- | includes/hardinfo.h | 8 | ||||
| -rw-r--r-- | modules/computer.c | 4 | ||||
| -rw-r--r-- | modules/computer/boots.c | 2 | ||||
| -rw-r--r-- | modules/computer/languages.c | 2 | ||||
| -rw-r--r-- | modules/computer/os.c | 16 | ||||
| -rw-r--r-- | modules/computer/ubuntu_flavors.c | 2 | ||||
| -rw-r--r-- | modules/network.c | 1 | ||||
| -rw-r--r-- | modules/network/samba.c | 7 | 
13 files changed, 44 insertions, 33 deletions
| diff --git a/hardinfo/dmi_util.c b/hardinfo/dmi_util.c index 5f9f6f9a..91be8508 100644 --- a/hardinfo/dmi_util.c +++ b/hardinfo/dmi_util.c @@ -202,7 +202,7 @@ char *dmi_get_str_abs(const char *id_str) {      /* try dmidecode, but may require root */      snprintf(full_path, PATH_MAX, "dmidecode -s %s", id_str); -    spawned = g_spawn_command_line_sync(full_path, +    spawned = hardinfo_spawn_command_line_sync(full_path,              &out, &err, &i, NULL);      if (spawned) {          if (i == 0) @@ -303,7 +303,7 @@ char *dmidecode_read(const dmi_type *type) {          snprintf(full_path, PATH_MAX, "dmidecode");      } -    spawned = g_spawn_command_line_sync(full_path, +    spawned = hardinfo_spawn_command_line_sync(full_path,              &out, &err, &i, NULL);      if (spawned) {          if (i == 0) diff --git a/hardinfo/pci_util.c b/hardinfo/pci_util.c index ec80662b..2aa2ece3 100644 --- a/hardinfo/pci_util.c +++ b/hardinfo/pci_util.c @@ -99,9 +99,7 @@ static gboolean pci_fill_details(pcid *s) {      gchar *pci_loc = pci_address_str(s->domain, s->bus, s->device, s->function);      gchar *lspci_cmd = g_strdup_printf("lspci -D -s %s -vvv", pci_loc); -    shell_status_pulse(); - -    spawned = g_spawn_command_line_sync(lspci_cmd, +    spawned = hardinfo_spawn_command_line_sync(lspci_cmd,              &out, &err, NULL, NULL);      g_free(lspci_cmd);      g_free(pci_loc); @@ -213,9 +211,7 @@ static gboolean pci_get_device_lspci(uint32_t dom, uint32_t bus, uint32_t dev, u      s->device = dev;      s->function = func; -    shell_status_pulse(); - -    spawned = g_spawn_command_line_sync(lspci_cmd, +    spawned = hardinfo_spawn_command_line_sync(lspci_cmd,              &out, &err, NULL, NULL);      g_free(lspci_cmd);      if (spawned) { @@ -274,7 +270,7 @@ static pcid *pci_get_device_list_lspci(uint32_t class_min, uint32_t class_max) {      if (class_max == 0) class_max = 0xffff; -    spawned = g_spawn_command_line_sync("lspci -D -mn", +    spawned = hardinfo_spawn_command_line_sync("lspci -D -mn",              &out, &err, NULL, NULL);      if (spawned) {          p = out; diff --git a/hardinfo/usb_util.c b/hardinfo/usb_util.c index a758026f..f883657c 100644 --- a/hardinfo/usb_util.c +++ b/hardinfo/usb_util.c @@ -173,7 +173,7 @@ static gboolean usb_get_device_lsusb(int bus, int dev, usbd *s) {      s->bus = bus;      s->dev = dev; -    spawned = g_spawn_command_line_sync(lsusb_cmd, +    spawned = hardinfo_spawn_command_line_sync(lsusb_cmd,              &out, &err, NULL, NULL);      g_free(lsusb_cmd);      if (spawned) { @@ -447,7 +447,7 @@ static usbd *usb_get_device_list_lsusb() {      usbd *head = NULL, *nd;      int bus, dev, vend, prod, ec; -    spawned = g_spawn_command_line_sync("lsusb", +    spawned = hardinfo_spawn_command_line_sync("lsusb",              &out, &err, NULL, NULL);      if (spawned) {          p = out; diff --git a/hardinfo/util.c b/hardinfo/util.c index 1b92457c..e690ff20 100644 --- a/hardinfo/util.c +++ b/hardinfo/util.c @@ -1386,3 +1386,14 @@ gchar *hardinfo_clean_value(const gchar *v, int replacing) {          g_free((gpointer)v);      return clean;  } + +gboolean hardinfo_spawn_command_line_sync(const gchar *command_line, +                                          gchar **standard_output, +                                          gchar **standard_error, +                                          gint *exit_status, +                                          GError **error) +{ +    shell_status_pulse(); +    return g_spawn_command_line_sync(command_line, standard_output, +                                     standard_error, exit_status, error); +} diff --git a/hardinfo/x_util.c b/hardinfo/x_util.c index c052f00a..52888a8c 100644 --- a/hardinfo/x_util.c +++ b/hardinfo/x_util.c @@ -60,7 +60,7 @@ gboolean fill_glx_info(glx_info *glx) {  #define GLX_MATCH_LINE(prefix_str, struct_member) \      if (l = simple_line_value(p, prefix_str)) { glx->struct_member = g_strdup(l); goto glx_next_line; } -    spawned = g_spawn_command_line_sync(glx_cmd, +    spawned = hardinfo_spawn_command_line_sync(glx_cmd,              &out, &err, NULL, NULL);      g_free(glx_cmd);      if (spawned) { @@ -124,7 +124,7 @@ gboolean fill_xinfo(xinfo *xi) {  #define XI_MATCH_LINE(prefix_str, struct_member) \      if (l = simple_line_value(p, prefix_str)) { xi->struct_member = g_strdup(l); goto xi_next_line; } -    spawned = g_spawn_command_line_sync(xi_cmd, +    spawned = hardinfo_spawn_command_line_sync(xi_cmd,              &out, &err, NULL, NULL);      g_free(xi_cmd);      if (spawned) { @@ -166,7 +166,7 @@ gboolean fill_xrr_info(xrr_info *xrr) {      memset(status, 0, 128);      memset(alist, 0, 128); -    spawned = g_spawn_command_line_sync(xrr_cmd, +    spawned = hardinfo_spawn_command_line_sync(xrr_cmd,              &out, &err, NULL, NULL);      g_free(xrr_cmd);      if (spawned) { diff --git a/includes/hardinfo.h b/includes/hardinfo.h index c8ee1ca0..ab9ecb55 100644 --- a/includes/hardinfo.h +++ b/includes/hardinfo.h @@ -193,4 +193,12 @@ gchar *hardinfo_clean_label(const gchar *v, int replacing);  /* hardinfo uses the values as {ht,x}ml, apparently */  gchar *hardinfo_clean_value(const gchar *v, int replacing); +/* Same as hardinfo_spawn_command_line_sync(), but calls shell_status_pulse() + * before. */ +gboolean hardinfo_spawn_command_line_sync(const gchar *command_line, +                                          gchar **standard_output, +                                          gchar **standard_error, +                                          gint *exit_status, +                                          GError **error); +  #endif				/* __HARDINFO_H__ */ diff --git a/modules/computer.c b/modules/computer.c index 99257e9f..0123ef26 100644 --- a/modules/computer.c +++ b/modules/computer.c @@ -301,9 +301,9 @@ void scan_dev(gboolean reload)         }         if (detect_lang[i].stdout) { -            found = g_spawn_command_line_sync(detect_lang[i].version_command, &output, &ignored, NULL, NULL); +            found = hardinfo_spawn_command_line_sync(detect_lang[i].version_command, &output, &ignored, NULL, NULL);         } else { -            found = g_spawn_command_line_sync(detect_lang[i].version_command, &ignored, &output, NULL, NULL); +            found = hardinfo_spawn_command_line_sync(detect_lang[i].version_command, &ignored, &output, NULL, NULL);         }         g_free(ignored); diff --git a/modules/computer/boots.c b/modules/computer/boots.c index ba458242..63122994 100644 --- a/modules/computer/boots.c +++ b/modules/computer/boots.c @@ -35,7 +35,7 @@ scan_boots_real(void)      else        return; -    spawned = g_spawn_command_line_sync("last", +    spawned = hardinfo_spawn_command_line_sync("last",              &out, &err, NULL, NULL);      if (spawned && out != NULL) {          p = out; diff --git a/modules/computer/languages.c b/modules/computer/languages.c index 954f5b20..105b9e58 100644 --- a/modules/computer/languages.c +++ b/modules/computer/languages.c @@ -124,7 +124,7 @@ scan_languages(OperatingSystem * os)      locale_info *curr = NULL;      int last = 0; -    spawned = g_spawn_command_line_sync("locale -va", +    spawned = hardinfo_spawn_command_line_sync("locale -va",              &out, &err, NULL, NULL);      if (spawned) {          ret = g_strdup(""); diff --git a/modules/computer/os.c b/modules/computer/os.c index ab557fa6..32e4e8cd 100644 --- a/modules/computer/os.c +++ b/modules/computer/os.c @@ -47,7 +47,7 @@ get_libc_version(void)          gboolean spawned;          gchar *out, *err, *p; -        spawned = g_spawn_command_line_sync(libs[i].test_cmd, +        spawned = hardinfo_spawn_command_line_sync(libs[i].test_cmd,              &out, &err, NULL, NULL);          if (!spawned)              continue; @@ -92,7 +92,7 @@ static gchar *detect_kde_version(void)          cmd = "kcontrol --version";      } -    spawned = g_spawn_command_line_sync(cmd, &out, NULL, NULL, NULL); +    spawned = hardinfo_spawn_command_line_sync(cmd, &out, NULL, NULL, NULL);      if (!spawned)          return NULL; @@ -107,7 +107,7 @@ detect_gnome_version(void)      gchar *out;      gboolean spawned; -    spawned = g_spawn_command_line_sync( +    spawned = hardinfo_spawn_command_line_sync(          "gnome-shell --version", &out, NULL, NULL, NULL);      if (spawned) {          tmp = strstr(idle_free(out), _("GNOME Shell ")); @@ -118,7 +118,7 @@ detect_gnome_version(void)          }      } -    spawned = g_spawn_command_line_sync( +    spawned = hardinfo_spawn_command_line_sync(          "gnome-about --gnome-version", &out, NULL, NULL, NULL);      if (spawned) {          tmp = strstr(idle_free(out), _("Version: ")); @@ -140,7 +140,7 @@ detect_mate_version(void)      gchar *out;      gboolean spawned; -    spawned = g_spawn_command_line_sync( +    spawned = hardinfo_spawn_command_line_sync(          "mate-about --version", &out, NULL, NULL, NULL);      if (spawned) {          tmp = strstr(idle_free(out), _("MATE Desktop Environment ")); @@ -268,7 +268,7 @@ computer_get_dmesg_status(void)  {      gchar *out = NULL, *err = NULL;      int ex = 1, result = 0; -    g_spawn_command_line_sync("dmesg", &out, &err, &ex, NULL); +    hardinfo_spawn_command_line_sync("dmesg", &out, &err, &ex, NULL);      g_free(out);      g_free(err);      result += (getuid() == 0) ? 2 : 0; @@ -388,7 +388,7 @@ parse_lsb_release(void)      gchar *id = NULL;      gchar **split, *contents, **line; -    if (!g_spawn_command_line_sync("/usr/bin/lsb_release -di", &contents, NULL, NULL, NULL)) +    if (!hardinfo_spawn_command_line_sync("/usr/bin/lsb_release -di", &contents, NULL, NULL, NULL))          return (Distro) {};      split = g_strsplit(idle_free(contents), "\n", 0); @@ -548,7 +548,7 @@ const gchar *  computer_get_selinux(void)  {      int r; -    gboolean spawned = g_spawn_command_line_sync("selinuxenabled", +    gboolean spawned = hardinfo_spawn_command_line_sync("selinuxenabled",                                                   NULL, NULL, &r, NULL);      if (!spawned) diff --git a/modules/computer/ubuntu_flavors.c b/modules/computer/ubuntu_flavors.c index 20e83c82..f50afb0e 100644 --- a/modules/computer/ubuntu_flavors.c +++ b/modules/computer/ubuntu_flavors.c @@ -62,7 +62,7 @@ GSList *ubuntu_flavors_scan(void) {      if (!i)          return NULL; -    spawned = g_spawn_command_line_sync(cmd_line, +    spawned = hardinfo_spawn_command_line_sync(cmd_line,              &out, &err, &exit_status, NULL);      if (spawned) {          p = out; diff --git a/modules/network.c b/modules/network.c index e08f08b6..a40db80e 100644 --- a/modules/network.c +++ b/modules/network.c @@ -161,7 +161,6 @@ void scan_dns(gboolean reload)                __nameservers = h_strdup_cprintf("%s=%s\n",                                                 __nameservers,                                                 ip, hbuf); -            }            shell_status_pulse(); diff --git a/modules/network/samba.c b/modules/network/samba.c index 7e8dc46c..5df28010 100644 --- a/modules/network/samba.c +++ b/modules/network/samba.c @@ -57,7 +57,7 @@ scan_samba_usershares(void)      gchar *usershare, *cmdline;      gsize length; -    spawned = g_spawn_command_line_sync("net usershare list", +    spawned = hardinfo_spawn_command_line_sync("net usershare list",              &out, &err, &status, NULL);      if (spawned && status == 0 && out != NULL) { @@ -66,7 +66,7 @@ scan_samba_usershares(void)          while(next_nl = strchr(p, '\n')) {              cmdline = g_strdup_printf("net usershare info '%s'",                                        strend(p, '\n')); -            if (g_spawn_command_line_sync(cmdline, +            if (hardinfo_spawn_command_line_sync(cmdline,                          &usershare, NULL, NULL, NULL)) {                  length = strlen(usershare);                  scan_samba_from_string(usershare, length); @@ -74,7 +74,6 @@ scan_samba_usershares(void)              }              g_free(cmdline); -            shell_status_pulse();              p = next_nl + 1;          }          g_free(out); @@ -105,8 +104,6 @@ scan_samba_from_string(gchar *str, gsize length)      groups = g_key_file_get_groups(keyfile, NULL);      while (groups[i]) { -        shell_status_pulse(); -          if (g_key_file_has_key(keyfile, groups[i], "path", NULL)) {              gchar *path = g_key_file_get_string(keyfile, groups[i], "path", NULL);              smb_shares_list = h_strdup_cprintf("%s=%s\n", | 
