network: Mobile broadband bug fixes

Fix On/off switch, options buttons and info display

https://bugzilla.gnome.org/show_bug.cgi?id=657303
This commit is contained in:
Jiří Klimeš 2011-05-04 09:45:35 +02:00 committed by Bastien Nocera
parent 18365c1c56
commit 31f975996e
2 changed files with 139 additions and 3 deletions

View file

@ -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 */
}
@ -1186,6 +1189,33 @@ wimax_enabled_toggled (NMClient *client,
panel->priv->updating_device = FALSE;
}
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)
{
@ -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"));
@ -3212,6 +3248,11 @@ cc_network_panel_init (CcNetworkPanel *panel)
g_signal_connect (widget, "clicked",
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",

View file

@ -1415,6 +1415,49 @@
<property name="height">1</property>
</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>
@ -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>