diff --git a/configure.ac b/configure.ac
index f7167241..a5321fb5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -430,6 +430,15 @@ if test "$have_xf86gamma" = yes -o "$have_xf86vmode" = yes; then
fi
fi
+dnl ---------------------------------------------------------------------------
+dnl - Check if Remote Desktop Awareness support is available
+dnl ---------------------------------------------------------------------------
+
+PKG_CHECK_MODULES(RDA, rda, have_rda=yes, have_rda=no)
+if test "x$have_rda" = "xyes"; then
+ AC_DEFINE(HAVE_RDA, 1, [Have the Remote Desktop Awareness library])
+fi
+
dnl ---------------------------------------------------------------------------
dnl - The --enable-locking option
dnl ---------------------------------------------------------------------------
@@ -1172,6 +1181,7 @@ echo "
Have enhanced shadow: ${have_shadow_enhanced}
Have HPUX shadow: ${have_shadow_hpux}
Have password helper: ${have_passwd_helper}
+ Have RD awareness: ${have_rda}
Authentication scheme: ${AUTH_SCHEME}"
if test "x$need_setuid" = "xyes" -a "x$have_pam" != "xyes" ; then
diff --git a/data/lock-dialog-default.ui b/data/lock-dialog-default.ui
index 94c9d46c..2274b01c 100644
--- a/data/lock-dialog-default.ui
+++ b/data/lock-dialog-default.ui
@@ -249,6 +249,22 @@
1
+
+
+
+ False
+ False
+ 2
+
+
@@ -278,7 +294,7 @@
False
False
- 3
+ 4
@@ -293,7 +309,7 @@
False
False
- 4
+ 5
diff --git a/src/Makefile.am b/src/Makefile.am
index 51e09bfb..21d359d2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,6 +32,7 @@ AM_CPPFLAGS = \
$(LIBMATEKBDUI_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
$(SYSTEMD_CFLAGS) \
+ $(RDA_CFLAGS) \
$(NULL)
bin_PROGRAMS = \
@@ -129,6 +130,7 @@ test_window_SOURCES = \
test_window_LDADD = \
$(MATE_SCREENSAVER_LIBS) \
$(SAVER_LIBS) \
+ $(RDA_LIBS) \
$(NULL)
mate_screensaver_dialog_SOURCES = \
@@ -157,6 +159,7 @@ mate_screensaver_dialog_LDADD = \
$(AUTH_LIBS) \
$(LIBMATEKBDUI_LIBS) \
$(LIBNOTIFY_LIBS) \
+ $(RDA_LIBS) \
$(NULL)
BUILT_SOURCES = \
@@ -216,6 +219,7 @@ mate_screensaver_LDADD = \
$(MATE_SCREENSAVER_LIBS) \
$(SAVER_LIBS) \
$(SYSTEMD_LIBS) \
+ $(RDA_LIBS) \
$(NULL)
mate_screensaver_LDFLAGS = -export-dynamic
diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c
index 0dbd32e8..62a94444 100644
--- a/src/gs-lock-plug.c
+++ b/src/gs-lock-plug.c
@@ -39,6 +39,10 @@
#include
#include
+#ifdef HAVE_RDA
+#include
+#endif /* HAVE_RDA */
+
#define MATE_DESKTOP_USE_UNSTABLE_API
#include
@@ -101,6 +105,9 @@ struct GSLockPlugPrivate
GtkWidget *auth_switch_button;
GtkWidget *auth_cancel_button;
GtkWidget *auth_logout_button;
+#ifdef HAVE_RDA
+ GtkWidget *auth_suspend_button;
+#endif /* HAVE_RDA */
GtkWidget *auth_note_button;
GtkWidget *note_tab;
GtkWidget *note_tab_label;
@@ -112,6 +119,9 @@ struct GSLockPlugPrivate
gboolean caps_lock_on;
gboolean switch_enabled;
+#ifdef HAVE_RDA
+ gboolean suspend_enabled;
+#endif /* HAVE_RDA */
gboolean leave_note_enabled;
gboolean logout_enabled;
char *logout_command;
@@ -148,6 +158,9 @@ enum
PROP_LOGOUT_ENABLED,
PROP_LOGOUT_COMMAND,
PROP_SWITCH_ENABLED,
+#ifdef HAVE_RDA
+ PROP_SUSPEND_ENABLED,
+#endif /* HAVE_RDA */
PROP_STATUS_MESSAGE
};
@@ -1094,6 +1107,37 @@ gs_lock_plug_set_logout_enabled (GSLockPlug *plug,
}
}
+#ifdef HAVE_RDA
+static void
+gs_lock_plug_set_suspend_enabled (GSLockPlug *plug,
+ gboolean suspend_enabled)
+{
+ g_return_if_fail (GS_LOCK_PLUG (plug));
+
+ if (plug->priv->suspend_enabled == suspend_enabled)
+ {
+ return;
+ }
+
+ plug->priv->suspend_enabled = suspend_enabled;
+ g_object_notify (G_OBJECT (plug), "suspend-enabled");
+
+ if (plug->priv->auth_suspend_button == NULL)
+ {
+ return;
+ }
+
+ if (suspend_enabled)
+ {
+ gtk_widget_show (plug->priv->auth_suspend_button);
+ }
+ else
+ {
+ gtk_widget_hide (plug->priv->auth_suspend_button);
+ }
+}
+#endif /* HAVE_RDA */
+
static void
gs_lock_plug_set_logout_command (GSLockPlug *plug,
const char *command)
@@ -1157,6 +1201,11 @@ gs_lock_plug_get_property (GObject *object,
case PROP_SWITCH_ENABLED:
g_value_set_boolean (value, self->priv->switch_enabled);
break;
+#ifdef HAVE_RDA
+ case PROP_SUSPEND_ENABLED:
+ g_value_set_boolean (value, self->priv->suspend_enabled);
+ break;
+#endif /* HAVE_RDA */
case PROP_STATUS_MESSAGE:
g_value_set_string (value, self->priv->status_message);
break;
@@ -1238,6 +1287,11 @@ gs_lock_plug_set_property (GObject *object,
case PROP_SWITCH_ENABLED:
gs_lock_plug_set_switch_enabled (self, g_value_get_boolean (value));
break;
+#ifdef HAVE_RDA
+ case PROP_SUSPEND_ENABLED:
+ gs_lock_plug_set_suspend_enabled (self, g_value_get_boolean (value));
+ break;
+#endif /* HAVE_RDA */
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1325,6 +1379,15 @@ gs_lock_plug_class_init (GSLockPlugClass *klass)
NULL,
FALSE,
G_PARAM_READWRITE));
+#ifdef HAVE_RDA
+ g_object_class_install_property (object_class,
+ PROP_SUSPEND_ENABLED,
+ g_param_spec_boolean ("suspend-enabled",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+#endif /* HAVE_RDA */
binding_set = gtk_binding_set_by_class (klass);
@@ -1452,6 +1515,25 @@ logout_button_clicked (GtkButton *button,
}
}
+#ifdef HAVE_RDA
+static void
+suspend_button_clicked (GtkButton *button,
+ GSLockPlug *plug)
+{
+ remove_response_idle (plug);
+
+ gs_lock_plug_set_sensitive (plug, FALSE);
+
+ plug->priv->response_idle_id = g_timeout_add (2000,
+ (GSourceFunc)response_cancel_idle_cb,
+ plug);
+
+ gs_lock_plug_set_busy (plug);
+
+ rda_session_suspend();
+}
+#endif
+
void
gs_lock_plug_set_busy (GSLockPlug *plug)
{
@@ -1666,6 +1748,14 @@ create_page_one_buttons (GSLockPlug *plug)
gtk_widget_set_focus_on_click (GTK_WIDGET (plug->priv->auth_logout_button), FALSE);
gtk_widget_set_no_show_all (plug->priv->auth_logout_button, TRUE);
+#ifdef HAVE_RDA
+ plug->priv->auth_suspend_button = gs_lock_plug_add_button (GS_LOCK_PLUG (plug),
+ plug->priv->auth_action_area,
+ _("Disconnect"));
+ gtk_widget_set_focus_on_click (GTK_WIDGET (plug->priv->auth_suspend_button), FALSE);
+ gtk_widget_set_no_show_all (plug->priv->auth_suspend_button, TRUE);
+#endif /* HAVE_RDA */
+
plug->priv->auth_cancel_button = gs_lock_plug_add_button (GS_LOCK_PLUG (plug),
plug->priv->auth_action_area,
"gtk-cancel");
@@ -2040,6 +2130,9 @@ load_theme (GSLockPlug *plug)
plug->priv->auth_cancel_button = GTK_WIDGET (gtk_builder_get_object(builder, "auth-cancel-button"));
plug->priv->auth_logout_button = GTK_WIDGET (gtk_builder_get_object(builder, "auth-logout-button"));
plug->priv->auth_switch_button = GTK_WIDGET (gtk_builder_get_object(builder, "auth-switch-button"));
+#ifdef HAVE_RDA
+ plug->priv->auth_suspend_button = GTK_WIDGET (gtk_builder_get_object(builder, "auth-suspend-button"));
+#endif /* HAVE_RDA */
plug->priv->auth_note_button = GTK_WIDGET (gtk_builder_get_object(builder, "auth-note-button"));
plug->priv->note_tab = GTK_WIDGET (gtk_builder_get_object(builder, "note-tab"));
plug->priv->note_tab_label = GTK_WIDGET (gtk_builder_get_object(builder, "note-tab-label"));
@@ -2057,6 +2150,12 @@ load_theme (GSLockPlug *plug)
{
gtk_widget_set_no_show_all (plug->priv->auth_switch_button, TRUE);
}
+#ifdef HAVE_RDA
+ if (plug->priv->auth_suspend_button != NULL)
+ {
+ gtk_widget_set_no_show_all (plug->priv->auth_suspend_button, TRUE);
+ }
+#endif /* HAVE_RDA */
if (plug->priv->auth_note_button != NULL)
{
gtk_widget_set_no_show_all (plug->priv->auth_note_button, TRUE);
@@ -2215,6 +2314,24 @@ gs_lock_plug_init (GSLockPlug *plug)
}
}
+#ifdef HAVE_RDA
+ if (! plug->priv->suspend_enabled)
+ {
+ if (plug->priv->auth_suspend_button != NULL)
+ {
+ gtk_widget_hide (plug->priv->auth_suspend_button);
+ }
+ }
+ if (plug->priv->auth_suspend_button != NULL)
+ {
+ gchar *btn_label;
+ btn_label = g_strdup_printf (_("_Disconnect %s"), rda_get_remote_technology_name());
+ gs_debug ("Renaming remote suspension button to %s", btn_label);
+ gtk_button_set_label (GTK_BUTTON (plug->priv->auth_suspend_button), btn_label);
+ g_free (btn_label);
+ }
+#endif /* HAVE_RDA */
+
plug->priv->timeout = DIALOG_TIMEOUT_MSEC;
g_signal_connect (plug, "key_press_event",
@@ -2251,6 +2368,14 @@ gs_lock_plug_init (GSLockPlug *plug)
G_CALLBACK (switch_user_button_clicked), plug);
}
+#ifdef HAVE_RDA
+ if (plug->priv->auth_suspend_button != NULL)
+ {
+ g_signal_connect (plug->priv->auth_suspend_button, "clicked",
+ G_CALLBACK (suspend_button_clicked), plug);
+ }
+#endif /* HAVE_RDA */
+
if (plug->priv->auth_note_button != NULL)
{
g_signal_connect (plug->priv->auth_note_button, "clicked",
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index e5b857cf..d3e9f30a 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -32,6 +32,10 @@
#include
#include
+#ifdef HAVE_RDA
+#include
+#endif
+
#include "gs-window.h"
#include "gs-marshal.h"
#include "subprocs.h"
@@ -1726,6 +1730,13 @@ popup_dialog (GSWindow *window)
command = g_string_append (command, " --enable-switch");
}
+#ifdef HAVE_RDA
+ if (rda_session_is_remote() && rda_session_can_be_suspended())
+ {
+ command = g_string_append (command, " --enable-suspend");
+ }
+#endif /* HAVE_RDA */
+
if (gs_debug_enabled ())
{
command = g_string_append (command, " --verbose");
diff --git a/src/mate-screensaver-dialog.c b/src/mate-screensaver-dialog.c
index 62daa98b..a3649207 100644
--- a/src/mate-screensaver-dialog.c
+++ b/src/mate-screensaver-dialog.c
@@ -49,6 +49,9 @@ static gboolean verbose = FALSE;
static gboolean show_version = FALSE;
static gboolean enable_logout = FALSE;
static gboolean enable_switch = FALSE;
+#ifdef HAVE_RDA
+static gboolean enable_suspend = FALSE;
+#endif /* HAVE_RDA */
static char* logout_command = NULL;
static char* status_message = NULL;
static char* away_message = NULL;
@@ -57,6 +60,9 @@ static GOptionEntry entries[] = {
{"verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, N_("Show debugging output"), NULL},
{"version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL},
{"enable-logout", 0, 0, G_OPTION_ARG_NONE, &enable_logout, N_("Show the logout button"), NULL},
+#ifdef HAVE_RDA
+ {"enable-suspend", 0, 0, G_OPTION_ARG_NONE, &enable_suspend, N_("Show the suspend button if session is remote\n\t\t\t\t and suspension is supported"), NULL},
+#endif /* HAVE_RDA */
{"logout-command", 0, 0, G_OPTION_ARG_STRING, &logout_command, N_("Command to invoke from the logout button"), NULL},
{"enable-switch", 0, 0, G_OPTION_ARG_NONE, &enable_switch, N_("Show the switch user button"), NULL},
{"status-message", 0, 0, G_OPTION_ARG_STRING, &status_message, N_("Message to show in the dialog"), N_("MESSAGE")},
@@ -389,6 +395,13 @@ static gboolean popup_dialog_idle(void)
g_object_set(widget, "logout-enabled", TRUE, NULL);
}
+#ifdef HAVE_RDA
+ if (enable_suspend)
+ {
+ g_object_set(widget, "suspend-enabled", TRUE, NULL);
+ }
+#endif /* HAVE_RDA */
+
if (logout_command)
{
g_object_set(widget, "logout-command", logout_command, NULL);