aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2023-02-16 05:18:23 +0100
committerRobert Tari <robert@tari.in>2023-02-17 13:10:19 +0100
commit8a223541810566c2c5ccc5d4f7f9f0b2425bf0ca (patch)
treefa4d337cdd3a00bb396170881d873982a451f102 /src
parent7f0e2f59bf896b64463fdcb6987203ebd0e7517b (diff)
downloadayatana-indicator-power-8a223541810566c2c5ccc5d4f7f9f0b2425bf0ca.tar.gz
ayatana-indicator-power-8a223541810566c2c5ccc5d4f7f9f0b2425bf0ca.tar.bz2
ayatana-indicator-power-8a223541810566c2c5ccc5d4f7f9f0b2425bf0ca.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/service.c10
1 files changed, 10 insertions, 0 deletions
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);
}