aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2023-08-10 19:44:56 +0200
committerRobert Tari <robert@tari.in>2023-08-10 19:44:56 +0200
commit319748d4476c7731d883597f6a2c161d865e1049 (patch)
tree94b4c20c1197385274cecc00224ba078ed39f144 /src
parent225638336336d34e4357de264258cce0e80e5f30 (diff)
downloadayatana-indicator-power-319748d4476c7731d883597f6a2c161d865e1049.tar.gz
ayatana-indicator-power-319748d4476c7731d883597f6a2c161d865e1049.tar.bz2
ayatana-indicator-power-319748d4476c7731d883597f6a2c161d865e1049.zip
Do not show when in a remote session
fixes https://github.com/AyatanaIndicators/ayatana-indicator-power/issues/13
Diffstat (limited to 'src')
-rw-r--r--src/service.c16
1 files changed, 11 insertions, 5 deletions
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 <glib/gi18n.h>
#include <gio/gio.h>
+#include <rda/rda.h>
#include <ayatana/common/utils.h>
#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();