[gnome-control-center: 5/14] network: Add network strength to the details panel



commit 6b526f121319b78e56423d41cbe1ae143077a8aa
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jul 26 14:29:38 2012 +0100

    network: Add network strength to the details panel

 panels/network/net-device-wifi.c |   22 ++++++++++++++++++++++
 panels/network/network-wifi.ui   |   34 +++++++++++++++++++++++++++++-----
 2 files changed, 51 insertions(+), 5 deletions(-)
---
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index a1eb4db..721b725 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -638,6 +638,7 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
         GString *string;
         GtkWidget *sw;
         GtkWidget *widget;
+        gint strength = 0;
         guint speed = 0;
         NMAccessPoint *active_ap;
         NMClientPermissionResult perm;
@@ -765,6 +766,27 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
                                          str_tmp);
         g_free (str_tmp);
 
+if(0){
+        /* signal strength */
+        if (active_ap != NULL)
+                strength = nm_access_point_get_strength (active_ap);
+        if (strength <= 0)
+                str = NULL;
+        else if (strength < 20)
+                str = C_("Signal strength", "None");
+        else if (strength < 40)
+                str = C_("Signal strength", "Weak");
+        else if (strength < 50)
+                str = C_("Signal strength", "Ok");
+        else if (strength < 80)
+                str = C_("Signal strength", "Good");
+        else
+                str = C_("Signal strength", "Excellent");
+        panel_set_device_widget_details (device_wifi->priv->builder,
+                                         "strength",
+                                         str);
+}
+
         /* setup wireless button */
         widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
                                                      "button_forget"));
diff --git a/panels/network/network-wifi.ui b/panels/network/network-wifi.ui
index ac9a1fa..e5145ac 100644
--- a/panels/network/network-wifi.ui
+++ b/panels/network/network-wifi.ui
@@ -529,13 +529,37 @@
                   </packing>
                 </child>
                 <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
+                  <object class="GtkLabel" id="heading_strength">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Strength</property>
+                    <property name="mnemonic_widget">label_security</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
                 </child>
                 <child>
-                  <placeholder/>
+                  <object class="GtkLabel" id="label_strength">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Security</property>
+                    <property name="mnemonic_widget">label_security</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">2</property>
+                    <property name="height">1</property>
+                  </packing>
                 </child>
                 <child>
                   <placeholder/>



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