From 319748d4476c7731d883597f6a2c161d865e1049 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 10 Aug 2023 19:44:56 +0200 Subject: Do not show when in a remote session fixes https://github.com/AyatanaIndicators/ayatana-indicator-power/issues/13 --- src/service.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/service.c') diff --git a/src/service.c b/src/service.c index 3a0ff82..3f3e3b0 100644 --- a/src/service.c +++ b/src/service.c @@ -22,6 +22,7 @@ #include #include +#include #include #include "brightness.h" #include "dbus-shared.h" @@ -118,7 +119,7 @@ struct _IndicatorPowerServicePrivate GSimpleAction * battery_level_action; GSimpleAction * device_state_action; GSimpleAction * brightness_action; - + gboolean bLocal; IndicatorPowerDevice * primary_device; GList * devices; /* IndicatorPowerDevice */ @@ -387,14 +388,19 @@ count_batteries (GList * devices, int *total, int *inuse) static gboolean should_be_visible (IndicatorPowerService * self) { + gboolean visible = TRUE; + priv_t * p = self->priv; + + if (!self->priv->bLocal) + { + return FALSE; + } + if (!ayatana_common_utils_is_lomiri()) { return TRUE; } - gboolean visible = TRUE; - priv_t * p = self->priv; - const int policy = g_settings_get_enum (p->settings, SETTINGS_ICON_POLICY_S); g_debug ("policy is: %d (present==0, charge==1, never==2)", policy); @@ -1182,7 +1188,7 @@ indicator_power_service_init (IndicatorPowerService * self) self->priv = p; p->cancellable = g_cancellable_new (); - + p->bLocal = rda_session_is_local (); p->settings = g_settings_new ("org.ayatana.indicator.power"); p->brightness = indicator_power_brightness_new(); -- cgit v1.2.3