From e01dfa43b33e812bab8584ed247f6b9bab7aa091 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 8 May 2008 18:13:28 +0000 Subject: [PATCH] 2008-05-08 Dan Williams Patch from Markus Becker * src/nm-gsm-device.c src/nm-cdma-device.c - (real_get_best_auto_connection): implement; allow autoconnection to GSM & CDMA devices git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3645 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 10 ++++++++++ src/nm-cdma-device.c | 27 +++++++++++++++++++++++++++ src/nm-gsm-device.c | 27 +++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4836c33568..b3f58b079c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-05-08 Dan Williams + + Patch from Markus Becker + + * src/nm-gsm-device.c + src/nm-cdma-device.c + - (real_get_best_auto_connection): implement; allow autoconnection + to GSM & CDMA devices + 2008-05-08 Tambet Ingo Rewrite the suse system settings plugin. @@ -18,6 +27,7 @@ * system-settings/src/Makefile.am: Add sha1[ch] to build. +>>>>>>> .r3644 2008-05-07 Dan Williams * system-settings/plugins/keyfile/reader.c diff --git a/src/nm-cdma-device.c b/src/nm-cdma-device.c index 19aa77017d..984df79fd9 100644 --- a/src/nm-cdma-device.c +++ b/src/nm-cdma-device.c @@ -9,6 +9,7 @@ #include "nm-utils.h" #include "nm-properties-changed-signal.h" #include "nm-cdma-device-glue.h" +#include "nm-setting-connection.h" G_DEFINE_TYPE (NMCdmaDevice, nm_cdma_device, NM_TYPE_SERIAL_DEVICE) @@ -203,6 +204,31 @@ real_act_stage1_prepare (NMDevice *device) return priv->pending_id ? NM_ACT_STAGE_RETURN_POSTPONE : NM_ACT_STAGE_RETURN_FAILURE; } +static NMConnection * +real_get_best_auto_connection (NMDevice *dev, + GSList *connections, + char **specific_object) +{ + GSList *iter; + + for (iter = connections; iter; iter = g_slist_next (iter)) { + NMConnection *connection = NM_CONNECTION (iter->data); + NMSettingConnection *s_con; + + s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION); + g_assert (s_con); + + if (!s_con->autoconnect) + continue; + + if (strcmp (s_con->type, NM_SETTING_CDMA_SETTING_NAME)) + continue; + + return connection; + } + return NULL; +} + static guint32 real_get_generic_capabilities (NMDevice *dev) { @@ -453,6 +479,7 @@ nm_cdma_device_class_init (NMCdmaDeviceClass *klass) object_class->set_property = set_property; object_class->finalize = finalize; + device_class->get_best_auto_connection = real_get_best_auto_connection; device_class->get_generic_capabilities = real_get_generic_capabilities; device_class->act_stage1_prepare = real_act_stage1_prepare; device_class->connection_secrets_updated = real_connection_secrets_updated; diff --git a/src/nm-gsm-device.c b/src/nm-gsm-device.c index 7df2cd013a..282ebd1939 100644 --- a/src/nm-gsm-device.c +++ b/src/nm-gsm-device.c @@ -9,6 +9,7 @@ #include "nm-utils.h" #include "nm-properties-changed-signal.h" #include "nm-gsm-device-glue.h" +#include "nm-setting-connection.h" G_DEFINE_TYPE (NMGsmDevice, nm_gsm_device, NM_TYPE_SERIAL_DEVICE) @@ -515,6 +516,31 @@ real_act_stage1_prepare (NMDevice *device) return priv->pending_id ? NM_ACT_STAGE_RETURN_POSTPONE : NM_ACT_STAGE_RETURN_FAILURE; } +static NMConnection * +real_get_best_auto_connection (NMDevice *dev, + GSList *connections, + char **specific_object) +{ + GSList *iter; + + for (iter = connections; iter; iter = g_slist_next (iter)) { + NMConnection *connection = NM_CONNECTION (iter->data); + NMSettingConnection *s_con; + + s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION); + g_assert (s_con); + + if (!s_con->autoconnect) + continue; + + if (strcmp (s_con->type, NM_SETTING_GSM_SETTING_NAME)) + continue; + + return connection; + } + return NULL; +} + static guint32 real_get_generic_capabilities (NMDevice *dev) { @@ -765,6 +791,7 @@ nm_gsm_device_class_init (NMGsmDeviceClass *klass) object_class->set_property = set_property; object_class->finalize = finalize; + device_class->get_best_auto_connection = real_get_best_auto_connection; device_class->get_generic_capabilities = real_get_generic_capabilities; device_class->act_stage1_prepare = real_act_stage1_prepare; device_class->connection_secrets_updated = real_connection_secrets_updated;