[network-manager-netbook/MplPanelClient] Deactivate 3G connections when 3G is disabled
- From: Tambet Ingo <tambeti src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [network-manager-netbook/MplPanelClient] Deactivate 3G connections when 3G is disabled
- Date: Wed, 2 Dec 2009 14:35:39 +0000 (UTC)
commit 3e7ee8e21b2244c795c1da366c947dfef2ff04b3
Author: Tambet Ingo <tambet gmail com>
Date: Wed Dec 2 16:34:02 2009 +0200
Deactivate 3G connections when 3G is disabled
src/nmn-model.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/nmn-model.c b/src/nmn-model.c
index 1cd0b8e..53ae9a6 100644
--- a/src/nmn-model.c
+++ b/src/nmn-model.c
@@ -206,6 +206,32 @@ nmn_model_modems_get_active (NmnModel *self)
return GET_PRIVATE (self)->modems_active;
}
+static void
+modems_deactive (NmnModel *self)
+{
+ GtkTreeModel *child_model;
+ GtkTreeIter iter;
+ gboolean valid;
+
+ child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (self));
+ valid = gtk_tree_model_get_iter_first (child_model, &iter);
+ while (valid) {
+ NMListItem *item = NULL;
+
+ gtk_tree_model_get (child_model, &iter, NM_LIST_MODEL_COL_ITEM, &item, -1);
+ if (item) {
+ if ((NM_IS_GSM_ITEM (item) || NM_IS_CDMA_ITEM (item)) &&
+ nm_list_item_get_status (item) != NM_LIST_ITEM_STATUS_DISCONNECTED)
+
+ nm_list_item_disconnect (item);
+
+ g_object_unref (item);
+ }
+
+ valid = gtk_tree_model_iter_next (child_model, &iter);
+ }
+}
+
void
nmn_model_modems_toggled (NmnModel *self,
gboolean active)
@@ -219,6 +245,8 @@ nmn_model_modems_toggled (NmnModel *self,
/* FIXME: Save in gconf? */
priv->modems_active = active;
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (self));
+ if (!active)
+ modems_deactive (self);
g_signal_emit (self, signals[MODEMS_TOGGLED], 0, active);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]