mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 04:50:30 +01:00
2007-09-25 Dan Williams <dcbw@redhat.com>
* libnm-glib/nm-settings.c libnm-glib/nm-settings.h - (new_error -> nm_settings_new_error): make public so that subclasses can use the same error domain. Also pass a valid error code to g_error_new_literal() so that libdbus doesn't assert when converting the GError into a DBusError - (impl_settings_list_connections, impl_connection_settings_get_id, impl_connection_settings_get_settings, impl_connection_settings_get_secrets): use new error creator function git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2879 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
cb286aac71
commit
ae74953a4d
3 changed files with 37 additions and 12 deletions
13
ChangeLog
13
ChangeLog
|
|
@ -1,3 +1,16 @@
|
|||
2007-09-25 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-glib/nm-settings.c
|
||||
libnm-glib/nm-settings.h
|
||||
- (new_error -> nm_settings_new_error): make public so that subclasses
|
||||
can use the same error domain. Also pass a valid error code to
|
||||
g_error_new_literal() so that libdbus doesn't assert when converting
|
||||
the GError into a DBusError
|
||||
- (impl_settings_list_connections, impl_connection_settings_get_id,
|
||||
impl_connection_settings_get_settings,
|
||||
impl_connection_settings_get_secrets): use new error creator
|
||||
function
|
||||
|
||||
2007-09-25 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/NetworkManager.c
|
||||
|
|
|
|||
|
|
@ -2,23 +2,23 @@
|
|||
#include <nm-utils.h>
|
||||
#include "nm-settings.h"
|
||||
|
||||
static GError *
|
||||
new_error (const gchar *format, ...)
|
||||
|
||||
GError *
|
||||
nm_settings_new_error (const gchar *format, ...)
|
||||
{
|
||||
GError *err;
|
||||
va_list args;
|
||||
gchar *msg;
|
||||
static GQuark domain_quark = 0;
|
||||
|
||||
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);
|
||||
|
||||
if (domain_quark == 0) {
|
||||
domain_quark = g_quark_from_static_string ("nm-settings-error-quark");
|
||||
}
|
||||
|
||||
err = g_error_new_literal (domain_quark, -1, (const gchar *) msg);
|
||||
err = g_error_new_literal (domain_quark, 1, (const gchar *) msg);
|
||||
|
||||
g_free (msg);
|
||||
|
||||
|
|
@ -51,7 +51,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 = new_error ("%s.%d - Missing implementation for Settings::list_connections.", __FILE__, __LINE__);
|
||||
*error = nm_settings_new_error ("%s.%d - Missing implementation for "
|
||||
"Settings::list_connections.",
|
||||
__FILE__, __LINE__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +145,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 = new_error ("%s.%d - Missing implementation for ConnectionSettings::get_id.", __FILE__, __LINE__);
|
||||
*error = nm_settings_new_error ("%s.%d - Missing implementation for "
|
||||
"ConnectionSettings::get_id.",
|
||||
__FILE__, __LINE__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +164,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 = new_error ("%s.%d - Missing implementation for ConnectionSettings::get_settings.", __FILE__, __LINE__);
|
||||
*error = nm_settings_new_error ("%s.%d - Missing implementation for "
|
||||
"ConnectionSettings::get_settings.",
|
||||
__FILE__, __LINE__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -178,14 +184,18 @@ impl_connection_settings_get_secrets (NMConnectionSettings *connection,
|
|||
GError *error = NULL;
|
||||
|
||||
if (!NM_IS_CONNECTION_SETTINGS (connection)) {
|
||||
error = new_error ("%s.%d - Invalid connection in ConnectionSettings::get_secret.", __FILE__, __LINE__);
|
||||
error = nm_settings_new_error ("%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 = new_error ("%s.%d - Missing implementation for ConnectionSettings::get_secret.", __FILE__, __LINE__);
|
||||
error = nm_settings_new_error ("%s.%d - Missing implementation for "
|
||||
"ConnectionSettings::get_secrets.",
|
||||
__FILE__, __LINE__);
|
||||
dbus_g_method_return_error (context, error);
|
||||
g_error_free (error);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue