diff --git a/configure.ac b/configure.ac index bfa9afc24..4748f9b7d 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,7 @@ GTK_REQUIRED=3.22.0 LIBWNCK_REQUIRED=3.4.6 LIBWNCK_PREVIEWS_OPTIONAL=3.32.0 WEATHER_REQUIRED=1.17.0 +RDA_REQUIRED=0.0.3 dnl pkg-config dependency checks @@ -243,6 +244,34 @@ if test "x$have_randr" = "xyes"; then AC_DEFINE(HAVE_RANDR, 1, [Have the Xrandr extension library]) fi +dnl Remote Desktop Awareness + +AC_ARG_ENABLE(rda, + [AS_HELP_STRING([--enable-rda], + [Enable RDA (Remote Desktop Awareness, + default is to enable only if RDA development library is detected)])],, + [enable_rda=$enableval], + [enable_rda=auto]) + +# Check if we have librda installed, and thus should build with Wayland support +have_rda=no +if test "x$enable_rda" != "xno"; then + PKG_CHECK_MODULES(RDA, rda >= $RDA_REQUIRED, have_rda=yes, [ + if test "x$enable_rda" = "xyes"; then + AC_MSG_ERROR([Remote Desktop Awareness enabled but RDA library not found]) + fi + ]) +fi + +AM_CONDITIONAL(ENABLE_RDA, [test "x$have_rda" = "xyes"]) + +if test "x$have_rda" = "xyes"; then + AC_DEFINE(HAVE_RDA, 1, [Have the Remote Desktop Awareness library]) +fi + +AC_SUBST(RDA_CFLAGS) +AC_SUBST(RDA_LIBS) + dnl Modules dir AC_SUBST([modulesdir],"\$(libdir)/mate-panel/modules") @@ -381,6 +410,7 @@ echo " Wayland support: ${have_wayland} X11 support: ${have_x11} XRandr support: ${have_randr} + RDA support: ${have_rda} Build introspection support: ${found_introspection} Build gtk-doc documentation: ${enable_gtk_doc} diff --git a/mate-panel/Makefile.am b/mate-panel/Makefile.am index f2f04d27b..8a1358c92 100644 --- a/mate-panel/Makefile.am +++ b/mate-panel/Makefile.am @@ -15,8 +15,7 @@ AM_CPPFLAGS = \ -I$(top_builddir)/mate-panel/libpanel-util \ -DMATELOCALEDIR=\""$(datadir)/locale"\" \ -DPANELDATADIR=\""$(datadir)/mate-panel"\" \ - $(DISABLE_DEPRECATED_CFLAGS) \ - $(WAYLAND_CFLAGS) + $(DISABLE_DEPRECATED_CFLAGS) AM_CFLAGS = $(WARN_CFLAGS) @@ -145,6 +144,11 @@ mate_panel_CPPFLAGS = \ -DPANEL_MODULES_DIR=\"$(modulesdir)\" \ -DMATEMENU_I_KNOW_THIS_IS_UNSTABLE +if ENABLE_RDA +mate_panel_CPPFLAGS += \ + $(RDA_CFLAGS) +endif + if ENABLE_WAYLAND mate_panel_CPPFLAGS += \ $(WAYLAND_CFLAGS) @@ -157,8 +161,12 @@ mate_panel_LDADD = \ $(PANEL_LIBS) \ $(DCONF_LIBS) \ $(XRANDR_LIBS) \ - $(X_LIBS) \ - $(WAYLAND_LIBS) + $(X_LIBS) + +if ENABLE_RDA +mate_panel_LDADD += \ + $(RDA_LIBS) +endif if ENABLE_WAYLAND mate_panel_LDADD += \ diff --git a/mate-panel/panel-action-button.c b/mate-panel/panel-action-button.c index 7d5bdefaa..87b67cd51 100644 --- a/mate-panel/panel-action-button.c +++ b/mate-panel/panel-action-button.c @@ -34,6 +34,10 @@ #include #include +#ifdef HAVE_RDA +#include +#endif + #define MATE_DESKTOP_USE_UNSTABLE_API #include #include @@ -86,6 +90,9 @@ static const char *panel_action_type [PANEL_ACTION_LAST] = { [PANEL_ACTION_NONE] = "none", [PANEL_ACTION_LOCK] = "lock", [PANEL_ACTION_LOGOUT] = "logout", +#ifdef HAVE_RDA + [PANEL_ACTION_SUSPEND] = "suspend", +#endif [PANEL_ACTION_RUN] = "run", [PANEL_ACTION_SEARCH] = "search", [PANEL_ACTION_FORCE_QUIT] = "force-quit", @@ -213,6 +220,24 @@ panel_action_logout (GtkWidget *widget) PANEL_SESSION_MANAGER_LOGOUT_MODE_NORMAL); } +#ifdef HAVE_RDA +/* Suspend Remote Session + */ +static void +panel_action_suspend (GtkWidget *widget) +{ + + rda_session_suspend(); + +} + +static gboolean +panel_action_suspend_not_supported(void) +{ + return (!rda_session_can_be_suspended()); +} +#endif /* HAVE_RDA */ + static void panel_action_shutdown (GtkWidget *widget) { @@ -361,6 +386,18 @@ static PanelAction actions [PANEL_ACTION_LAST] = { panel_action_logout, NULL, NULL, panel_lockdown_get_disable_log_out }, +#ifdef HAVE_RDA + [PANEL_ACTION_SUSPEND] = { + PANEL_ACTION_SUSPEND, + PANEL_ICON_SUSPEND, + N_("Suspend Session..."), + N_("Suspend the Remote Session and Resume later"), + "gospanel-20", + "ACTION:suspend:NEW", + panel_action_suspend, NULL, NULL, + panel_action_suspend_not_supported + }, +#endif /* HAVE_RDA */ [PANEL_ACTION_RUN] = { PANEL_ACTION_RUN, PANEL_ICON_RUN, diff --git a/mate-panel/panel-enums-gsettings.h b/mate-panel/panel-enums-gsettings.h index 89e8f7e1c..ad75d533b 100644 --- a/mate-panel/panel-enums-gsettings.h +++ b/mate-panel/panel-enums-gsettings.h @@ -70,6 +70,7 @@ typedef enum { PANEL_ACTION_NONE = 0, PANEL_ACTION_LOCK, PANEL_ACTION_LOGOUT, + PANEL_ACTION_SUSPEND, PANEL_ACTION_RUN, PANEL_ACTION_SEARCH, PANEL_ACTION_FORCE_QUIT, diff --git a/mate-panel/panel-icon-names.h b/mate-panel/panel-icon-names.h index 4c948b761..b50f685ac 100644 --- a/mate-panel/panel-icon-names.h +++ b/mate-panel/panel-icon-names.h @@ -1,3 +1,5 @@ +#include + #ifndef PANEL_ICON_NAMES_H #define PANEL_ICON_NAMES_H @@ -21,6 +23,9 @@ #define PANEL_ICON_LAUNCHER "mate-panel-launcher" #define PANEL_ICON_LOCKSCREEN "system-lock-screen" #define PANEL_ICON_LOGOUT "system-log-out" +#ifdef HAVE_RDA +#define PANEL_ICON_SUSPEND "stock_media-pause" +#endif #define PANEL_ICON_MAIN_MENU "start-here" #define PANEL_ICON_NETWORK "network-workgroup" #define PANEL_ICON_NETWORK_SERVER "network-server" diff --git a/mate-panel/panel-menu-items.c b/mate-panel/panel-menu-items.c index aa4c5d1f8..8eb9fd08b 100644 --- a/mate-panel/panel-menu-items.c +++ b/mate-panel/panel-menu-items.c @@ -40,6 +40,9 @@ #include #include #include +#ifdef HAVE_RDA +#include +#endif #include #include @@ -1543,6 +1546,28 @@ panel_menu_items_append_lock_logout (GtkWidget *menu) } g_list_free (children); +#ifdef HAVE_RDA + if (rda_session_can_be_suspended()) + { + + label = g_strdup_printf (_("Suspend %s Session..."), + rda_get_remote_technology_name()); + tooltip = g_strdup_printf (_("Suspend this %s session and resume it later..."), + rda_get_remote_technology_name()); + item = panel_menu_items_create_action_item_full (PANEL_ACTION_SUSPEND, + label, tooltip); + g_free (label); + g_free (tooltip); + + if (item != NULL) { + /* this separator will always be inserted */ + add_menu_separator (menu); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + } + + } +#endif /* HAVE_RDA */ + if (panel_lock_screen_action_available("lock")) { item = panel_menu_items_create_action_item(PANEL_ACTION_LOCK); @@ -1605,6 +1630,9 @@ panel_menu_items_append_lock_logout (GtkWidget *menu) gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); } +#ifdef HAVE_RDA + if (rda_session_is_local()) { +#endif /* HAVE_RDA */ item = panel_menu_items_create_action_item (PANEL_ACTION_SHUTDOWN); if (item != NULL) { if (!separator_inserted) @@ -1612,6 +1640,9 @@ panel_menu_items_append_lock_logout (GtkWidget *menu) gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); } +#ifdef HAVE_RDA + } +#endif /* HAVE_RDA */ } void