vpn: fix VPN plugin D-Bus errors

The errors were documented as org.freedesktop.NetworkManager.VPN.Error.*,
but the actual values were org.freedesktop.NetworkManager.VPN.Plugin.*

Also update the errors documentation.
This commit is contained in:
Jiří Klimeš 2013-09-26 15:06:17 +02:00
parent 9dff830692
commit 282b9df60d
4 changed files with 34 additions and 11 deletions

View file

@ -41,6 +41,7 @@
#define NM_DBUS_NO_VPN_CONNECTIONS "org.freedesktop.NetworkManager.VPNConnections.NoVPNConnections"
#define NM_DBUS_INVALID_VPN_CONNECTION "org.freedesktop.NetworkManager.VPNConnections.InvalidVPNConnection"
#define NM_DBUS_VPN_ERROR_PREFIX "org.freedesktop.NetworkManager.VPN.Error"
#define NM_DBUS_VPN_STARTING_IN_PROGRESS "StartingInProgress"
#define NM_DBUS_VPN_ALREADY_STARTED "AlreadyStarted"
#define NM_DBUS_VPN_STOPPING_IN_PROGRESS "StoppingInProgress"

View file

@ -2,31 +2,53 @@
<tp:errors xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
namespace="org.freedesktop.NetworkManager.VPN.Error">
<tp:error name="General">
<tp:docstring>This is a drab, nondescript error.</tp:docstring>
<tp:docstring>General failure without further details.</tp:docstring>
</tp:error>
<tp:error name="StartingInProgress">
<tp:docstring>The request could not be processed because the VPN connection is already being started.</tp:docstring>
<tp:docstring>
The plugin is already starting, and another connect request was received.
</tp:docstring>
</tp:error>
<tp:error name="AlreadyStarted">
<tp:docstring>The request could not be processed because a VPN connection was already active.</tp:docstring>
<tp:docstring>
The plugin is already connected, and another connect request was received.
</tp:docstring>
</tp:error>
<tp:error name="StoppingInProgress">
<tp:docstring>The request could not be processed because the VPN connection is already being stopped.</tp:docstring>
<tp:docstring>
The plugin is already stopping, and another stop request was received.
</tp:docstring>
</tp:error>
<tp:error name="AlreadyStopped">
<tp:docstring>The request could not be processed because the VPN connection was already stopped.</tp:docstring>
<tp:docstring>
The plugin is already stopped, and another disconnect request was received.
</tp:docstring>
</tp:error>
<tp:error name="WrongState">
<tp:docstring>The request could not be processed because the VPN connection is in the wrong state for this type of request. FIXME: too general?</tp:docstring>
<tp:docstring>
The request could not be processed because the VPN plugin is in the wrong
state for this type of request.
</tp:docstring>
</tp:error>
<tp:error name="BadArguments">
<tp:docstring>Invalid arguments were passed with the request. FIXME: too general.</tp:docstring>
<tp:docstring>
The request could not be processed because it contained malformed
arguments, or arguments of unexpected type. It usually means that one of
the VPN setting data items or secrets was not of the expected type (i.e.
int, string, bool, etc).
</tp:docstring>
</tp:error>
<tp:error name="LaunchFailed">
<tp:docstring>A binary providing the service failed to launch.</tp:docstring>
<tp:docstring>
A binary providing the service failed to launch.
</tp:docstring>
</tp:error>
<tp:error name="ConnectionInvalid">
<tp:docstring>The request could not be processed because the VPN connection settings were invalid.</tp:docstring>
<tp:docstring>
The request could not be processed because the connection was invalid. It
usually means that the connection's VPN setting was missing some required
data item or secret.
</tp:docstring>
</tp:error>
<tp:error name="InteractiveNotSupported">
<tp:docstring>

View file

@ -1053,7 +1053,7 @@ nm_vpn_plugin_class_init (NMVPNPluginClass *plugin_class)
G_TYPE_NONE);
dbus_g_error_domain_register (NM_VPN_PLUGIN_ERROR,
NULL,
NM_DBUS_VPN_ERROR_PREFIX,
NM_TYPE_VPN_PLUGIN_ERROR);
setup_unix_signal_handler ();

View file

@ -1181,7 +1181,7 @@ connect_interactive_cb (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data
return;
}
if (dbus_g_error_has_name (err, "org.freedesktop.NetworkManager.VPN.Plugin.InteractiveNotSupported")) {
if (dbus_g_error_has_name (err, NM_DBUS_VPN_ERROR_PREFIX "." NM_DBUS_VPN_INTERACTIVE_NOT_SUPPORTED)) {
/* Fall back to Connect() */
dbus_g_proxy_begin_call (priv->proxy, "Connect",
connect_cb, self, NULL,