[gnome-control-center] network: Don't show a blank name server label in the IP overview
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Don't show a blank name server label in the IP overview
- Date: Mon, 30 Jul 2012 09:05:31 +0000 (UTC)
commit c0d771c277bda0ba73ab308d4c3013601e04bd3a
Author: Richard Hughes <richard hughsie com>
Date: Mon Jul 30 10:03:04 2012 +0100
network: Don't show a blank name server label in the IP overview
panels/network/panel-common.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/panels/network/panel-common.c b/panels/network/panel-common.c
index 76a380e..09ba2a2 100644
--- a/panels/network/panel-common.c
+++ b/panels/network/panel-common.c
@@ -572,19 +572,21 @@ get_ipv4_config_name_servers_as_string (NMIP4Config *ip4_config)
struct in_addr addr;
gchar tmp[INET_ADDRSTRLEN];
int i;
-
- dns = g_string_new (NULL);
+ gchar *str = NULL;
array = nm_ip4_config_get_nameservers (ip4_config);
- if (array) {
- for (i = 0; i < array->len; i++) {
- addr.s_addr = g_array_index (array, guint32, i);
- if (inet_ntop (AF_INET, &addr, tmp, sizeof(tmp)))
- g_string_append_printf (dns, "%s ", tmp);
- }
- }
+ if (array == NULL || array->len == 0)
+ goto out;
- return g_string_free (dns, FALSE);
+ dns = g_string_new (NULL);
+ for (i = 0; i < array->len; i++) {
+ addr.s_addr = g_array_index (array, guint32, i);
+ if (inet_ntop (AF_INET, &addr, tmp, sizeof(tmp)))
+ g_string_append_printf (dns, "%s ", tmp);
+ }
+ str = g_string_free (dns, FALSE);
+out:
+ return str;
}
static gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]