From 4c9eaa898b14442d23d3d485c2725af978b35da4 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 7 May 2012 17:36:21 +0100 Subject: [PATCH 1/3] Use TP_ERRORS instead of deprecated TP_ERROR --- src/connection-aliasing.c | 4 ++-- src/connection-avatars.c | 6 +++--- src/connection-mail.c | 4 ++-- src/connection-presence.c | 2 +- src/connection.c | 4 ++-- src/contact-list.c | 2 +- src/im-channel-factory.c | 2 +- src/im-channel.c | 12 ++++++------ src/media-backend.c | 2 +- src/media-channel.c | 22 +++++++++++----------- src/media-manager.c | 2 +- src/media-stream.c | 2 +- src/protocol.c | 6 +++--- 13 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/connection-aliasing.c b/src/connection-aliasing.c index 5a5a276..2c75d65 100644 --- a/src/connection-aliasing.c +++ b/src/connection-aliasing.c @@ -247,7 +247,7 @@ set_aliases_foreach (gpointer key, { DEBUG ("can't set alias for %s to \"%s\": not on contact list", bname, new_alias); - g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED, + g_set_error (&error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "can't set alias for %s to \"%s\": not on contact list", bname, new_alias); } @@ -288,7 +288,7 @@ haze_connection_set_aliases (TpSvcConnectionInterfaceAliasing *self, if (!can_alias (conn)) { - g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "You can't set aliases on this protocol"); dbus_g_method_return_error (context, error); g_error_free (error); diff --git a/src/connection-avatars.c b/src/connection-avatars.c index d1b2289..163f39c 100644 --- a/src/connection-avatars.c +++ b/src/connection-avatars.c @@ -378,7 +378,7 @@ haze_connection_request_avatar (TpSvcConnectionInterfaceAvatars *self, else { DEBUG ("handle %u has no avatar", contact); - g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "handle %u has no avatar", contact); @@ -455,7 +455,7 @@ haze_connection_set_avatar (TpSvcConnectionInterfaceAvatars *self, if (max_filesize > 0 && icon_len > max_filesize) { - g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + g_set_error (&error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "avatar is %" G_GSIZE_FORMAT "B, " "but the limit is %" G_GSIZE_FORMAT "B", icon_len, max_filesize); @@ -484,7 +484,7 @@ haze_connection_set_avatar (TpSvcConnectionInterfaceAvatars *self, if (!acceptable_mime_type) { - g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + g_set_error (&error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "'%s' is not a supported MIME type", mime_type); dbus_g_method_return_error (context, error); diff --git a/src/connection-mail.c b/src/connection-mail.c index 84d5efd..f286c27 100644 --- a/src/connection-mail.c +++ b/src/connection-mail.c @@ -69,7 +69,7 @@ haze_connection_mail_request_inbox_url ( HazeSvcConnectionInterfaceMailNotification *iface, DBusGMethodInvocation *context) { - GError e = {TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED, + GError e = {TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "LibPurple does not provide Inbox URL"}; dbus_g_method_return_error (context, &e); } @@ -86,7 +86,7 @@ haze_connection_mail_request_mail_url ( if (!G_VALUE_HOLDS_STRING (in_url_data)) { - GError e = {TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + GError e = {TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Wrong type for url-data"}; dbus_g_method_return_error (context, &e); return; diff --git a/src/connection-presence.c b/src/connection-presence.c index 3c635e5..f09de62 100644 --- a/src/connection-presence.c +++ b/src/connection-presence.c @@ -184,7 +184,7 @@ _get_contact_statuses (GObject *obj, { DEBUG ("[%s] %s isn't on the blist, ergo no status!", conn->account->username, bname); - g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Presence for %u unknown; subscribe to them first", handle); g_hash_table_destroy (status_table); status_table = NULL; diff --git a/src/connection.c b/src/connection.c index 28eed06..0b272a9 100644 --- a/src/connection.c +++ b/src/connection.c @@ -390,7 +390,7 @@ set_option ( * constructors can't fail. * * Returns: %TRUE if the account was successfully created and hooked up; - * %FALSE with @error set in the TP_ERRORS domain if the account + * %FALSE with @error set in the TP_ERROR domain if the account * already existed or another error occurred. */ gboolean @@ -406,7 +406,7 @@ haze_connection_create_account (HazeConnection *self, if (purple_accounts_find (priv->username, priv->prpl_id) != NULL) { - g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "a connection already exists to %s on %s", priv->username, priv->prpl_id); return FALSE; diff --git a/src/contact-list.c b/src/contact-list.c index 80f26c6..60eda63 100644 --- a/src/contact-list.c +++ b/src/contact-list.c @@ -739,7 +739,7 @@ haze_contact_list_prep_remove_from_group (HazeContactList *self, if (default_group == group) { - g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Contacts can't be removed from '%s' unless they are in " "another group", group->name); return FALSE; diff --git a/src/im-channel-factory.c b/src/im-channel-factory.c index 44df761..fee7990 100644 --- a/src/im-channel-factory.c +++ b/src/im-channel-factory.c @@ -596,7 +596,7 @@ haze_im_channel_factory_request (HazeImChannelFactory *self, if (require_new) { tp_channel_manager_emit_request_failed (self, request_token, - TP_ERRORS, TP_ERROR_NOT_AVAILABLE, "Channel already exists"); + TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Channel already exists"); } else { diff --git a/src/im-channel.c b/src/im-channel.c index 4c8545b..9dbc43a 100644 --- a/src/im-channel.c +++ b/src/im-channel.c @@ -283,7 +283,7 @@ haze_im_channel_set_chat_state (TpSvcChannelInterfaceChatState *self, { case TP_CHANNEL_CHAT_STATE_GONE: DEBUG ("The Gone state may not be explicitly set"); - g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + g_set_error (&error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "The Gone state may not be explicitly set"); break; case TP_CHANNEL_CHAT_STATE_INACTIVE: @@ -298,7 +298,7 @@ haze_im_channel_set_chat_state (TpSvcChannelInterfaceChatState *self, break; default: DEBUG ("Invalid chat state: %u", state); - g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + g_set_error (&error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Invalid chat state: %u", state); } @@ -356,7 +356,7 @@ haze_im_channel_send (GObject *obj, if (tp_message_count_parts (message) != 2) { - error = g_error_new (TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "messages must have a single plain-text part"); goto err; } @@ -370,14 +370,14 @@ haze_im_channel_send (GObject *obj, if (tp_strdiff (content_type, "text/plain")) { - error = g_error_new (TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "messages must have a single plain-text part"); goto err; } if (text == NULL) { - error = g_error_new (TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + error = g_error_new (TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "message body must be a UTF-8 string"); goto err; } @@ -401,7 +401,7 @@ haze_im_channel_send (GObject *obj, * support TP_CHANNEL_TEXT_MESSAGE_TYPE_NOTICE. */ default: - error = g_error_new (TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED, + error = g_error_new (TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "unsupported message type: %u", type); goto err; } diff --git a/src/media-backend.c b/src/media-backend.c index 1d231e7..ec40af9 100644 --- a/src/media-backend.c +++ b/src/media-backend.c @@ -553,7 +553,7 @@ haze_media_backend_error (TpSvcMediaSessionHandler *iface, * error message describes the only legitimate situation in which this * could arise. */ - GError e = { TP_ERRORS, TP_ERROR_NOT_AVAILABLE, "call has already ended" }; + GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE, "call has already ended" }; DEBUG ("no session, returning an error."); dbus_g_method_return_error (context, &e); diff --git a/src/media-channel.c b/src/media-channel.c index 5e7f165..8fadea4 100644 --- a/src/media-channel.c +++ b/src/media-channel.c @@ -265,7 +265,7 @@ pending_stream_request_free (gpointer data) if (p->context != NULL) { - GError e = { TP_ERRORS, TP_ERROR_CANCELLED, + GError e = { TP_ERROR, TP_ERROR_CANCELLED, "The session terminated before the requested streams could be added" }; @@ -1179,7 +1179,7 @@ haze_media_channel_remove_streams (TpSvcChannelTypeStreamedMedia *iface, GError *e; g_object_get (base_conn, "protocol", &name, NULL); - g_set_error (&e, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED, + g_set_error (&e, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Streams can't be removed in Haze's \"%s\" protocol's calls", name); g_free (name); @@ -1216,7 +1216,7 @@ haze_media_channel_remove_streams (TpSvcChannelTypeStreamedMedia *iface, if (j >= backend_streams->len) { - GError e = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Requested stream wasn't found" }; DEBUG ("%s", e.message); dbus_g_method_return_error (context, &e); @@ -1261,7 +1261,7 @@ haze_media_channel_request_stream_direction (TpSvcChannelTypeStreamedMedia *ifac DBusGMethodInvocation *context) { /* Libpurple doesn't have API for this yet */ - GError e = { TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED, + GError e = { TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Stream direction can't be set Haze calls" }; DEBUG ("%s", e.message); dbus_g_method_return_error (context, &e); @@ -1327,7 +1327,7 @@ _haze_media_channel_request_contents (HazeMediaChannel *chan, } else { - g_set_error (error, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED, + g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "given media type %u is invalid", media_type); return FALSE; } @@ -1348,7 +1348,7 @@ _haze_media_channel_request_contents (HazeMediaChannel *chan, gchar *name; g_object_get (base_conn, "protocol", &name, NULL); - g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Streams can't be added in Haze's \"%s\" protocol's calls", name); @@ -1360,7 +1360,7 @@ _haze_media_channel_request_contents (HazeMediaChannel *chan, if ((want_audio == FALSE || caps & PURPLE_MEDIA_CAPS_AUDIO) && (want_video == FALSE || caps & PURPLE_MEDIA_CAPS_VIDEO)) { - g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Member does not have the desired audio/video capabilities"); return FALSE; } @@ -1442,7 +1442,7 @@ media_channel_request_streams (HazeMediaChannel *self, if (peer != contact_handle) { - g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "cannot add streams for %u: this channel's peer is %u", contact_handle, peer); goto error; @@ -1581,7 +1581,7 @@ haze_media_channel_add_member (GObject *obj, if (peer != handle) { - g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "handle %u cannot be added: this channel's peer is %u", handle, peer); return FALSE; @@ -1611,7 +1611,7 @@ haze_media_channel_add_member (GObject *obj, /* is the call on hold? */ if (priv->hold_state != TP_LOCAL_HOLD_STATE_UNHELD) { - g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Can't answer a call while it's on hold"); return FALSE; } @@ -1630,7 +1630,7 @@ haze_media_channel_add_member (GObject *obj, } } - g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + g_set_error (error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "handle %u cannot be added in the current state", handle); return FALSE; } diff --git a/src/media-manager.c b/src/media-manager.c index fddd63a..3df771c 100644 --- a/src/media-manager.c +++ b/src/media-manager.c @@ -478,7 +478,7 @@ haze_media_manager_requestotron (TpChannelManager *manager, /* already checked by TpBaseConnection */ g_assert (handle == 0); - g_set_error (&error, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED, + g_set_error (&error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "A valid Contact handle must be provided when requesting a media " "channel"); diff --git a/src/media-stream.c b/src/media-stream.c index 50dde5b..7b4f29f 100644 --- a/src/media-stream.c +++ b/src/media-stream.c @@ -1345,7 +1345,7 @@ haze_media_stream_codecs_updated (TpSvcMediaStreamHandler *iface, if (self->priv->codecs == NULL) { - GError e = { TP_ERRORS, TP_ERROR_NOT_AVAILABLE, + GError e = { TP_ERROR, TP_ERROR_NOT_AVAILABLE, "CodecsUpdated may only be called once an initial set of codecs " "has been set" }; diff --git a/src/protocol.c b/src/protocol.c index 13dc8ae..6fd279e 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -285,7 +285,7 @@ _param_filter_no_blanks (const TpCMParamSpec *paramspec, if (*str == '\0') { - g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Account parameter '%s' must not be empty", paramspec->name); return FALSE; @@ -293,7 +293,7 @@ _param_filter_no_blanks (const TpCMParamSpec *paramspec, if (strstr (str, " ") != NULL) { - g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "Account parameter '%s' may not contain spaces", paramspec->name); return FALSE; @@ -318,7 +318,7 @@ _param_filter_string_list (const TpCMParamSpec *paramspec, != NULL) return TRUE; - g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "'%s' is not a valid value for parameter '%s'", str, paramspec->name); return FALSE; } -- 1.7.10