[PATCH] NMSupplicantInterface: make PROP_CONNECTION_STATE a real property



It now generates notify events when the property changes.
---
 src/supplicant-manager/nm-supplicant-interface.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c
index 32bbdfa..eff9ea2 100644
--- a/src/supplicant-manager/nm-supplicant-interface.c
+++ b/src/supplicant-manager/nm-supplicant-interface.c
@@ -395,6 +395,16 @@ nm_supplicant_interface_class_init (NMSupplicantInterfaceClass *klass)
 	                                                    G_PARAM_READABLE));
 
 	g_object_class_install_property (object_class,
+	                                 PROP_CONNECTION_STATE,
+	                                 g_param_spec_uint ("connection-state",
+	                                                    "Connection state",
+	                                                    "Connection state",
+	                                                    NM_SUPPLICANT_INTERFACE_CON_STATE_DISCONNECTED,
+	                                                    NM_SUPPLICANT_INTERFACE_CON_STATE_LAST - 1,
+	                                                    NM_SUPPLICANT_INTERFACE_CON_STATE_DISCONNECTED,
+	                                                    G_PARAM_READABLE));
+
+	g_object_class_install_property (object_class,
 	                                 PROP_SCANNING,
 	                                 g_param_spec_boolean ("scanning",
 	                                                    "Scanning",
@@ -640,6 +650,7 @@ wpas_iface_handle_state_change (DBusGProxy *proxy,
 	enum_new_state = wpas_state_string_to_enum (str_new_state);
 	old_state = priv->con_state;
 	priv->con_state = enum_new_state;
+	g_object_notify (G_OBJECT (user_data), "connection-state");
 	if (priv->con_state != old_state) {
 		g_signal_emit (user_data,
 		               nm_supplicant_interface_signals[CONNECTION_STATE],
@@ -663,11 +674,13 @@ iface_state_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
 		g_error_free (err);
 	} else {
 		NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
-		NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (info->interface);
+		NMSupplicantInterface *iface = info->interface;
+		NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (iface);
 
 		priv->con_state = wpas_state_string_to_enum (state_str);
+		g_object_notify (G_OBJECT (iface), "connection-state");
 		g_free (state_str);
-		nm_supplicant_interface_set_state (info->interface, NM_SUPPLICANT_INTERFACE_STATE_READY);
+		nm_supplicant_interface_set_state (iface, NM_SUPPLICANT_INTERFACE_STATE_READY);
 	}
 }
 
-- 
1.6.2.2


--=-8aR9plRWNNAYr89u7TZm--



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]