On Fri, 2009-06-05 at 11:26 +0100, Daniel Drake wrote:
> Hi,
> 
> The PROP_CONNECTION_STATE property on NMSupplicantInterface
> (src/supplicant-manager/nm-supplicant-interface.c) seems not to be
> installed through g_object_class_install_property(), hence is not
> really usable.

possible patch, compile tested only

Daniel

>From 41b84dffe018e764dd7571ad10be42c1c4a7f511 Mon Sep 17 00:00:00 2001
From: Daniel Drake <[email protected]>
Date: Fri, 5 Jun 2009 12:05:13 +0100
Subject: [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

_______________________________________________
NetworkManager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to