diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-08-24 16:40:39 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-08-24 16:40:39 +0200 |
commit | dc145085d9bb47bf40b1f8fac0123689b7e3b127 (patch) | |
tree | fb2186c681cdbcc75691882e549ba14177da0308 /src | |
parent | 12e9c966d6f633db7882d76ad25069e3c47a095c (diff) | |
parent | 62d78d59fab309f06de6fd4629d0c45523bcbf98 (diff) | |
download | ayatana-indicator-power-dc145085d9bb47bf40b1f8fac0123689b7e3b127.tar.gz ayatana-indicator-power-dc145085d9bb47bf40b1f8fac0123689b7e3b127.tar.bz2 ayatana-indicator-power-dc145085d9bb47bf40b1f8fac0123689b7e3b127.zip |
Merge branch 'tari01-pr/detect-remote-session'
Attributes GH PR #83: https://github.com/AyatanaIndicators/ayatana-indicator-power/pull/83
Diffstat (limited to 'src')
-rw-r--r-- | src/notifier.c | 5 | ||||
-rw-r--r-- | src/service.c | 16 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/notifier.c b/src/notifier.c index c513656..0a56b6b 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -1,6 +1,6 @@ /* * Copyright 2014-2016 Canonical Ltd. - * Copyright 2021-2022 Robert Tari + * Copyright 2021-2023 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -309,7 +309,6 @@ notification_show(IndicatorPowerNotifier * self) icon_name = NULL; nn = notify_notification_new(title, body, icon_name); g_strfreev (icon_names); - g_free (body); if (are_actions_supported(self)) { @@ -355,6 +354,8 @@ notification_show(IndicatorPowerNotifier * self) g_error_free(error); g_object_unref(nn); } + + g_free (body); } /*** 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(); |