From 8a223541810566c2c5ccc5d4f7f9f0b2425bf0ca Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 16 Feb 2023 05:18:23 +0100 Subject: src/service.c: Create a fake primary device icon on Lomiri if no device is present fixes https://gitlab.com/ubports/development/core/packaging/ayatana-indicators/ayatana-indicator-power/-/issues/2 --- src/service.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/service.c b/src/service.c index 293a983..f9122ba 100644 --- a/src/service.c +++ b/src/service.c @@ -494,6 +494,16 @@ create_header_state (IndicatorPowerService * self) g_object_unref (icon); } } + else if (ayatana_common_utils_is_lomiri()) + { + g_variant_builder_add (&b, "{sv}", "label", g_variant_new_string ("Fake battery")); + g_variant_builder_add (&b, "{sv}", "accessible-desc", g_variant_new_string ("Fake battery")); + GIcon *pIcon = g_themed_icon_new_with_default_fallbacks ("battery-missing-symbolic"); + GVariant *pIconSerialised = g_icon_serialize (pIcon); + g_object_unref (pIcon); + g_variant_builder_add (&b, "{sv}", "icon", pIconSerialised); + g_variant_unref (pIconSerialised); + } return g_variant_builder_end (&b); } -- cgit v1.2.3