libpurple/purplenotificationconnectionerror.c

changeset 43004
06521648500e
parent 43001
a4b2110b2908
child 43008
d46e90e0757a
--- a/libpurple/purplenotificationconnectionerror.c	Mon Oct 14 20:34:15 2024 -0500
+++ b/libpurple/purplenotificationconnectionerror.c	Mon Oct 14 22:54:33 2024 -0500
@@ -28,18 +28,14 @@
 
 struct _PurpleNotificationConnectionError {
 	PurpleNotification parent;
-
-	PurpleConnectionErrorInfo *info;
 };
 
 enum {
 	PROP_0,
-	PROP_ERROR_INFO,
 	N_PROPERTIES,
 	/* Overrides */
 	PROP_ACCOUNT,
 };
-static GParamSpec *properties[N_PROPERTIES] = {NULL, };
 
 static void
 purple_notification_connection_error_error_notify_cb(GObject *self,
@@ -52,15 +48,15 @@
 static void
 purple_notification_connection_error_update(PurpleNotification *notification) {
 	PurpleAccount *account = NULL;
-	const PurpleConnectionErrorInfo *error = NULL;
 	PurpleProtocol *protocol = NULL;
+	GError *error = NULL;
 	GObject *obj = G_OBJECT(notification);
 	char *title = NULL;
 	const char *icon_name = "network-error-symbolic";
 	const char *subtitle = NULL;
 
 	account = purple_notification_get_account(notification);
-	error = purple_account_get_error_info(account);
+	error = purple_account_get_error(account);
 
 	protocol = purple_account_get_protocol(account);
 	if(PURPLE_IS_PROTOCOL(protocol)) {
@@ -73,7 +69,7 @@
 	} else {
 		title = g_strdup_printf(_("%s disconnected"),
 		                      purple_account_get_username(account));
-		subtitle = error->description;
+		subtitle = error->message;
 	}
 
 	g_object_freeze_notify(obj);
@@ -86,22 +82,6 @@
 }
 
 static void
-purple_notification_connection_error_set_error_info(PurpleNotificationConnectionError *error,
-                                                    PurpleConnectionErrorInfo *info)
-{
-	if(error->info == info) {
-		return;
-	}
-
-	g_clear_pointer(&error->info, purple_connection_error_info_free);
-	if(info != NULL) {
-		error->info = purple_connection_error_info_copy(info);
-	}
-
-	g_object_notify_by_pspec(G_OBJECT(error), properties[PROP_ERROR_INFO]);
-}
-
-static void
 purple_notification_connection_error_set_account(PurpleNotificationConnectionError *error,
                                                  PurpleAccount *account)
 {
@@ -147,16 +127,6 @@
                     PURPLE_TYPE_NOTIFICATION)
 
 static void
-purple_notification_connection_error_finalize(GObject *obj) {
-	PurpleNotificationConnectionError *error = NULL;
-
-	error = PURPLE_NOTIFICATION_CONNECTION_ERROR(obj);
-	g_clear_pointer(&error->info, purple_connection_error_info_free);
-
-	G_OBJECT_CLASS(purple_notification_connection_error_parent_class)->finalize(obj);
-}
-
-static void
 purple_notification_connection_error_get_property(GObject *obj, guint param_id,
                                                   GValue *value,
                                                   GParamSpec *pspec)
@@ -185,10 +155,6 @@
 	error = PURPLE_NOTIFICATION_CONNECTION_ERROR(obj);
 
 	switch(param_id) {
-	case PROP_ERROR_INFO:
-		purple_notification_connection_error_set_error_info(error,
-		                                                    g_value_get_boxed(value));
-		break;
 	/* Overrides */
 	case PROP_ACCOUNT:
 		purple_notification_connection_error_set_account(error,
@@ -210,24 +176,9 @@
 {
 	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
 
-	obj_class->finalize = purple_notification_connection_error_finalize;
 	obj_class->get_property = purple_notification_connection_error_get_property;
 	obj_class->set_property = purple_notification_connection_error_set_property;
 
-	/**
-	 * PurpleNotificationConnectionError:info:
-	 *
-	 * The [type@ConnectionErrorInfo] that this notification is for.
-	 *
-	 * Since: 3.0
-	 */
-	properties[PROP_ERROR_INFO] = g_param_spec_boxed(
-		"info", NULL, NULL,
-		PURPLE_TYPE_CONNECTION_ERROR_INFO,
-		G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
-
-	g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
-
 	g_object_class_override_property(obj_class, PROP_ACCOUNT, "account");
 }
 
@@ -236,16 +187,13 @@
  *****************************************************************************/
 PurpleNotification *
 purple_notification_connection_error_new(const char *id,
-                                         PurpleAccount *account,
-                                         PurpleConnectionErrorInfo *info)
+                                         PurpleAccount *account)
 {
 	g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
-	g_return_val_if_fail(info != NULL, NULL);
 
 	return g_object_new(
 		PURPLE_TYPE_NOTIFICATION_CONNECTION_ERROR,
 		"id", id,
 		"account", account,
-		"info", info,
 		NULL);
 }

mercurial