summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-12-29 23:58:39 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2016-12-30 10:48:50 +0100
commita2936f0ee5296f97a6c3fb9cba9ac88673c6a33f (patch)
tree0682283b4b9dfc2aaeac75510ff21214dab0ba8e
parent163e6e842267a6e7e6e72f486160179312c44ca9 (diff)
downloadnetwork-manager-applet-a2936f0ee5296f97a6c3fb9cba9ac88673c6a33f.tar.gz
applet: re-add broadband devices when MM becomes available
Broadband devices stay uninitialized if they are added before the ModemManager is running. Call again the device_added method after MM becomes available. https://bugzilla.gnome.org/show_bug.cgi?id=776384
-rw-r--r--src/applet-device-broadband.c3
-rw-r--r--src/applet.c20
2 files changed, 23 insertions, 0 deletions
diff --git a/src/applet-device-broadband.c b/src/applet-device-broadband.c
index 59dd4626..585166fe 100644
--- a/src/applet-device-broadband.c
+++ b/src/applet-device-broadband.c
@@ -1009,6 +1009,9 @@ device_added (NMDevice *device,
if (!udi)
return;
+ if (g_object_get_data (G_OBJECT (modem), BROADBAND_INFO_TAG))
+ return;
+
if (!applet->mm1) {
g_warning ("Cannot grab information for modem at %s: No ModemManager support",
nm_device_get_udi (device));
diff --git a/src/applet.c b/src/applet.c
index f3a4a1e2..b702f8e7 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -2372,6 +2372,26 @@ mm1_name_owner_changed_cb (GDBusObjectManagerClient *mm1,
name_owner = g_dbus_object_manager_client_get_name_owner (mm1);
applet->mm1_running = !!name_owner;
g_free (name_owner);
+
+ if (applet->mm1_running) {
+ const GPtrArray *devices;
+ NMADeviceClass *dclass;
+ NMDevice *device;
+ int i;
+
+ devices = nm_client_get_devices (applet->nm_client);
+ for (i = 0; devices && (i < devices->len); i++) {
+ device = NM_DEVICE (g_ptr_array_index (devices, i));
+ if (NM_IS_DEVICE_MODEM (device)) {
+ dclass = get_device_class (device, applet);
+ if (dclass && dclass->device_added)
+ dclass->device_added (device, applet);
+
+ applet_schedule_update_icon (applet);
+ applet_schedule_update_menu (applet);
+ }
+ }
+ }
}
static void