pidgin/pidgin

Parents 1c33866c1ae9
Children e76677ed819c
connection: Drop description argument from purple_connection_g_error()

purple_connection_g_error() had a description argument in order to
simply prefix the message before passing it off to
purple_connection_error(). I've since discovered that g_prefix_error()
exists, which provides the same functionality in a standardized way.

This patch removes the description argument from
purple_connection_g_error() in favor of g_prefix_error() and updates
any uses of the former to use the latter.
--- a/libpurple/connection.c Fri Aug 26 00:00:52 2016 -0500
+++ b/libpurple/connection.c Fri Aug 26 03:04:41 2016 -0500
@@ -543,11 +543,9 @@
}
void
-purple_connection_g_error(PurpleConnection *pc, const GError *error,
- const gchar *description)
+purple_connection_g_error(PurpleConnection *pc, const GError *error)
{
PurpleConnectionError reason;
- gchar *tmp;
if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
/* Not a connection error. Ignore. */
@@ -578,9 +576,7 @@
reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
}
- tmp = g_strdup_printf(description, error->message);
- purple_connection_error(pc, reason, tmp);
- g_free(tmp);
+ purple_connection_error(pc, reason, error->message);
}
gboolean
--- a/libpurple/connection.h Fri Aug 26 00:00:52 2016 -0500
+++ b/libpurple/connection.h Fri Aug 26 03:04:41 2016 -0500
@@ -510,8 +510,6 @@
* purple_connection_g_error
* @gc: Connection the error is associated with
* @error: Error information
- * @description: Extra string which further explains the error.
- * Substitutes a "%s" with the GError message.
*
* Closes a connection similar to purple_connection_error(), but
* takes a GError which is then converted to purple error codes.
@@ -524,8 +522,7 @@
*/
void
purple_connection_g_error(PurpleConnection *pc,
- const GError *error,
- const gchar *description);
+ const GError *error);
/**
* purple_connection_error_is_fatal:
--- a/libpurple/protocols/irc/irc.c Fri Aug 26 00:00:52 2016 -0500
+++ b/libpurple/protocols/irc/irc.c Fri Aug 26 03:04:41 2016 -0500
@@ -107,8 +107,8 @@
res, &error);
if (!result) {
- purple_connection_g_error(gc, error,
- _("Lost connection with server: %s"));
+ g_prefix_error(&error, _("Lost connection with server: "));
+ purple_connection_g_error(gc, error);
g_clear_error(&error);
return;
}
@@ -427,8 +427,8 @@
res, &error);
if (conn == NULL) {
- purple_connection_g_error(gc, error,
- _("Unable to connect: %s"));
+ g_prefix_error(&error, _("Unable to connect: "));
+ purple_connection_g_error(gc, error);
g_clear_error(&error);
return;
}
@@ -598,8 +598,8 @@
G_DATA_INPUT_STREAM(source), res, &len, &error);
if (line == NULL && error != NULL) {
- purple_connection_g_error(gc, error,
- _("Lost connection with server: %s"));
+ g_prefix_error(&error, _("Lost connection with server: "));
+ purple_connection_g_error(gc, error);
g_clear_error(&error);
return;
} else if (line == NULL) {