Mercurial > pidgin.yaz
comparison libpurple/media.c @ 26058:0ad1b8e950d7
Add purple_media_error.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Tue, 16 Dec 2008 00:53:59 +0000 |
parents | 584a4f5ce4dc |
children | 18b71033ea6e |
comparison
equal
deleted
inserted
replaced
26057:584a4f5ce4dc | 26058:0ad1b8e950d7 |
---|---|
105 static GObjectClass *parent_class = NULL; | 105 static GObjectClass *parent_class = NULL; |
106 | 106 |
107 | 107 |
108 | 108 |
109 enum { | 109 enum { |
110 ERROR, | |
110 READY, | 111 READY, |
111 WAIT, | 112 WAIT, |
112 ACCEPTED, | 113 ACCEPTED, |
113 HANGUP, | 114 HANGUP, |
114 REJECT, | 115 REJECT, |
181 g_param_spec_pointer("connection", | 182 g_param_spec_pointer("connection", |
182 "Connection", | 183 "Connection", |
183 "The PurpleConnection associated with this session", | 184 "The PurpleConnection associated with this session", |
184 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); | 185 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); |
185 | 186 |
187 purple_media_signals[ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass), | |
188 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | |
189 g_cclosure_marshal_VOID__STRING, | |
190 G_TYPE_NONE, 1, G_TYPE_STRING); | |
186 purple_media_signals[READY] = g_signal_new("ready", G_TYPE_FROM_CLASS(klass), | 191 purple_media_signals[READY] = g_signal_new("ready", G_TYPE_FROM_CLASS(klass), |
187 G_SIGNAL_RUN_LAST, 0, NULL, NULL, | 192 G_SIGNAL_RUN_LAST, 0, NULL, NULL, |
188 g_cclosure_marshal_VOID__VOID, | 193 g_cclosure_marshal_VOID__VOID, |
189 G_TYPE_NONE, 0); | 194 G_TYPE_NONE, 0); |
190 purple_media_signals[WAIT] = g_signal_new("wait", G_TYPE_FROM_CLASS(klass), | 195 purple_media_signals[WAIT] = g_signal_new("wait", G_TYPE_FROM_CLASS(klass), |
763 g_object_get(G_OBJECT(media), "screenname", &ret, NULL); | 768 g_object_get(G_OBJECT(media), "screenname", &ret, NULL); |
764 return ret; | 769 return ret; |
765 } | 770 } |
766 | 771 |
767 void | 772 void |
773 purple_media_error(PurpleMedia *media, const gchar *error, ...) | |
774 { | |
775 va_list args; | |
776 gchar *message; | |
777 | |
778 va_start(args, error); | |
779 message = g_strdup_vprintf(error, args); | |
780 va_end(args); | |
781 | |
782 purple_debug_error("media", "%s\n", message); | |
783 g_signal_emit(media, purple_media_signals[ERROR], 0, message); | |
784 | |
785 g_free(message); | |
786 } | |
787 | |
788 void | |
768 purple_media_ready(PurpleMedia *media) | 789 purple_media_ready(PurpleMedia *media) |
769 { | 790 { |
770 g_signal_emit(media, purple_media_signals[READY], 0); | 791 g_signal_emit(media, purple_media_signals[READY], 0); |
771 } | 792 } |
772 | 793 |
1138 session = g_new0(PurpleMediaSession, 1); | 1159 session = g_new0(PurpleMediaSession, 1); |
1139 | 1160 |
1140 session->session = fs_conference_new_session(media->priv->conference, type, &err); | 1161 session->session = fs_conference_new_session(media->priv->conference, type, &err); |
1141 | 1162 |
1142 if (err != NULL) { | 1163 if (err != NULL) { |
1143 purple_debug_error("media", "Error creating session: %s\n", err->message); | 1164 purple_media_error(media, "Error creating session: %s\n", err->message); |
1144 g_error_free(err); | 1165 g_error_free(err); |
1145 purple_conv_present_error(who, | |
1146 purple_connection_get_account(purple_media_get_connection(media)), | |
1147 _("Error creating session.")); | |
1148 g_free(session); | 1166 g_free(session); |
1149 return FALSE; | 1167 return FALSE; |
1150 } | 1168 } |
1151 | 1169 |
1152 /* XXX: SPEEX has a latency of 5 or 6 seconds for me */ | 1170 /* XXX: SPEEX has a latency of 5 or 6 seconds for me */ |