summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mate-panel/libmate-panel-applet-private/panel-applets-manager-dbus.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/mate-panel/libmate-panel-applet-private/panel-applets-manager-dbus.c b/mate-panel/libmate-panel-applet-private/panel-applets-manager-dbus.c
index 496190b7..00c8a6f3 100644
--- a/mate-panel/libmate-panel-applet-private/panel-applets-manager-dbus.c
+++ b/mate-panel/libmate-panel-applet-private/panel-applets-manager-dbus.c
@@ -31,6 +31,13 @@
#include "panel-applet-frame-dbus.h"
#include "panel-applets-manager-dbus.h"
+#ifdef HAVE_X11
+#include "gdk/gdkx.h"
+#endif
+#ifdef HAVE_WAYLAND
+#include "gdk/gdkwayland.h"
+#endif
+
struct _MatePanelAppletsManagerDBusPrivate
{
GHashTable *applet_factories;
@@ -439,6 +446,7 @@ mate_panel_applets_manager_dbus_factory_activate (MatePanelAppletsManager *manag
const gchar *iid)
{
MatePanelAppletFactoryInfo *info;
+ MatePanelAppletInfo *applet_info;
ActivateAppletFunc activate_applet;
GetAppletWidgetFunc get_applet_widget;
@@ -446,6 +454,23 @@ mate_panel_applets_manager_dbus_factory_activate (MatePanelAppletsManager *manag
if (!info)
return FALSE;
+ applet_info = MATE_PANEL_APPLETS_MANAGER_GET_CLASS (manager)->get_applet_info (manager, iid);
+ g_return_val_if_fail (applet_info, FALSE);
+#ifdef HAVE_X11
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()) &&
+ !mate_panel_applet_info_get_x11_supported (applet_info)) {
+ g_warning ("Failed to load %p, because it does not support X11", iid);
+ return FALSE;
+ }
+#endif
+#ifdef HAVE_WAYLAND
+ if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()) &&
+ !mate_panel_applet_info_get_wayland_supported (applet_info)) {
+ g_warning ("Failed to load %p, because it does not support Wayland", iid);
+ return FALSE;
+ }
+#endif
+
/* Out-of-process applets are activated by the session bus */
if (!info->in_process)
return TRUE;