NetworkManager r3895 - in trunk: . libnm-util
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3895 - in trunk: . libnm-util
- Date: Mon, 4 Aug 2008 22:16:08 +0000 (UTC)
Author: dcbw
Date: Mon Aug 4 22:16:08 2008
New Revision: 3895
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3895&view=rev
Log:
2008-08-04 Dan Williams <dcbw redhat com>
* libnm-util/nm-connection.c
libnm-util/nm-connection.h
- (nm_connection_verify): return error on missing 'connection' setting
(found by Sjoerd Simons)
Modified:
trunk/ChangeLog
trunk/libnm-util/nm-connection.c
trunk/libnm-util/nm-connection.h
Modified: trunk/libnm-util/nm-connection.c
==============================================================================
--- trunk/libnm-util/nm-connection.c (original)
+++ trunk/libnm-util/nm-connection.c Mon Aug 4 22:16:08 2008
@@ -45,6 +45,37 @@
#include "nm-setting-gsm.h"
#include "nm-setting-cdma.h"
+GQuark
+nm_connection_error_quark (void)
+{
+ static GQuark quark;
+
+ if (G_UNLIKELY (!quark))
+ quark = g_quark_from_static_string ("nm-connection-error-quark");
+ return quark;
+}
+
+/* This should really be standard. */
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+
+GType
+nm_connection_error_get_type (void)
+{
+ static GType etype = 0;
+
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ /* Unknown error. */
+ ENUM_ENTRY (NM_CONNECTION_ERROR_UNKNOWN, "UnknownError"),
+ /* The required 'connection' setting was not found. */
+ ENUM_ENTRY (NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND, "ConnectionSettingNotFound"),
+ { 0, 0, 0 }
+ };
+ etype = g_enum_register_static ("NMConnectionError", values);
+ }
+ return etype;
+}
+
typedef struct {
GHashTable *settings;
@@ -430,7 +461,7 @@
nm_connection_verify (NMConnection *connection, GError **error)
{
NMConnectionPrivate *priv;
- NMSetting *connection_setting;
+ NMSetting *s_con;
VerifySettingsInfo info;
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
@@ -440,9 +471,12 @@
priv = NM_CONNECTION_GET_PRIVATE (connection);
/* First, make sure there's at least 'connection' setting */
- connection_setting = nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
- if (!connection_setting) {
- g_warning ("'connection' setting not present.");
+ s_con = nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+ if (!s_con) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND,
+ "connection setting not found");
return FALSE;
}
Modified: trunk/libnm-util/nm-connection.h
==============================================================================
--- trunk/libnm-util/nm-connection.h (original)
+++ trunk/libnm-util/nm-connection.h Mon Aug 4 22:16:08 2008
@@ -45,6 +45,18 @@
NM_CONNECTION_SCOPE_USER
} NMConnectionScope;
+typedef enum
+{
+ NM_CONNECTION_ERROR_UNKNOWN = 0,
+ NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND
+} NMConnectionError;
+
+#define NM_TYPE_CONNECTION_ERROR (nm_connection_error_get_type ())
+GType nm_connection_error_get_type (void);
+
+#define NM_CONNECTION_ERROR nm_connection_error_quark ()
+GQuark nm_connection_error_quark (void);
+
#define NM_CONNECTION_SCOPE "scope"
#define NM_CONNECTION_PATH "path"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]