Commit 5022e3b8 authored by Thomas Haller's avatar Thomas Haller

libnm: revert coercing NMVpnConnectionStateReason to NMActiveConnectionStateReason

NMVpnConnectionStateReason is no longer used and replaced by
NMActiveConnectionStateReason. However, the old enums should
stay in place as they were:

Otherwise:
  #define NMVpnConnectionStateReason NMActiveConnectionStateReason
causes compiler warnings:
  NMVpnConnectionStateReason x;
  x = NM_VPN_CONNECTION_STATE_REASON_UNKNOWN;             // -Wenum-conversion
  if (x == NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS) { } // -Wenum-compare

Similarly, a user who didn't upgrade shall continue to get the
old GType for NM_TYPE_VPN_CONNECTION_STATE_REASON.

In practice, old users will have no issues using the old enum
the places where it worked before.
The only use of the deprecated enum is in vpn_state_changed()
signal slot of NMVpnConnection. This makes the signal slot
itself deprecated. However, NMVpnConnection is an NMObject and commonly
created within libnm itself, not by the user. It is very unlikely that
a user of libnm subclassed NMVpnConnection and makes use of the
vpn_state_changed() signal slot. So, deprecate it without replacement.

Fixes: a91369f8
parent e65aa9e6
......@@ -154,7 +154,7 @@ typedef enum {
* VPN connection state reasons
*/
NM_DEPRECATED_IN_1_8_FOR(NMActiveConnectionStateReason)
typedef enum { /*< skip >*/
typedef enum {
NM_VPN_CONNECTION_STATE_REASON_UNKNOWN = NM_ACTIVE_CONNECTION_STATE_REASON_UNKNOWN,
NM_VPN_CONNECTION_STATE_REASON_NONE = NM_ACTIVE_CONNECTION_STATE_REASON_NONE,
NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED = NM_ACTIVE_CONNECTION_STATE_REASON_USER_DISCONNECTED,
......@@ -168,7 +168,6 @@ typedef enum { /*< skip >*/
NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED = NM_ACTIVE_CONNECTION_STATE_REASON_LOGIN_FAILED,
NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED = NM_ACTIVE_CONNECTION_STATE_REASON_CONNECTION_REMOVED,
} NMVpnConnectionStateReason;
#define NMVpnConnectionStateReason NMActiveConnectionStateReason
/**
* NMVpnPluginFailure:
......
......@@ -36,6 +36,8 @@ G_DEFINE_TYPE (NMVpnConnection, nm_vpn_connection, NM_TYPE_ACTIVE_CONNECTION)
#define NM_VPN_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_VPN_CONNECTION, NMVpnConnectionPrivate))
G_STATIC_ASSERT (sizeof (NMVpnConnectionStateReason) == sizeof (NMActiveConnectionStateReason));
typedef struct {
char *banner;
NMVpnConnectionState vpn_state;
......@@ -220,6 +222,7 @@ nm_vpn_connection_class_init (NMVpnConnectionClass *connection_class)
G_PARAM_STATIC_STRINGS));
/* signals */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
signals[VPN_STATE_CHANGED] =
g_signal_new ("vpn-state-changed",
G_OBJECT_CLASS_TYPE (object_class),
......@@ -228,10 +231,5 @@ nm_vpn_connection_class_init (NMVpnConnectionClass *connection_class)
NULL, NULL, NULL,
G_TYPE_NONE, 2,
G_TYPE_UINT, G_TYPE_UINT);
}
GType
nm_vpn_connection_state_reason_get_type (void)
{
return nm_active_connection_state_reason_get_type ();
G_GNUC_END_IGNORE_DEPRECATIONS
}
......@@ -41,9 +41,6 @@ G_BEGIN_DECLS
#define NM_VPN_CONNECTION_VPN_STATE "vpn-state"
#define NM_VPN_CONNECTION_BANNER "banner"
GType nm_vpn_connection_state_reason_get_type (void) G_GNUC_CONST;
#define NM_TYPE_VPN_CONNECTION_STATE_REASON (nm_vpn_connection_state_reason_get_type ())
/**
* NMVpnConnection:
*/
......@@ -55,9 +52,17 @@ typedef struct {
NMActiveConnectionClass parent;
/* Signals */
/* NMVpnConnectionStateReason got deprecated in 1.8.0. Thus, vpn_state_changed()
* uses a deprecated type and is itself deprecated.
*
* If you use this signal slot, you are advised to cast the reason
* to the NMActiveConnectionStateReason type, which is fully compatible.
*/
NM_DEPRECATED_IN_1_8
void (*vpn_state_changed) (NMVpnConnection *connection,
NMVpnConnectionState state,
NMActiveConnectionStateReason reason);
NMVpnConnectionStateReason reason);
/*< private >*/
gpointer padding[4];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment