summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wold <[email protected]>2019-06-18 06:54:58 +0000
committerraveit65 <[email protected]>2019-06-20 08:15:12 +0200
commita1c2e4d8f3f81e0d75bb0ae2da4f96dbee2906d7 (patch)
treedd4dd7923533b17c6d2b9c8df9915399dd5140bb
parent59b36542a9cb4c1265cb2395ca3256ee812dd5d8 (diff)
downloadmate-panel-a1c2e4d8f3f81e0d75bb0ae2da4f96dbee2906d7.tar.bz2
mate-panel-a1c2e4d8f3f81e0d75bb0ae2da4f96dbee2906d7.tar.xz
Error in the correct place when applets are loaded on a platform they don't support
-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;