[PATCH 2/3] Add nm_connection_get_setting_serial()
- From: Thomas Graf <tgraf redhat com>
- To: networkmanager-list gnome org
- Cc: Thomas Graf <tgraf redhat com>
- Subject: [PATCH 2/3] Add nm_connection_get_setting_serial()
- Date: Mon, 21 Nov 2011 12:20:34 +0100
Signed-off-by: Thomas Graf <tgraf redhat com>
---
libnm-util/libnm-util.ver | 1 +
libnm-util/nm-connection.c | 18 ++++++++++++++++++
libnm-util/nm-connection.h | 2 ++
src/nm-device-bt.c | 2 +-
src/settings/plugins/keyfile/tests/test-keyfile.c | 4 ++--
5 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/libnm-util/libnm-util.ver b/libnm-util/libnm-util.ver
index 888c9e1..637ae82 100644
--- a/libnm-util/libnm-util.ver
+++ b/libnm-util/libnm-util.ver
@@ -26,6 +26,7 @@ global:
nm_connection_get_setting_olpc_mesh;
nm_connection_get_setting_ppp;
nm_connection_get_setting_pppoe;
+ nm_connection_get_setting_serial;
nm_connection_get_setting_vpn;
nm_connection_get_setting_wimax;
nm_connection_get_setting_wired;
diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c
index 2fcc9dc..4003cb7 100644
--- a/libnm-util/nm-connection.c
+++ b/libnm-util/nm-connection.c
@@ -42,6 +42,7 @@
#include "nm-setting-wired.h"
#include "nm-setting-wireless.h"
#include "nm-setting-wireless-security.h"
+#include "nm-setting-serial.h"
#include "nm-setting-vpn.h"
#include "nm-setting-olpc-mesh.h"
#include "nm-setting-bond.h"
@@ -1498,6 +1499,23 @@ nm_connection_get_setting_pppoe (NMConnection *connection)
}
/**
+ * nm_connection_get_setting_serial:
+ * @connection: the #NMConnection
+ *
+ * A shortcut to return any #NMSettingSerial the connection might contain.
+ *
+ * Returns: (transfer none): an #NMSettingSerial if the connection contains one, otherwise NULL
+ **/
+NMSettingSerial *
+nm_connection_get_setting_serial (NMConnection *connection)
+{
+ g_return_val_if_fail (connection != NULL, NULL);
+ g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
+
+ return (NMSettingSerial *) nm_connection_get_setting (connection, NM_TYPE_SETTING_SERIAL);
+}
+
+/**
* nm_connection_get_setting_vpn:
* @connection: the #NMConnection
*
diff --git a/libnm-util/nm-connection.h b/libnm-util/nm-connection.h
index 6014138..ad1017f 100644
--- a/libnm-util/nm-connection.h
+++ b/libnm-util/nm-connection.h
@@ -41,6 +41,7 @@
#include <nm-setting-olpc-mesh.h>
#include <nm-setting-ppp.h>
#include <nm-setting-pppoe.h>
+#include <nm-setting-serial.h>
#include <nm-setting-vpn.h>
#include <nm-setting-wimax.h>
#include <nm-setting-wired.h>
@@ -193,6 +194,7 @@ NMSettingIP6Config * nm_connection_get_setting_ip6_config (NMConnec
NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection);
NMSettingPPP * nm_connection_get_setting_ppp (NMConnection *connection);
NMSettingPPPOE * nm_connection_get_setting_pppoe (NMConnection *connection);
+NMSettingSerial * nm_connection_get_setting_serial (NMConnection *connection);
NMSettingVPN * nm_connection_get_setting_vpn (NMConnection *connection);
NMSettingWimax * nm_connection_get_setting_wimax (NMConnection *connection);
NMSettingWired * nm_connection_get_setting_wired (NMConnection *connection);
diff --git a/src/nm-device-bt.c b/src/nm-device-bt.c
index eff570f..55ff951 100644
--- a/src/nm-device-bt.c
+++ b/src/nm-device-bt.c
@@ -278,7 +278,7 @@ real_complete_connection (NMDevice *device,
s_gsm = nm_connection_get_setting_gsm (connection);
s_cdma = nm_connection_get_setting_cdma (connection);
- s_serial = (NMSettingSerial *) nm_connection_get_setting (connection, NM_TYPE_SETTING_SERIAL);
+ s_serial = nm_connection_get_setting_serial (connection);
s_ppp = nm_connection_get_setting_ppp (connection);
s_bt = nm_connection_get_setting_bluetooth (connection);
diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/settings/plugins/keyfile/tests/test-keyfile.c
index 5c9ced7..bf95418 100644
--- a/src/settings/plugins/keyfile/tests/test-keyfile.c
+++ b/src/settings/plugins/keyfile/tests/test-keyfile.c
@@ -1952,7 +1952,7 @@ test_read_bt_dun_connection (void)
/* ===== SERIAL SETTING ===== */
- s_serial = NM_SETTING_SERIAL (nm_connection_get_setting (connection, NM_TYPE_SETTING_SERIAL));
+ s_serial = nm_connection_get_setting_serial (connection);
ASSERT (s_serial != NULL,
"connection-verify-serial", "failed to verify %s: missing %s setting",
TEST_BT_DUN_FILE,
@@ -2215,7 +2215,7 @@ test_read_gsm_connection (void)
/* ===== SERIAL SETTING ===== */
- s_serial = NM_SETTING_SERIAL (nm_connection_get_setting (connection, NM_TYPE_SETTING_SERIAL));
+ s_serial = nm_connection_get_setting_serial (connection);
ASSERT (s_serial != NULL,
"connection-verify-serial", "failed to verify %s: missing %s setting",
TEST_GSM_FILE,
--
1.7.7.3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]