[network-manager-netbook] Disallow 3G connection creation when 3G is disabled.
- From: Tambet Ingo <tambeti src gnome org>
- To: svn-commits-list gnome org
- Subject: [network-manager-netbook] Disallow 3G connection creation when 3G is disabled.
- Date: Tue, 26 May 2009 09:42:10 -0400 (EDT)
commit 22ca54eb7e8dfc152ac8102cb26e133a2bcab0a5
Author: Tambet Ingo <tambet gmail com>
Date: Tue May 26 16:16:33 2009 +0300
Disallow 3G connection creation when 3G is disabled.
---
src/nmn-new-connection.c | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/nmn-new-connection.c b/src/nmn-new-connection.c
index dae6d1b..907392e 100644
--- a/src/nmn-new-connection.c
+++ b/src/nmn-new-connection.c
@@ -43,6 +43,7 @@ typedef struct {
GtkWidget *mobile_list;
GtkWidget *mobile_save;
gboolean mobile_list_populated;
+ gulong mobile_toggled_id;
GtkWidget *close;
@@ -129,12 +130,17 @@ mobile_status_update (NmnNewConnection *connection)
NmnMobileProviderType type;
gboolean found;
- found = mobile_have_device (connection, &type);
+ if (!nmn_nm_data_modems_get_active (priv->nm_data)) {
+ found = FALSE;
+ gtk_label_set_text (GTK_LABEL (priv->mobile_label), "3G disabled");
+ } else {
+ found = mobile_have_device (connection, &type);
- if (found)
- gtk_label_set_text (GTK_LABEL (priv->mobile_label), "Internal 3G modem and SIM card detected");
- else
- gtk_label_set_text (GTK_LABEL (priv->mobile_label), "No modems detected");
+ if (found)
+ gtk_label_set_text (GTK_LABEL (priv->mobile_label), "Internal 3G modem and SIM card detected");
+ else
+ gtk_label_set_text (GTK_LABEL (priv->mobile_label), "No modems detected");
+ }
gtk_widget_set_sensitive (priv->mobile_list, found);
gtk_widget_set_sensitive (priv->mobile_save, found);
@@ -391,6 +397,11 @@ mobile_page_init (NmnNewConnection *connection)
g_signal_connect (priv->nm_data, "device-added", G_CALLBACK (mobile_device_added), connection);
g_signal_connect_swapped (priv->nm_data, "device-removed", G_CALLBACK (mobile_status_update), connection);
+
+ priv->mobile_toggled_id = g_signal_connect_swapped (priv->nm_data, "modems-toggled",
+ G_CALLBACK (mobile_status_update),
+ connection);
+
mobile_status_update (connection);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->mobile_list));
@@ -494,6 +505,8 @@ dispose (GObject *object)
if (priv->builder)
g_object_unref (priv->builder);
+ g_signal_handler_disconnect (priv->nm_data, priv->mobile_toggled_id);
+
if (priv->nm_data)
g_object_unref (priv->nm_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]