summaryrefslogtreecommitdiff
path: root/libnm
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-03-17 11:01:38 +0100
committerThomas Haller <thaller@redhat.com>2017-03-17 13:00:32 +0100
commit5022e3b8eea47bbbebf2cf557b24413b6fa6de52 (patch)
tree3c620e72b3f8168a0e90f93b97b88c56d0182aba /libnm
parente65aa9e6ffee48e3f98f0a0dc6b3aec7e6dc872c (diff)
downloadNetworkManager-5022e3b8eea47bbbebf2cf557b24413b6fa6de52.tar.gz
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: a91369f80d44d1fc748fc3a9f5d9ef0fb566c77c
Diffstat (limited to 'libnm')
-rw-r--r--libnm/nm-vpn-connection.c10
-rw-r--r--libnm/nm-vpn-connection.h13
2 files changed, 13 insertions, 10 deletions
diff --git a/libnm/nm-vpn-connection.c b/libnm/nm-vpn-connection.c
index b773096eb8..814f45f0f8 100644
--- a/libnm/nm-vpn-connection.c
+++ b/libnm/nm-vpn-connection.c
@@ -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
}
diff --git a/libnm/nm-vpn-connection.h b/libnm/nm-vpn-connection.h
index 23b17d963a..9913a873d3 100644
--- a/libnm/nm-vpn-connection.h
+++ b/libnm/nm-vpn-connection.h
@@ -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];