[gnome-control-center] network: never show the loop device if IP4 data isn't available



commit 199774f0872064d425207b9a9a7f1dbe5641e9f8
Author: Richard Hughes <richard hughsie com>
Date:   Fri Mar 11 10:27:23 2011 +0000

    network: never show the loop device if IP4 data isn't available

 panels/network/cc-network-panel.c |   28 ++++++++++++++++++++++++++++
 panels/network/network.ui         |    4 ++--
 2 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 1451976..9158ae0 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -517,6 +517,8 @@ panel_set_widget_data (CcNetworkPanel *panel,
         /* hide the parent bix if there is no value */
         hbox_id = g_strdup_printf ("hbox_%s_%s", sub_pane, widget_suffix);
         widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, hbox_id));
+        if (widget == NULL)
+                goto out;
         if (value == NULL) {
                 gtk_widget_hide (widget);
                 goto out;
@@ -969,6 +971,32 @@ nm_device_refresh_item_ui (CcNetworkPanel *panel, NMDevice *device)
                                                nm_dhcp4_config_get_one_option (config_dhcp4,
                                                                                "subnet_mask"));
                 }
+        } else {
+                /* IPv4 address */
+                panel_set_widget_data (panel,
+                                       sub_pane,
+                                       "ip4",
+                                       NULL);
+
+                /* IPv4 DNS */
+                panel_set_widget_data (panel,
+                                       sub_pane,
+                                       "dns",
+                                       NULL);
+
+                /* IPv4 route */
+                panel_set_widget_data (panel,
+                                       sub_pane,
+                                       "route",
+                                       NULL);
+
+                /* IPv4 netmask */
+                if (type == NM_DEVICE_TYPE_ETHERNET) {
+                        panel_set_widget_data (panel,
+                                               sub_pane,
+                                               "subnet",
+                                               NULL);
+                }
         }
 
         /* get IP6 parameters */
diff --git a/panels/network/network.ui b/panels/network/network.ui
index 7ce2f3a..a184cb7 100644
--- a/panels/network/network.ui
+++ b/panels/network/network.ui
@@ -1096,7 +1096,7 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkHBox" id="hbox_mobilebb_ip">
+                                  <object class="GtkHBox" id="hbox_mobilebb_ip4">
                                     <property name="visible">True</property>
                                     <property name="spacing">9</property>
                                     <child>
@@ -1122,7 +1122,7 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label_mobilebb_ip">
+                                      <object class="GtkLabel" id="label_mobilebb_ip4">
                                         <property name="visible">True</property>
                                         <property name="label">127.0.0.1</property>
                                         <property name="selectable">True</property>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]