[network-manager-applet/bg/vpn-state-rh1442782: 3/4] applet: subscribe to notify::state property of unsupported devices



commit 4de02490130d2cd34bb144dcf7bd2c5ab0a04c4a
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Wed Apr 19 13:52:15 2017 +0200

    applet: subscribe to notify::state property of unsupported devices
    
    In different places we call applet_is_any_device_activating() to start
    or stop an activation animation. Such fuction takes all devices into
    account, including ones not directly supported by the
    applet. Therefore, we should update the animation status also when
    their state changes.

 src/applet.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index 613e126..a19c6c7 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -2176,13 +2176,14 @@ foo_device_state_changed_cb (NMDevice *device,
        NMADeviceClass *dclass;
 
        dclass = get_device_class (device, applet);
-       g_assert (dclass);
 
-       if (dclass->device_state_changed)
+       if (dclass && dclass->device_state_changed)
                dclass->device_state_changed (device, new_state, old_state, reason, applet);
+
        applet_common_device_state_changed (device, new_state, old_state, reason, applet);
 
-       if (   new_state == NM_DEVICE_STATE_ACTIVATED
+       if (   dclass
+           && new_state == NM_DEVICE_STATE_ACTIVATED
            && !g_settings_get_boolean (applet->gsettings, PREF_DISABLE_CONNECTED_NOTIFICATIONS)) {
                NMConnection *connection;
                char *str = NULL;
@@ -2208,15 +2209,12 @@ foo_device_added_cb (NMClient *client, NMDevice *device, gpointer user_data)
        NMADeviceClass *dclass;
 
        dclass = get_device_class (device, applet);
-       if (!dclass)
-               return;
-
-       if (dclass->device_added)
+       if (dclass && dclass->device_added)
                dclass->device_added (device, applet);
 
        g_signal_connect (device, "state-changed",
-                                  G_CALLBACK (foo_device_state_changed_cb),
-                                  user_data);
+                         G_CALLBACK (foo_device_state_changed_cb),
+                         user_data);
 
        foo_device_state_changed_cb     (device,
                                     nm_device_get_state (device),


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