aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.build.yml6
-rw-r--r--CMakeLists.txt1
-rw-r--r--debian/control1
-rw-r--r--src/notifier.c5
-rw-r--r--src/service.c16
5 files changed, 21 insertions, 8 deletions
diff --git a/.build.yml b/.build.yml
index 4284dc4..916609b 100644
--- a/.build.yml
+++ b/.build.yml
@@ -13,7 +13,7 @@ requires:
- cmake
- cmake-extras
- intltool
-# - libayatana-common
+ - libayatana-common
- liblomiri-url-dispatcher
- gobject-introspection
- vala
@@ -21,6 +21,7 @@ requires:
- libnotify
- systemd
- gstreamer
+ - librda
debian:
# Useful URL: https://salsa.debian.org/debian-ayatana-team/ayatana-indicator-power
@@ -47,6 +48,7 @@ requires:
- libdbustest1-dev
- systemd
- libgstreamer1.0-dev
+ - librda-dev
ubuntu:
- clang
@@ -69,6 +71,7 @@ requires:
- libdbustest1-dev
- systemd
- libgstreamer1.0-dev
+ - librda-dev
ubuntu:focal:
- clang
@@ -91,6 +94,7 @@ requires:
- libdbustest1-dev
- systemd
- libgstreamer1.0-dev
+ - librda-dev
variables:
- 'CHECKERS="
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/debian/control b/debian/control
index 5450ce1..8c552e8 100644
--- a/debian/control
+++ b/debian/control
@@ -10,6 +10,7 @@ Build-Depends: cmake,
libnotify-dev (>= 0.7.6),
libglib2.0-dev (>= 2.36),
lomiri-schemas | hello,
+ librda-dev,
# for packaging
debhelper (>= 10),
dpkg-dev (>= 1.16.1.1),
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();