# HG changeset patch
# Node ID e47f4ea283a6
# Parent  4784cd60a1f8
diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -30,6 +30,8 @@
 #include "debug.h"
 #include "plugins.h"
 #include "purpleenums.h"
+#include "purplenotification.h"
+#include "purplenotificationmanager.h"
 #include "signals.h"
 #include "util.h"
 #ifdef _WIN32
@@ -424,8 +426,9 @@
 
 	for (l = files; l; l = l->next)
 	{
+		PurplePlugin *plugin;
+		GError *error = NULL;
 		char *file;
-		PurplePlugin *plugin;
 
 		if (l->data == NULL)
 			continue;
@@ -434,10 +437,38 @@
 		plugin = purple_plugins_find_by_filename(file);
 
 		if (plugin) {
-			purple_debug_info("plugins", "Loading saved plugin %s\n", file);
-			purple_plugin_load(plugin, NULL);
+			purple_debug_info("plugins", "Loading saved plugin %s", file);
+			purple_plugin_load(plugin, &error);
 		} else {
-			purple_debug_error("plugins", "Unable to find saved plugin %s\n", file);
+			error = g_error_new(PURPLE_PLUGINS_DOMAIN, 0,
+			                    _("Unable to find saved plugin %s"), file);
+			purple_debug_error("plugins", "Unable to find saved plugin %s", file);
+		}
+
+		if(error != NULL) {
+			PurpleNotification *notification = NULL;
+			PurpleNotificationManager *manager = NULL;
+			char *msg = NULL;
+			char *title = NULL;
+
+			if(error->message != NULL) {
+				msg = g_strdup(error->message);
+			} else {
+				msg = g_strdup(_("Unknown error"));
+			}
+			g_clear_error(&error);
+
+			notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC,
+			                                       NULL, msg, g_free);
+
+			purple_notification_set_icon_name(notification,
+			                                  "dialog-error-symbolic");
+			title = g_strdup_printf(_("Failed to load saved plugin %s"), file);
+			purple_notification_set_title(notification, title);
+			g_free(title);
+
+			manager = purple_notification_manager_get_default();
+			purple_notification_manager_add(manager, notification);
 		}
 
 		g_free(l->data);
diff --git a/pidgin/pidginnotificationlist.c b/pidgin/pidginnotificationlist.c
--- a/pidgin/pidginnotificationlist.c
+++ b/pidgin/pidginnotificationlist.c
@@ -41,6 +41,17 @@
 /******************************************************************************
  * Helpers
  *****************************************************************************/
+static gboolean
+pidgin_notification_gpointer_to_char(G_GNUC_UNUSED GBinding *binding,
+                                     const GValue *from_value,
+                                     GValue *to_value,
+                                     G_GNUC_UNUSED gpointer user_data)
+{
+	g_value_set_string(to_value, (char *)g_value_get_pointer(from_value));
+
+	return TRUE;
+}
+
 static GtkWidget *
 pidgin_notification_list_unknown_notification(PurpleNotification *notification) {
 	GtkWidget *widget = NULL;
@@ -65,6 +76,25 @@
 }
 
 static GtkWidget *
+pidgin_notification_generic_new(PurpleNotification *notification) {
+	GtkWidget *row = NULL;
+
+	row = adw_action_row_new();
+	g_object_bind_property(notification, "title", row, "title",
+	                       G_BINDING_SYNC_CREATE);
+	g_object_bind_property(notification, "icon-name", row, "icon-name",
+	                       G_BINDING_SYNC_CREATE);
+	g_object_bind_property_full(notification, "data", row, "subtitle",
+	                            G_BINDING_SYNC_CREATE,
+	                            pidgin_notification_gpointer_to_char,
+	                            NULL,
+	                            NULL,
+	                            NULL);
+
+	return row;
+}
+
+static GtkWidget *
 pidgin_notification_list_create_widget_func(gpointer item,
                                             G_GNUC_UNUSED gpointer data)
 {
@@ -72,6 +102,9 @@
 	GtkWidget *widget = NULL;
 
 	switch(purple_notification_get_notification_type(notification)) {
+		case PURPLE_NOTIFICATION_TYPE_GENERIC:
+			widget = pidgin_notification_generic_new(notification);
+			break;
 		case PURPLE_NOTIFICATION_TYPE_CONNECTION_ERROR:
 			widget = pidgin_notification_connection_error_new(notification);
 			break;
