Update libpurple for the Purple.Notification deprecations

Tue, 10 Sep 2024 02:03:43 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 10 Sep 2024 02:03:43 -0500
changeset 42931
9e8b9ee3cfbb
parent 42930
2f883972e245
child 42932
766a92094ed2

Update libpurple for the Purple.Notification deprecations

Testing Done:
Compiled and verified there were no more deprecation warnings for notifications in libpurple.

Bugs closed: PIDGIN-17941

Reviewed at https://reviews.imfreedom.org/r/3478/

libpurple/plugins.c file | annotate | diff | comparison | revisions
libpurple/plugins/hello-world/hello_world.c file | annotate | diff | comparison | revisions
libpurple/purpleaccount.c file | annotate | diff | comparison | revisions
libpurple/purplecredentialmanager.c file | annotate | diff | comparison | revisions
libpurple/reference/tut_c_plugins.md file | annotate | diff | comparison | revisions
--- a/libpurple/plugins.c	Tue Sep 10 01:34:35 2024 -0500
+++ b/libpurple/plugins.c	Tue Sep 10 02:03:43 2024 -0500
@@ -447,28 +447,28 @@
 		if(error != NULL) {
 			PurpleNotification *notification = NULL;
 			PurpleNotificationManager *manager = NULL;
-			char *msg = NULL;
+			const char *msg = NULL;
 			char *title = NULL;
 
 			if(error->message != NULL) {
-				msg = g_strdup(error->message);
+				msg = error->message;
 			} else {
-				msg = g_strdup(_("Unknown error"));
+				msg = _("Unknown error");
 			}
-			g_clear_error(&error);
 
-			notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC,
-			                                       NULL, msg, g_free);
+			title = g_strdup_printf(_("Failed to load saved plugin %s"), file);
+			notification = purple_notification_new_generic(NULL, title);
+			g_free(title);
 
+			purple_notification_set_subtitle(notification, msg);
 			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_clear_object(&notification);
+
+			g_clear_error(&error);
 		}
 
 		g_free(l->data);
--- a/libpurple/plugins/hello-world/hello_world.c	Tue Sep 10 01:34:35 2024 -0500
+++ b/libpurple/plugins/hello-world/hello_world.c	Tue Sep 10 02:03:43 2024 -0500
@@ -26,9 +26,7 @@
 	PurpleNotification *notification = NULL;
 	PurpleNotificationManager *manager = NULL;
 
-	notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC,
-	                                       NULL, NULL, NULL);
-	purple_notification_set_title(notification, "Hello World!");
+	notification = purple_notification_new_generic(NULL, "Hello World!");
 	purple_notification_set_subtitle(notification,
 	                                 "This is the Hello World! plugin :)");
 
--- a/libpurple/purpleaccount.c	Tue Sep 10 01:34:35 2024 -0500
+++ b/libpurple/purpleaccount.c	Tue Sep 10 02:03:43 2024 -0500
@@ -1106,14 +1106,13 @@
 		PurpleNotificationManager *manager = NULL;
 		char *value = NULL;
 
-		notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC,
-		                                       account, NULL, NULL);
-
 		value = g_strdup_printf(_("Failed to load account '%s'"),
 		                        account->username);
-		purple_notification_set_title(notification, value);
+		notification = purple_notification_new_generic(NULL, value);
 		g_free(value);
 
+		purple_notification_set_account(notification, account);
+
 		value = g_strdup_printf(_("Failed to find a protocol with id '%s'"),
 		                        account->protocol_id);
 		purple_notification_set_subtitle(notification, value);
--- a/libpurple/purplecredentialmanager.c	Tue Sep 10 01:34:35 2024 -0500
+++ b/libpurple/purplecredentialmanager.c	Tue Sep 10 02:03:43 2024 -0500
@@ -145,19 +145,17 @@
 		if(!purple_credential_manager_set_active(manager, id, &error)) {
 			PurpleNotification *notification = NULL;
 			PurpleNotificationManager *manager = NULL;
+			const char *title = NULL;
 
 			g_warning("Failed to make %s the active credential provider : %s",
 			          id, error != NULL ? error->message : "unknown error");
 
-			notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC,
-			                                       NULL, NULL, NULL);
-			purple_notification_set_title(notification,
-			                              _("Failed to load the selected "
-			                                "credential provider."));
-			purple_notification_set_subtitle(notification,
-			                                 _("Check your system "
-			                                   "configuration or select "
-			                                   "another one in preferences"));
+			title = _("Failed to load the selected credential provider.");
+			notification = purple_notification_new_generic(NULL, title);
+
+			title = _("Check your system configuration or select another one "
+			          "in preferences");
+			purple_notification_set_subtitle(notification, title);
 
 			manager = purple_notification_manager_get_default();
 			purple_notification_manager_add(manager, notification);
--- a/libpurple/reference/tut_c_plugins.md	Tue Sep 10 01:34:35 2024 -0500
+++ b/libpurple/reference/tut_c_plugins.md	Tue Sep 10 02:03:43 2024 -0500
@@ -45,9 +45,7 @@
 	PurpleNotification *notification = NULL;
 	PurpleNotificationManager *manager = NULL;
 
-	notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC,
-	                                       NULL, NULL, NULL);
-	purple_notification_set_title(notification, "Hello World!");
+	notification = purple_notification_new_generic(NULL, "Hello World!");
 	purple_notification_set_subtitle(notification,
 	                                 "This is the Hello World! plugin :)");
 

mercurial