Changeset 2204
- Timestamp:
- 06/18/07 13:29:38
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-send-queue.c (modified) (9 diffs)
- trunk/libtinymail/tny-header.c (modified) (1 diff)
- trunk/libtinymail/tny-send-queue.c (modified) (2 diffs)
- trunk/libtinymail/tny-signals-marshal.list (modified) (1 diff)
- trunk/tests/c-demo/tny-demoui-summary-view.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r2201 r2204 3 3 * Fixed the From and the Error reporting when sending messages 4 4 * Fixed the support for Yahoo's SMTP 5 * Added some more information to the error-happened signal for 6 TnySendQueue 7 8 * This was a major API change 5 9 6 10 2007-06-17 Philip Van Hoof <pvanhoof@gnome.org> trunk/libtinymail-camel/tny-camel-send-queue.c
r2200 r2204 48 48 typedef struct { 49 49 TnySendQueue *self; 50 TnyMsg *msg; 50 TnyMsg *msg; 51 TnyHeader *header; 51 52 GError *error; 52 53 gint i, total; … … 58 59 ErrorInfo *info = data; 59 60 g_signal_emit (info->self, tny_send_queue_signals [TNY_SEND_QUEUE_ERROR_HAPPENED], 60 0, info-> msg, info->error);61 0, info->header, info->msg, info->error); 61 62 return FALSE; 62 63 } … … 78 79 79 80 static void 80 emit_error (TnySendQueue *self, Tny Msg *msg, GError *error, int i, int total)81 emit_error (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, GError *error, int i, int total) 81 82 { 82 83 ErrorInfo *info = g_slice_new0 (ErrorInfo); … … 88 89 if (msg) 89 90 info->msg = TNY_MSG (g_object_ref (G_OBJECT (msg))); 91 if (header) 92 info->header = TNY_HEADER (g_object_ref (G_OBJECT (header))); 90 93 91 94 info->i = i; … … 122 125 if (terror != NULL) 123 126 { 124 emit_error (self, NULL, terror, i, priv->total);127 emit_error (self, NULL, NULL, terror, i, priv->total); 125 128 g_error_free (terror); 126 129 g_object_unref (G_OBJECT (list)); … … 155 158 if (ferror != NULL) 156 159 { 157 emit_error (self, msg, ferror, i, priv->total);160 emit_error (self, NULL, NULL, ferror, i, priv->total); 158 161 g_error_free (ferror); 159 162 g_object_unref (G_OBJECT (headers)); … … 191 194 tny_list_prepend (hassent, G_OBJECT (header)); 192 195 msg = tny_folder_get_msg (outbox, header, &err); 193 g_object_unref (G_OBJECT (header)); 196 197 /* hassent is owner now */ 198 g_object_unref (G_OBJECT (header)); 194 199 195 200 if (err == NULL) … … 198 203 199 204 if (err != NULL) { 200 emit_error (self, msg, err, i, priv->total);205 emit_error (self, header, msg, err, i, priv->total); 201 206 priv->do_continue = FALSE; 202 207 } 203 208 } else { 204 emit_error (self, msg, err, i, priv->total);209 emit_error (self, header, msg, err, i, priv->total); 205 210 priv->do_continue = FALSE; 206 211 } … … 214 219 if (newerr != NULL) 215 220 { 216 emit_error (self, msg, newerr, i, priv->total);221 emit_error (self, header, msg, newerr, i, priv->total); 217 222 priv->do_continue = FALSE; 218 223 g_error_free (newerr); trunk/libtinymail/tny-header.c
r2182 r2204 553 553 type = g_type_register_static (G_TYPE_INTERFACE, 554 554 "TnyHeader", &info, 0); 555 g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); 556 555 557 } 556 558 trunk/libtinymail/tny-send-queue.c
r2199 r2204 163 163 * TnySendQueue::error-happened 164 164 * @self: the object on which the signal is emitted 165 * @arg1: The message that was supposed to be sent or NULL 166 * @arg2: a GError containing the error that happened 167 * @arg5: user data 165 * @arg1: The header of the message that was supposed to be sent or NULL 166 * @arg2: The message that was supposed to be sent or NULL 167 * @arg3: a GError containing the error that happened 168 * @arg4: user data 168 169 * 169 170 * … … 176 177 G_STRUCT_OFFSET (TnySendQueueIface, error_happened), 177 178 NULL, NULL, 178 tny_marshal_VOID__POINTER_POINTER ,179 G_TYPE_NONE, 2, TNY_TYPE_MSG, G_TYPE_POINTER);179 tny_marshal_VOID__POINTER_POINTER_POINTER, 180 G_TYPE_NONE, 3, TNY_TYPE_HEADER, TNY_TYPE_MSG, G_TYPE_POINTER); 180 181 181 182 initialized = TRUE; trunk/libtinymail/tny-signals-marshal.list
r2198 r2204 1 VOID:POINTER,POINTER 1 VOID:POINTER,POINTER,POINTER trunk/tests/c-demo/tny-demoui-summary-view.c
r2201 r2204 192 192 } 193 193 194 195 typedef struct 196 { 197 TnySummaryView *self; 198 TnyMsg *msg; 199 TnyHeader *header; 200 } OnResponseInfo; 201 194 202 static void 195 203 on_response (GtkDialog *dialog, gint arg1, gpointer user_data) 196 204 { 205 OnResponseInfo *info = (OnResponseInfo *) user_data; 206 TnySummaryView *self = info->self; 207 TnyDemouiSummaryViewPriv *priv = TNY_DEMOUI_SUMMARY_VIEW_GET_PRIVATE (self); 208 TnyHeader *header = info->header; 209 TnyMsg *msg = info->msg; 210 211 if (arg1 == GTK_RESPONSE_YES) 212 { 213 TnyFolder *outbox = tny_send_queue_get_outbox (priv->send_queue); 214 tny_folder_remove_msg (outbox, header, NULL); 215 tny_folder_sync (outbox, TRUE, NULL); 216 g_object_unref (outbox); 217 } 218 219 g_object_unref (msg); 220 g_object_unref (header); 221 g_object_unref (self); 222 197 223 gtk_widget_destroy (GTK_WIDGET (dialog)); 224 g_slice_free (OnResponseInfo, info); 198 225 } 199 226 200 227 static void 201 on_send_queue_error_happened (TnySendQueue *self, TnyMsg *msg, GError *err, gpointer user_data) 202 { 228 on_send_queue_error_happened (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, GError *err, gpointer user_data) 229 { 230 gchar *str = g_strdup_printf ("%s. Do you want to remove the message (%s)?", 231 err->message, tny_header_get_subject (header)); 232 OnResponseInfo *info = g_slice_new (OnResponseInfo); 203 233 GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, 204 GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, err->message); 205 g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (on_response), NULL); 234 GTK_MESSAGE_ERROR, GTK_BUTTONS_YES_NO, str); 235 g_free (str); 236 info->self = g_object_ref (user_data); 237 info->msg = g_object_ref (msg); 238 info->header = g_object_ref (header); 239 g_signal_connect (G_OBJECT (dialog), "response", 240 G_CALLBACK (on_response), info); 206 241 gtk_widget_show_all (dialog); 207 208 242 return; 209 243 } 210 244 211 245 static void 212 reload_accounts (TnyDemouiSummaryViewPriv *priv) 213 { 246 reload_accounts (TnySummaryView *self) 247 { 248 TnyDemouiSummaryViewPriv *priv = TNY_DEMOUI_SUMMARY_VIEW_GET_PRIVATE (self); 214 249 TnyAccountStore *account_store = priv->account_store; 215 250 GtkTreeModel *sortable, *maccounts, *mailbox_model; … … 267 302 priv->send_queue = tny_camel_send_queue_new ((TnyCamelTransportAccount *) tacc); 268 303 g_signal_connect (G_OBJECT (priv->send_queue), "error-happened", 269 G_CALLBACK (on_send_queue_error_happened), priv);304 G_CALLBACK (on_send_queue_error_happened), self); 270 305 g_object_unref (tacc); 271 306 g_object_unref (iter); … … 289 324 accounts_reloaded (TnyAccountStore *store, gpointer user_data) 290 325 { 291 TnyDemouiSummaryViewPriv *priv = user_data; 292 reload_accounts (priv); 326 reload_accounts ((TnySummaryView *)user_data); 293 327 return; 294 328 } … … 427 461 priv->accounts_reloaded_signal = g_signal_connect ( 428 462 G_OBJECT (account_store), "accounts_reloaded", 429 G_CALLBACK (accounts_reloaded), priv);430 431 reload_accounts ( priv);463 G_CALLBACK (accounts_reloaded), self); 464 465 reload_accounts ((TnySummaryView *) self); 432 466 433 467 g_object_unref (G_OBJECT (device));
