From 1a0bd44694a17d8035a1eceb2a7bc2440c22d19f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 18 Aug 2022 18:31:49 +0200 Subject: [PATCH] backend: Hook up to the parent constructed() Doing an early out in a constructed() is a bit awkward, and unexpected, and makes it tricky to call the parents constructed() method (which we didn't), so clean that up. Part-of: --- src/backends/meta-backend.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index 32d883420..509dd2aad 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -810,16 +810,18 @@ meta_backend_constructed (GObject *object) } #endif - if (backend_class->is_lid_closed != meta_backend_real_is_lid_closed) - return; + if (backend_class->is_lid_closed == meta_backend_real_is_lid_closed) + { + priv->upower_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM, + "org.freedesktop.UPower", + G_BUS_NAME_WATCHER_FLAGS_NONE, + upower_appeared, + upower_vanished, + backend, + NULL); + } - priv->upower_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM, - "org.freedesktop.UPower", - G_BUS_NAME_WATCHER_FLAGS_NONE, - upower_appeared, - upower_vanished, - backend, - NULL); + G_OBJECT_CLASS (meta_backend_parent_class)->constructed (object); } static void