2007-11-09 Dan Williams <dcbw@redhat.com>

* libnm-glib/nm-settings.h
	  libnm-glib/nm-settings.c
		- (nm_settings_new_error): remove
		- (nm_settings_error_quark): add; instead of nm_settings_new_error,
			clients should use g_set_error() with NM_SETTINGS_ERROR



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3077 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2007-11-09 16:24:39 +00:00
parent 0b21c3c8c2
commit 65b9233068
3 changed files with 32 additions and 35 deletions

View file

@ -1,3 +1,11 @@
2007-11-09 Dan Williams <dcbw@redhat.com>
* libnm-glib/nm-settings.h
libnm-glib/nm-settings.c
- (nm_settings_new_error): remove
- (nm_settings_error_quark): add; instead of nm_settings_new_error,
clients should use g_set_error() with NM_SETTINGS_ERROR
2007-11-09 Dan Williams <dcbw@redhat.com>
* src/supplicant-manager/nm-supplicant-config.c

View file

@ -3,26 +3,14 @@
#include "nm-settings.h"
GError *
nm_settings_new_error (const gchar *format, ...)
GQuark
nm_settings_error_quark (void)
{
GError *err;
va_list args;
gchar *msg;
static GQuark domain_quark = 0;
static GQuark quark;
if (domain_quark == 0)
domain_quark = g_quark_from_static_string ("nm_settings_error");
va_start (args, format);
msg = g_strdup_vprintf (format, args);
va_end (args);
err = g_error_new_literal (domain_quark, 1, (const gchar *) msg);
g_free (msg);
return err;
if (G_UNLIKELY (!quark))
quark = g_quark_from_static_string ("nm-settings-error-quark");
return quark;
}
/*
@ -51,9 +39,9 @@ impl_settings_list_connections (NMSettings *settings, GPtrArray **connections, G
g_return_val_if_fail (NM_IS_SETTINGS (settings), FALSE);
if (!SETTINGS_CLASS (settings)->list_connections) {
*error = nm_settings_new_error ("%s.%d - Missing implementation for "
"Settings::list_connections.",
__FILE__, __LINE__);
g_set_error (error, NM_SETTINGS_ERROR, 1,
"%s.%d - Missing implementation for Settings::list_connections.",
__FILE__, __LINE__);
return FALSE;
}
@ -146,9 +134,9 @@ impl_connection_settings_get_id (NMConnectionSettings *connection,
g_return_val_if_fail (NM_IS_CONNECTION_SETTINGS (connection), FALSE);
if (!CONNECTION_SETTINGS_CLASS (connection)->get_id) {
*error = nm_settings_new_error ("%s.%d - Missing implementation for "
"ConnectionSettings::get_id.",
__FILE__, __LINE__);
g_set_error (error, NM_SETTINGS_ERROR, 1,
"%s.%d - Missing implementation for ConnectionSettings::get_id.",
__FILE__, __LINE__);
return FALSE;
}
@ -165,9 +153,9 @@ impl_connection_settings_get_settings (NMConnectionSettings *connection,
g_return_val_if_fail (NM_IS_CONNECTION_SETTINGS (connection), FALSE);
if (!CONNECTION_SETTINGS_CLASS (connection)->get_settings) {
*error = nm_settings_new_error ("%s.%d - Missing implementation for "
"ConnectionSettings::get_settings.",
__FILE__, __LINE__);
g_set_error (error, NM_SETTINGS_ERROR, 1,
"%s.%d - Missing implementation for ConnectionSettings::get_settings.",
__FILE__, __LINE__);
return FALSE;
}
@ -186,18 +174,18 @@ impl_connection_settings_get_secrets (NMConnectionSettings *connection,
GError *error = NULL;
if (!NM_IS_CONNECTION_SETTINGS (connection)) {
error = nm_settings_new_error ("%s.%d - Invalid connection in "
"ConnectionSettings::get_secrets.",
__FILE__, __LINE__);
g_set_error (&error, NM_SETTINGS_ERROR, 1,
"%s.%d - Invalid connection in ConnectionSettings::get_secrets.",
__FILE__, __LINE__);
dbus_g_method_return_error (context, error);
g_error_free (error);
return;
}
if (!CONNECTION_SETTINGS_CLASS (connection)->get_secrets) {
error = nm_settings_new_error ("%s.%d - Missing implementation for "
"ConnectionSettings::get_secrets.",
__FILE__, __LINE__);
g_set_error (&error, NM_SETTINGS_ERROR, 1,
"%s.%d - Missing implementation for ConnectionSettings::get_secrets.",
__FILE__, __LINE__);
dbus_g_method_return_error (context, error);
g_error_free (error);
return;

View file

@ -7,6 +7,9 @@
G_BEGIN_DECLS
#define NM_SETTINGS_ERROR nm_settings_error_quark ()
GQuark nm_settings_error_quark (void);
#define NM_TYPE_CONNECTION_SETTINGS (nm_connection_settings_get_type ())
#define NM_CONNECTION_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONNECTION_SETTINGS, NMConnectionSettings))
#define NM_CONNECTION_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_CONNECTION_SETTINGS, NMConnectionSettingsClass))
@ -73,8 +76,6 @@ GType nm_settings_get_type (void);
void nm_settings_signal_new_connection (NMSettings *settings, NMConnectionSettings *connection);
GError * nm_settings_new_error (const gchar *format, ...);
G_END_DECLS
#endif