aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-09-10 22:43:26 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-09-10 22:43:26 +0200
commitac1c3d561c74540a1254b044148192f7f1c3d4e7 (patch)
tree1dea5a306f4db5682bd3de966c1a2290148aacbc
parente072850ca4873ba31084943353f46a8a8e1e5327 (diff)
parent830773c48bfee71dd6cc6fdaa017008cc09fdb5f (diff)
downloadayatana-indicator-session-ac1c3d561c74540a1254b044148192f7f1c3d4e7.tar.gz
ayatana-indicator-session-ac1c3d561c74540a1254b044148192f7f1c3d4e7.tar.bz2
ayatana-indicator-session-ac1c3d561c74540a1254b044148192f7f1c3d4e7.zip
Merge branch 'tari01-pr/add-rda'
Attributes GH PR #88: https://github.com/AyatanaIndicators/ayatana-indicator-session/pull/88
-rw-r--r--.build.yml6
-rw-r--r--CMakeLists.txt3
-rw-r--r--debian/control1
-rw-r--r--src/service.c90
4 files changed, 74 insertions, 26 deletions
diff --git a/.build.yml b/.build.yml
index 9ea3ad6..c980a1a 100644
--- a/.build.yml
+++ b/.build.yml
@@ -13,12 +13,13 @@ requires:
- cmake
- cmake-extras
- intltool
-# - libayatana-common
+ - libayatana-common
- liblomiri-url-dispatcher
- gobject-introspection
- vala
- glib2
- systemd
+ - librda
debian:
# Useful URL: https://salsa.debian.org/debian-ayatana-team/ayatana-session
@@ -38,6 +39,7 @@ requires:
- libglib2.0-dev
- libgtest-dev
- dbus
+ - librda-dev
ubuntu:
- clang
@@ -55,6 +57,7 @@ requires:
- libglib2.0-dev
- libgtest-dev
- dbus
+ - librda-dev
ubuntu:focal:
- clang
@@ -72,6 +75,7 @@ requires:
- libglib2.0-dev
- libgtest-dev
- dbus
+ - librda-dev
variables:
- 'CHECKERS="
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c244c8..79cf868 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,7 +48,8 @@ include (FindPkgConfig)
pkg_check_modules (SERVICE REQUIRED
libayatana-common>=0.9.2
glib-2.0>=2.36
- gio-unix-2.0>=2.36)
+ gio-unix-2.0>=2.36
+ rda)
include_directories (${SERVICE_INCLUDE_DIRS})
set (ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
diff --git a/debian/control b/debian/control
index e0b5544..494a227 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,7 @@ Build-Depends: cmake,
libgtest-dev,
libayatana-common-dev (>= 0.9.2),
systemd [linux-any],
+ librda-dev,
Standards-Version: 4.1.1
Homepage: https://github.com/AyatanaIndicators/ayatana-indicator-session
Vcs-Git: https://github.com/AyatanaIndicators/ayatana-indicator-session
diff --git a/src/service.c b/src/service.c
index d05f2cb..7711f97 100644
--- a/src/service.c
+++ b/src/service.c
@@ -22,7 +22,7 @@
#include <glib/gi18n.h>
#include <gio/gio.h>
#include <ayatana/common/utils.h>
-
+#include <rda/rda.h>
#include "backend.h"
#include "recoverable-problem.h"
#include "service.h"
@@ -115,6 +115,7 @@ struct _IndicatorSessionServicePrivate
GDBusConnection * conn;
GCancellable * cancellable;
GVariant * default_icon_serialized;
+ gboolean bLocal;
};
typedef IndicatorSessionServicePrivate priv_t;
@@ -676,6 +677,11 @@ create_switch_section (IndicatorSessionService * self, int profile)
menu = g_menu_new ();
+ if (!self->priv->bLocal)
+ {
+ return G_MENU_MODEL (menu);
+ }
+
/* lockswitch */
if (indicator_session_users_is_live_session (p->backend_users))
{
@@ -828,11 +834,21 @@ create_logout_section (IndicatorSessionService * self)
menu = g_menu_new ();
- if (indicator_session_actions_can_logout (p->backend_actions))
- {
- const char * label = ellipsis ? _("Log Out…") : _("Log Out");
- g_menu_append (menu, label, "indicator.logout");
- }
+ if (!self->priv->bLocal || indicator_session_actions_can_logout (p->backend_actions))
+ {
+ const char * label = NULL;
+
+ if (self->priv->bLocal && ellipsis)
+ {
+ label = _("Log Out…");
+ }
+ else
+ {
+ label = _("Log Out");
+ }
+
+ g_menu_append (menu, label, "indicator.logout");
+ }
return G_MENU_MODEL (menu);
}
@@ -847,25 +863,35 @@ create_session_section (IndicatorSessionService * self, int profile)
menu = g_menu_new ();
- if (indicator_session_actions_can_suspend (p->backend_actions))
- g_menu_append (menu, _("Suspend"), "indicator.suspend");
+ if (self->priv->bLocal)
+ {
+ if (indicator_session_actions_can_suspend (p->backend_actions))
+ g_menu_append (menu, _("Suspend"), "indicator.suspend");
- if (indicator_session_actions_can_hibernate (p->backend_actions))
- g_menu_append (menu, _("Hibernate"), "indicator.hibernate");
+ if (indicator_session_actions_can_hibernate (p->backend_actions))
+ g_menu_append (menu, _("Hibernate"), "indicator.hibernate");
- if (profile != PROFILE_LOCKSCREEN &&
- indicator_session_actions_can_reboot (p->backend_actions))
- {
- const char * label = ellipsis ? _("Restart…") : _("Restart");
- g_menu_append (menu, label, "indicator.reboot");
- }
+ if (profile != PROFILE_LOCKSCREEN && indicator_session_actions_can_reboot (p->backend_actions))
+ {
+ const char * label = ellipsis ? _("Restart…") : _("Restart");
+ g_menu_append (menu, label, "indicator.reboot");
+ }
- if (profile != PROFILE_LOCKSCREEN &&
- !g_settings_get_boolean (s, "suppress-shutdown-menuitem"))
- {
- const char * label = ellipsis ? _("Shut Down…") : _("Shut Down");
- g_menu_append (menu, label, "indicator.power-off");
- }
+ if (profile != PROFILE_LOCKSCREEN && !g_settings_get_boolean (s, "suppress-shutdown-menuitem"))
+ {
+ const char * label = ellipsis ? _("Shut Down…") : _("Shut Down");
+ g_menu_append (menu, label, "indicator.power-off");
+ }
+ }
+ else
+ {
+ gboolean bSuspendable = rda_session_can_be_suspended ();
+
+ if (bSuspendable)
+ {
+ g_menu_append (menu, _("Suspend Remote Session"), "indicator.remotesuspend");
+ }
+ }
return G_MENU_MODEL (menu);
}
@@ -986,7 +1012,16 @@ on_logout_activated (GSimpleAction * a G_GNUC_UNUSED,
GVariant * param G_GNUC_UNUSED,
gpointer gself)
{
- indicator_session_actions_logout (get_backend_actions(gself));
+ IndicatorSessionService *self = INDICATOR_SESSION_SERVICE (gself);
+
+ if (!self->priv->bLocal)
+ {
+ rda_session_terminate ();
+ }
+ else
+ {
+ indicator_session_actions_logout (get_backend_actions(gself));
+ }
}
static void
@@ -1062,6 +1097,11 @@ static void on_custom_activated (GSimpleAction *pAction G_GNUC_UNUSED, GVariant
ayatana_common_utils_open_url (sUri);
}
+static void onRemoteSuspend (GSimpleAction *pAction G_GNUC_UNUSED, GVariant *pParam G_GNUC_UNUSED, gpointer pUserData)
+{
+ rda_session_suspend ();
+}
+
static void
init_gactions (IndicatorSessionService * self)
{
@@ -1083,7 +1123,8 @@ init_gactions (IndicatorSessionService * self)
{ "switch-to-greeter", on_greeter_activated },
{ "suspend", on_suspend_activated },
{ "power-off", on_power_off_activated },
- { "custom", on_custom_activated }
+ { "custom", on_custom_activated },
+ { "remotesuspend", onRemoteSuspend }
};
p->actions = g_simple_action_group_new ();
@@ -1372,6 +1413,7 @@ indicator_session_service_init (IndicatorSessionService * self)
}
self->priv = p;
+ self->priv->bLocal = rda_session_is_local ();
/* init the backend objects */
p->cancellable = g_cancellable_new ();