[gnome-control-center] network: Mobile broadband bug fixes



commit 31f975996ecece93f8921f360e12f97dd29a4b40
Author: JiÅÃ KlimeÅ <jklimes redhat com>
Date:   Wed May 4 09:45:35 2011 +0200

    network: Mobile broadband bug fixes
    
    Fix On/off switch, options buttons and info display
    
    https://bugzilla.gnome.org/show_bug.cgi?id=657303

 panels/network/cc-network-panel.c |   45 ++++++++++++++++-
 panels/network/network.ui         |   97 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 139 insertions(+), 3 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index f88633a..a494f48 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -1126,6 +1126,9 @@ device_off_toggled (GtkSwitch      *sw,
                 case NM_DEVICE_TYPE_WIMAX:
                         nm_client_wimax_set_enabled (panel->priv->client, active);
                         break;
+                case NM_DEVICE_TYPE_MODEM:
+                        nm_client_wwan_set_enabled (panel->priv->client, active);
+                        break;
                 default: ;
                         /* FIXME: handle other device types */
                 }
@@ -1187,6 +1190,33 @@ wimax_enabled_toggled (NMClient       *client,
 }
 
 static void
+mobilebb_enabled_toggled (NMClient       *client,
+                          GParamSpec     *pspec,
+                          CcNetworkPanel *panel)
+{
+        gboolean enabled;
+        GtkSwitch *sw;
+        NMDevice *device;
+        NetObject *object;
+
+        object = get_selected_object (panel);
+        if (object == NULL)
+                return;
+        device = net_device_get_nm_device (NET_DEVICE (object));
+
+        if (nm_device_get_device_type (device) != NM_DEVICE_TYPE_MODEM)
+                return;
+
+        enabled = nm_client_wwan_get_enabled (client);
+        sw = GTK_SWITCH (gtk_builder_get_object (panel->priv->builder,
+                                                 "device_mobilebb_off_switch"));
+
+        panel->priv->updating_device = TRUE;
+        gtk_switch_set_active (sw, enabled);
+        panel->priv->updating_device = FALSE;
+}
+
+static void
 update_off_switch_from_device_state (GtkSwitch *sw, NMDeviceState state, CcNetworkPanel *panel)
 {
         panel->priv->updating_device = TRUE;
@@ -1385,6 +1415,10 @@ refresh_header_ui (CcNetworkPanel *panel, NMDevice *device, const char *page_nam
                 gtk_widget_show (widget);
                 wimax_enabled_toggled (panel->priv->client, NULL, panel);
                 break;
+        case NM_DEVICE_TYPE_MODEM:
+                gtk_widget_show (widget);
+                mobilebb_enabled_toggled (panel->priv->client, NULL, panel);
+                break;
         default:
                 gtk_widget_hide (widget);
                 break;
@@ -1601,7 +1635,7 @@ device_refresh_modem_ui (CcNetworkPanel *panel, NetDevice *device)
         if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) ||
             (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) {
                 /* IMEI */
-                str = g_object_get_data (G_OBJECT (device),
+                str = g_object_get_data (G_OBJECT (nm_device),
                                          "ControlCenter::EquipmentIdentifier");
                 panel_set_widget_data (panel,
                                        "mobilebb",
@@ -1609,7 +1643,7 @@ device_refresh_modem_ui (CcNetworkPanel *panel, NetDevice *device)
                                        str);
 
                 /* operator name */
-                str = g_object_get_data (G_OBJECT (device),
+                str = g_object_get_data (G_OBJECT (nm_device),
                                          "ControlCenter::OperatorName");
                 panel_set_widget_data (panel,
                                        "mobilebb",
@@ -3191,6 +3225,8 @@ cc_network_panel_init (CcNetworkPanel *panel)
                           G_CALLBACK (wireless_enabled_toggled), panel);
         g_signal_connect (panel->priv->client, "notify::wimax-enabled",
                           G_CALLBACK (wimax_enabled_toggled), panel);
+        g_signal_connect (panel->priv->client, "notify::wwan-enabled",
+                          G_CALLBACK (mobilebb_enabled_toggled), panel);
 
         widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
                                                      "start_hotspot_button"));
@@ -3213,6 +3249,11 @@ cc_network_panel_init (CcNetworkPanel *panel)
                           G_CALLBACK (edit_connection), panel);
 
         widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+                                                     "button_mobilebb_options"));
+        g_signal_connect (widget, "clicked",
+                          G_CALLBACK (edit_connection), panel);
+
+        widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
                                                      "button_vpn_options"));
         g_signal_connect (widget, "clicked",
                           G_CALLBACK (edit_connection), panel);
diff --git a/panels/network/network.ui b/panels/network/network.ui
index 71209e7..2afeae5 100644
--- a/panels/network/network.ui
+++ b/panels/network/network.ui
@@ -1416,6 +1416,49 @@
                               </packing>
                             </child>
                             <child>
+                              <object class="GtkLabel" id="label_mobilebb_ipv6">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">5</property>
+                                <property name="width">2</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label_mobilebb_route">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="selectable">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">6</property>
+                                <property name="width">2</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label_mobilebb_dns">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="yalign">0</property>
+                                <property name="selectable">True</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">7</property>
+                                <property name="width">2</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
                               <object class="GtkAlignment" id="alignment_mobilebb_switch">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
@@ -1455,6 +1498,58 @@
                                 <property name="height">1</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkLabel" id="heading_mobilebb_ipv6">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">IPv6 Address</property>
+                                <style>
+                                  <class name="dim-label"/>
+                                </style>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">5</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="heading_mobilebb_route">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Default Route</property>
+                                <style>
+                                  <class name="dim-label"/>
+                                </style>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">6</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="heading_mobilebb_dns">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="yalign">0</property>
+                                <property name="label" translatable="yes">DNS</property>
+                                <style>
+                                  <class name="dim-label"/>
+                                </style>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">7</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -1472,7 +1567,7 @@
                             <property name="yscale">0</property>
                             <property name="top_padding">12</property>
                             <child>
-                              <object class="GtkButton" id="button_mobile_options">
+                              <object class="GtkButton" id="button_mobilebb_options">
                                 <property name="label" translatable="yes">_Options...</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>



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