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 --- CMakeLists.txt | 1 + src/service.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 755a09a..a4035c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,7 @@ set( gio-unix-2.0>=2.36 libnotify>=0.7.6 libayatana-common>=0.9.1 + rda ) if (ENABLE_LOMIRI_FEATURES) 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