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)



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3895 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-08-04 22:16:08 +00:00
parent 369299271a
commit fb74207755
3 changed files with 57 additions and 4 deletions

View file

@ -1,3 +1,10 @@
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)
2008-08-04 Dan Williams <dcbw@redhat.com>
Handle multiple concurrent PPP connections.

View file

@ -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 @@ gboolean
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 @@ nm_connection_verify (NMConnection *connection, GError **error)
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;
}

View file

@ -45,6 +45,18 @@ typedef enum {
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"